Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rvfi_tracer and cva6.py #2684

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions corev_apu/tb/rvfi_tracer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module rvfi_tracer #(

logic [31:0] cycles;
// Generate the trace based on RVFI
logic [63:0] pc64;
logic [CVA6Cfg.XLEN-1:0] pc;
string cause;
logic[31:0] end_of_test_q;
logic[31:0] end_of_test_d;
Expand All @@ -74,19 +74,25 @@ module rvfi_tracer #(
always_ff @(posedge clk_i) begin
end_of_test_q <= (rst_ni && (end_of_test_d[0] == 1'b1)) ? end_of_test_d : 0;
for (int i = 0; i < CVA6Cfg.NrCommitPorts; i++) begin
pc64 = {{CVA6Cfg.XLEN-CVA6Cfg.VLEN{rvfi_i[i].pc_rdata[CVA6Cfg.VLEN-1]}}, rvfi_i[i].pc_rdata};
pc = {{CVA6Cfg.XLEN-CVA6Cfg.VLEN{rvfi_i[i].pc_rdata[CVA6Cfg.VLEN-1]}}, rvfi_i[i].pc_rdata};
// print the instruction information if the instruction is valid or a trap is taken
if (rvfi_i[i].valid) begin
// Instruction information
$fwrite(f, "core 0: 0x%h (0x%h) DASM(%h)\n",
pc64, rvfi_i[i].insn, rvfi_i[i].insn);
if (rvfi_i[i].intr[2]) begin
$fwrite(f, "core INTERRUPT 0: 0x%h (0x%h) DASM(%h)\n",
pc, rvfi_i[i].insn, rvfi_i[i].insn);
end
else begin
$fwrite(f, "core 0: 0x%h (0x%h) DASM(%h)\n",
pc, rvfi_i[i].insn, rvfi_i[i].insn);
end
// Destination register information
if (rvfi_i[i].insn[1:0] != 2'b11) begin
$fwrite(f, "%h 0x%h (0x%h)",
rvfi_i[i].mode, pc64, rvfi_i[i].insn[15:0]);
rvfi_i[i].mode, pc, rvfi_i[i].insn[15:0]);
end else begin
$fwrite(f, "%h 0x%h (0x%h)",
rvfi_i[i].mode, pc64, rvfi_i[i].insn);
rvfi_i[i].mode, pc, rvfi_i[i].insn);
end
// Decode instruction to know if destination register is FP register.
// Handle both uncompressed and compressed instructions.
Expand Down Expand Up @@ -129,8 +135,13 @@ module rvfi_tracer #(
32'h5: cause = "LD_ACCESS_FAULT";
32'h6: cause = "ST_ADDR_MISALIGNED";
32'h7: cause = "ST_ACCESS_FAULT";
32'hb: cause = "ENV_CALL_MMODE";
endcase;
$fwrite(f, "%s exception @ 0x%h\n", cause, pc64);
if (rvfi_i[i].insn[1:0] != 2'b11) begin
$fwrite(f, "%s exception @ 0x%h (0x%h)\n", cause, pc, rvfi_i[i].insn[15:0]);
end else begin
$fwrite(f, "%s exception @ 0x%h (0x%h)\n", cause, pc, rvfi_i[i].insn);
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion verif/sim/cva6.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ def parse_args(cwd):
help="switch AXI agent mode: yes for Active, no for Passive")
parser.add_argument("--gen_sv_seed", type=int, default=0,
help="Run test N times with random seed")
parser.add_argument("--sv_seed", type=str, default="1",
parser.add_argument("--sv_seed", type=str, default=str(random.getrandbits(31)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the seed is random, the CI tests will be executed with different seeds. This means the CI will not be deterministic. This can be a problem when executing Dhrystone or Coremark tests for instance for which we monitor cycle number.
Moreover some CI tests can have random behavior in relation to the seed. Debug can be more difficult.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can fix you're sv_seed using cva6.py option --sv_seed = n , by default sv_seed is always 1 and this limit finding bugs and use 100% of the UVM advantage (randomization), for now in CI all tests are running with only one sv_seed.

But we should store uvm seed in a specific file and store them in the artifacts

help="Run test with a specific seed")
parser.add_argument("--isa_extension", type=str, default="",
help="Choose additional z, s, x extensions")
Expand Down
Loading