Forum Discussion
Altera_Forum
Honored Contributor
12 years agoNewbie memory question
Hi, I got a Terasic DE0-nano board with a Cyclone IV FPGA. My design is writing data in the memory. I use a NIOS II softcore too and I'd like it to read the FPGA memory and the data I wrote in a h...
Altera_Forum
Honored Contributor
12 years agoI'm in Brazil, that's GMT-3 so I guess we're four hours apart...
You can access that memory in software using pointers. In your BSP you should have a system.h where the memory address is defined, like # define MEMORYNAME_BASE 0x08000000 Then in your code you can: unsigned char *pmem = (unsigned char *)MEMORYNAME_BASE; You can cast your memory address to whatever pointer type you need. Be aware that access to this memory will be cached, so there's a risk that you're reading old data because it's on processor data cache (if your Nios is configured with data cache). In order to avoid caching you can set the first address bit. Nios has 32bit address space but it can address only 2GB, because the first address bit is used to bypass data cache. To make uncached memory access you can: unsigned char *pmem = (unsigned char *)(0x80000000 | MEMORYNAME_BASE);