Skip to content

Commit

Permalink
update issue2: MTC big read transasction
Browse files Browse the repository at this point in the history
  • Loading branch information
martinspinler committed Aug 23, 2024
1 parent d494345 commit cea5eaa
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions tests/cocotb/issues/issue2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,35 @@ def ms_add_cursor(name, time=None):
ms.cmd(f"wave cursor add")
ms.cmd(f'wave cursor configure -name {{{name}}} -time {{{time}}} -lock 1')

async def get_dev_init(dut):
dev = NFBDevice(dut)
await dev.init()
return dev, dev.nfb

async def wr_rd(c, length):

async def wr_rd(c, length, offset=0):
data = bytes([(j%256) for j in range(length)])
await e(c.write)(0, data)
rdata = await e(c.read)(0, length)
await e(c.write)(offset, data)
rdata = await e(c.read)(offset, length)
assert rdata == data, f'writen: {list(data)}, readen: {list(rdata)}'

@cocotb.test()

@cocotb.test(timeout_time=400, timeout_unit='us')
async def mtc_big_write_tr(dut):
ms_add_cursor("CQ WR REQ", "0.1us")
ms_add_cursor("CQ RD REQ", "0.104us")
ms_add_cursor("bad cq_data ", "1.42us")
dev, nfb = await get_dev_init(dut)
c = nfb.comp_open("cesnet,ofm,mi_test_space")

await wr_rd(c, 126, 3)

dev = NFBDevice(dut)
await dev.init()
c = dev.nfb.comp_open("cesnet,ofm,mi_test_space")

# This one will pass through
#await wr_rd(c, 32)

# This one transfers correctly 32B, 4B incorrectly and then stucks!
await with_timeout(
wr_rd(c, 36),
10, 'us',
)
)



core = NFBDevice.core_instance_from_top(cocotb.top)
core_path = ms.cocotb2path(core)

pci_core = core.pcie_i.pcie_core_i

MiBus(core.pcie_i, 'MI', 0, label='MI_PCIe').add_wave()
ms.cmd(f"log -recursive {ms.cocotb2path(core)}/*")
ms.cmd('add wave sim:/fpga/cm_i/pcie_i/pcie_ctrl_g(0)/pcie_ctrl_i/mtc_i/*')
ms.cmd(f"log -recursive {core_path}/*")
ms.cmd(f'add wave {core_path}/pcie_i/pcie_ctrl_g(0)/pcie_ctrl_i/mtc_i/*')

0 comments on commit cea5eaa

Please sign in to comment.