Skip to content

Commit 32d5580

Browse files
robertszczepanskitmichalak
authored andcommitted
Add test for collision during burst write
1 parent 2a79bc7 commit 32d5580

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

verification/cocotb/block/axi_adapter/test_bus_stress.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,39 @@ async def test_write_read_burst(dut):
165165

166166
assert received_data == test_data, "Received data does not match sent data!"
167167

168+
tb.log.info("Test finished!")
168169

169-
@cocotb.test(skip=True)
170-
async def test_read_burst_collision_with_write(dut):
170+
171+
@cocotb.test()
172+
async def test_write_burst_collision_with_read(dut):
171173
tb, data_len, test_data = await initialize(dut)
172174

173175
fifo_addr = tb.reg_map.I3C_EC.SECFWRECOVERYIF.INDIRECT_FIFO_DATA.base_addr
174176

177+
# Time in clock cycles to perform single dword write
178+
single_write_cycles = 3
179+
180+
async def writer():
181+
await with_timeout(tb.axi_m.write_dwords(fifo_addr, test_data, burst=AxiBurstType.FIXED), 1, "us")
182+
183+
async def reader(return_data):
184+
return_data.extend(await with_timeout(tb.axi_m.read_dwords(fifo_addr, count=data_len, burst=AxiBurstType.FIXED), 1, "us"))
185+
186+
received_data = []
187+
half_write_timer = ClockCycles(tb.clk, data_len * single_write_cycles // 2)
188+
189+
w = cocotb.start_soon(writer())
190+
await half_write_timer
191+
r = cocotb.start_soon(reader(received_data))
192+
await Combine(w, r)
193+
194+
assert received_data == test_data, "Received data does not match sent data!"
195+
196+
tb.log.info("Test finished!")
197+
175198

176199
@cocotb.test(skip=True)
177-
async def test_write_burst_collision_with_read(dut):
200+
async def test_read_burst_collision_with_write(dut):
178201
tb, data_len, test_data = await initialize(dut)
179202

180203
fifo_addr = tb.reg_map.I3C_EC.SECFWRECOVERYIF.INDIRECT_FIFO_DATA.base_addr

0 commit comments

Comments
 (0)