Forum Discussion
Altera_Forum
Honored Contributor
15 years agoFull On-Chip Memory
Hi, I'd like to know how to determine if the memory space of an on-chip memory is full. In my nios II system, I generated an on-chip M4K memory. It's size is 4096 bytes with a 32 bits data...
Altera_Forum
Honored Contributor
15 years agoYou mean if you do this:
IOWR_32DIRECT(mem_1,0x0,(int)"THIS IS TO TEST HOW MUCH DATA CAN A MEMORY SPACE CONTAIN"); ? It will try to store all that data in 4 bytes, which won't fit, so it will truncate the data as far as I know. Let me try :). First clearing the memory to all 0x00 : memset((void*)memory_base,0x00, memory_size) and then using the following functions: IOWR_32DIRECT(ALTMEMDDR_1_BASE,0x0,(int)"THIS IS TO TEST HOW MUCH DATA CAN A MEMORY SPACE CONTAIN"); int i; for (i=0x0;i<0x20;i+=4) { printf("Address 0x%X: %x\n",(i+ALTMEMDDR_1_BASE),IORD_32DIRECT(ALTMEMDDR_1_BASE,i)); } Gives (0xC being my ALTMEMDDR_1_BASE): Address 0xC000000: 8030210 Address 0xC000004: 0 Address 0xC000008: 0 Address 0xC00000C: 0 Address 0xC000010: 0 Address 0xC000014: 0 Address 0xC000018: 0 Address 0xC00001C: 0 Hmm it's not even possible to store a string with this code or by using IOWR(ALTMEMDDR_1_BASE,0x0,(int)"IN") . But as you can see it will only store data in the first word.