There are several avalon_mm entities in the repository, but it’s not entirely clear to me, which one should be used.
There is the
avalon_mm_bus_arbitrer
which splits the master into several slaves. The number of slaves can be set with the NHI
generic (number of slaves is 2 ** NHI). Right so far? Why do I need the NM
generic?
But what is the
avalon_mm_ic_merged
for? The interface is pretty much the same…
An then there are several slave implementations,
avalon_mm_slave_vererr
avalon_mm_slave_xl
avalon_mm_slave
According to the comments, the functionality of the first two is now included in the last one, right? So the *_xl and *_vererr are outdated by now?
So If I want to use all the addresses coming into the user_logic (24bit address range), I instantiate one
avalon_mm_bus_arbitrer
where I set NHI
to 24. NH
I would keep at 1 and AWIDTH
I don’t know, maybe also 24? Then for example the S_WAITREQ
would be a 16,777,215 bit vector (2 ** 24). Does this make sense, I don’t really think so?
Ok, then the other way around, the lowest level is the
avalon_mm_slave
According to the width of RSTVAL
, I can decode at most 64 addresses with one slave. For this case, MODE_LG
would be 64 and AWIDTH = 6
(2 ** 6 = 64)?
Ok, how do I get a set of 6bit addresses out of the avalon_mm_bus_arbitrer
? In line 179 of the source code, maddr(AWIDTH-NHI - 1 downto 0)
is assigned to saddrlo
which is later assigned to S_ADDR
. So to get 6bit address, AWIDTH - NHI
has to be 6, so for AWIDTH = 24
(we want all addresses), NHI
needs to be 18.
With that I would conclude, I can have up to 18 (or 2 ** 18) slave instances with 1 master using all the available addresses. In total, up to 18 * 64 = 1152 (or 2 ** 18 * 64 = 16,777,216) registers can be used. Was this correct? Maybe the documentation could be extended to answer those questions a bit clearer. It took me half a day to dig through the code
Another question: if I want to trigger some action from the host PC, for example a write_enable which is one clock cycle high to write a previously transmitted data to a local LUT. How can I do that with the avalon_mm_slaves? Sure, I could check If a value of one address has changed and use that to generate the pulse. But this requires, that the user always writes a different value to the relevant address, which might not be the case… Is there a different way which I overlooked?
Sorry for the long post, but this avalon_master/slaves are still a bit confusing for me…
@costaf @bourrion do you read through this from time to time, or should I better just mention your names here so that a mail is send to you?