Forum Discussion
Altera_Forum
Honored Contributor
19 years agoNios behaving erratically?
I was wondering if anyone has encountered this strange problem... I have a scenario where I have a working code build for my particular product. however, when I add some simple code, it breaks other ...
Altera_Forum
Honored Contributor
19 years ago"No pointers. Instead of pointers, I use simple loops and integer indexes in loops to fill arrays. IIRC, reading the manuals said that "volatile" only affects cached processors, which I am not."
Actually that's from Nios classic. Back then volatile meant no optimization and cache bypassing. With Nios II volatile simply means no optimization (that's the defined behavior from the C standard). To talk to your FIFOs do something like this: # include "io.h" // for IORD and IOWR# include "system.h" // so that you have the FIFO base addresses# include "stdio.h" // printf int main(void) { int i; for(i = 0; i < 1024; i++) { IOWR(MY_WRITE_FIFO_BASE_ADDRESS, 0, i); // stuff 0->1023 into the FIFO printf("Data back is %d\n", IORD(MY_READ_FIFO_BASE_ADDRESS, 0); // read back what you stuffed into the FIFO } return 1; } Assuming I didn't miss anything and that compiles http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif that should give you cache bypassing reads and write to a FIFO component that has the write and read ports mapped to the system interconnect fabric.