forked from Github_Repos/cvw
		
	Merge branch 'main' of github.com:davidharrishmc/riscv-wally into main
This commit is contained in:
		
						commit
						8fee3b3872
					
				| @ -8,8 +8,35 @@ | ||||
| # | ||||
| ################################## | ||||
| 
 | ||||
| # edit this line to add more configurations | ||||
| confignames = ["rv32ic", "rv64ic", "busybear"] | ||||
| from collections import namedtuple | ||||
| # name:     the name of this test configuration/script | ||||
| # cmd:      the command to run to test (should include the logfile as {}) | ||||
| # grepstr:  the string to grep through the log file for, success iff grep finds that string | ||||
| Config = namedtuple("Config", ['name', 'cmd', 'grepstr']) | ||||
| 
 | ||||
| # edit this list to add more configurations | ||||
| configs = [ | ||||
|     Config( | ||||
|         name="busybear", | ||||
|         cmd="vsim -do wally-busybear-batch.do -c > {}", | ||||
|         grepstr="# loaded 800000 instructions" | ||||
|     ), | ||||
|     Config( | ||||
|         name="buildroot", | ||||
|         cmd="vsim -do wally-buildroot-batch.do -c > {}", | ||||
|         grepstr="# loaded 100000 instructions" | ||||
|     ), | ||||
|     Config( | ||||
|         name="rv32ic", | ||||
|         cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do ../config/rv32ic rv32ic\n!", | ||||
|         grepstr="All tests ran without failures" | ||||
|     ), | ||||
|     Config( | ||||
|         name="rv64ic", | ||||
|         cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do ../config/rv64ic rv64ic\n!", | ||||
|         grepstr="All tests ran without failures" | ||||
|     ), | ||||
| ] | ||||
| 
 | ||||
| import multiprocessing, os | ||||
| 
 | ||||
| @ -21,35 +48,27 @@ def search_log_for_text(text, logfile): | ||||
|     return os.system(grepcmd) == 0 | ||||
| 
 | ||||
| def test_config(config, print_res=True): | ||||
|   """Run the given config, and return 0 if it suceeds and 1 if it fails""" | ||||
|   logname = "wally_"+config+".log" | ||||
|   if config == "busybear": | ||||
|     # Handle busybear separately | ||||
|     cmd = "vsim -do wally-busybear-batch.do -c >" + logname | ||||
|     os.system(cmd) | ||||
|     # check for success.  grep returns 0 if found, 1 if not found | ||||
|     passed = search_log_for_text("# loaded 800000 instructions", logname) | ||||
|   else: | ||||
|     # Any other configuration loads that name from the config folder and runs vsim | ||||
|     cmd = "vsim -c >" + logname +" <<!\ndo wally-pipelined-batch.do ../config/" + config + " " + config + "\n!\n" | ||||
|     """Run the given config, and return 0 if it suceeds and 1 if it fails""" | ||||
|     logname = "wally_"+config.name+".log" | ||||
|     cmd = config.cmd.format(logname) | ||||
|     print(cmd) | ||||
|     os.system(cmd) | ||||
|     # check for success.  grep returns 0 if found, 1 if not found | ||||
|     passed = search_log_for_text("All tests ran without failures", logname) | ||||
|   if passed: | ||||
|     if print_res:print(logname+": Success") | ||||
|     return 0 | ||||
|   else: | ||||
|     if print_res:print(logname+": failures detected") | ||||
|     return 1 | ||||
|     passed = search_log_for_text(config.grepstr, logname) | ||||
|     if passed: | ||||
|         if print_res:print(logname+": Success") | ||||
|         return 0 | ||||
|     else: | ||||
|         if print_res:print(logname+": failures detected") | ||||
|         return 1 | ||||
| 
 | ||||
| # Run the tests and count the failures | ||||
| pool = multiprocessing.Pool(min(len(confignames), 12)) | ||||
| fail = sum(pool.map(test_config, confignames)) | ||||
| pool = multiprocessing.Pool(min(len(configs), 12)) | ||||
| fail = sum(pool.map(test_config, configs)) | ||||
| 
 | ||||
| if (fail): | ||||
|   print ("Regression failed with " +str(fail)+ " failed configurations") | ||||
|   exit(1) | ||||
|     print("Regression failed with " +str(fail)+ " failed configurations") | ||||
|     exit(1) | ||||
| else: | ||||
|   print ("SUCCESS! All tests ran without failures") | ||||
|   exit(0) | ||||
|     print("SUCCESS! All tests ran without failures") | ||||
|     exit(0) | ||||
|  | ||||
| @ -107,8 +107,10 @@ module csrm #(parameter | ||||
|   logic            WritePMPCFG0M, WritePMPCFG2M; | ||||
|   logic            WritePMPADDRM [0:15];  | ||||
| 
 | ||||
|   localparam MISA_26 = (`MISA) & 32'h03ffffff; | ||||
| 
 | ||||
|   // MISA is hardwired.  Spec says it could be written to disable features, but this is not supported by Wally
 | ||||
|   assign MISA_REGW = {(`XLEN == 32 ? 2'b01 : 2'b10), {(`XLEN-28){1'b0}}, {`MISA}[25:0]}; | ||||
|   assign MISA_REGW = {(`XLEN == 32 ? 2'b01 : 2'b10), {(`XLEN-28){1'b0}}, MISA_26[25:0]}; | ||||
| 
 | ||||
|   // Write machine Mode CSRs 
 | ||||
|   assign WriteMSTATUSM = CSRMWriteM && (CSRAdrM == MSTATUS); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user