forked from Github_Repos/cvw
		
	arch bug fixes and testbench changes
This commit is contained in:
		
							parent
							
								
									aa05dd7636
								
							
						
					
					
						commit
						3a5c02b44a
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -32,7 +32,7 @@ testsBP/*/*/*.elf* | ||||
| testsBP/*/OBJ/* | ||||
| testsBP/*/*.a | ||||
| tests/wally-riscv-arch-test/riscv-test-suite/*/I/*/* | ||||
| tests/riscof/riscof_work*/* | ||||
| tests/riscof/riscof_work/ | ||||
| tests/riscof/config32.ini | ||||
| tests/riscof/config64.ini | ||||
| tests/linux-testgen/linux-testvectors/* | ||||
|  | ||||
| @ -3,7 +3,7 @@ make allclean: | ||||
| 	make all | ||||
| 
 | ||||
| make clean: | ||||
| 	make clean -C ../../addins/riscv-arch-test | ||||
| 	make clean -C ../../tests/riscof | ||||
| 	make clean -C ../../tests/wally-riscv-arch-test | ||||
| #	make allclean -C ../../tests/imperas-riscv-tests
 | ||||
| 
 | ||||
| @ -15,8 +15,8 @@ make all: | ||||
| 	#make -C ../../tests/imperas-riscv-tests XLEN=64 --jobs | ||||
| 	 | ||||
| 	# Build riscv-arch-test 64 and 32-bit versions | ||||
| 	make -C ../../addins/riscv-arch-test --jobs | ||||
| 	make -C ../../addins/riscv-arch-test XLEN=32 --jobs | ||||
| 	make -C ../../tests/riscof/ --jobs | ||||
| 	make -C ../../tests/riscof/ XLEN=32 --jobs | ||||
| 
 | ||||
| 	# Build wally-riscv-arch-test | ||||
| 	make -C ../../tests/wally-riscv-arch-test/ --jobs | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| ROOT	:= ../.. | ||||
| SUFFIX	:= work | ||||
| ARCHDIR	:= $(ROOT)/addins/riscv-arch-test | ||||
| ARCHDIR	:= $(ROOT)/tests/riscof | ||||
| WALLYDIR:= $(ROOT)/tests/wally-riscv-arch-test | ||||
| # IMPERASDIR	:= $(ROOT)/tests/imperas-riscv-tests | ||||
| # ALLDIRS := $(ARCHDIR)/$(SUFFIX) $(WALLYDIR)/$(SUFFIX) $(IMPERASDIR)/$(SUFFIX) | ||||
|  | ||||
| @ -51,7 +51,6 @@ module testbench; | ||||
| string tests[]; | ||||
| logic [3:0] dummy; | ||||
| 
 | ||||
|   string ProgramAddrMapFile, ProgramLabelMapFile; | ||||
|   logic [`AHBW-1:0] HRDATAEXT; | ||||
|   logic             HREADYEXT, HRESPEXT; | ||||
|   logic [31:0]      HADDR; | ||||
| @ -65,6 +64,9 @@ logic [3:0] dummy; | ||||
|   logic             HCLK, HRESETn; | ||||
|   logic [`XLEN-1:0] PCW; | ||||
| 
 | ||||
|   string ProgramAddrMapFile, ProgramLabelMapFile; | ||||
|   integer   	ProgramAddrLabelArray [string]; | ||||
| 
 | ||||
|   logic 	    DCacheFlushDone, DCacheFlushStart; | ||||
|      | ||||
|   flopenr #(`XLEN) PCWReg(clk, reset, ~dut.core.ieu.dp.StallW, dut.core.ifu.PCM, PCW); | ||||
| @ -127,7 +129,7 @@ logic [3:0] dummy; | ||||
|   end | ||||
| 
 | ||||
|   string signame, memfilename, pathname, objdumpfilename, adrstr, outputfile; | ||||
|   integer outputFilePointer, ProgramLabelMap, ProgramAddrMap; | ||||
|   integer outputFilePointer; | ||||
| 
 | ||||
|   logic [31:0] GPIOPinsIn, GPIOPinsOut, GPIOPinsEn; | ||||
|   logic UARTSin, UARTSout; | ||||
| @ -193,6 +195,11 @@ logic [3:0] dummy; | ||||
| 
 | ||||
|       ProgramAddrMapFile = {pathname, tests[test], ".elf.objdump.addr"}; | ||||
|       ProgramLabelMapFile = {pathname, tests[test], ".elf.objdump.lab"}; | ||||
|       // declare memory labels that interest us, the updateProgramAddrLabelArray task will find the addr of each label and fill the array
 | ||||
|       // to expand, add more elements to this array and initialize them to zero (also initilaize them to zero at the start of the next test)
 | ||||
|       ProgramAddrLabelArray = '{ "begin_signature" : 0,  | ||||
| 	            	                 "tohost" : 0 }; | ||||
|       updateProgramAddrLabelArray(ProgramAddrMapFile, ProgramLabelMapFile, ProgramAddrLabelArray); | ||||
|       $display("Read memfile %s", memfilename); | ||||
|       reset_ext = 1; # 42; reset_ext = 0; | ||||
|     end | ||||
| @ -217,30 +224,12 @@ logic [3:0] dummy; | ||||
|         end | ||||
|       // Termination condition (i.e. we finished running current test) 
 | ||||
|       if (DCacheFlushDone) begin | ||||
|         // Gets the memory location of begin_signature
 | ||||
|         adrstr = "0"; | ||||
|         ProgramLabelMap = $fopen(ProgramLabelMapFile, "r"); | ||||
|         ProgramAddrMap = $fopen(ProgramAddrMapFile, "r"); | ||||
|         if (ProgramLabelMap & ProgramAddrMap) begin // check we found both files
 | ||||
|           while (!$feof(ProgramLabelMap)) begin | ||||
|             string label; | ||||
|             integer returncode; | ||||
|             returncode = $fgets(label, ProgramLabelMap); | ||||
|             returncode = $fgets(adrstr, ProgramAddrMap); | ||||
|             if (label == "begin_signature\n") begin | ||||
|               if (DEBUG) $display("%s begin_signature adrstr: %s", TEST, adrstr); | ||||
|               break; | ||||
|             end | ||||
|           end | ||||
|         end | ||||
|         if (adrstr == "0") begin | ||||
|         integer begin_signature_addr;  | ||||
|         begin_signature_addr = ProgramAddrLabelArray["begin_signature"]; | ||||
|         if (!begin_signature_addr) | ||||
|           $display("begin_signature addr not found in %s", ProgramLabelMapFile); | ||||
|         end | ||||
|         $fclose(ProgramLabelMap); | ||||
|         $fclose(ProgramAddrMap); | ||||
| 
 | ||||
|         testadr = ($unsigned(adrstr.atohex()))/(`XLEN/8); | ||||
|         testadrNoBase = (adrstr.atohex() - `RAM_BASE)/(`XLEN/8); | ||||
|         testadr = ($unsigned(begin_signature_addr))/(`XLEN/8); | ||||
|         testadrNoBase = (begin_signature_addr - `RAM_BASE)/(`XLEN/8); | ||||
|         #600; // give time for instructions in pipeline to finish
 | ||||
|         if (TEST == "embench") begin | ||||
|           // Writes contents of begin_signature to .sim.output file
 | ||||
| @ -318,7 +307,6 @@ logic [3:0] dummy; | ||||
|           end | ||||
|         end | ||||
|         // move onto the next test, check to see if we're done
 | ||||
|         // test = test + 2;
 | ||||
|         test = test + 1; | ||||
|         if (test == tests.size()) begin | ||||
|           if (totalerrors == 0) $display("SUCCESS! All tests ran without failures."); | ||||
| @ -336,6 +324,9 @@ logic [3:0] dummy; | ||||
| 
 | ||||
|             ProgramAddrMapFile = {pathname, tests[test], ".elf.objdump.addr"}; | ||||
|             ProgramLabelMapFile = {pathname, tests[test], ".elf.objdump.lab"}; | ||||
|             ProgramAddrLabelArray = '{ "begin_signature" : 0,  | ||||
| 	            	                       "tohost" : 0 }; | ||||
|             updateProgramAddrLabelArray(.ProgramAddrMapFile(ProgramAddrMapFile), .ProgramLabelMapFile(ProgramLabelMapFile), .ProgramAddrLabelArray(ProgramAddrLabelArray)); | ||||
|             $display("Read memfile %s", memfilename); | ||||
|             reset_ext = 1; # 47; reset_ext = 0; | ||||
|         end | ||||
| @ -363,7 +354,8 @@ logic [3:0] dummy; | ||||
| 			     (dut.core.ieu.dp.regf.we3 &  | ||||
| 			      dut.core.ieu.dp.regf.a3 == 3 &  | ||||
| 			      dut.core.ieu.dp.regf.wd3 == 1)) | | ||||
|           (dut.core.ifu.InstrM == 32'h6f | dut.core.ifu.InstrM == 32'hfc32a423 | dut.core.ifu.InstrM == 32'hfc32a823) & dut.core.ieu.c.InstrValidM; | ||||
|            ((dut.core.ifu.InstrM == 32'h6f | dut.core.ifu.InstrM == 32'hfc32a423 | dut.core.ifu.InstrM == 32'hfc32a823) & dut.core.ieu.c.InstrValidM ) | | ||||
|            ((dut.core.lsu.IEUAdrM == ProgramAddrLabelArray["tohost"]) & InstrMName == "SW" );  | ||||
| 
 | ||||
|   DCacheFlushFSM DCacheFlushFSM(.clk(clk), | ||||
|     			.reset(reset), | ||||
| @ -523,5 +515,26 @@ module copyShadow | ||||
|     end | ||||
|   end | ||||
|    | ||||
| endmodule		       | ||||
| endmodule | ||||
| 
 | ||||
| task automatic updateProgramAddrLabelArray; | ||||
|   input string ProgramAddrMapFile, ProgramLabelMapFile; | ||||
|   inout  integer ProgramAddrLabelArray [string]; | ||||
|   // Gets the memory location of begin_signature
 | ||||
|   integer ProgramLabelMapFP, ProgramAddrMapFP; | ||||
|   ProgramLabelMapFP = $fopen(ProgramLabelMapFile, "r"); | ||||
|   ProgramAddrMapFP = $fopen(ProgramAddrMapFile, "r"); | ||||
|    | ||||
|   if (ProgramLabelMapFP & ProgramAddrMapFP) begin // check we found both files
 | ||||
|     while (!$feof(ProgramLabelMapFP)) begin | ||||
|       string label, adrstr; | ||||
|       integer returncode; | ||||
|       returncode = $fscanf(ProgramLabelMapFP, "%s\n", label); | ||||
|       returncode = $fscanf(ProgramAddrMapFP, "%s\n", adrstr); | ||||
|       if (ProgramAddrLabelArray.exists(label))  | ||||
|         ProgramAddrLabelArray[label] = adrstr.atohex(); | ||||
|     end | ||||
|   end | ||||
|   $fclose(ProgramLabelMapFP); | ||||
|   $fclose(ProgramAddrMapFP); | ||||
| endtask | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,18 +1,28 @@ | ||||
| arch_dir = ../../addins/riscv-arch-test | ||||
| work_dir = "./riscof_work" | ||||
| current_dir = $(shell pwd) | ||||
| XLEN    ?= 64 | ||||
| 
 | ||||
| all: clone memfile | ||||
| all: build | ||||
| 
 | ||||
| clone: | ||||
| build: | ||||
| 	mkdir -p $(work_dir) | ||||
| 	mkdir -p work | ||||
| 	sed 's,{0},$(current_dir),g;s,{1},32imc,g' config.ini > config32.ini | ||||
| 	sed 's,{0},$(current_dir),g;s,{1},64gc,g' config.ini > config64.ini | ||||
| 	riscof run --work-dir=$(work_dir) --config=config64.ini --suite=$(arch_dir)/riscv-test-suite/ --env=$(arch_dir)/riscv-test-suite/env | ||||
| 	cp -r $(work_dir)/rv64i_m work/ | ||||
| 	riscof run --work-dir=$(work_dir) --config=config32.ini --suite=$(arch_dir)/riscv-test-suite/ --env=$(arch_dir)/riscv-test-suite/env | ||||
| 	cp -r $(work_dir)/rv32i_m work/ | ||||
| 	sed 's,{0},$(current_dir),g;s,{1},$(XLEN)$(if $(findstring 64,$(XLEN)),gc,imc),g' config.ini > config$(XLEN).ini | ||||
| 	riscof run --work-dir=$(work_dir) --config=config$(XLEN).ini --suite=$(arch_dir)/riscv-test-suite/ --env=$(arch_dir)/riscv-test-suite/env --no-browser --no-dut-run | ||||
| 	mv $(work_dir)/rv$(XLEN)i_m work/ | ||||
| 
 | ||||
| # buildold:
 | ||||
| # 	mkdir -p $(work_dir)
 | ||||
| # 	mkdir -p work
 | ||||
| # 	sed 's,{0},$(current_dir),g;s,{1},32imc,g' config.ini > config32.ini
 | ||||
| # 	sed 's,{0},$(current_dir),g;s,{1},64gc,g' config.ini > config64.ini
 | ||||
| # 	riscof run --work-dir=$(work_dir) --config=config32.ini --suite=$(arch_dir)/riscv-test-suite/ --env=$(arch_dir)/riscv-test-suite/env --no-browser --no-dut-run
 | ||||
| # 	mv -r $(work_dir)/rv32i_m work/
 | ||||
| # 	riscof run --work-dir=$(work_dir) --config=config64.ini --suite=$(arch_dir)/riscv-test-suite/ --env=$(arch_dir)/riscv-test-suite/env --no-browser --no-dut-run
 | ||||
| # 	mv -r $(work_dir)/rv64i_m work/
 | ||||
| 
 | ||||
| # no-dut-run? do we want to run spike?
 | ||||
| # sed  >> config64.ini
 | ||||
| #	(cd $(arch_dir) && riscof validateyaml --config=config.ini)
 | ||||
| #	(cd $(arch_dir) && riscof --verbose info arch-test --clone)
 | ||||
| @ -20,12 +30,12 @@ clone: | ||||
| # sed -i 's/riscv{.}-unknown-/riscv64-unknown-/g' $(arch_dir)/spike/riscof_spike.py
 | ||||
| # sed -i 's/riscv{.}-unknown-/riscv64-unknown-/g' $(arch_dir)/sail_cSim/riscof_sail_cSim.py
 | ||||
| 
 | ||||
| memfile: | ||||
| 	sleep 1 | ||||
| 	find work/rv*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-objdump -S -D "$$f" > "$$f.objdump"; done | ||||
| 	find work/rv32*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-elf2hex --bit-width 32 --input "$$f" --output "$$f.memfile"; done | ||||
| 	find work/rv64*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-elf2hex --bit-width 64 --input "$$f" --output "$$f.memfile"; done | ||||
| 	find work/rv*/*/ -type f -name "*.objdump" | while read f; do extractFunctionRadix.sh $$f; done | ||||
| # memfile:
 | ||||
