mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Fixed lockstep simulation of directory of ELF files
This commit is contained in:
		
							parent
							
								
									b334dc50a4
								
							
						
					
					
						commit
						e18d6b2744
					
				@ -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 --lockstep --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"""
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								bin/wsim
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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(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)
 | 
				
			||||||
 | 
				
			|||||||
@ -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} 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
 | 
					#    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/*
 | 
					# power add -r /dut/core/*
 | 
				
			||||||
if { ${GUI} } {
 | 
					if { ${GUI} } {
 | 
				
			||||||
    add log -recursive /*
 | 
					    add log -recursive /*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user