Forum Discussion
Altera_Forum
Honored Contributor
21 years agoThe Nios jmp instruction does not expect the register to hold the address to jump to, but rather the address divided by 2 (they are always even and this was probably done to give a larger addressable range for the 16 bit version of Nios).
As a result, the raw bit pattern for function pointers and return addresses on the Nios is the address divided by 2, not the actual address. If you want to display a function pointer as an int, you need to cast it and then double it. Data pointers are just raw addresses and can be casted to ints (or more strictly, unsigned ints) in the expected way. Does this explain what you're seeing?