Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHow to access the Program Counter of Nios II
Hey everybody. I'm a fairly new user using this board, however I come here to search for topics that can help solve my problems. Lately I have been successful finding these troubleshooting topi...
Altera_Forum
Honored Contributor
20 years agoNios II provides the NEXTPC instruction that returns the PC of that instruction plus four.
There doesn't appear to be a HAL macro available for using this instruction from C code. However, it is relatively easy to make one yourself. Just look at the examples in the HAL nios2.h file. It is located in your Nios II kit directory under components/altera_nios2/HAL/inc.