Forum Discussion
Altera_Forum
Honored Contributor
11 years agoavalon memory mapped slave
hi. just a quick backgrund for the task at hand. i have a nios II system that writes/reads to onchip-memory and a custom-vhdl block using IOWR/IORD. I can write/read data to/from the vhdl block from my c-code running on NIOS. I would like to create a ring-buffer(log) in the onchip memory(storing 500bytes) so i add it tot the buffer from my vhdl code. One byte per 5MHz clk, and read all of the log from my nios c-code.
I'm unsure what would be the proper way to do this? and what avalon interface to use. Any advice would be appreciated. /stefan3 Replies
- Altera_Forum
Honored Contributor
To do what you are asking, roughly, you add an Avalon-MM Master interface to your custom VHDL component. Connect it to the onchip-memory the same as you have connected the NIOS, and then tell your custom component the base address of the RAM it should write to.
Because you're using Avalon-MM Master, this solution is quite flexible. But, if you aren't interested in flexibility and are more interested in less labor, it is probably simpler to do something like embed a second dual-port ring buffer RAM inside your custom VHDL component and access it via your IOWR/IORD through your VHDL component. - Altera_Forum
Honored Contributor
Hi Ted thanks for the answer.
Just be sure i understand it correct, my custom vhdl block will be both an avalon slave (getting data from NIOS) and an avalon master (writing to onchip memory) ? /stefan - Altera_Forum
Honored Contributor
hi again.
got a avalon master and slave running in "my custom vhdl" the on-chip memory has base address 0x8000-0xFFFF, but how do i figure out where niosII is storing variables in the memory ? cant find a .map file (probably called something else). Anyway if i write to 0x8000 from vhdl code and read from 0x8000 in nios i dont get the correct data, so im thinking something else i writing to that addresse as well. thanks stefan