Skip to content

Commit 4f801d8

Browse files
mszalkowski-antrobertszczepanski
authored andcommitted
test_ibi: verify pending IBIs are inhibited without a valid address assigned
1 parent ca0b534 commit 4f801d8

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

verification/cocotb/top/lib_i3c_top/test_ibi.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,3 +1979,34 @@ async def inject_arb_loss():
19791979

19801980
await tb.teardown()
19811981

1982+
1983+
@cocotb.test
1984+
async def test_ibi_not_attempted_without_addr(dut):
1985+
"""
1986+
DUT is initialized with neither a static nor a dynamic address.
1987+
An IBI is then pushed to the IBI queue and the test ensures
1988+
that no action of sending the IBI is attempted by the DUT until
1989+
it has a valid address assigned.
1990+
"""
1991+
1992+
i3c_controller, _, tb = await test_setup(dut, static_addr=None)
1993+
await init_ibi(i3c_controller, tb, retry_num=0)
1994+
i3c_controller.enable_ibi(True)
1995+
1996+
mdb = 0xDD
1997+
data = [0xAA]
1998+
await send_ibi(tb, mdb, data)
1999+
2000+
try:
2001+
result = await i3c_controller.wait_for_ibi_event(timeout=10)
2002+
except SimTimeoutError:
2003+
"""Nothing has happened and the wait has timed out as expected"""
2004+
else:
2005+
assert False, f"There was an unexpected IBI event. {result}"
2006+
2007+
# Assign address to the target, so that it can finally request the IBI
2008+
await i3c_controller.i3c_entdaa([TARGET_ADDRESS], stop_after_n_targets=1)
2009+
2010+
# Capture and verify the IBI
2011+
result = await i3c_controller.wait_for_ibi_event(timeout=10)
2012+
assert result and result["ack"] and result["addr"] == TARGET_ADDRESS and result["data"] == bytes([mdb, *data])

verification/testplan/top/target_ibi.hjson

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,19 @@
338338
tests: ["ibi_arb_lost_in_drive_addr"]
339339
tags: ["top"]
340340
}
341+
{
342+
name: ibi_not_attempted_without_addr
343+
desc:
344+
'''
345+
Coverage: i3c_target_fsm.sv ibi_pending (cond).
346+
DUT is initialized with neither a static nor a dynamic address.
347+
An IBI is then pushed to the IBI queue and the test ensures
348+
that no action of sending the IBI is attempted by the DUT until
349+
it has a valid address assigned.
350+
'''
351+
tests: ["ibi_not_attempted_without_addr"]
352+
tags: ["top"]
353+
}
341354
{
342355
name: ibi_retry_count_limit
343356
desc:

0 commit comments

Comments
 (0)