Merge branch 'openhwgroup:main' into main

This commit is contained in:
Divya2030 2024-04-03 10:40:30 -07:00 committed by GitHub
commit aa6eacbce5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 18 deletions

@ -1 +1 @@
Subproject commit 8a52b016dbe1e2733cc168b9d6e5c93e39059d4d Subproject commit 8a0cdceca9f0b91b81905eb8497f6586bf8d1c6b

View file

@ -305,6 +305,24 @@ module testbench;
signature_size = end_signature_addr - begin_signature_addr; signature_size = end_signature_addr - begin_signature_addr;
end end
always @(posedge clk) begin always @(posedge clk) begin
////////////////////////////////////////////////////////////////////////////////
// Verify the test ran correctly by checking the memory against a known signature.
////////////////////////////////////////////////////////////////////////////////
if(TestBenchReset) test = 1;
if (TEST == "coremark")
if (dut.core.priv.priv.EcallFaultM) begin
$display("Benchmark: coremark is done.");
$stop;
end
if (P.ZICSR_SUPPORTED & dut.core.ifu.PCM == 0 & dut.core.ifu.InstrM == 0 & dut.core.ieu.InstrValidM) begin
$display("Program fetched illegal instruction 0x00000000 from address 0x00000000. Might be fault with no fault handler.");
//$stop; // presently wally32/64priv tests trigger this for reasons not yet understood.
end
// modifications 4/3/24 kunlin & harris to speed up Verilator
// For some reason, Verilator runs ~100x slower when these SelectTest and Validate codes are in the posedge clk block
//end // added
//always @(posedge SelectTest) // added
if(SelectTest) begin if(SelectTest) begin
if (riscofTest) memfilename = {pathname, tests[test], "/ref/ref.elf.memfile"}; if (riscofTest) memfilename = {pathname, tests[test], "/ref/ref.elf.memfile"};
else if(TEST == "buildroot") begin else if(TEST == "buildroot") begin
@ -327,20 +345,14 @@ module testbench;
// and initialize them to zero (also initilaize them to zero at the start of the next test) // and initialize them to zero (also initilaize them to zero at the start of the next test)
updateProgramAddrLabelArray(ProgramAddrMapFile, ProgramLabelMapFile, ProgramAddrLabelArray); updateProgramAddrLabelArray(ProgramAddrMapFile, ProgramLabelMapFile, ProgramAddrLabelArray);
end end
`ifdef VERILATOR // this macro is defined when verilator is used
//////////////////////////////////////////////////////////////////////////////// // Simulator Verilator has an issue that the validate logic below slows runtime 110x if it is
// Verify the test ran correctly by checking the memory against a known signature. // in the posedge clk block rather than a separate posedge Validate block.
//////////////////////////////////////////////////////////////////////////////// // Until it is fixed, provide a silly posedge Validate block to keep Verilator happy.
if(TestBenchReset) test = 1; // https://github.com/verilator/verilator/issues/4967
if (TEST == "coremark") end // restored
if (dut.core.priv.priv.EcallFaultM) begin always @(posedge Validate) // added
$display("Benchmark: coremark is done."); `endif
$stop;
end
if (P.ZICSR_SUPPORTED & dut.core.ifu.PCM == 0 & dut.core.ifu.InstrM == 0 & dut.core.ieu.InstrValidM) begin
$display("Program fetched illegal instruction 0x00000000 from address 0x00000000. Might be fault with no fault handler.");
//$stop; // presently wally32/64priv tests trigger this for reasons not yet understood.
end
if(Validate) begin if(Validate) begin
if (TEST == "embench") begin if (TEST == "embench") begin
// Writes contents of begin_signature to .sim.output file // Writes contents of begin_signature to .sim.output file
@ -376,10 +388,17 @@ module testbench;
if (test == tests.size()) begin if (test == tests.size()) begin
if (totalerrors == 0) $display("SUCCESS! All tests ran without failures."); if (totalerrors == 0) $display("SUCCESS! All tests ran without failures.");
else $display("FAIL: %d test programs had errors", totalerrors); else $display("FAIL: %d test programs had errors", totalerrors);
$stop; // if this is changed to $finish, wally-batch.do does not go to the next step to run coverage `ifdef VERILATOR // this macro is defined when verilator is used
$finish; // Simulator Verilator needs $finish to terminate simulation.
`else
$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
`endif
end end
end end
end `ifndef VERILATOR
// Remove this when issue 4967 is resolved and the posedge Validate logic above is removed
end
`endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -471,7 +490,7 @@ module testbench;
assign SPIIn = 0; assign SPIIn = 0;
if(P.EXT_MEM_SUPPORTED) begin if(P.EXT_MEM_SUPPORTED) begin
ram_ahb #(.BASE(P.EXT_MEM_BASE), .RANGE(P.EXT_MEM_RANGE)) ram_ahb #(.P(P), .BASE(P.EXT_MEM_BASE), .RANGE(P.EXT_MEM_RANGE))
ram (.HCLK, .HRESETn, .HADDR, .HWRITE, .HTRANS, .HWDATA, .HSELRam(HSELEXT), ram (.HCLK, .HRESETn, .HADDR, .HWRITE, .HTRANS, .HWDATA, .HSELRam(HSELEXT),
.HREADRam(HRDATAEXT), .HREADYRam(HREADYEXT), .HRESPRam(HRESPEXT), .HREADY, .HWSTRB); .HREADRam(HRDATAEXT), .HREADYRam(HREADYEXT), .HRESPRam(HRESPEXT), .HREADY, .HWSTRB);
end else begin end else begin
@ -760,6 +779,8 @@ end
logic [P.XLEN-1:0] signature[0:SIGNATURESIZE]; logic [P.XLEN-1:0] signature[0:SIGNATURESIZE];
string signame; string signame;
logic [P.XLEN-1:0] testadr, testadrNoBase; logic [P.XLEN-1:0] testadr, testadrNoBase;
//$display("Invoking CheckSignature %s %s %0t", pathname, TestName, $time);
// read .signature.output file and compare to check for errors // read .signature.output file and compare to check for errors
if (riscofTest) signame = {pathname, TestName, "/ref/Reference-sail_c_simulator.signature"}; if (riscofTest) signame = {pathname, TestName, "/ref/Reference-sail_c_simulator.signature"};