From be358542863d7eaf2e28dcbc4aac10c03a97dd0b Mon Sep 17 00:00:00 2001 From: joey0320 Date: Mon, 20 Feb 2023 23:59:52 -0800 Subject: [PATCH 1/4] Remove Duplicate Compiler Flags --- common.mk | 19 +++++++++++++++++-- tools/barstools | 2 +- variables.mk | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/common.mk b/common.mk index f592fa5ce2..f5ed314245 100644 --- a/common.mk +++ b/common.mk @@ -126,10 +126,26 @@ define mfc_extra_anno_contents } ] endef +define sfc_extra_low_transforms_anno_contents +[ + { + "class": "firrtl.stage.RunFirrtlTransformAnnotation", + "transform": "barstools.tapeout.transforms.ExtraLowTransforms" + } +] +endef export mfc_extra_anno_contents +export sfc_extra_low_transforms_anno_contents $(FINAL_ANNO_FILE) $(MFC_EXTRA_ANNO_FILE): $(ANNO_FILE) echo "$$mfc_extra_anno_contents" > $(MFC_EXTRA_ANNO_FILE) +ifeq (,$(ENABLE_CUSTOM_FIRRTL_PASS)) jq -s '[.[][]]' $(ANNO_FILE) $(MFC_EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE) +else + echo "$$sfc_extra_low_transforms_anno_contents" > $(SFC_EXTRA_ANNO_FILE) + jq -s '[.[][]]' $(SFC_EXTRA_ANNO_FILE) $(MFC_EXTRA_ANNO_FILE) > $(EXTRA_ANNO_FILE) + jq -s '[.[][]]' $(ANNO_FILE) $(EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE) +endif + .PHONY: firrtl firrtl: $(FIRRTL_FILE) $(FINAL_ANNO_FILE) @@ -179,9 +195,8 @@ endif --annotation-file $(FINAL_ANNO_FILE) \ --log-level $(FIRRTL_LOGLEVEL) \ --allow-unrecognized-annotations \ - -DX $(SFC_LEVEL) \ -X $(SFC_LEVEL) \ - $(EXTRA_FIRRTL_OPTIONS)) # -X and -DX are duplicates to allow for extra FIRRTL passes to be run + $(EXTRA_FIRRTL_OPTIONS)) -mv $(SFC_FIRRTL_BASENAME).lo.fir $(SFC_FIRRTL_FILE) # Optionally change file type when SFC generates LowFIRRTL @if [ "$(SFC_LEVEL)" = low ]; then cat $(SFC_ANNO_FILE) | jq 'del(.[] | select(.target | test("io.cpu"))?)' > /tmp/unnec-anno-deleted.sfc.anno.json; fi @if [ "$(SFC_LEVEL)" = low ]; then cat /tmp/unnec-anno-deleted.sfc.anno.json | jq 'del(.[] | select(.class | test("SRAMAnnotation"))?)' > /tmp/unnec-anno-deleted2.sfc.anno.json; fi diff --git a/tools/barstools b/tools/barstools index 9760528f1d..a9f9068baf 160000 --- a/tools/barstools +++ b/tools/barstools @@ -1 +1 @@ -Subproject commit 9760528f1de2b1a52a11476e76d25909b31d1def +Subproject commit a9f9068baf5ecf3aa3c37980738971036e411731 diff --git a/variables.mk b/variables.mk index 1312cbe387..a89d23a0f4 100644 --- a/variables.mk +++ b/variables.mk @@ -146,6 +146,7 @@ endif # chisel generated outputs FIRRTL_FILE ?= $(build_dir)/$(long_name).fir ANNO_FILE ?= $(build_dir)/$(long_name).anno.json +EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extra.anno.json # chisel anno modification output MFC_EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extrafirtool.anno.json @@ -154,6 +155,7 @@ FINAL_ANNO_FILE ?= $(build_dir)/$(long_name).appended.anno.json # scala firrtl compiler (sfc) outputs SFC_FIRRTL_BASENAME ?= $(build_dir)/$(long_name).sfc SFC_FIRRTL_FILE ?= $(SFC_FIRRTL_BASENAME).fir +SFC_EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extrasfc.anno.json SFC_ANNO_FILE ?= $(build_dir)/$(long_name).sfc.anno.json # firtool compiler outputs From a9209c4aaaba21ec2b043c997b0f5f40cc67fb7e Mon Sep 17 00:00:00 2001 From: joey0320 Date: Tue, 21 Feb 2023 16:56:25 -0800 Subject: [PATCH 2/4] Fix TestDriver.v missing from gen-collateral after recompiling --- sims/vcs/Makefile | 6 +++--- sims/verilator/Makefile | 6 +++--- vlsi/Makefile | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sims/vcs/Makefile b/sims/vcs/Makefile index b26df84331..b6f11a800b 100644 --- a/sims/vcs/Makefile +++ b/sims/vcs/Makefile @@ -38,10 +38,10 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/vsrc/TestDriver.v # copy files but ignore *.h files in *.f since vcs has +incdir+$(build_dir) -$(sim_files): $(SIM_FILE_REQS) | $(GEN_COLLATERAL_DIR) - cp -f $^ $(GEN_COLLATERAL_DIR) +$(sim_files): $(SIM_FILE_REQS) $(ALL_MODS_FILELIST) | $(GEN_COLLATERAL_DIR) + cp -f $(SIM_FILE_REQS) $(GEN_COLLATERAL_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(GEN_COLLATERAL_DIR)/, $(notdir $(file)))" >> $@;)) diff --git a/sims/verilator/Makefile b/sims/verilator/Makefile index fd171b4cb3..d48da28e8c 100644 --- a/sims/verilator/Makefile +++ b/sims/verilator/Makefile @@ -66,10 +66,10 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/csrc/remote_bitbang.cc # copy files and add -FI for *.h files in *.f -$(sim_files): $(SIM_FILE_REQS) | $(GEN_COLLATERAL_DIR) - cp -f $^ $(GEN_COLLATERAL_DIR) +$(sim_files): $(SIM_FILE_REQS) $(ALL_MODS_FILELIST) | $(GEN_COLLATERAL_DIR) + cp -f $(SIM_FILE_REQS) $(GEN_COLLATERAL_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ echo "-FI $(addprefix $(GEN_COLLATERAL_DIR)/, $(notdir $(file)))" >> $@;,\ echo "$(addprefix $(GEN_COLLATERAL_DIR)/, $(notdir $(file)))" >> $@;)) diff --git a/vlsi/Makefile b/vlsi/Makefile index a1f850a1ee..ab8438d50c 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -134,10 +134,10 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/vsrc/TestDriver.v # copy files but ignore *.h files in *.f since vcs has +incdir+$(build_dir) -$(sim_files): $(SIM_FILE_REQS) | $(build_dir) - cp -f $^ $(build_dir) +$(sim_files): $(SIM_FILE_REQS) $(ALL_MODS_FILELIST) | $(build_dir) + cp -f $(SIM_FILE_REQS) $(build_dir) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(build_dir)/, $(notdir $(file)))" >> $@;)) From 32dfc6fbf04925fce1fd16c5137ee64f43af26d2 Mon Sep 17 00:00:00 2001 From: joey0320 Date: Tue, 21 Feb 2023 21:23:58 -0800 Subject: [PATCH 3/4] fixes --- fpga/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fpga/Makefile b/fpga/Makefile index 037b2fb9a6..79bdb338b8 100644 --- a/fpga/Makefile +++ b/fpga/Makefile @@ -90,11 +90,14 @@ fpga_common_script_dir := $(fpga_dir)/common/tcl ######################################################################################### # setup misc. sim files ######################################################################################### +SIM_FILE_REQS += \ + $(ROCKETCHIP_RSRCS_DIR)/vsrc/EICG_wrapper.v + # copy files but ignore *.h files in *.f (match vcs) -$(sim_files): $(SIM_FILE_REQS) | $(GEN_COLLATERAL_DIR) - cp -f $^ $(GEN_COLLATERAL_DIR) +$(sim_files): $(SIM_FILE_REQS) $(ALL_MODS_FILELIST) | $(GEN_COLLATERAL_DIR) + cp -f $(SIM_FILE_REQS) $(GEN_COLLATERAL_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(GEN_COLLATERAL_DIR)/, $(notdir $(file)))" >> $@;)) From 0bcdbaa9b2e49b3688b0bfa3925b2b77006737d4 Mon Sep 17 00:00:00 2001 From: joey0320 Date: Tue, 21 Feb 2023 21:54:45 -0800 Subject: [PATCH 4/4] Revert "Remove Duplicate Compiler Flags" This reverts commit be358542863d7eaf2e28dcbc4aac10c03a97dd0b. --- common.mk | 19 ++----------------- tools/barstools | 2 +- variables.mk | 2 -- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/common.mk b/common.mk index f5ed314245..f592fa5ce2 100644 --- a/common.mk +++ b/common.mk @@ -126,26 +126,10 @@ define mfc_extra_anno_contents } ] endef -define sfc_extra_low_transforms_anno_contents -[ - { - "class": "firrtl.stage.RunFirrtlTransformAnnotation", - "transform": "barstools.tapeout.transforms.ExtraLowTransforms" - } -] -endef export mfc_extra_anno_contents -export sfc_extra_low_transforms_anno_contents $(FINAL_ANNO_FILE) $(MFC_EXTRA_ANNO_FILE): $(ANNO_FILE) echo "$$mfc_extra_anno_contents" > $(MFC_EXTRA_ANNO_FILE) -ifeq (,$(ENABLE_CUSTOM_FIRRTL_PASS)) jq -s '[.[][]]' $(ANNO_FILE) $(MFC_EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE) -else - echo "$$sfc_extra_low_transforms_anno_contents" > $(SFC_EXTRA_ANNO_FILE) - jq -s '[.[][]]' $(SFC_EXTRA_ANNO_FILE) $(MFC_EXTRA_ANNO_FILE) > $(EXTRA_ANNO_FILE) - jq -s '[.[][]]' $(ANNO_FILE) $(EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE) -endif - .PHONY: firrtl firrtl: $(FIRRTL_FILE) $(FINAL_ANNO_FILE) @@ -195,8 +179,9 @@ endif --annotation-file $(FINAL_ANNO_FILE) \ --log-level $(FIRRTL_LOGLEVEL) \ --allow-unrecognized-annotations \ + -DX $(SFC_LEVEL) \ -X $(SFC_LEVEL) \ - $(EXTRA_FIRRTL_OPTIONS)) + $(EXTRA_FIRRTL_OPTIONS)) # -X and -DX are duplicates to allow for extra FIRRTL passes to be run -mv $(SFC_FIRRTL_BASENAME).lo.fir $(SFC_FIRRTL_FILE) # Optionally change file type when SFC generates LowFIRRTL @if [ "$(SFC_LEVEL)" = low ]; then cat $(SFC_ANNO_FILE) | jq 'del(.[] | select(.target | test("io.cpu"))?)' > /tmp/unnec-anno-deleted.sfc.anno.json; fi @if [ "$(SFC_LEVEL)" = low ]; then cat /tmp/unnec-anno-deleted.sfc.anno.json | jq 'del(.[] | select(.class | test("SRAMAnnotation"))?)' > /tmp/unnec-anno-deleted2.sfc.anno.json; fi diff --git a/tools/barstools b/tools/barstools index a9f9068baf..9760528f1d 160000 --- a/tools/barstools +++ b/tools/barstools @@ -1 +1 @@ -Subproject commit a9f9068baf5ecf3aa3c37980738971036e411731 +Subproject commit 9760528f1de2b1a52a11476e76d25909b31d1def diff --git a/variables.mk b/variables.mk index a89d23a0f4..1312cbe387 100644 --- a/variables.mk +++ b/variables.mk @@ -146,7 +146,6 @@ endif # chisel generated outputs FIRRTL_FILE ?= $(build_dir)/$(long_name).fir ANNO_FILE ?= $(build_dir)/$(long_name).anno.json -EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extra.anno.json # chisel anno modification output MFC_EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extrafirtool.anno.json @@ -155,7 +154,6 @@ FINAL_ANNO_FILE ?= $(build_dir)/$(long_name).appended.anno.json # scala firrtl compiler (sfc) outputs SFC_FIRRTL_BASENAME ?= $(build_dir)/$(long_name).sfc SFC_FIRRTL_FILE ?= $(SFC_FIRRTL_BASENAME).fir -SFC_EXTRA_ANNO_FILE ?= $(build_dir)/$(long_name).extrasfc.anno.json SFC_ANNO_FILE ?= $(build_dir)/$(long_name).sfc.anno.json # firtool compiler outputs