diff --git a/dv/uvm/icache/dv/ibex_icache_core_agent/ibex_icache_core_driver.sv b/dv/uvm/icache/dv/ibex_icache_core_agent/ibex_icache_core_driver.sv index 689145ff..cfbd5a7f 100644 --- a/dv/uvm/icache/dv/ibex_icache_core_agent/ibex_icache_core_driver.sv +++ b/dv/uvm/icache/dv/ibex_icache_core_agent/ibex_icache_core_driver.sv @@ -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;