1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Rewrite test

This commit is contained in:
Alex Forencich 2021-03-24 22:00:20 -07:00
parent bb30f0a50f
commit bf2a779e48
2 changed files with 24 additions and 20 deletions

View File

@ -152,25 +152,26 @@ async def run_test_arb(dut, data_in=None, idle_inserter=None, backpressure_inser
tb = TB(dut)
byte_width = tb.axi_master[0].write_if.byte_width
await tb.cycle_reset()
tb.set_idle_generator(idle_inserter)
tb.set_backpressure_generator(backpressure_inserter)
for k in range(10):
tb.axi_master[0].init_write(k*256, b'\x11\x22\x33\x44')
tb.axi_master[0].init_read(k*256, 4)
tb.axi_master[1].init_write(k*256, b'\x11\x22\x33\x44')
tb.axi_master[1].init_read(k*256, 4)
async def worker(master, offset):
wr_op = master.init_write(offset, b'\x11\x22\x33\x44')
rd_op = master.init_read(offset, 4)
await tb.axi_master[0].wait()
await tb.axi_master[1].wait()
await wr_op.wait()
await rd_op.wait()
workers = []
for k in range(10):
tb.axi_master[0].get_read_data()
tb.axi_master[1].get_read_data()
workers.append(cocotb.fork(worker(tb.axi_master[0], k*256)))
workers.append(cocotb.fork(worker(tb.axi_master[1], k*256)))
while workers:
await workers.pop(0).join()
await RisingEdge(dut.a_clk)
await RisingEdge(dut.a_clk)

View File

@ -149,18 +149,21 @@ async def run_test_arb(dut, data_in=None, idle_inserter=None, backpressure_inser
tb.set_idle_generator(idle_inserter)
tb.set_backpressure_generator(backpressure_inserter)
for k in range(10):
tb.axil_master[0].init_write(k*256, b'\x11\x22\x33\x44')
tb.axil_master[0].init_read(k*256, 4)
tb.axil_master[1].init_write(k*256, b'\x11\x22\x33\x44')
tb.axil_master[1].init_read(k*256, 4)
async def worker(master, offset):
wr_op = master.init_write(offset, b'\x11\x22\x33\x44')
rd_op = master.init_read(offset, 4)
await tb.axil_master[0].wait()
await tb.axil_master[1].wait()
await wr_op.wait()
await rd_op.wait()
workers = []
for k in range(10):
tb.axil_master[0].get_read_data()
tb.axil_master[1].get_read_data()
workers.append(cocotb.fork(worker(tb.axil_master[0], k*256)))
workers.append(cocotb.fork(worker(tb.axil_master[1], k*256)))
while workers:
await workers.pop(0).join()
await RisingEdge(dut.a_clk)
await RisingEdge(dut.a_clk)