From a59a5f2f4c2bfb02e7309250c511fd8c524a4e6f Mon Sep 17 00:00:00 2001 From: David Harris Date: Thu, 8 Aug 2024 21:03:59 -0700 Subject: [PATCH 1/3] Updated regression to avoid iter-elf --- Makefile | 5 ++++- bin/regression-wally | 29 +++-------------------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index b0f01c49c..06538bd5c 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: make riscof make testfloat # make verify -# make coverage + make coverage # make benchmarks # riscof builds the riscv-arch-test and wally-riscv-arch-test suites @@ -35,6 +35,9 @@ coremark: embench: cd ${WALLY}/benchmarks/embench; make; make run +coverage: + make -C tests/coverage + clean: make clean -C sim diff --git a/bin/regression-wally b/bin/regression-wally index 95c3a7c99..5cd8bf76c 100755 --- a/bin/regression-wally +++ b/bin/regression-wally @@ -284,7 +284,7 @@ def addTests(tests, sim): def addLockstepTestsByDir(dir, config, sim): sim_logdir = WALLY+ "/sim/" + sim + "/logs/" - cmdPrefix="wsim --sim " + sim + " " + coverStr + " " + config + cmdPrefix="wsim --lockstep --sim " + sim + " " + coverStr + " " + config for file in os.listdir(dir): if file.endswith(".elf"): fullfile = os.path.join(dir, file) @@ -387,14 +387,6 @@ if (args.ccov): # only run RV64GC tests on Questa in code coverage mode addTests(tests64gc_fp, coveragesim) elif (args.fcov): # only run RV64GC tests on Questa in lockstep in functional coverage mode addLockstepTestsByDir(WALLY+"/tests/functcov/rv64/I", "rv64gc", coveragesim) - #sim_log = WALLY + "/sim/questa/logs/fcov.log" - #tc = TestCase( - # name="lockstep_functcov", - # variant="rv64gc", - # cmd="iterelf " + WALLY + "/tests/functcov/rv64/I > " + sim_log, - # grepstr="SUCCESS! All tests ran without failures", - # grepfile = sim_log) - #configs.append(tc) elif (args.fcovrvvi): # only run RV64GC tests on Questa in rvvi coverage mode addTests(tests64gc_nofp, coveragesim) if (args.fp): @@ -409,23 +401,8 @@ else: # run derivative configurations and lockstep tests in nightly regression if (args.nightly): - sim_log = WALLY + "/sim/questa/logs/lockstep_coverage.log" - tc = TestCase( - name="lockstep_coverage", - variant="rv64gc", - cmd="iterelf " + WALLY + "/tests/coverage > " + sim_log, - grepstr="SUCCESS! All tests ran without failures", - grepfile = sim_log) - configs.append(tc) - - sim_log = WALLY + "/sim/questa/logs/lockstep_wally-riscv-arch-test.log" - tc = TestCase( - name="lockstep_wally-riscv-arch-test", - variant="rv64gc", - cmd="iterelf " + WALLY + "/tests/riscof/work/wally-riscv-arch-test/rv64i_m > " + sim_log, - grepstr="SUCCESS! All tests ran without failures", - grepfile = sim_log) - configs.append(tc) + addLockstepTestsByDir(WALLY+"/tests/coverage", "rv64gc", "questa") + addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m", "rv64gc", "questa") addTests(derivconfigtests, defaultsim) # testfloat tests From b334dc50a44e780ef2f604c98c18626c40cc3fe0 Mon Sep 17 00:00:00 2001 From: David Harris Date: Thu, 8 Aug 2024 21:45:57 -0700 Subject: [PATCH 2/3] Fixed fldsp decompress with rd = 0 --- src/ifu/decompress.sv | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ifu/decompress.sv b/src/ifu/decompress.sv index 798993d78..77e8ef219 100644 --- a/src/ifu/decompress.sv +++ b/src/ifu/decompress.sv @@ -151,8 +151,7 @@ module decompress import cvw::*; #(parameter cvw_t P) ( 5'b10000: if (rds1 != 5'b0) begin if (P.XLEN > 32 | ~immSH[5]) LInstrD = {1'b1, 6'b000000, immSH, rds1, 3'b001, rds1, 7'b0010011}; // c.slli; shamt[5] must be 0 in RV32C end else if (immSH != 0) LInstrD = {1'b1, 25'b0, 7'b0010011}; // c.slli with rd = 0, immm != 0 is a HINT, treated as nop - 5'b10001: if (P.ZCD_SUPPORTED) - if (rds1 != 5'b0) LInstrD = {1'b1, immCILSPD, 5'b00010, 3'b011, rds1, 7'b0000111}; // c.fldsp + 5'b10001: if (P.ZCD_SUPPORTED) LInstrD = {1'b1, immCILSPD, 5'b00010, 3'b011, rds1, 7'b0000111}; // c.fldsp 5'b10010: if (rds1 != 5'b0) LInstrD = {1'b1, immCILSP, 5'b00010, 3'b010, rds1, 7'b0000011}; // c.lwsp 5'b10011: if (P.XLEN == 32) begin if (P.ZCF_SUPPORTED) LInstrD = {1'b1, immCILSP, 5'b00010, 3'b010, rds1, 7'b0000111}; // c.flwsp From e18d6b2744d4c8b09be68643bf52a2b756d74c8d Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 9 Aug 2024 06:18:38 -0700 Subject: [PATCH 3/3] Fixed lockstep simulation of directory of ELF files --- bin/regression-wally | 45 ++++++++++++++++++++++++++++++++------------ bin/wsim | 10 +++++++++- sim/questa/wally.do | 2 +- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/bin/regression-wally b/bin/regression-wally index 5cd8bf76c..cd4844b08 100755 --- a/bin/regression-wally +++ b/bin/regression-wally @@ -229,6 +229,13 @@ bpredtests = [ ["bpred_GSHARE_10_10_10_1_rv32gc", ["embench"], "-GPrintHPMCounters=1"] ] +# list of tests not supported by ImperasDV yet that should be waived during lockstep testing +lockstepwaivers = [ + "WALLY-q-01.S_ref.elf", # Q extension is not supported by ImperasDV + "WALLY-cbom-01.S_ref.elf", # cbom extension is not supported by ImperasDV because there is no cache model in ImperasDV + "coverage_ieu.elf" # Issue 881: ImperasDV misinterprets 0x6BF05013 as a grevi rather than an illegal instruction +] + ################################## # Data Types & Functions ################################## @@ -282,21 +289,35 @@ def addTests(tests, sim): grepfile = grepfile) configs.append(tc) + def addLockstepTestsByDir(dir, config, sim): sim_logdir = WALLY+ "/sim/" + sim + "/logs/" cmdPrefix="wsim --lockstep --sim " + sim + " " + coverStr + " " + config - for file in os.listdir(dir): - if file.endswith(".elf"): - fullfile = os.path.join(dir, file) - sim_log = sim_logdir + config + "_" + file + ".log" - grepstring = "" - tc = TestCase( - name=file, - variant=config, - cmd=cmdPrefix + " " + fullfile + " > " + sim_log, - grepstr="Mismatches : 0", - grepfile = sim_log) - configs.append(tc) + if (os.path.isdir(dir)): + for dirpath, dirnames, filenames in os.walk(os.path.abspath(dir)): + for file in filenames: + if file.endswith(".elf"): + fullfile = os.path.join(dirpath, file) + fields = fullfile.rsplit('/', 3) + if (fields[2] == "ref"): + shortelf = fields[1] + "_" + fields[3] + else: + shortelf = fields[2] + "_" + fields[3] + if (shortelf in lockstepwaivers): # skip tests that itch bugs in ImperasDV + print(f"{bcolors.WARNING}Skipping waived test {shortelf}{bcolors.ENDC}") + continue + sim_log = sim_logdir + config + "_" + shortelf + ".log" + grepstring = "" + tc = TestCase( + name=file, + variant=config, + cmd=cmdPrefix + " " + fullfile + " > " + sim_log, + grepstr="Mismatches : 0", + grepfile = sim_log) + configs.append(tc) + else: + print("Error: Directory not found: " + dir) + exit(1) def search_log_for_text(text, grepfile): """Search through the given log file for text, returning True if it is found or False if it is not""" diff --git a/bin/wsim b/bin/wsim index e35ec6841..986957a3c 100755 --- a/bin/wsim +++ b/bin/wsim @@ -49,7 +49,15 @@ elif (args.elf != ""): if(args.testsuite.endswith('.elf') and args.elf == ""): # No --elf argument; check if testsuite has a .elf extension and use that instead if (os.path.isfile(args.testsuite)): ElfFile = "+ElfFile=" + os.path.abspath(args.testsuite) - if ('/' in args.testsuite): + # extract the elf name from the path to be the test suite + fields = args.testsuite.rsplit('/', 3) + # if the name is just ref.elf in a deep path (riscv-arch-test/wally-riscv-arch-test), then use the directory name as the test suite to make it unique; otherwise work directory will have duplicates. + if (len(fields) > 3): + if (fields[2] == "ref"): + args.testsuite = fields[1] + "_" + fields[3] + else: + args.testsuite = fields[2] + "_" + fields[3] + elif ('/' in args.testsuite): args.testsuite=args.testsuite.rsplit('/', 1)[1] # strip off path if present else: print("ELF file not found: " + args.testsuite) diff --git a/sim/questa/wally.do b/sim/questa/wally.do index db1cbbae1..35b728d83 100644 --- a/sim/questa/wally.do +++ b/sim/questa/wally.do @@ -222,7 +222,7 @@ vopt $accFlag wkdir/${CFG}_${TESTSUITE}.${TESTBENCH} -work ${WKDIR} ${ParamArgs} vsim -lib ${WKDIR} testbenchopt +TEST=${TESTSUITE} $temp0 $temp1 $temp2 $temp3 -fatal 7 ${SVLib} ${SVLibPath} ${OtherFlags} ${FCTRACE2COV} ${FCdefineIDV_TRACE2COV} -suppress 3829 ${CoverageVsimArg} # vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 -# power add generates the logging necessary for said generation. +# power add generates the logging necessary for saif generation. # power add -r /dut/core/* if { ${GUI} } { add log -recursive /*