Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
819 Views

FPGA example to wirte data to SSRAM/SDRAM in Cyclone III starter kit?

I want to use VHDL/verilog to write some simple data to the SSRAM/ DDR SDRAM in Cyclone III starter kit, then use control plane to read the data out. 

 

Anyone has VHDL/verilog examples? just a simple write is O.k. I don't need read etc. 

 

Thank you very much!
0 Kudos
4 Replies
Altera_Forum
Honored Contributor I
70 Views

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 I
70 Views

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 I
70 Views

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
70 Views

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.
Reply