Nios® II Processor Reference Guide

ID 683836
Date 8/28/2023
Public
Document Table of Contents

3.9.6. Program Control Instructions

The Nios II architecture supports the unconditional jump, branch, and call instructions. These instructions do not have delay slots.
Table 50.  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 programming language:

  • == and !=
  • < and <= (signed and unsigned)
  • > and >= (signed and unsigned)

The conditional branch instructions do not have delay slots.

Table 51.  Conditional Branch Instructions
Instruction Description
bge
bgeu
bgt
bgtu
ble
bleu
blt
bltu
beq
bne
These instructions provide relative branches that compare two register values and branch if the expression is true. Refer to the "Comparison Instructions" section of this chapter for a description of the relational operations implemented.