[otbn,dv] Fix early exits in otbn_base_vseq::run_otbn() on reset
If the block gets reset, we want run_otbn() to exit immediately. In
practice, this already happens (because csr_wr and csr_spinwait both
exit immediately). But we make the early exit explicit to avoid
checking the end address: that check will fail if there is a reset in
the middle of the first execution of a binary.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_base_vseq.sv b/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_base_vseq.sv
index 0195444..aab914b 100644
--- a/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_base_vseq.sv
+++ b/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_base_vseq.sv
@@ -103,6 +103,8 @@
endfunction
// Start OTBN and then wait until done
+ //
+ // If the block gets reset, this task will exit early.
protected task run_otbn();
int exp_end_addr;
uvm_reg_data_t cmd_val;
@@ -127,12 +129,18 @@
`uvm_info(`gfn, $sformatf("\n\t ----| OTBN finished"), UVM_MEDIUM)
- // If there was an expected end address, compare it with the model. This isn't really a test of
- // the RTL, but it's handy to make sure that the RIG really is generating the control flow that
- // it expects.
- exp_end_addr = OtbnMemUtilGetExpEndAddr(cfg.mem_util);
- if (exp_end_addr >= 0) begin
- `DV_CHECK_EQ_FATAL(exp_end_addr, cfg.model_agent_cfg.vif.stop_pc)
+ // Post-run checks
+ //
+ // The CSR operations above short-circuit and exit immediately if the reset line goes low. If
+ // that happens, we don't want to run the checks (since the run didn't finish properly).
+ if (!cfg.under_reset) begin
+ // If there was an expected end address, compare it with the model. This isn't really a test of
+ // the RTL, but it's handy to make sure that the RIG really is generating the control flow that
+ // it expects.
+ exp_end_addr = OtbnMemUtilGetExpEndAddr(cfg.mem_util);
+ if (exp_end_addr >= 0) begin
+ `DV_CHECK_EQ_FATAL(exp_end_addr, cfg.model_agent_cfg.vif.stop_pc)
+ end
end
running_ = 1'b0;