Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Ddr sdram

Altera_Forum
名誉コントリビューター II
2,384件の閲覧回数

Hi,  

 

Can someone tell me how to read and write data to specified memory address like 0x02000001 and so on. 

I'm programming with Eclipse and I declare an array like: 

unsigned char buff[256][512]; 

I wanna write data in this array and after that I want to take the values from memory, so I have to know memory range. 

 

Can anyone help me with this? 

 

Regards 

 

Kycas
0 件の賞賛
6 返答(返信)
Altera_Forum
名誉コントリビューター II
891件の閲覧回数

You can use pointers for that. You can assign an address to a pointer.

Altera_Forum
名誉コントリビューター II
891件の閲覧回数

Thank You for an answer 

 

Can you show an example how to do with pointers, I'm not very good at C and I dont know how to use these pointers :) 

 

Or maybe it will be Ok if I just use IOWR_8DIRECT() for example?
Altera_Forum
名誉コントリビューター II
891件の閲覧回数

Something like this should work:char *mypointer = 0x02000001; *mypointer = ...; 

You can also use the IORD/IOWR macros. The main difference between pointers and the IORD/WR macros is that a pointer access can use the data cache, while the IO macros will always bypass it.
Altera_Forum
名誉コントリビューター II
891件の閲覧回数

Great! 

 

One more thing, should I just put all array of data with one IOWR() function, or should I make a loop and write byte by byte to memory?
Altera_Forum
名誉コントリビューター II
891件の閲覧回数

It depends on your needs. Doing a 32-bit operation with a IOWR() or an (unsigned) int pointer will give you better performance than writing byte per byte.

Altera_Forum
名誉コントリビューター II
891件の閲覧回数

I think the same thing. I have char type data, so I'll use IOWR_8DIRECT() with a loop. 

 

Oh and one more thing, if I declare some variables with value for example: 

 

float c[3][3] = {{1,1,1}, 

{1,1,1}, 

{1,1,1}}; 

 

I think that this "c" will be put in SDRAM and if I write date with IOWR() function from the beginning of memory lets say. Won't the data that I want to write overlap the declared data "c"? 

 

Its kind of confusing with this to me...
返信