Drive the branch_spec line in ICache UVM tests

This signal already got driven (to 1) when signalling a branch with
the interface's branch_to task. This patch now drives the branch_spec
line occasionally even if we don't actually do a branch. (One cycle in
64, for now).
This commit is contained in:
Rupert Swarbrick 2020-06-15 11:41:12 +01:00 committed by Rupert Swarbrick
parent 632ebcfe86
commit 2569a63eb7

View file

@ -59,12 +59,24 @@ class ibex_icache_core_driver
// Drive the enable state
cfg.vif.driver_cb.enable <= req.enable;
// Branch, invalidate and set new seed immediately. When the branch has finished, read num_insns
// instructions and wiggle the branch_spec line until everything is done.
fork
begin
cfg.vif.branch_to(req.branch_addr);
if (req.invalidate) invalidate();
if (req.new_seed != 0) drive_new_seed(req.new_seed);
read_insns(rsp, req.num_insns);
fork
read_insns(rsp, req.num_insns);
drive_branch_spec();
join_any
end
if (req.invalidate) invalidate();
if (req.new_seed != 0) drive_new_seed(req.new_seed);
join
// Kill the drive_branch_spec process and reset branch_spec if necessary.
disable fork;
cfg.vif.driver_cb.branch_spec <= 0;
endtask
// Drive the cache for a "req transaction".
@ -89,12 +101,23 @@ class ibex_icache_core_driver
// Drive the enable state
cfg.vif.driver_cb.enable <= req.enable;
// Lower req, invalidate and set new seed immediately. After req_low_cycles cycles, start
// reading instructions. Wiggle the branch_spec line the whole time.
fork
if (req_low_cycles > 0) lower_req(req_low_cycles);
if (req.invalidate) invalidate();
if (req.new_seed != 0) drive_new_seed(req.new_seed);
join
read_insns(rsp, req.num_insns);
begin
fork
if (req_low_cycles > 0) lower_req(req_low_cycles);
if (req.invalidate) invalidate();
if (req.new_seed != 0) drive_new_seed(req.new_seed);
join
read_insns(rsp, req.num_insns);
end
drive_branch_spec();
join_any
// Kill the drive_branch_spec process and reset branch_spec if necessary.
disable fork;
cfg.vif.driver_cb.branch_spec <= 0;
endtask
// Read up to num_insns instructions from the cache, stopping early on an error. If there was an
@ -110,6 +133,14 @@ class ibex_icache_core_driver
end
endtask
// Randomly drive the branch_spec line one cycle in 64. Never returns.
task automatic drive_branch_spec();
forever begin
cfg.vif.driver_cb.branch_spec <= $urandom_range(64) == 0;
@(cfg.vif.driver_cb);
end
endtask
// Read a single instruction from the cache
virtual task automatic read_insn();
int unsigned delay;