From 954fbadec910594e126a26eefb767265d0a310af Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Tue, 18 Jul 2023 12:38:06 +0100 Subject: [PATCH] [otbn,dv] Wait long enough for RF read in otbn_rf_base_intg_err_vseq This vseq wants to start an OTBN run and then, at some time after the run has started, corrupt the next read of the base register file. Of course, this needs a bit of a wait: we need to wait until the base register file is being read. This wait is usually very short (we read from the RF with most instructions) but is rather longer if we happen to be stalled reading from RND! The stall for a RND read is longer when CDC is enabled, and pushed us over the 2000 cycle max wait. Increasing by another multiple of 10 seems to fix things. Signed-off-by: Rupert Swarbrick --- .../otbn/dv/uvm/env/seq_lib/otbn_rf_base_intg_err_vseq.sv | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_rf_base_intg_err_vseq.sv b/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_rf_base_intg_err_vseq.sv index 737a4689faad5..946410d8b1e12 100644 --- a/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_rf_base_intg_err_vseq.sv +++ b/hw/ip/otbn/dv/uvm/env/seq_lib/otbn_rf_base_intg_err_vseq.sv @@ -11,6 +11,11 @@ class otbn_rf_base_intg_err_vseq extends otbn_base_vseq; `uvm_object_new rand bit insert_intg_err_to_a; + // Wait until the selected register file is being used + // + // This will normally just be a couple of cycles (because most instructions read from the register + // file), but it might be a bit longer if we happen to be stalled waiting for the EDN, which + // happens on a RND read. task await_use(); logic rd_en; `uvm_info(`gfn, "Waiting for selected RF to be used", UVM_LOW) @@ -20,7 +25,8 @@ class otbn_rf_base_intg_err_vseq extends otbn_base_vseq; rd_en = insert_intg_err_to_a ? cfg.trace_vif.rf_base_rd_en_a : cfg.trace_vif.rf_base_rd_en_b; end while(!rd_en);, - cfg.clk_rst_vif.wait_clks(20000);) + cfg.clk_rst_vif.wait_clks(20000); + ) if (!rd_en) begin `uvm_fatal(`gfn, $sformatf("Timeout while waiting for register file %s to be used",