Skip to content

Commit 129bbac

Browse files
committed
[dv] Use id_done to accurately track instruction monitor
This refactors `instr_vif` to use `rvfi_id_done` instead of `instr_new_id` to track when a new instruction appears in the ID stage. This interface and signal are only used to keep track of instruction fetch errors by using the aforementioned valid signal and checking whether the `rvfi_order_id` has changed. However, if an instruction fetch error is consecutive to another error, `instr_new_id` will be gated, which leads us to miss the `fetch_err` in the verification. This will fix failing `riscv_mem_error_test`
1 parent 246849e commit 129bbac

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

dv/uvm/core_ibex/common/ibex_cosim_agent/ibex_cosim_scoreboard.sv

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ class ibex_cosim_scoreboard extends uvm_scoreboard;
268268
bit [31:0] aligned_next_addr;
269269
forever begin
270270
// Wait for new instruction to appear in ID stage
271-
wait (instr_vif.instr_cb.valid_id &&
272-
instr_vif.instr_cb.instr_new_id &&
271+
wait (instr_vif.instr_cb.rvfi_id_done &&
273272
latest_order != instr_vif.instr_cb.rvfi_order_id);
274273

275274
latest_order = instr_vif.instr_cb.rvfi_order_id;
@@ -320,9 +319,9 @@ class ibex_cosim_scoreboard extends uvm_scoreboard;
320319
// Wait for a new instruction or a writeback exception. When a new instruction has entered the
321320
// ID stage and we haven't seen a writeback exception we know the instruction associated with the
322321
// error just added to the queue isn't getting flushed.
323-
wait (instr_vif.instr_cb.instr_new_id || dut_vif.dut_cb.wb_exception);
322+
wait (instr_vif.instr_cb.rvfi_id_done || dut_vif.dut_cb.wb_exception);
324323

325-
if (!instr_vif.instr_cb.instr_new_id && dut_vif.dut_cb.wb_exception) begin
324+
if (!instr_vif.instr_cb.rvfi_id_done && dut_vif.dut_cb.wb_exception) begin
326325
// If we hit a writeback exception without seeing a new instruction then the newly added
327326
// error relates to an instruction just flushed from the ID stage so pop it from the
328327
// queue.

dv/uvm/core_ibex/env/core_ibex_instr_monitor_if.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface core_ibex_instr_monitor_if #(
1515
// ID stage
1616
logic reset;
1717
logic valid_id;
18-
logic instr_new_id;
18+
logic rvfi_id_done;
1919
logic err_id;
2020
logic is_compressed_id;
2121
logic [15:0] instr_compressed_id;
@@ -30,7 +30,7 @@ interface core_ibex_instr_monitor_if #(
3030
clocking instr_cb @(posedge clk);
3131
input reset;
3232
input valid_id;
33-
input instr_new_id;
33+
input rvfi_id_done;
3434
input err_id;
3535
input is_compressed_id;
3636
input instr_compressed_id;

dv/uvm/core_ibex/tb/core_ibex_tb_top.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ module core_ibex_tb_top;
274274
// Instruction monitor connections
275275
assign instr_monitor_if.reset = ~rst_n;
276276
assign instr_monitor_if.valid_id = dut.u_ibex_top.u_ibex_core.id_stage_i.instr_valid_i;
277-
assign instr_monitor_if.instr_new_id = dut.u_ibex_top.u_ibex_core.instr_new_id;
277+
assign instr_monitor_if.rvfi_id_done = dut.u_ibex_top.u_ibex_core.rvfi_id_done;
278278

279279
assign instr_monitor_if.err_id =
280280
dut.u_ibex_top.u_ibex_core.id_stage_i.controller_i.instr_fetch_err;

0 commit comments

Comments
 (0)