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

SRAM Addressing in QSYS

Hello I'm using a DE2-115 board with 2 MB SRAM (Address width 20. Data width 16). 

 

I used Qsys "Generic tri state controller" to attach the memory to the NIOS processor. 

 

Problem: How to access the entire 2MB RAM from c code ? Qsys give to the sram only a 20 bit address on its data bus (instead a 21 bit) so in C code I can access only the first MB. 

 

The following example generates errors:  

sram_mem= (void*)SSRAM_BASE; 

memset(sram_mem,0,2097152); 

 

 

Thanks  

Tiziano
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
56 Views

finally I foud the answare my self: 

 

set address width to 21 in generic tri state controller and detach the less significant bit (bit 0) from the sram addr bus.
Altera_Forum
Honored Contributor I
56 Views

 

--- Quote Start ---  

finally I foud the answare my self: 

 

set address width to 21 in generic tri state controller and detach the less significant bit (bit 0) from the sram addr bus. 

--- Quote End ---  

 

 

address width in generic tri state controller is the byte address arrange of SRAM, not the address bus width. Typically, SRAM has two bits byte-enable input, that's to say, the address bus width + log2(byte-enable width) is the address width of byte. 

Therefore, do not connect MLB of the address from generic tri state controller to any wire, let it free.
Altera_Forum
Honored Contributor I
56 Views

Hey on your SRAM what did you do with the SRAM_UB_N and SRAM_LB_N pins? Also, did you have to modify any of the values in the module assignments section? For example memory size, memory units (which I don't understand what a memory unit is) etc...?

Reply