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

Memory for Nios II Software

I am using a 12K on chip memory for my Nios II system. In my software code, I am using an Integer array of length 500000. But I am wondering how it can be implemented on a 12k on chip memory?!!!. the project is built succesfully with no shortage of memory. Here is my code: 

# include "system.h" 

int main(void) 

 

 

volatile unsigned int * read_ptr = (unsigned int *) (READ_PORT_BASE + 1);  

volatile unsigned int * write_ptr = (unsigned int *) (WRITE_PORT_BASE + 1);  

unsigned int temp; 

int length = 500000; 

unsigned int buff[length]; 

 

while(1) 

buff[0] = (* read_ptr); 

for (int i = 1; i < length - 1; i++) 

temp = buff

buff = buff[i - 1]; 

buff[i + 1] = temp; 

 

 

 

temp = buff[0] + buff[length]; 

(* write_ptr) = temp; 

 

}
0 Kudos
1 Reply
Altera_Forum
Honored Contributor I
43 Views

That is a on-stack array - so space is only allocated at run time.

Reply