diff --git a/common.mk b/common.mk index 7f2a1f5040..c62743e046 100644 --- a/common.mk +++ b/common.mk @@ -182,6 +182,7 @@ endif if [ $(SFC_LEVEL) = low ]; then jq -s '[.[][]]' $(EXTRA_ANNO_FILE) $(SFC_EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE); fi if [ $(SFC_LEVEL) = none ]; then cat $(EXTRA_ANNO_FILE) > $(FINAL_ANNO_FILE); fi +$(SFC_MFC_TARGETS) &: private TMP_DIR := $(shell mktemp -d -t cy-XXXXXXXX) $(SFC_MFC_TARGETS) &: $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(VLOG_SOURCES) $(SFC_LEVEL) $(EXTRA_FIRRTL_OPTIONS) rm -rf $(GEN_COLLATERAL_DIR) $(call run_scala_main,tapeout,barstools.tapeout.transforms.GenerateModelStageMain,\ @@ -196,9 +197,9 @@ $(SFC_MFC_TARGETS) &: $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(VLOG_SOURCES) $(SFC_LE -X $(SFC_LEVEL) \ $(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 - @if [ $(SFC_LEVEL) = low ]; then cat /tmp/unnec-anno-deleted2.sfc.anno.json > $(SFC_ANNO_FILE) && rm /tmp/unnec-anno-deleted.sfc.anno.json && rm /tmp/unnec-anno-deleted2.sfc.anno.json; fi + @if [ $(SFC_LEVEL) = low ]; then cat $(SFC_ANNO_FILE) | jq 'del(.[] | select(.target | test("io.cpu"))?)' > $(TMP_DIR)/unnec-anno-deleted.sfc.anno.json; fi + @if [ $(SFC_LEVEL) = low ]; then cat $(TMP_DIR)/unnec-anno-deleted.sfc.anno.json | jq 'del(.[] | select(.class | test("SRAMAnnotation"))?)' > $(TMP_DIR)/unnec-anno-deleted2.sfc.anno.json; fi + @if [ $(SFC_LEVEL) = low ]; then cat $(TMP_DIR)/unnec-anno-deleted2.sfc.anno.json > $(SFC_ANNO_FILE) && rm $(TMP_DIR)/unnec-anno-deleted.sfc.anno.json && rm $(TMP_DIR)/unnec-anno-deleted2.sfc.anno.json; fi firtool \ --format=fir \ --dedup \ diff --git a/scripts/check-tracegen.sh b/scripts/check-tracegen.sh index e2974fb11c..c30447ee21 100755 --- a/scripts/check-tracegen.sh +++ b/scripts/check-tracegen.sh @@ -6,25 +6,26 @@ SCRIPT_DIR=$(dirname $0) AXE_DIR=$(realpath ${SCRIPT_DIR}/../tools/axe) ROCKET_DIR=$(realpath ${SCRIPT_DIR}/../generators/rocket-chip) +TMP_DIR=$(mktemp -d -t tracegen-XXXXXXXX) TO_AXE=${ROCKET_DIR}/scripts/toaxe.py -TO_AXE_PY3=/tmp/toaxe.py +TO_AXE_PY3=${TMP_DIR}/toaxe.py AXE=${AXE_DIR}/src/axe AXE_SHRINK=${AXE_DIR}/src/axe-shrink.py -AXE_SHRINK_PY3=/tmp/axe-shrink.py +AXE_SHRINK_PY3=${TMP_DIR}/axe-shrink.py # TODO: convert scripts to py3 in src -2to3 $TO_AXE -o /tmp -n -w +2to3 $TO_AXE -o ${TMP_DIR} -n -w sed -i '30d' $TO_AXE_PY3 # remove import sets -2to3 $AXE_SHRINK -o /tmp -n -w +2to3 $AXE_SHRINK -o ${TMP_DIR} -n -w PATH=$PATH:${AXE_DIR}/src -grep '.*:.*#.*@' $1 > /tmp/clean-trace.txt -python "$TO_AXE_PY3" /tmp/clean-trace.txt > /tmp/trace.axe -result=$("$AXE" check wmo /tmp/trace.axe) +grep '.*:.*#.*@' $1 > ${TMP_DIR}/clean-trace.txt +python "$TO_AXE_PY3" ${TMP_DIR}/clean-trace.txt > ${TMP_DIR}/trace.axe +result=$("$AXE" check wmo ${TMP_DIR}/trace.axe) if [ "$result" != OK ]; then - "$AXE_SHRINK_PY3" wmo /tmp/trace.axe + "$AXE_SHRINK_PY3" wmo ${TMP_DIR}/trace.axe else echo OK fi