alexforencich/cocotbext-axi

[Question] Handling array of structs with bus drivers

aignacio opened this issue · 4 comments

Hey @alexforencich,
thanks for the repository, I still didn't have time to implement it but I went through it shortly and it's really amazing. Sorry for raising this issue but didn't know a better way to ask you this question but do you have an idea of how to connect your AXIMaster bus drivers for an AXI slave that's an array of structs and it has different names for miso/mosi signals?
image
SV Structs:
image
image
simengine: verilator-master
Thanks!

I should probably enable discussions on the cocotbext repos. Anyway, that's a rather odd way to split things out. Right now I don't think it's possible to connect that up, but I'm looking in to reworking how the bus object is used to make this sort of thing easier/possible. Worse comes to worse, you'll be able to manually connect all of the signals. In your case, it looks like maybe having some way to combine signals from two objects into one object might make this unnecessary. Something like this, perhaps:

axi_if = [AxiMaster(mosi + miso, dut.clk, dut.rst, ...) for mosi, miso in zip(dut.inst.axi_mosi_if, dut.inst.axi_miso_if]

or perhaps:

axi_if = [AxiMaster(Combine(mosi, miso), dut.clk, dut.rst, ...) for mosi, miso in zip(dut.inst.axi_mosi_if, dut.inst.axi_miso_if]

I'll discuss with the cocotb folks about the feasibility of making something like this work.

I just added new objects that will hopefully be able to make this sort of thing easier. Right now they are just wrappers around the Bus object, but I'm planning on doing a more complete rewrite. I'm not sure exactly what it's going to look like at this point, but I'm definitely going to keep this particular use-case in mind, perhaps by supporting matching signals from multiple source entities.

oh great, thanks for the heads up! Please keep as an example too if possible.... This type of usage is very common in ASIC industry once it helps with bus integration and during the synthesis steps when you need to constrain in/outs

btw, if you're willing to have something in SV, use Verilator 4.106 once the latest is hanging due to VPI changes