diff --git a/Makefile b/Makefile index 33416c6ba..bb7b1a8e9 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,11 @@ SIM_TOP = SimTop FPGATOP = NutShellFPGATop BUILD_DIR = $(abspath ./build) -SIM_TOP_V = $(BUILD_DIR)/$(SIM_TOP).v -TOP_V = $(BUILD_DIR)/$(TOP).v + +RTL_DIR = $(BUILD_DIR)/rtl +SIM_TOP_V = $(RTL_DIR)/$(SIM_TOP).v +TOP_V = $(RTL_DIR)/$(TOP).v + SCALA_FILE = $(shell find ./src/main/scala -name '*.scala') TEST_FILE = $(shell find ./src/test/scala -name '*.scala') @@ -17,7 +20,7 @@ DATAWIDTH ?= 64 BOARD ?= sim # sim pynq axu3cg CORE ?= inorder # inorder ooo embedded -MILL_ARGS = -td $(@D) BOARD=$(BOARD) CORE=$(CORE) +MILL_ARGS = -td $(RTL_DIR) BOARD=$(BOARD) CORE=$(CORE) FPGA_ARGS = # If firtool is not specified and not found in PATH, download and cache it. @@ -40,6 +43,8 @@ ifneq ($(FIRTOOL),) MILL_ARGS += --firtool-binary-path $(FIRTOOL) endif +EXTRACTOR = $(abspath ./scripts/extract_files.sh) + .DEFAULT_GOAL = verilog help: @@ -49,7 +54,7 @@ $(TOP_V): $(SCALA_FILE) mkdir -p $(@D) mill -i generator.test.runMain top.$(TOP) $(MILL_ARGS) $(FPGA_ARGS) @mv $(SIM_TOP_V) $(TOP_V) - @cd $(BUILD_DIR) && bash ../scripts/extract_files.sh $(TOP_V) + @cd $(RTL_DIR) && bash $(EXTRACTOR) $(TOP_V) sed -i -e 's/_\(aw\|ar\|w\|r\|b\)_\(\|bits_\)/_\1/g' $@ @git log -n 1 >> .__head__ @git diff >> .__diff__ @@ -74,7 +79,7 @@ $(SIM_TOP_V): $(SCALA_FILE) $(TEST_FILE) mill -i generator.test.runMain $(SIMTOP) $(MILL_ARGS) @sed -i 's/$$fatal/xs_assert(`__LINE__)/g' $(SIM_TOP_V) @sed -i -e "s/\$$error(/\$$fwrite(32\'h80000002, /g" $(SIM_TOP_V) - @cd $(BUILD_DIR) && bash ../scripts/extract_files.sh $(SIM_TOP_V) + @cd $(RTL_DIR) && bash $(EXTRACTOR) $(SIM_TOP_V) sim-verilog: $(SIM_TOP_V) diff --git a/difftest b/difftest index cbcc80169..63d130444 160000 --- a/difftest +++ b/difftest @@ -1 +1 @@ -Subproject commit cbcc801699c7b20de84f3bc15f03f3f24c72d400 +Subproject commit 63d130444215b07fa1b2236911699c3b503edd67 diff --git a/scripts/extract_files.sh b/scripts/extract_files.sh deleted file mode 100644 index 98b19006d..000000000 --- a/scripts/extract_files.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Check if input file is provided -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " - exit 1 -fi - -input_file="$1" - -# Check if input file exists -if [ ! -f "$input_file" ]; then - echo "Error: File '$input_file' not found!" - exit 1 -fi - -# Set initial state to false -extract=false -output_file="" -temp_file=$(mktemp) - -# Read input file line by line -while IFS= read -r line; do - # Check if line contains the marker - if [[ $line == *'// ----- 8< ----- FILE'* ]]; then - # Set extract state to true - extract=true - # Extract filename from the line - output_file=$(echo "$line" | grep -o '".*"' | tr -d '"') - # Check if output file is not empty - if [ -z "$output_file" ]; then - echo "Error: Could not extract filename!" - exit 1 - fi - # Create/overwrite the output file - : > "$output_file" - elif [ "$extract" = true ]; then - # Write line to output file - echo "$line" >> "$output_file" - else - # Write line to temporary file - echo "$line" >> "$temp_file" - fi - - # Reset extract flag if endmodule is encountered - if [[ $line == "endmodule" ]]; then - extract=false - fi -done < "$input_file" - -# Replace the original file with the temporary file -mv "$temp_file" "$input_file" \ No newline at end of file