alexforencich/cocotbext-axi

AXILiteMaster incorrect write data

jahagirdar opened this issue · 1 comments

My code is

@cocotb.test()
async def my_first_test(dut):
    """Try accessing the design."""

    dut._log.info("Running test!")
    axi_master = AxiLiteMaster(dut, "axi_slave", dut.CLK)
    cocotb.fork(Clock(dut.CLK, 1250, 'ps').start())
    dut._log.info("Running test!")
    await axi_master.write(0x800,0x04)
    data=await axi_master.read(0x800,4)
    dut._log.info("Read "+repr(data))

When I simulate this i expected to see 4 on the wdata bus but I am seeing 0.

I put a few print statements to debug this...

axil_master

 async def write(self, address, data, prot=AxiProt.NONSECURE):
    ¦   event = Event()
    ¦   cocotb.log.warn("Write Data is "+repr(data))

shows "WARNING Write Data is 4 "

In async def _process_write(self)

    ¦   ¦   cmd = self.write_command_queue.popleft()
    ¦   ¦   self.log.info("cmd="+repr(cmd))

I see cmd=AxiLiteWriteCmd(address=2048, data=bytearray(b'\x00\x00\x00\x00'), prot=170, event=<Event at 0x7f2af9c580a0>)

Am I doing something wrong? Or is the axilite module broken?

Hmm, I might need to add some more type checking or something. read and write accept bytes, passing an integer should be an error. If you want to write, say, a dword, then you can use write_dword instead, and in that case you can provide a single integer for the data.