Hello veryone,im going to implement a arbitrary signal generator on my DE3 development board. I already managed to set up a simple function generetor in VHDL. In order to make it arbitrary i implemented a UART(RS232) communication with a Nios2 processor. The communication works so far (with MATLAB or Realterm), i can toggle my LED´s with the Data send via UART. Now i want to store the send data in a on chip memory. I set up a tightly coupled memory in my SOPC Builder but now im stuck with the programming in Nios. Is there anywhere a documentation which includes the operations that are neccessary to store data in the memory? And is it possible to read the stored data directly in with VHDL to implement a fast output? Thank you very much in advance!!!
Add on-chip memory as dual port. Make sure to clock each port separately Connect one port to your NIOS system. The other port will be used by your VHDL code.If your VHDL is independent of QSYS, export the other port of the on-chip memory, and re-generate the QSYS module. The QSYS declaration will now have the signals needed by the other port of on-chip memory. If your VHDL is implemented as a QSYS component, edit the definition to include an Avalon master port. Connect this port to the other port of the on-chip memory. In either case your VHDL code will need to follow the specifications to implement the Avalon master port to talk to the memory. Search for "Altera Avalon spec" for more information. It's similar to interfacing to wishbone or AXI.
Thank you for your answer.I understand that i have to export the 2nd Port of the onchip memory. My first problem is: I dont know how to store data with nios in the on chip memory. Is there anywhere a documentation what commands can be used in nios. For example i cant even find a documentation for the IOWR command used for toggling LED´s or something. Can u tell me how i can store a value in the on chip memory (in nios) and to read it (in nios) again?
With NIOS, you do an ordinary write with a pointer. Something like:
uint32_t *on_chip_address = // address you want to use *on_chip_address = 42; // for example
This should be a valuable reference - Altera's memory test example:https://www.altera.com/support/support-resources/design-examples/intellectual-property/embedded/exm-... It helped me when I had the same questions. As far as what you use to write directly to memory (ocram, sdram, ddr, etc), the function "IOWR_32DIRECT" is what you need to use. Explore the memtest example code and it will be much more clear. Also, don't forget "system.h" in the BSP so that you know the# define base addresses of the memories. Do remember, if you are writing to the same RAM as NIOS, you can have issues. To keep things simple at first, ensure you setup your BSP so that NIOS isn't executing in the same memory that you are directly writing to. Altera has a similar warning in their demo. Hope that helps. If anyone sees any errors please add your 2 cents!