@@ -196,8 +196,39 @@ async def reader(return_data):
196
196
tb .log .info ("Test finished!" )
197
197
198
198
199
- @cocotb .test (skip = True )
199
+ @cocotb .test ()
200
200
async def test_read_burst_collision_with_write (dut ):
201
201
tb , data_len , test_data = await initialize (dut )
202
202
203
203
fifo_addr = tb .reg_map .I3C_EC .SECFWRECOVERYIF .INDIRECT_FIFO_DATA .base_addr
204
+
205
+ # Time in clock cycles to perform single dword write
206
+ single_write_cycles = 3
207
+
208
+ async def writer ():
209
+ await with_timeout (tb .axi_m .write_dwords (fifo_addr , test_data , burst = AxiBurstType .FIXED ), 1 , "us" )
210
+
211
+ async def reader (return_data ):
212
+ return_data .extend (await with_timeout (tb .axi_m .read_dwords (fifo_addr , count = data_len , burst = AxiBurstType .FIXED ), 1 , "us" ))
213
+
214
+ received_data1 = []
215
+ received_data2 = []
216
+ half_write_timer = ClockCycles (tb .clk , data_len * single_write_cycles // 2 )
217
+
218
+ # Request 1st write burst
219
+ w1 = cocotb .start_soon (writer ())
220
+ await half_write_timer
221
+ # Request 1st read burst during 1st write burst, should wait for write to finish
222
+ r1 = cocotb .start_soon (reader (received_data1 ))
223
+ await half_write_timer
224
+ # Request 2nd write burst that will collision with 1st read burst, should wait for read to finish
225
+ w2 = cocotb .start_soon (writer ())
226
+ await half_write_timer
227
+ # Request 2nd read burst during 2nd write burst, should wait for write to finish
228
+ r2 = cocotb .start_soon (reader (received_data2 ))
229
+ await Combine (w1 , r1 , w2 , r2 )
230
+
231
+ assert received_data1 == test_data , "Received data from 1st burst does not match sent data!"
232
+ assert received_data2 == test_data , "Received data from 2nd burst does not match sent data!"
233
+
234
+ tb .log .info ("Test finished!" )
0 commit comments