mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Breker tests working
This commit is contained in:
		
							parent
							
								
									8468428b21
								
							
						
					
					
						commit
						6cff03bd33
					
				
							
								
								
									
										3
									
								
								bin/wsim
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								bin/wsim
									
									
									
									
									
								
							@ -111,7 +111,10 @@ def prepSim(args, ElfFile):
 | 
			
		||||
        prefix = lockstepSetup(args)
 | 
			
		||||
        defineList.append("+define+USE_IMPERAS_DV")
 | 
			
		||||
    if "breker" in ElfFile:
 | 
			
		||||
        ElfFileNoExtension = os.path.splitext(args.testsuite)[0]
 | 
			
		||||
        flagsList.append("--breker")
 | 
			
		||||
        defineList.append("+define+USE_TREK_DV")
 | 
			
		||||
        argsList.append(f"+TREK_TBX_FILE={WALLY}/tests/breker/work/{ElfFileNoExtension}/{ElfFileNoExtension}.tbx")
 | 
			
		||||
    # Combine into a single string
 | 
			
		||||
    args.args += " ".join(argsList)
 | 
			
		||||
    args.params += " ".join(paramsList)
 | 
			
		||||
 | 
			
		||||
@ -132,11 +132,9 @@ if {[lcheck lst "--lockstep"] || $FunctCoverage == 1} {
 | 
			
		||||
if {[lcheck lst "--breker"]} {
 | 
			
		||||
    set breker 1
 | 
			
		||||
    set BREKER_HOME $::env(BREKER_HOME)
 | 
			
		||||
    set brekervlog "+define+USE_TREK_DV \
 | 
			
		||||
                    +incdir+${WALLY}/testbench/trek_files \
 | 
			
		||||
    set brekervlog "+incdir+${WALLY}/testbench/trek_files \
 | 
			
		||||
                    ${WALLY}/testbench/trek_files/uvm_output/trek_uvm_pkg.sv"
 | 
			
		||||
    set brekervopt "${WKDIR}.trek_uvm"
 | 
			
		||||
    set brekervsim "+TREK_TBX_FILE=${WALLY}/tests/breker/work/${TESTSUITE_NO_ELF}/${TESTSUITE_NO_ELF}.tbx"
 | 
			
		||||
    append SVLib " -sv_lib ${BREKER_HOME}/linux64/lib/libtrek "
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -419,7 +419,11 @@ module testbench;
 | 
			
		||||
      end else if (TEST == "coverage64gc") begin
 | 
			
		||||
        $display("%s ran. Coverage tests don't get checked", tests[test]);
 | 
			
		||||
      end else if (ElfFile != "none") begin
 | 
			
		||||
        $display("Single Elf file tests are not signatured verified.");
 | 
			
		||||
        `ifdef USE_TREK_DV
 | 
			
		||||
          $display("Breker test is done.");
 | 
			
		||||
        `else
 | 
			
		||||
          $display("Single Elf file tests are not signatured verified.");
 | 
			
		||||
        `endif
 | 
			
		||||
`ifdef QUESTA
 | 
			
		||||
        $stop;  // if this is changed to $finish for Questa, wally-batch.do does not go to the next step to run coverage, and wally.do terminates without allowing GUI debug
 | 
			
		||||
`else
 | 
			
		||||
@ -696,6 +700,7 @@ module testbench;
 | 
			
		||||
  always @(posedge clk) begin
 | 
			
		||||
  //  if (reset) PrevPCZero <= 0;
 | 
			
		||||
  //  else if (dut.core.InstrValidM) PrevPCZero <= (FunctionName.PCM == 0 & dut.core.ifu.InstrM == 0);
 | 
			
		||||
    // $display("PCE: %0h IEUAdrM: %0h Label (tohost): %0h instruction: %s", dut.core.ifu.PCE, dut.core.lsu.IEUAdrM, ProgramAddrLabelArray["tohost"], InstrMName);
 | 
			
		||||
    TestComplete <= ((InstrM == 32'h6f) & dut.core.InstrValidM ) |
 | 
			
		||||
		   ((dut.core.lsu.IEUAdrM == ProgramAddrLabelArray["tohost"] & dut.core.lsu.IEUAdrM != 0) & InstrMName == "SW"); // |
 | 
			
		||||
    //   (FunctionName.PCM == 0 & dut.core.ifu.InstrM == 0 & dut.core.InstrValidM & PrevPCZero));
 | 
			
		||||
 | 
			
		||||
@ -159,13 +159,7 @@ trek:
 | 
			
		||||
      doc: >-
 | 
			
		||||
        Verbatim code that will be put into the declaration section of the test.
 | 
			
		||||
      value: |-
 | 
			
		||||
        volatile uint64_t tohost;
 | 
			
		||||
 | 
			
		||||
        void __attribute__((noreturn)) tohost_exit(uintptr_t code)
 | 
			
		||||
        {
 | 
			
		||||
          tohost = (code << 1) | 1;
 | 
			
		||||
          while (1);
 | 
			
		||||
        }
 | 
			
		||||
        extern void tohost_exit(int status);
 | 
			
		||||
 | 
			
		||||
        #undef trek_exit
 | 
			
		||||
        #define trek_exit(status) tohost_exit(status);
 | 
			
		||||
 | 
			
		||||
@ -11,10 +11,15 @@ CONSTRAINT_FILES := $(shell find $(CONSTRAINTS_DIR) -type f)
 | 
			
		||||
TREKEXE_FLAGS    += --seed 0x # free (0x) or lock (0x1) the seed used for test generation
 | 
			
		||||
TREKSVIP = source $(TREKFILES)/breker-setup.sh && treksvip -p $(PLATFORM_YAML) -p $(TREKSVIP_YAML) $(TREKEXE_FLAGS)
 | 
			
		||||
 | 
			
		||||
EXAMPLES_LIB = $(WALLY)/examples/C/common
 | 
			
		||||
 | 
			
		||||
# -nostdlib -static -lm -fno-tree-loop-distribute-patterns
 | 
			
		||||
 | 
			
		||||
# Compilation paths and variables
 | 
			
		||||
MARCH        :=-march=rv64gc_zcb_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh_svinval 
 | 
			
		||||
MABI         :=-mabi=lp64d
 | 
			
		||||
LINKER       := $(WALLY)/tests/custom/linker8000-0000.x
 | 
			
		||||
LINKER       := $(EXAMPLES_LIB)/test.ld
 | 
			
		||||
# $(WALLY)/tests/custom/linker8000-0000.x
 | 
			
		||||
LINK_FLAGS   := -nostartfiles
 | 
			
		||||
CFLAGS 		   := -Wa,-alhs -Wa,-L -mcmodel=medany -Og -DSINGLE_CPU 
 | 
			
		||||
CRT0_DIR     := $(WALLY)/tests/custom/crt0
 | 
			
		||||
@ -33,7 +38,8 @@ $(TESTDIR)/%: $(CONSTRAINTS_DIR)/%.yaml | $(TESTDIR)
 | 
			
		||||
# Compile c code
 | 
			
		||||
.PRECIOUS: %.elf
 | 
			
		||||
%.elf: %.c $(CRT0_DIR)/libcrt0.a
 | 
			
		||||
	riscv64-unknown-elf-gcc $(MARCH) $(MABI) $(CFLAGS) $(LINK_FLAGS) -g -o $@ $< -L$(CRT0_DIR) -lcrt0 -T $(LINKER) > /dev/null
 | 
			
		||||
	riscv64-unknown-elf-gcc $(MARCH) $(MABI) $(CFLAGS) $(LINK_FLAGS) -g -o $@ $< -T $(LINKER) -I$(EXAMPLES_LIB) $(EXAMPLES_LIB)/crt.S $(EXAMPLES_LIB)/syscalls.c> /dev/null
 | 
			
		||||
# riscv64-unknown-elf-gcc $(MARCH) $(MABI) $(CFLAGS) $(LINK_FLAGS) -g -o $@ $< -L$(CRT0_DIR) -lcrt0 -T $(LINKER) > /dev/null
 | 
			
		||||
 | 
			
		||||
# Convert elf to hex
 | 
			
		||||
%.elf.memfile: %.elf
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user