alexforencich/cocotbext-axi

Question - does it support array of I/Fs?

aignacio opened this issue · 8 comments

Hi,
is there a way to specify an array index when creating the bus? Something like...

axim_0 = AXI4Master(dut, AXI_PREFIX, dut.clk, index_array=0)

What do you mean by "array index"?

In the case where you have an array of AXI Slaves as part of your dut interface, and you need to bind one master for each slave I/F, something like the code below:
https://github.com/cocotb/cocotb/blob/master/tests/test_cases/test_array_buses/test_array_buses.py#L59

Ah, I see. I think that's just a matter of feeding the parameter through to the bus object, I can add that for now until the bus handling is rebuilt.

What do mean by "...until the bus handling is rebuilt.", is there a refactoring in progress?

The bus object is being deprecated in the main cocotb repo, so I'm mulling over a more flexible replacement that's more decoupled from the actual models. The idea would be to do something more like:

axim_0 = AxiMaster(AxiBus.from_prefix(dut, AXI_PREFIX, index=0), dut.clk)

or something along those lines. In this way, you can directly mess around with the bus object before handing it off to the model and fix up settings and connections if necessary.

oh okay, I got your point. Thanks for answering!

I did sort of a stop-gap rewrite that still uses the Bus object, but pulls this out into new wrapper objects including AxiBus. So you should now be able to do:

axim_0 = AxiMaster(AxiBus.from_prefix(dut, AXI_PREFIX, index=0), dut.clk)

Let me know if this doesn't work for you.