diff --git a/bin/objdump2itb b/bin/objdump2itb index 072397e21..ef479af8e 100755 --- a/bin/objdump2itb +++ b/bin/objdump2itb @@ -74,19 +74,22 @@ class CFunction: # Regular expression to extract a function from objdump # Example: # 00000256 : -FUNC_PATTERN = "(?P[0-9a-f]{8}) <(?P\S*)>:" +# Note: raw string to treat \S literally for regex +FUNC_PATTERN = r"(?P[0-9a-f]{8}) <(?P\S*)>:" FUNC_RE = re.compile(FUNC_PATTERN) # Regular expression to extract an individual instruction # Example: # 264: 00a31363 bne t1,a0,26a -INST_PATTERN = "(?P[0-9a-f]{1,8}):\t*(?P[0-9a-f]{4}([0-9a-f]{4})?)\s{2,}(?P[a-z].*)$" +# Note: raw string to treat \s literally for regex +INST_PATTERN = r"(?P[0-9a-f]{1,8}):\t*(?P[0-9a-f]{4}([0-9a-f]{4})?)\s{2,}(?P[a-z].*)$" INST_RE = re.compile(INST_PATTERN) # Regular expression to extract a source annotation for each instruction # Example: # /work/strichmo/core-v-verif/cv32e40x/tests/programs/custom/debug_test_trigger/debugger.S:47 -SRC_FILE_PATTERN = "^(?P/\S+)/(?P[^/\s]+):(?P[0-9]*)$" +# Note: raw string to treat \S and \s literally for regex +SRC_FILE_PATTERN = r"^(?P/\S+)/(?P[^/\s]+):(?P[0-9]*)$" SRC_FILE_RE = re.compile(SRC_FILE_PATTERN) parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) diff --git a/cv32e40p/sim/core/Makefile b/cv32e40p/sim/core/Makefile index 53a8d4af6..34ba51086 100644 --- a/cv32e40p/sim/core/Makefile +++ b/cv32e40p/sim/core/Makefile @@ -153,14 +153,20 @@ XRUN_FLAGS = -clean -smartorder -sv -top worklib.tb_top -timescale 1ns/1p XRUN_DIR = xcelium.d # verilator configuration -VERILATOR = verilator -VERI_FLAGS += -VERI_COMPILE_FLAGS += -Wno-BLKANDNBLK -Wno-MULTIDRIVEN -Wno-COMBDLY $(SV_CMP_FLAGS) +VERILATOR ?= verilator +VERI_RUN_FLAGS ?= +VERI_COMPILE_FLAGS ?= -Wno-BLKANDNBLK \ + -Wno-MULTIDRIVEN \ + -Wno-COMBDLY \ + -Wno-lint \ + -Wno-UNOPTFLAT \ + -Wno-MODDUP \ + $(SV_CMP_FLAGS) VERI_TRACE ?= VERI_OBJ_DIR ?= cobj_dir -#VERI_LOG_DIR ?= cobj_dir/logs VERI_LOG_DIR ?= $(SIM_TEST_PROGRAM_RESULTS) -VERI_CFLAGS += -O2 +VERI_CFLAGS ?= -std=c++14 \ + -O2 #riviera configuration @@ -472,7 +478,7 @@ xrun-clean-all: xrun-clean # We first test if the user wants to to vcd dumping. This hacky part is required # because we need to conditionally compile the testbench (-DVCD_TRACE) and pass # the --trace flags to the verilator call -#ifeq ($(findstring +vcd,$(VERI_FLAGS)),+vcd) +#ifeq ($(findstring +vcd,$(VERI_RUN_FLAGS)),+vcd) ifneq (${WAVES}, 0) VERI_TRACE="--trace" @@ -488,15 +494,17 @@ testbench_verilator: CV_CORE_pkg $(TBSRC_VERI) $(TBSRC_PKG) @echo "$(BANNER)" @echo "* Compiling CORE TB and CV32E40P with Verilator" @echo "$(BANNER)" - $(VERILATOR) --cc --sv --exe \ + $(VERILATOR) \ + --cc \ + --sv \ + --exe \ $(VERI_TRACE) \ - --Wno-lint --Wno-UNOPTFLAT \ - --Wno-MODDUP --top-module \ - tb_top_verilator $(TBSRC_VERI) \ + --top-module tb_top_verilator \ + $(TBSRC_VERI) \ -f $(CV_CORE_MANIFEST) \ $(CV_CORE_PKG)/bhv/$(CV_CORE_LC)_core_log.sv \ $(TBSRC_CORE)/tb_top_verilator.cpp --Mdir $(VERI_OBJ_DIR) \ - -CFLAGS "-std=gnu++11 $(VERI_CFLAGS)" \ + -CFLAGS $(VERI_CFLAGS) \ $(VERI_COMPILE_FLAGS) $(MAKE) -C $(VERI_OBJ_DIR) -f Vtb_top_verilator.mk mkdir -p $(SIM_RESULTS) @@ -509,7 +517,7 @@ veri-test: verilate $(TEST_PROGRAM_PATH)/$(TEST)/$(TEST).hex @echo "$(BANNER)" mkdir -p $(VERI_LOG_DIR) $(SIM_TEST_RESULTS)/verilator_executable \ - $(VERI_FLAGS) \ + $(VERI_RUN_FLAGS) \ "+firmware=$(TEST_PROGRAM_RELPATH)/$(TEST)/$(TEST).hex" \ | tee $(VERI_LOG_DIR)/$(TEST).log @@ -682,13 +690,14 @@ clean-sim-results: # clean up toolchain generated files clean-test-programs: - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.o -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.hex -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.elf -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.map -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.readelf -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name *.objdump -exec rm {} \; - find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name corev_*.S -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.o" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.hex" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.elf" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.map" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.itb" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.readelf" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "*.objdump" -exec rm {} \; + find $(CORE_V_VERIF)/$(CV_CORE_LC)/tests/programs -name "corev_*.S" -exec rm {} \; .PHONY: clean clean_all distclean clean: clean-sim-results clean-test-programs questa-clean verilate-clean vcs-clean firmware-clean dsim-clean xrun-clean vcs-clean riviera-clean diff --git a/mk/Common.mk b/mk/Common.mk index 731500954..cb1d9dcfa 100644 --- a/mk/Common.mk +++ b/mk/Common.mk @@ -435,12 +435,12 @@ endif -S \ $*.elf > $*.objdump $(RISCV_EXE_PREFIX)objdump \ - -d \ - -S \ - -M no-aliases \ - -M numeric \ - -l \ - $*.elf | ${CORE_V_VERIF}/bin/objdump2itb - > $*.itb + -d \ + -S \ + -M no-aliases \ + -M numeric \ + -l \ + $*.elf | ${CORE_V_VERIF}/bin/objdump2itb - > $*.itb # Patterned targets to generate ELF. Used only if explicit targets do not match. #