Skip to content

Commit ba9e9c5

Browse files
committed
[top_earlgrey/dv] Wait for SBA ready before reading in chip_sw_lc_raw_unlock_vseq
Prior to this commit, this vseq would try to read a CSR via JTAG without checking if SBA is non-busy. The `rom_raw_unlock` test failed (for some seeds) because the SBA was indeed busy, which caused an `sbbusyerror` that never got cleared. Signed-off-by: Andreas Kurth <[email protected]>
1 parent 850de98 commit ba9e9c5

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

hw/top_earlgrey/dv/chip_rom_tests.hjson

+1
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@
778778
"+use_otp_image=OtpTypeLcStRaw",
779779
"+chip_clock_source=ChipClockSourceExternal48Mhz",
780780
"+rom_prod_mode=1",
781+
"+use_jtag_dmi=1",
781782
]
782783
run_timeout_mins: 480
783784
}

hw/top_earlgrey/dv/env/seq_lib/chip_sw_lc_raw_unlock_vseq.sv

+28
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,32 @@ class chip_sw_lc_raw_unlock_vseq extends chip_sw_base_vseq;
77

88
`uvm_object_new
99

10+
jtag_dmi_reg_block jtag_dmi_ral;
11+
1012
// Mapped to plusarg to indicate that the test is run with a production ROM
1113
// image.
1214
bit rom_prod_mode = 1'b0;
1315

16+
virtual function void set_handles();
17+
super.set_handles();
18+
jtag_dmi_ral = cfg.jtag_dmi_ral;
19+
endfunction
20+
1421
virtual task pre_start();
1522
void'($value$plusargs("rom_prod_mode=%0d", rom_prod_mode));
1623
cfg.chip_vif.tap_straps_if.drive(JtagTapLc);
1724
super.pre_start();
1825
endtask
1926

27+
virtual task apply_reset(string kind = "HARD");
28+
fork
29+
if (kind inside {"HARD", "TRST"}) begin
30+
jtag_dmi_ral.reset("HARD");
31+
end
32+
super.apply_reset(kind);
33+
join
34+
endtask
35+
2036
// reset jtag interface
2137
virtual task reset_jtag_tap();
2238
cfg.m_jtag_riscv_agent_cfg.in_reset = 1;
@@ -40,12 +56,24 @@ class chip_sw_lc_raw_unlock_vseq extends chip_sw_base_vseq;
4056
`uvm_info(`gfn, "Waiting for extclk transition", UVM_LOW)
4157
`DV_SPINWAIT(
4258
while (!ack) begin
59+
// Wait for SBA to be non-busy before attempting to read (otherwise we'll get and have to
60+
// handle an `sbbusyerror`).
61+
bit busy = 1'b1;
62+
`DV_SPINWAIT(
63+
while (busy) begin
64+
uvm_reg_data_t sbcs_val;
65+
csr_rd(.ptr(jtag_dmi_ral.sbcs), .value(sbcs_val));
66+
busy = dv_base_reg_pkg::get_field_val(jtag_dmi_ral.sbcs.sbbusy, sbcs_val);
67+
`uvm_info(`gfn, $sformatf("busy = %0b", busy), UVM_HIGH)
68+
end,
69+
"Timed out waiting for SBA to be non-busy")
4370
jtag_riscv_agent_pkg::jtag_read_csr(base_addr + ral.clkmgr_aon.extclk_status.get_offset(),
4471
p_sequencer.jtag_sequencer_h, status);
4572

4673
ack = dv_base_reg_pkg::get_field_val(
4774
ral.clkmgr_aon.extclk_status.ack, status
4875
) == prim_mubi_pkg::MuBi4True;
76+
`uvm_info(`gfn, $sformatf("ack = %0b", ack), UVM_HIGH)
4977
end,
5078
"Timed out waiting for clkmgr to confirm extclk enablement")
5179
endtask

0 commit comments

Comments
 (0)