OpenCores
Issue List
or1ksim NPC behaviour #48
Closed ocghost opened this issue about 15 years ago
ocghost commented about 15 years ago

The NPC in the RTL model of the OR1k isn't readable immediately after a write to it.

Further things to note: A write to either the NPC or PPC (SPR group 0, registers 16 and 18, respectively) affects just a single PC register in the RTL implementation. Put simply, this register is then used as the address for the instruction fetch stage of the pipeline (fetch, decode, execute, memory access, write back).

The PPC (as read by the debug unit) is the write back PC. The NPC (as read by the debug unit) is either the execute stage PC or, in the event that the execute stage's result is void (for instance during a jump or branch), it is the value of the decode stage PC.

This being the case, both the values of the PPC and NPC as read by the debug unit are, in a sense, artificial. This should be taken into account when relying upon them to make decisions in any debug client.

jeremybennett commented about 15 years ago

Documented as an issue for Or1ksim 0.3.0rc3. Will be fixed in a subsquent release.

jeremybennett commented about 15 years ago

Fixed as an option in Or1ksim 0.3.0rc3. The --strict-npc flag will enforce this behavior. Not made the default, since this now breaks current implementations of GDB, which assume NPC can be read back any time.<br> <br> This will become default behavior in a future release.

jeremybennett was assigned about 15 years ago
jeremybennett closed this about 15 years ago

Assignee
jeremybennett
Labels
Bug