| # 	sleep 1
 | ||||
| # # find work/rv*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-objdump -S -D "$$f" > "$$f.objdump"; echo $$f; done
 | ||||
| # 	find work/rv32*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-elf2hex --bit-width 32 --input "$$f" --output "$$f.memfile"; done
 | ||||
| # 	find work/rv64*/*/ -type f -name "*ref.elf" | while read f; do riscv64-unknown-elf-elf2hex --bit-width 64 --input "$$f" --output "$$f.memfile"; done
 | ||||
| # 	find work/rv*/*/ -type f -name "*.objdump" | while read f; do extractFunctionRadix.sh $$f; done
 | ||||
| 
 | ||||
| clean: | ||||
| 	rm -f config64.ini | ||||
|  | ||||
| @ -98,8 +98,8 @@ class sail_cSim(pluginTemplate): | ||||
|             compile_cmd = cmd + ' -D' + " -D".join(testentry['macros']) | ||||
|             execute+=compile_cmd+";" | ||||
| 
 | ||||
|             execute += self.objdump_cmd.format(elf, self.xlen, 'ref.disass') | ||||
|             sig_file = os.path.join(test_dir, self.name[:-1] + ".signature") | ||||
|             execute += self.objdump_cmd.format(elf, self.xlen, 'ref.elf.objdump') | ||||
|             sig_file = os.path.join(test_dir, "ref.signature.output") | ||||
| 
 | ||||
|             execute += self.sail_exe[self.xlen] + ' --test-signature={0} {1} > {2}.log 2>&1;'.format(sig_file, elf, test_name) | ||||
| 
 | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| hart_ids: [0] | ||||
| hart0: | ||||
|   ISA: RV32IMCZicsr_Zifencei | ||||
|   ISA: RV32IMFCZicsr_Zifencei | ||||
|   physical_addr_sz: 32 | ||||
|   User_Spec_Version: '2.3' | ||||
|   supported_xlen: [32] | ||||
|   misa: | ||||
|    reset-val: 0x40001104 | ||||
|    reset-val: 0x40001124 | ||||
|    rv32: | ||||
|      accessible: true | ||||
|      mxl: | ||||
| @ -23,7 +23,7 @@ hart0: | ||||
|            warl: | ||||
|               dependency_fields: [] | ||||
|               legal: | ||||
|                 - extensions[25:0] bitmask [0x0001104, 0x0000000] | ||||
|                 - extensions[25:0] bitmask [0x0001124, 0x0000000] | ||||
|               wr_illegal: | ||||
|                 - Unchanged | ||||
|   | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user