[ibex, dv] Added a sequence to toggle fetch_enable_i pin

Ibex has a top-level `fetch_enable_i` input. When set to on (noting it's a multi-bit signal for
security hardening though only the bottom bit is looked at for non secure ibex) Ibex executes
normally. When set to off Ibex will stop executing. Randomly toggling it should have no functional
effect on Ibex's behaviour.
The fetch enable sequence will randomly toggle the value of `fetch_enable_i` with a configurable
bias between the 'On' value and all other values.
This commit is contained in:
Prajwala Puttappa 2022-03-01 10:15:17 +00:00 committed by prajwalaputtappa
parent 3438b77921
commit e6eb4fb11d
2 changed files with 50 additions and 9 deletions

View file

@ -225,3 +225,38 @@ class memory_error_seq extends core_base_new_seq#(irq_seq_item);
endtask
endclass: memory_error_seq
class fetch_enable_seq extends core_base_new_seq#(irq_seq_item);
`uvm_object_utils(fetch_enable_seq)
`uvm_object_new
ibex_pkg::fetch_enable_t fetch_enable;
int unsigned on_bias_pc = 50;
int max_delay = 500;
int min_delay = 75;
rand int unsigned off_delay = 0;
virtual task body();
dut_vif.dut_cb.fetch_enable <= ibex_pkg::FetchEnableOn;
if(off_delay == 0) begin
`DV_CHECK_MEMBER_RANDOMIZE_WITH_FATAL(off_delay,
off_delay inside {[min_delay : max_delay]};)
end
super.body();
endtask
virtual task send_req();
`uvm_info(get_full_name(), "Sending fetch enable request", UVM_LOW)
`DV_CHECK_MEMBER_RANDOMIZE_WITH_FATAL(fetch_enable,
fetch_enable dist {ibex_pkg::FetchEnableOn :/ on_bias_pc,
[0:15] :/ 100 - on_bias_pc};
)
`uvm_info(`gfn, $sformatf("fetch_enable = %d", fetch_enable), UVM_LOW)
dut_vif.dut_cb.fetch_enable <= fetch_enable;
clk_vif.wait_clks(off_delay);
dut_vif.dut_cb.fetch_enable <= ibex_pkg::FetchEnableOn;
endtask
endclass

View file

@ -1400,17 +1400,23 @@ class core_ibex_invalid_csr_test extends core_ibex_directed_test;
endclass
class core_mem_err_test extends core_ibex_directed_test;
memory_error_seq memory_error_seq_h;
class core_ibex_fetch_en_chk_test extends core_ibex_directed_test;
`uvm_component_utils(core_mem_err_test)
`uvm_component_utils(core_ibex_fetch_en_chk_test)
`uvm_component_new
virtual task send_stimulus();
memory_error_seq_h = memory_error_seq::type_id::create("memory_error_seq_h");
memory_error_seq_h.vseq.cfg = cfg;
memory_error_seq_h.vseq.mem = mem;
memory_error_seq_h.start(env.vseqr);
endtask: send_stimulus
fetch_enable_seq fetch_enable_seq_h;
fetch_enable_seq_h = fetch_enable_seq::type_id::create("fetch_enable_seq_h", this);
`uvm_info(`gfn, "Running core_ibex_fetch_en_chk_test", UVM_LOW)
fork
begin
vseq.start(env.vseqr);
end
begin
fetch_enable_seq_h.start(env.vseqr);
end
join_any
endtask
endclass: core_mem_err_test
endclass