Excalibur electronic A-MNL-NIOSPROG-01.1 用户手册

下载
页码 122
Altera Corporation
15
Getting
Overview
Ov
er
vi
e
w
1
Absolute-Jump Instructions
There are two absolute (computed) jump instructions: JMP and CALL. 
The jump-target address is given by the contents of a general-purpose 
register. The register contents are left-shifted by one and transferred into 
the PC. CALL is identical to JMP except that the return-address  is saved 
in %o7. Details of the return-address computation are provided in the 
description of the CALL instruction. Both JMP and CALL are 
unconditional. Conditional jumps are implemented by preceding JMP or 
CALL with a SKP-type instruction.
Both JMP and CALL instructions have branch delay slot behavior: The 
instruction immediately following a JMP or CALL is executed after JMP 
or CALL, but before the instruction at the jump-target. The LRET pseudo-
instruction, which is an assembler alias for JMP %o7, is conventionally 
used to return from subroutines.
Trap Instructions
The Nios processor implements two instructions for software exception 
processing: TRAP and TRET. See “TRAP” on page 102 and “TRET” on 
page 103 
for detailed descriptions of both these instructions. Unlike JMP 
and CALL, neither TRAP nor TRET has a branch delay-slot: The 
instruction immediately following TRAP is not executed until the 
exception-handler returns. The instruction immediately following TRET 
is not executed at all as part of TRET's operation.
Conditional Instructions
There are five conditional instructions (SKPs, SKP0, SKP1, SKPRz, and 
SKPRnz). Each of these instructions has a converse assembler-alias 
pseudo-instruction (IFs, IF0, IF1, IFRz, and IFRnz, respectively). Each of 
these instructions tests a CPU-internal condition and then executes the 
next instruction or not, depending on the outcome. The operation of all 
five SKP-type instructions (and their pseudo-instruction aliases), are 
identical except for the particular test performed. In each case, the 
subsequent (conditionalized) instruction is fetched from memory 
regardless of the test outcome. Depending on the outcome of the test, the 
subsequent instruction is either executed or cancelled. 
While SKP and IF type conditional instructions are often used to 
conditionalize jump (JMP, CALL) and branch (BR, BSR) instructions, they 
can be used to conditionalize any instruction. Conditionalized PFX 
instructions (PFX immediately after a SKPx or IFx instruction) present a 
special case; the next two instructions are either both cancelled or both 
executed. PFX instruction pairs are conditionalized as an atomic unit.