Skip to content

Commit 6ac0ddc

Browse files
committed
[dv] Alter riscv_rf_intg_test to cover more scenarios
Previously the riscv_rf_intg_test skipped certain scenarios where an ECC error from the register file should trigger an alert. This change stops it from skipping those scenarios.
1 parent 9e4a950 commit 6ac0ddc

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

dv/uvm/core_ibex/env/core_ibex_dut_probe_if.sv

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface core_ibex_dut_probe_if(input logic clk);
3434
logic rf_ren_b;
3535
logic rf_rd_a_wb_match;
3636
logic rf_rd_b_wb_match;
37+
logic rf_write_wb;
3738
logic sync_exc_seen;
3839
logic irq_exc_seen;
3940
logic csr_save_cause;
@@ -80,6 +81,7 @@ interface core_ibex_dut_probe_if(input logic clk);
8081
input rf_ren_b;
8182
input rf_rd_a_wb_match;
8283
input rf_rd_b_wb_match;
84+
input rf_write_wb;
8385
input sync_exc_seen;
8486
input irq_exc_seen;
8587
input wb_exception;
@@ -93,6 +95,7 @@ interface core_ibex_dut_probe_if(input logic clk);
9395
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_rf_ren_b, rf_ren_b)
9496
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_rf_rd_a_wb_match, rf_rd_a_wb_match)
9597
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_rf_rd_b_wb_match, rf_rd_b_wb_match)
98+
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_rf_write_wb, rf_write_wb)
9699
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_alert_minor, alert_minor)
97100
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_ic_tag_req, ic_tag_req)
98101
`DV_CREATE_SIGNAL_PROBE_FUNCTION(signal_probe_ic_tag_write, ic_tag_write)

dv/uvm/core_ibex/tb/core_ibex_tb_top.sv

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ module core_ibex_tb_top;
250250
assign dut_if.rf_ren_b = dut.u_ibex_top.u_ibex_core.rf_ren_b;
251251
assign dut_if.rf_rd_a_wb_match = dut.u_ibex_top.u_ibex_core.rf_rd_a_wb_match;
252252
assign dut_if.rf_rd_b_wb_match = dut.u_ibex_top.u_ibex_core.rf_rd_b_wb_match;
253+
assign dut_if.rf_write_wb = dut.u_ibex_top.u_ibex_core.rf_write_wb;
253254
assign dut_if.sync_exc_seen = dut.u_ibex_top.u_ibex_core.cs_registers_i.cpuctrlsts_part_q.sync_exc_seen;
254255
assign dut_if.csr_save_cause = dut.u_ibex_top.u_ibex_core.csr_save_cause;
255256
assign dut_if.exc_cause = dut.u_ibex_top.u_ibex_core.exc_cause;

dv/uvm/core_ibex/tests/core_ibex_test_lib.sv

+9-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ class core_ibex_rf_intg_test extends core_ibex_base_test;
129129
endfunction
130130

131131
virtual task send_stimulus();
132-
bit port_idx;
132+
int rnd_delay;
133+
bit port_idx;
133134
string port_name;
134135

135136
vseq.start(env.vseqr);
@@ -138,14 +139,19 @@ class core_ibex_rf_intg_test extends core_ibex_base_test;
138139
port_idx = $urandom_range(1);
139140
port_name = port_idx ? "rf_rdata_b_ecc" : "rf_rdata_a_ecc";
140141

142+
`DV_CHECK_STD_RANDOMIZE_WITH_FATAL(rnd_delay, rnd_delay > 1000; rnd_delay < 10_000;)
143+
clk_vif.wait_n_clks(rnd_delay);
144+
141145
forever begin
142-
logic rf_ren, rf_rd_wb_match;
146+
logic rf_ren, rf_rd_wb_match, rf_write_wb;
143147
int unsigned bit_idx;
144148
uvm_hdl_data_t data, mask;
145149
logic exp_alert, alert_major_internal;
146150

147151
clk_vif.wait_n_clks(1);
148152

153+
rf_write_wb = dut_vif.signal_probe_rf_write_wb(dv_utils_pkg::SignalProbeSample);
154+
149155
// Check if port is being read.
150156
if (port_idx) begin
151157
rf_ren = dut_vif.signal_probe_rf_ren_b(dv_utils_pkg::SignalProbeSample);
@@ -156,7 +162,7 @@ class core_ibex_rf_intg_test extends core_ibex_base_test;
156162
end
157163

158164
// Only corrupt port if it is read.
159-
if (!(rf_ren == 1'b1 && rf_rd_wb_match == 1'b0)) continue;
165+
if (!(rf_ren == 1'b1 && (rf_rd_wb_match == 1'b0 || rf_write_wb == 1'b0))) continue;
160166

161167
data = read_data(port_name);
162168
`uvm_info(`gfn, $sformatf("Corrupting %s; original value: 'h%0x", port_name, data), UVM_LOW)

0 commit comments

Comments
 (0)