Register Conventions

Although most of the registers in the Nios II architecture are designated as General Purpose Registers, there are some recommended uses of the registers for correct software operation with high-level languages or an operating system.

Table 1: Register Conventions

CPU
Register
Symbolic
Register
Usage
r0 zero Always 0 (note 1)
r1 at Assembler Temporary
r2 - r3
Function Return Values
r4 - r7
Function Arguments
r8 - r15
Temporary – Caller does not need to preserve contents
r16 - r23
Saved Temporary – Caller must preserve contents
r24 et Exception Temporary
r25 bt Break Temporary
r26 gp Global Pointer – Used for fast-access to common data
r27 sp Stack Pointer – Software stack
r28 fp Frame Pointer – procdedure frame on stack
r29 ea Exception Return Address
r30 er Break Return Address
r31 ra Return Address (note 1)

Note 1: Hardware enforced, not just convention


Maintained by John Loomis, last updated 9 September 2008