a 16-bit signed immediate value, these macros return a value ranging from –32768 to
32767. When used with an instruction that requires a 16-bit unsigned immediate
value, these macros return a value ranging from 0 to 65535.
Table 96.
Assembler Macros
Macro
Description
Operation
%lo(immed32)
Extract bits [15..0] of immed32
immed32 & 0xFFFF
%hi(immed32)
Extract bits [31..16] of immed32
(immed32 >> 16) & 0xFFFF
%hiadj(immed32)
Extract bits [31..16] and adds bit 15 of immed32
((immed32 >> 16) & 0xFFFF) +
((immed32 >> 15) & 0x1)
%gprel(immed32)
Replace the immed32 address with an offset from
the global pointer
immed32 –_gp
Refer to the Application Binary Interface chapter of the Nios II Processor Reference
Handbook for more information about global pointers.
Related Information
Application Binary Interface
on page 146
8.5. Instruction Set Reference
The following pages list all Nios II instruction mnemonics in alphabetical order.
Table 97.
Notation Conventions
Notation
Meaning
X ← Y
X is written with Y
PC ← X
The program counter (PC) is written with address X; the instruction at X is the next instruction to execute
PC
The address of the assembly instruction in question
rA, rB, rC
One of the 32-bit general-purpose registers
prs.rA
General-purpose register rA in the previous register set
IMMn
An n-bit immediate value, embedded in the instruction word
IMMED
An immediate value
X
n
The nth bit of X, where n = 0 is the LSB
X
n..m
Consecutive bits n through m of X
0xNNMM
Hexadecimal notation
X : Y
Bitwise concatenation
For example, (0x12 : 0x34) = 0x1234
σ(X)
The value of X after being sign-extended to a full register-sized signed integer
X >> n
The value X after being right-shifted n bit positions
X << n
The value X after being left-shifted n bit positions
X & Y
Bitwise logical AND
X | Y
Bitwise logical OR
X ^ Y
Bitwise logical XOR
continued...
8. Instruction Set Reference
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
173