Specifications
Table 3-46: Shift and Rotate Instructions
Instruction Description
rol
ror
roli
The rol and roli instructions provide left bit-rotation. roli uses an immediate value to
specify the number of bits to rotate. The ror instructions provides right bit-rotation.
There is no immediate version of ror, because roli can be used to implement the
equivalent operation.
sll
slli
sra
srl
srai
srli
These shift instructions implement the << and >> operators of the C programming
language. The sll, slli, srl, srli instructions provide left and right logical bit-shifting
operations, inserting zeros. The sra and srai instructions provide arithmetic right bit-
shifting, duplicating the sign bit in the most significant bit. slli, srli and srai use an
immediate value to specify the number of bits to shift.
Program Control Instructions
The Nios II architecture supports the unconditional jump, branch, and call instructions. These
instructions do not have delay slots.
Table 3-47: Unconditional Jump and Call Instructions
Instruction Description
call This instruction calls a subroutine using an immediate value as the subroutine's absolute
address, and stores the return address in register ra.
callr This instruction calls a subroutine at the absolute address contained in a register, and
stores the return address in register ra. This instruction serves the roll of dereferencing a
C function pointer.
ret The ret instruction is used to return from subroutines called by call or callr. ret
loads and executes the instruction specified by the address in register ra.
jmp The jmp instruction jumps to an absolute address contained in a register. jmp is used to
implement switch statements of the C programming language.
jmpi The jmpi instruction jumps to an absolute address using an immediate value to
determine the absolute address.
br This instruction branches relative to the current instruction. A signed immediate value
gives the offset of the next instruction to execute.
The conditional branch instructions compare register values directly, and branch if the expression is true.
The conditional branches support the following equality and relational comparisons of the C program‐
ming language:
• == and !=
• < and <= (signed and unsigned)
• > and >= (signed and unsigned)
The conditional branch instructions do not have delay slots.
NII51003
2015.04.02
Program Control Instructions
3-63
Programming Model
Altera Corporation
Send Feedback