Altera_Forum
Honored Contributor
9 years agounderstanding avalon slave <-> master transfers
Hello,
I am trying to understand how avalon slave <-> master read and writes are working, I have seen the master and slave templates and several manuals and sheets and posts about that but I am not sure if I have understood it correctly. What I am trying to accomplish is a component which will be connected between the Nios(e) instuction master and the altera sdram controller with internal memory like a cache. For that I figured out I need a avalon slave to connect the instruction master to and a avalon master to connect to the altera sdram controller. I am also not quite sure which signals of the interfaces I really need. On the avalon slave, does the nios instruction master ever write data or does it only read it? As from my view instruction memory should be readonly but on the other hand the instructions somehow need to get into there (via the datamaster???). I figured the data width of that interface should be 32 bits as the nios instructions are also 32 bits? The address width should be the same as sdram size in bytes / 32 bits data width. So my assumption is when the instruction master wants to read an instruction it would set the address and assert the read signal on my avalon slave. The address is already cleaned from baseaddress, in the range of the sdram size, at this point ??? The avalon slave than needs to check the internal memory(cache) if valid data is there and would return it, if not it needs to read a cache block, multiple bytes, from the sdram controller, strore that internally and return the correct output. On a cache hit, I have a fixed amount of clock cycles it will take me to return the data, on a miss this will be variable depending on how long it takes the sdram controller to read and return the data. So what I would do is as soon as I see the read signal asserted, I would assert the waitrequest signal because at that point I can not know how long it will take to return valid data. As soon as I have the valid data, I would than deassert waitrequest and will "wait" until the instruction master has deasserted my slaves read signal, indicating to me that on the next clock cycle a new read could occur. Can somebody please verify if my assumptions are correct so far? Thanks in advance Grobi