Forum Discussion
4 Replies
- Altera_Forum
Honored Contributor
Hi,
Are you sure that you want to use a hardware language to read and write to off-chip mem? I would use a simple c program in the nios environment. For starters, you could use the IOWR and IORD functions to write and read to/from memory. The address range for the memory is specified in sopc builder. Hope that helps. Andrew - Altera_Forum
Honored Contributor
Thank u, I am not sure, I am not familiar with how to use nios to read and wirte off-chip memory.
--- Quote Start --- Hi, Are you sure that you want to use a hardware language to read and write to off-chip mem? I would use a simple c program in the nios environment. For starters, you could use the IOWR and IORD functions to write and read to/from memory. The address range for the memory is specified in sopc builder. Hope that helps. Andrew --- Quote End --- - Altera_Forum
Honored Contributor
Here's an example of a function to test the off-chip mem. It won't completely test the memory, but I think it is sufficient for what you're doing. MEM_TEST_VAL is whatever you want it to be as long as it's not bigger than 32 bits. Have fun.
int ddr2_mem_test() { int i; int error_count; int readbyte; error_count = 0; // Write to the memory needed. for(i=0; i<(MEM_SPAN); i++) { IOWR_32DIRECT(DDR2_SDRAM_BASE, i, MEM_TEST_VAL); } // Read back and verify data. for(i=0; i<(MEM_SPAN); i++) { readbyte = IORD_32DIRECT(DDR2_SDRAM_BASE, i); if (readbyte != MEM_TEST_VAL) { error_count++; } } return error_count; } - Altera_Forum
Honored Contributor
I also want to read data from SSRAM using verilog, but can not succeed.
Does anyone can share this code to read /write data from/to SSRAM? thANKS. It will be greatly helpful. pleaseeeee share here or send to chrisfzhang@gmail.com if possible.