Forum Discussion
Altera_Forum
Honored Contributor
21 years agoThis indeed is a bug in the Nios II/f core.
It has to do with clearing an ienable bit when its associated interrupt into the CPU is active. It has been fixed in our 1.1 release that will be available very soon. The effect of the bug is to cause a spurious interrupt. The CPU thinks an interrupt has occurred so it branches to the exception handler. Depending on your exception handler code, you get a different effect. If you are using the HAL with the unimplemented instruction emulation code enabled (the default), it will execute the equivalent of one of the multiply/divide instructions. Unfortunately, this looks to the programmer like one of the registers gets randomly trashed. The flushp is not required. If you need a workaround, I'd try putting a nop instruction after the wrctl if you are using the HAL. This way the multiply/divide emulation code will try to write r0 which is ignored. Of course, I'd recommend switching to Nios II 1.1 which completely fixes the problem.