Merge branch 'main' of https://github.com/openhwgroup/cvw into script_updates

This commit is contained in:
Jordan Carlin 2024-08-11 13:18:24 -07:00
commit d3c759518d
No known key found for this signature in database
8 changed files with 64 additions and 54 deletions

View File

@ -8,7 +8,7 @@ all:
make riscof make riscof
make testfloat make testfloat
# make verify # make verify
# make coverage make coverage
# make benchmarks # make benchmarks
# riscof builds the riscv-arch-test and wally-riscv-arch-test suites # riscof builds the riscv-arch-test and wally-riscv-arch-test suites
@ -35,6 +35,9 @@ coremark:
embench: embench:
cd ${WALLY}/benchmarks/embench; make; make run cd ${WALLY}/benchmarks/embench; make; make run
coverage:
make -C tests/coverage
clean: clean:
make clean -C sim make clean -C sim

View File

@ -229,6 +229,13 @@ bpredtests = [
["bpred_GSHARE_10_10_10_1_rv32gc", ["embench"], "-GPrintHPMCounters=1"] ["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 # Data Types & Functions
################################## ##################################
@ -282,13 +289,24 @@ def addTests(tests, sim):
grepfile = grepfile) grepfile = grepfile)
configs.append(tc) configs.append(tc)
def addLockstepTestsByDir(dir, config, sim): def addLockstepTestsByDir(dir, config, sim):
sim_logdir = WALLY+ "/sim/" + sim + "/logs/" 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 (os.path.isdir(dir)):
for dirpath, dirnames, filenames in os.walk(os.path.abspath(dir)):
for file in filenames:
if file.endswith(".elf"): if file.endswith(".elf"):
fullfile = os.path.join(dir, file) fullfile = os.path.join(dirpath, file)
sim_log = sim_logdir + config + "_" + file + ".log" 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 = "" grepstring = ""
tc = TestCase( tc = TestCase(
name=file, name=file,
@ -297,6 +315,9 @@ def addLockstepTestsByDir(dir, config, sim):
grepstr="Mismatches : 0", grepstr="Mismatches : 0",
grepfile = sim_log) grepfile = sim_log)
configs.append(tc) configs.append(tc)
else:
print("Error: Directory not found: " + dir)
exit(1)
def search_log_for_text(text, grepfile): 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""" """Search through the given log file for text, returning True if it is found or False if it is not"""
@ -387,14 +408,6 @@ if (args.ccov): # only run RV64GC tests on Questa in code coverage mode
addTests(tests64gc_fp, coveragesim) addTests(tests64gc_fp, coveragesim)
elif (args.fcov): # only run RV64GC tests on Questa in lockstep in functional coverage mode elif (args.fcov): # only run RV64GC tests on Questa in lockstep in functional coverage mode
addLockstepTestsByDir(WALLY+"/tests/functcov/rv64/I", "rv64gc", coveragesim) 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 elif (args.fcovrvvi): # only run RV64GC tests on Questa in rvvi coverage mode
addTests(tests64gc_nofp, coveragesim) addTests(tests64gc_nofp, coveragesim)
if (args.fp): if (args.fp):
@ -409,23 +422,8 @@ else:
# run derivative configurations and lockstep tests in nightly regression # run derivative configurations and lockstep tests in nightly regression
if (args.nightly): if (args.nightly):
sim_log = WALLY + "/sim/questa/logs/lockstep_coverage.log" addLockstepTestsByDir(WALLY+"/tests/coverage", "rv64gc", "questa")
tc = TestCase( addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m", "rv64gc", "questa")
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)
addTests(derivconfigtests, defaultsim) addTests(derivconfigtests, defaultsim)
# testfloat tests # testfloat tests

View File

@ -426,16 +426,6 @@ cd "$RISCV"
if [ ! -e "${RISCV}"/site-setup.sh ]; then if [ ! -e "${RISCV}"/site-setup.sh ]; then
wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.sh wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.sh
wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.csh wget https://raw.githubusercontent.com/openhwgroup/cvw/main/site-setup.csh
# Add necessary lines to site-setup script to activate newer version of gcc for older distros
if [ "$FAMILY" == rhel ]; then
echo "# Activate newer gcc version" >> site-setup.sh
echo "source /opt/rh/gcc-toolset-13/enable" >> site-setup.sh
elif (( UBUNTU_VERSION == 20 )); then
echo "# Activate newer gcc version" >> site-setup.sh
echo "export PATH=\$RISCV/gcc-10/bin:\$PATH" >> site-setup.sh
echo "# Activate newer gcc version" >> site-setup.csh
echo "prepend PATH \$RISCV/gcc-10/bin" >> site-setup.csh
fi
echo -e "${SUCCESS_COLOR}Site setup script successfully downloaded!${ENDC}" echo -e "${SUCCESS_COLOR}Site setup script successfully downloaded!${ENDC}"
echo -e "${WARNING_COLOR}Make sure to edit the environment variables in $RISCV/site-setup.sh (or .csh) to point to your installation of EDA tools and licensce files.${ENDC}" echo -e "${WARNING_COLOR}Make sure to edit the environment variables in $RISCV/site-setup.sh (or .csh) to point to your installation of EDA tools and licensce files.${ENDC}"
else else
@ -443,4 +433,4 @@ else
echo -e "You may need to manually update it if there were changes upstream.${ENDC}" echo -e "You may need to manually update it if there were changes upstream.${ENDC}"
fi fi
echo -e "${SUCCESS_COLOR}${BOLD}\n\nINSTALLATION SUCCESSFUL!!!\n\n${ENDC}" echo -e "${SUCCESS_COLOR}${BOLD}\n\nWALLY INSTALLATION SUCCESSFUL!!!\n\n${ENDC}"

View File

@ -50,7 +50,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(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)): if (os.path.isfile(args.testsuite)):
ElfFile = "+ElfFile=" + os.path.abspath(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 args.testsuite=args.testsuite.rsplit('/', 1)[1] # strip off path if present
else: else:
print("ELF file not found: " + args.testsuite) print("ELF file not found: " + args.testsuite)

View File

@ -191,7 +191,7 @@ vopt $accFlag wkdir/${CFG}_${TESTSUITE}.${TESTBENCH} -work ${WKDIR} {*}${Expande
vsim -lib ${WKDIR} testbenchopt +TEST=${TESTSUITE} {*}${PlusArgs} -fatal 7 {*}${SVLib} ${OtherFlags} {*}${FCvopt} -suppress 3829 ${CoverageVsimArg} vsim -lib ${WKDIR} testbenchopt +TEST=${TESTSUITE} {*}${PlusArgs} -fatal 7 {*}${SVLib} ${OtherFlags} {*}${FCvopt} -suppress 3829 ${CoverageVsimArg}
# power add generates the logging necessary for said generation. # power add generates the logging necessary for saif generation.
# power add -r /dut/core/* # power add -r /dut/core/*
# add waveforms if GUI is enabled # add waveforms if GUI is enabled

View File

@ -56,3 +56,8 @@ if ($?IDV) then
setupImperas ${IMPERAS_HOME} setupImperas ${IMPERAS_HOME}
extend PATH $IDV/scripts/cvw extend PATH $IDV/scripts/cvw
endif endif
# Use newer gcc version for older distros
if ( -e $RISCV/gcc-10 ) then
prepend PATH \$RISCV/gcc-10/bin # Ubuntu 20.04 LTS
endif

View File

@ -58,3 +58,10 @@ if [ -e "$IDV" ]; then
setupImperas "${IMPERAS_HOME}" setupImperas "${IMPERAS_HOME}"
export PATH=$IDV/scripts/cvw:$PATH export PATH=$IDV/scripts/cvw:$PATH
fi fi
# Use newer gcc version for older distros
if [ -e /opt/rh/gcc-toolset-13/enable ]; then
source /opt/rh/gcc-toolset-13/enable # Red Hat Family
elif [ -e $RISCV/gcc-10 ]; then
export PATH=$RISCV/gcc-10/bin:$PATH # Ubuntu 20.04 LTS
fi

View File

@ -151,8 +151,7 @@ module decompress import cvw::*; #(parameter cvw_t P) (
5'b10000: if (rds1 != 5'b0) begin 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 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 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) 5'b10001: if (P.ZCD_SUPPORTED) LInstrD = {1'b1, immCILSPD, 5'b00010, 3'b011, rds1, 7'b0000111}; // c.fldsp
if (rds1 != 5'b0) 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'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 5'b10011: if (P.XLEN == 32) begin
if (P.ZCF_SUPPORTED) LInstrD = {1'b1, immCILSP, 5'b00010, 3'b010, rds1, 7'b0000111}; // c.flwsp if (P.ZCF_SUPPORTED) LInstrD = {1'b1, immCILSP, 5'b00010, 3'b010, rds1, 7'b0000111}; // c.flwsp