Forum Discussion
Altera_Forum
Honored Contributor
14 years agoThere are two things about this code example. First if you declare the memory_location as a volatile variable, I believe the compiler will not try to optimise this and force to read back the value after having read it (can a gcc guru confirm this?).
Second on a hardware point of view, if the CPU has a data cache, when executing this code it will most probably read back this value from its cache rather than an external memory, meaning that this won't actually check the external memory. You'll have to declare this memory area as uncached. I'm just saying this to show you that you need to know the exact reasons why you would need those requirements, before finding out how to implement them. But you will learn about the compiler and the Nios II environment in the process ;)