Instruction Set Nios II
Instruction Set Nios II
Instruction Set Nios II
2015.04.02
NII51017
Send Feedback
Subscribe
This section introduces the Nios II instruction word format and provides a detailed reference of the
Nios II instruction set.
Word Formats
There are three types of Nios II instruction word format: I-type, R-type, and J-type.
I-Type
The defining characteristic of the I-type instruction word format is that it contains an immediate value
embedded within the instruction word. I-type instructions words contain:
A 6-bit opcode field OP
Two 5-bit register fields A and B
A 16-bit immediate data field IMM16
In most cases, fields A and IMM16 specify the source operands, and field B specifies the destination
register. IMM16 is considered signed except for logical operations and unsigned comparisons.
I-type instructions include arithmetic and logical operations such as addi and andi; branch operations;
load and store operations; and cache management operations.
Table 1: I-Type Instruction Format
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
IMM16
18
17
16
IMM16
7
2
OP
R-Type
The defining characteristic of the R-type instruction word format is that all arguments and results are
specified as registers. R-type instructions contain:
A 6-bit opcode field OP
Three 5-bit register fields A, B, and C
An 11-bit opcode-extension field OPX
In most cases, fields A and B specify the source operands, and field C specifies the destination register.
2015 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make changes to any
products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ISO
9001:2008
Registered
NII51017
2015.04.02
J-Type
Some R-Type instructions embed a small immediate value in the five low-order bits of OPX. Unused bits
in OPX are always 0.
R-type instructions include arithmetic and logical operations such as add and nor; comparison operations
such as cmpeq and cmplt; the custom instruction; and other operations that need only register operands.
Table 2: R-Type Instruction Format
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
12
11
10
19
18
17
16
OPX
OPX
OP
J-Type
J-type instructions contain:
A 6-bit opcode field
A 26-bit immediate data field
J-type instructions, such as call and jmpi, transfer execution anywhere within a 256-MB range.
Table 3: J-Type Instruction Format
Bit Fields
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
IMM26
15
14
13
12
11
10
IMM26
OP
Instruction Opcodes
The OP field in the Nios II instruction word specifies the major class of an opcode as listed in the two
tables below. Most values of OP are encodings for I-type instructions. One encoding, OP = 0x00, is the Jtype instruction call. Another encoding, OP = 0x3a, is used for all R-type instructions, in which case, the
OPX field differentiates the instructions. All undefined encodings of OP and OPX are reserved.
Table 4: OP Encodings
OP
Instruction
OP
Instruction
0x20
Instruction
cmpeqi
OP
0x30
Instruction
0x00
call
0x10
0x01
jmpi
0x11
0x21
0x31
0x12
0x22
0x32
custom
0x02
cmplti
OP
cmpltui
0x03
ldbu
0x13
initda
0x23
ldbuio
0x33
initd
0x04
addi
0x14
ori
0x24
muli
0x34
orhi
Altera Corporation
NII51017
2015.04.02
Assembler Pseudo-Instructions
OP
Instruction
OP
Instruction
OP
Instruction
OP
Instruction
0x05
stb
0x15
stw
0x25
stbio
0x35
stwio
0x06
br
0x16
blt
0x26
beq
0x36
bltu
0x07
ldb
0x17
ldw
0x27
ldbio
0x37
ldwio
0x08
cmpgei
0x18
cmpnei
0x28
cmpgeui
0x38
rdprs
0x09
0x19
0x29
0x39
0x0A
0x1A
0x2A
0x3A
R-type
0x0B
ldhu
0x1B
flushda
0x2B
ldhuio
0x3B
flushd
0x0C
andi
0x1C
xori
0x2C
andhi
0x3C
xorhi
0x0D
sth
0x1D
0x2D
sthio
0x3D
0x0E
bge
0x1E
0x2E
bgeu
0x3E
0x0F
ldh
0x1F
0x2F
ldhio
0x3F
bne
Instruction
0x00
OPX
0x10
Instruction
cmplt
OPX
0x20
Instruction
cmpeq
OPX
Instruction
0x30
cmpltu
0x21
0x31
add
0x01
eret
0x11
0x02
roli
0x12
slli
0x22
0x32
0x03
rol
0x13
sll
0x23
0x33
0x04
flushp
0x14
wrprs
0x24
divu
0x34
0x05
ret
0x15
0x25
div
0x35
0x06
nor
0x16
or
0x26
rdctl
0x36
0x07
mulxuu
0x17
mulxsu
0x27
mul
0x37
0x08
cmpge
0x18
cmpne
0x28
cmpgeu
0x38
0x09
bret
0x19
0x29
initi
0x39
sub
0x0A
sync
0x1A
srli
0x2A
0x3A
srai
sra
0x0B
ror
0x1B
srl
0x2B
0x3B
0x0C
flushi
0x1C
nextpc
0x2C
0x3C
0x0D
jmp
0x1D
callr
0x2D
trap
0x3D
0x0E
and
0x1E
xor
0x2E
wrctl
0x3E
0x1F
mulxss
0x2F
0x0F
break
0x3F
Assembler Pseudo-Instructions
Pseudo-instructions are used in assembly source code like regular assembly instructions. Each pseudoinstruction is implemented at the machine level using an equivalent instruction. The movia pseudoInstruction Set Reference
Send Feedback
Altera Corporation
NII51017
2015.04.02
Assembler Macros
instruction is the only exception, being implemented with two instructions. Most pseudo-instructions do
not appear in disassembly views of machine code.
Table 6: Assembler Pseudo-Instructions
Pseudo-Instruction
Equivalent Instruction
mov rC, rA
nop
Refer to the Application Binary Interface chapter of the Nios II Processor Reference Handbook for more
information about global pointers.
Related Information
Assembler Macros
The Nios II assembler provides macros to extract halfwords from labels and from 32-bit immediate
values. These macros return 16-bit signed values or 16-bit unsigned values depending on where they are
used. When used with an instruction that requires 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.
Altera Corporation
NII51017
2015.04.02
Description
Operation
%lo(immed32)
%hi(immed32)
immed32 _gp
%hiadj(immed32)
%gprel(immed32)
Refer to the Application Binary Interface chapter of the Nios II Processor Reference Handbook for more
information about global pointers.
Related Information
Meaning
XY
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
rA, rB, rC
prs.rA
IMMn
IMMED
An immediate value
Xn
Xn..m
0xNNMM
Hexadecimal notation
X:Y
Bitwise concatenation
For example, (0x12 : 0x34) = 0x1234
(X)
X >> n
X << n
X&Y
Altera Corporation
NII51017
2015.04.02
add
Notation
Meaning
X|Y
Bitwise logical OR
X^Y
~X
Mem8[X]
Mem16[X]
Mem32[X]
label
(signed) rX
(unsigned) rX
Note: All register operations apply to the current register set, except as noted.
The following exceptions are not listed for each instruction because they can occur on any instruction
fetch:
Related Information
Programming Model
add
Instruction
add
Operation
rC rA + rB
Assembler Syntax
Example
Description
Altera Corporation
NII51017
2015.04.02
add
Usage
Exceptions
None
Instruction Type
Instruction Fields
Altera Corporation
NII51017
2015.04.02
addi
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x31
12
11
10
19
18
17
C
7
16
0x31
0x3A
addi
Instruction
addi
Operation
rB rA + (IMM16)
Assembler Syntax
Example
Description
Altera Corporation
NII51017
2015.04.02
addi
Usage
Exceptions
None
Instruction Type
Altera Corporation
10
NII51017
2015.04.02
and
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x04
and
Instruction
Operation
rC rA & rB
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x0e
12
11
10
19
18
17
C
7
16
0x0e
0x3A
andhi
Instruction
Operation
Altera Corporation
NII51017
2015.04.02
andi
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
11
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x2c
andi
Instruction
Operation
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
Altera Corporation
12
NII51017
2015.04.02
beq
Bit Fields
A
15
14
B
13
12
11
10
IMM16
IMM16
0x0c
beq
Instruction
branch if equal
Operation
if (rA == rB)
then PC PC + 4 + (IMM16)
else PC PC + 4
Assembler Syntax
Example
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
IMM16
10
18
17
16
IMM16
7
2
0x26
bge
Instruction
Altera Corporation
NII51017
2015.04.02
bgeu
Operation
13
Assembler Syntax
Example
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x0e
bgeu
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
14
NII51017
2015.04.02
bgt
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x2e
bgt
Instruction
Operation
Assembler Syntax
Example
Description
Pseudo-instruction
bgtu
Instruction
Altera Corporation
NII51017
2015.04.02
ble
Operation
15
Assembler Syntax
Example
Description
Pseudo-instruction
ble
Instruction
Operation
Assembler Syntax
Example
Description
Pseudo-instruction
bleu
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
16
NII51017
2015.04.02
blt
Description
Pseudo-instruction
blt
Instruction
Operation
Assembler Syntax
Example
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x16
bltu
Instruction
Altera Corporation
NII51017
2015.04.02
bne
Operation
17
Assembler Syntax
Example
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x36
bne
Instruction
Operation
if (rA != rB)
then PC PC + 4 + (IMM16)
else PC PC + 4
Assembler Syntax
Example
Altera Corporation
18
NII51017
2015.04.02
br
Description
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x1e
br
Instruction
unconditional branch
Operation
PC PC + 4 + (IMM16)
Assembler Syntax
br label
Example
br top_of_loop
Description
Exceptions
Instruction Type
Instruction Fields
Altera Corporation
NII51017
2015.04.02
break
19
Bit Fields
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
19
0
13
12
11
10
18
17
16
IMM16
IMM16
2
0x06
break
Instruction
debugging breakpoint
Operation
bstatus status
PIE 0
U 0
ba
PC + 4
break
break imm5
Example
Description
break
Usage
Break
Instruction Type
Instruction Fields
Altera Corporation
20
NII51017
2015.04.02
bret
Bit Fields
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
0
13
12
11
10
0x34
19
18
17
0x1e
IMM5
16
0x34
0x3a
bret
Instruction
breakpoint return
Operation
status bstatus
PC ba
Assembler Syntax
bret
Example
bret
Description
Usage
Exceptions
Instruction Type
Instruction Fields
None
Bit Fields
31
30
29
28
27
26
25
0x1e
15
14
13
0x09
24
23
22
21
20
0
12
11
10
19
18
17
0x1e
7
16
0x09
0x3a
call
Instruction
call subroutine
Operation
ra
PC + 4
PC (PC31..28 : IMM26 x 4)
Altera Corporation
NII51017
2015.04.02
callr
Assembler Syntax
call label
Example
call write_char
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
21
Bit Fields
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
IMM26
15
14
13
12
11
10
IMM26
callr
Instruction
Operation
ra
PC + 4
PC rA
Assembler Syntax
callr rA
Example
callr r6
Description
Usage
pointers.
Exceptions
Instruction Type
Altera Corporation
22
NII51017
2015.04.02
cmpeq
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
12
11
10
0x1d
19
18
17
0x1f
16
0x1d
0x3a
cmpeq
Instruction
compare equal
Operation
if (rA == rB)
then rC 1
else rC 0
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
23
22
21
20
B
13
0x20
Altera Corporation
24
12
11
10
8
0
19
18
17
C
7
16
0x20
0x3a
NII51017
2015.04.02
cmpeqi
23
cmpeqi
Instruction
Operation
if (rA (IMM16))
then rB 1
else rB 0
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x20
cmpge
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
24
NII51017
2015.04.02
cmpgei
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x08
12
11
10
19
18
17
16
0x08
0x3a
cmpgei
Instruction
Operation
Assembler Syntax
Example
Description
Usage
programming language.
Exceptions
None
Instruction Type
Altera Corporation
NII51017
2015.04.02
25
cmpgeu
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x08
cmpgeu
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
0x28
Send Feedback
23
22
21
20
B
13
24
12
11
10
8
0
19
18
17
C
7
16
0x28
0x3a
Altera Corporation
26
NII51017
2015.04.02
cmpgeui
cmpgeui
Instruction
Operation
Assembler Syntax
Example
Description
Usage
C programming language.
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x28
cmpgt
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
cmpgti
27
Description
Usage
Pseudo-instruction
cmpgti
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
cmpgtu
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
28
NII51017
2015.04.02
cmpgtui
Description
Usage
Pseudo-instruction
cmpgtui
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
cmple
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
cmplei
29
Description
Usage
Pseudo-instruction
cmplei
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
cmpleu
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
30
NII51017
2015.04.02
cmpleui
Description
Usage
Pseudo-instruction
cmpleui
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
cmplt
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
31
cmplti
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x10
12
11
10
19
18
17
16
0x10
0x3a
cmplti
Instruction
Operation
Assembler Syntax
Example
Description
Usage
programming language.
Exceptions
None
Instruction Type
Altera Corporation
32
NII51017
2015.04.02
cmpltu
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x10
cmpltu
Instruction
Operation
Assembler Syntax
Example
Description
Usage
programming language.
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
23
22
21
20
B
13
0x30
Altera Corporation
24
12
11
10
8
0
19
18
17
C
7
16
0x30
0x3a
NII51017
2015.04.02
cmpltui
33
cmpltui
Instruction
Operation
Assembler Syntax
Example
Description
Usage
C programming language.
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x30
cmpne
Instruction
Operation
if (rA != rB)
then rC 1
else rC 0
Assembler Syntax
Example
Altera Corporation
34
NII51017
2015.04.02
cmpnei
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x18
12
11
10
19
18
17
16
0x18
0x3a
cmpnei
Instruction
Operation
if (rA != (IMM16))
then rB 1
else rB 0
Assembler Syntax
Example
Description
Usage
programming language.
Exceptions
None
Instruction Type
Altera Corporation
NII51017
2015.04.02
custom
Instruction Fields
35
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x18
custom
Instruction
custom instruction
Operation
if c == 1
then rC fN(rA, rB, A, B, C)
else fN(rA, rB, A, B, C)
Assembler Syntax
Description
Usage
Exceptions
None
Altera Corporation
36
NII51017
2015.04.02
div
Instruction Type
Instruction Fields
otherwise
30
29
28
27
26
25
A
15
14
readrb
readrc
24
23
22
21
20
B
13
12
11
10
19
18
17
C
7
16
readra
0x32
div
Instruction
divide
Operation
rC rA rB
Assembler Syntax
Example
Description
Altera Corporation
NII51017
2015.04.02
37
divu
Usage
Remainder of Division:
If the result of the division is defined, then the
remainder can be computed in rD using the
following instruction sequence:
div rC, rA, rB
mul rD, rC, rB
sub rD, rA, rD
# The original div operation
# rD = remainder
Exceptions
Division error
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x25
12
11
10
19
18
17
C
7
16
0x18
0x3a
divu
Instruction
divide unsigned
Operation
rC rA rB
Assembler Syntax
Example
Description
Altera Corporation
38
NII51017
2015.04.02
eret
Usage
Remainder of Division:
If the result of the division is defined, then the
remainder can be computed in rD using the
following instruction sequence:
divu rC, rA, rB
mul rD, rC, rB
sub rD, rA, rD
# The original divu operation
# rD = remainder
Exceptions
Division error
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x24
12
11
10
19
18
17
C
7
16
0x24
0x3a
eret
Instruction
exception return
Operation
status estatus
PC ea
Assembler Syntax
eret
Example
eret
Description
Altera Corporation
NII51017
2015.04.02
39
flushd
Usage
Exceptions
Instruction Type
Instruction Fields
None
Bit Fields
31
30
29
28
27
26
25
0x1d
15
14
13
0x01
24
23
22
21
20
0x1e
12
11
10
19
18
17
C
7
16
0x01
0x3a
flushd
Instruction
Operation
Assembler Syntax
flushd IMM16(rA)
Example
flushd -100(r6)
Altera Corporation
40
NII51017
2015.04.02
flushd
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
Altera Corporation
NII51017
2015.04.02
flushda
41
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
0
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x3b
Related Information
flushda
Instruction
Operation
Assembler Syntax
flushda IMM16(rA)
Example
flushda -100(r6)
Altera Corporation
42
NII51017
2015.04.02
flushda
Description
Usage
Exceptions
Altera Corporation
NII51017
2015.04.02
flushi
Instruction Type
Instruction Fields
43
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
0
13
12
11
10
18
17
16
IMM16
IMM16
2
0x1b
Related Information
flushi
Instruction
Operation
Assembler Syntax
flushi rA
Example
flushi r6
Description
Exceptions
None
Instruction Type
Instruction Fields
Altera Corporation
44
NII51017
2015.04.02
flushp
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
12
11
10
0x0c
19
18
17
16
0x0c
0x3a
Related Information
flushp
Instruction
flush pipeline
Operation
Assembler Syntax
flushp
Example
flushp
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
None
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x04
12
11
10
19
18
17
0
7
16
0x04
0x3a
initd
Instruction
Operation
Altera Corporation
NII51017
2015.04.02
initd
Assembler Syntax
initd IMM16(rA)
Example
initd 0(r6)
Description
45
Usage
Exceptions
Supervisor-only instruction
Instruction Type
Altera Corporation
46
NII51017
2015.04.02
initda
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
0
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x33
Related Information
initda
Instruction
Operation
Assembler Syntax
initda IMM16(rA)
Example
initda -100(r6)
Altera Corporation
NII51017
2015.04.02
initda
Description
47
Usage
Exceptions
Altera Corporation
48
NII51017
2015.04.02
initi
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
0
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x13
Related Information
initi
Instruction
Operation
Assembler Syntax
initi rA
Example
initi r6
Description
Usage
Exceptions
Altera Corporation
Supervisor-only instruction
NII51017
2015.04.02
Instruction Type
Instruction Fields
jmp
49
17
16
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
12
11
10
0x29
19
18
0x29
2
0x3a
Related Information
jmp
Instruction
computed jump
Operation
PC rA
Assembler Syntax
jmp rA
Example
jmp r12
Description
Usage
Exceptions
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x0d
12
11
10
19
18
17
0
7
16
0x0d
0x3a
jmpi
Instruction
Instruction Set Reference
Send Feedback
jump immediate
Altera Corporation
50
NII51017
2015.04.02
ldb / ldbio
Operation
PC (PC31..28 : IMM26 x 4)
Assembler Syntax
jmpi label
Example
jmpi write_char
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
IMM26
15
14
13
12
11
10
IMM26
0x01
ldb / ldbio
Instruction
Operation
rB (Mem8[rA + (IMM16)])
Assembler Syntax
Example
Description
Altera Corporation
NII51017
2015.04.02
ldb / ldbio
Usage
51
Exceptions
Instruction Type
Instruction Fields
Table 9: ldb
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
17
16
IMM16
7
IMM16
2
0x07
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
IMM16
18
IMM16
2
0x27
Related Information
Altera Corporation
52
NII51017
2015.04.02
ldbu / ldbuio
ldbu / ldbuio
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Exceptions
Instruction Type
Instruction Fields
30
29
A
Altera Corporation
28
27
26
25
24
B
23
22
21
20
19
18
17
16
IMM16
NII51017
2015.04.02
ldh / ldhio
53
17
16
Bit Fields
15
14
13
12
11
10
IMM16
0x03
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x23
Related Information
ldh / ldhio
Instruction
Operation
rB (Mem16[rA + (IMM16)])
Assembler Syntax
Example
Description
Usage
Altera Corporation
54
NII51017
2015.04.02
ldhu / ldhuio
Exceptions
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
17
16
IMM16
7
IMM16
2
0x0f
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x2f
Related Information
ldhu / ldhuio
Instruction
Operation
Assembler Syntax
Altera Corporation
NII51017
2015.04.02
ldhu / ldhuio
Example
55
Description
Usage
Exceptions
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
Send Feedback
23
22
21
20
19
B
13
12
11
IMM16
24
10
18
17
16
IMM16
7
2
0x0b
Altera Corporation
56
NII51017
2015.04.02
ldw / ldwio
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x2b
Related Information
ldw / ldwio
Instruction
Operation
rB Mem32[rA + (IMM14)]
Assembler Syntax
Example
Description
Usage
Altera Corporation
NII51017
2015.04.02
mov
Exceptions
57
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
17
16
IMM16
7
IMM16
2
0x17
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x37
Related Information
mov
Instruction
Operation
rC rA
Assembler Syntax
mov rC, rA
Example
mov r6, r7
Altera Corporation
58
NII51017
2015.04.02
movhi
Description
Pseudo-instruction
movhi
Instruction
Operation
rB (IMMED : 0x0000)
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
movi
Instruction
Operation
rB (IMMED)
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
movia
Description
Usage
59
movia
Instruction
Operation
rB label
Assembler Syntax
Example
Description
Pseudo-instruction
movui
Instruction
Operation
rB (0x0000 : IMMED)
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
Altera Corporation
60
NII51017
2015.04.02
mul
mul
Instruction
multiply
Operation
Assembler Syntax
Example
Description
Altera Corporation
NII51017
2015.04.02
mul
Usage
61
Unimplemented instruction
Instruction Type
Instruction Fields
Altera Corporation
62
NII51017
2015.04.02
muli
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
12
11
10
0x27
19
18
17
16
0x27
0x3a
muli
Instruction
multiply immediate
Operation
Assembler Syntax
Example
Description
Exceptions
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
23
22
21
20
19
B
13
12
11
IMM16
Altera Corporation
24
10
18
17
16
IMM16
7
2
0x24
NII51017
2015.04.02
mulxss
63
mulxss
Instruction
Operation
Assembler Syntax
Example
Description
instruction exception.
Usage
Exceptions
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x1f
12
11
10
8
0
19
18
17
C
7
16
0x1f
0x3a
mulxsu
Instruction
Operation
Altera Corporation
64
NII51017
2015.04.02
mulxuu
Assembler Syntax
Example
Description
instruction exception.
Usage
Exceptions
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x17
12
11
10
19
18
17
C
7
16
0x17
0x3a
mulxuu
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
nextpc
Description
65
Usage
Exceptions
Unimplemented instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x07
12
11
10
19
18
17
C
7
16
0x07
0x3a
nextpc
Instruction
Operation
rC PC + 4
Altera Corporation
66
NII51017
2015.04.02
nop
Assembler Syntax
nextpc rC
Example
nextpc r6
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
0
13
0x1c
12
11
10
19
18
17
C
7
16
0x1c
0x3a
nop
Instruction
no operation
Operation
None
Assembler Syntax
nop
Example
nop
Description
Pseudo-instruction
nor
Instruction
Operation
rC ~(rA | rB)
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
67
or
Description
Exceptions
None
Instruction Type
Instruction Fields
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
A
0x06
0x3a
or
Instruction
bitwise logical or
Operation
rC rA | rB
Assembler Syntax
or rC, rA, rB
Example
or r6, r7, r8
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x16
12
11
10
8
0
19
18
17
C
7
16
0x16
0x3a
orhi
Instruction
Instruction Set Reference
Send Feedback
68
NII51017
2015.04.02
ori
Operation
rB rA | (IMM16 : 0x0000)
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x34
ori
Instruction
Operation
rB rA | (0x0000 : IMM16)
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
Altera Corporation
NII51017
2015.04.02
rdctl
69
Bit Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
IMM16
2
0x14
rdctl
Instruction
Operation
rC ctlN
Assembler Syntax
Example
Description
Exceptions
Supervisor-only instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
0
13
0x26
12
11
10
19
18
17
C
7
16
0x26
0x3a
rdprs
Instruction
Operation
rB prs.rA + (IMM16)
Assembler Syntax
Example
Altera Corporation
70
NII51017
2015.04.02
ret
Description
Usage
Exceptions
Supervisor-only instruction
Illegal instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x38
ret
Instruction
Operation
PC ra
Assembler Syntax
ret
Example
ret
Description
Usage
ret to return.
Altera Corporation
NII51017
2015.04.02
Exceptions
Instruction Type
Instruction Fields
None
rol
71
17
16
Bit Fields
31
30
29
28
27
26
25
0x1f
15
14
13
24
23
22
21
20
0
12
11
10
0x05
19
18
0x05
2
0x3a
rol
Instruction
rotate left
Operation
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x03
12
11
10
19
18
17
C
7
16
0x03
0x3a
roli
Instruction
Instruction Set Reference
Send Feedback
72
NII51017
2015.04.02
ror
Operation
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x02
12
11
10
19
18
17
C
7
IMM5
16
0x02
0x3a
ror
Instruction
rotate right
Operation
Assembler Syntax
Example
Description
Exceptions
None
Altera Corporation
NII51017
2015.04.02
Instruction Type
Instruction Fields
sll
73
17
16
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
12
11
10
0x0b
19
18
0x0b
2
0x3a
sll
Instruction
Operation
rC rA << (rB4..0)
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
0x13
Send Feedback
23
22
21
20
B
13
24
12
11
10
8
0
19
18
17
C
7
16
0x13
0x3a
Altera Corporation
74
NII51017
2015.04.02
slli
slli
Instruction
Operation
rC rA << IMM5
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x12
12
11
10
19
18
17
C
7
IMM5
16
0x12
0x3a
sra
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Altera Corporation
NII51017
2015.04.02
Exceptions
None
Instruction Type
Instruction Fields
srai
75
17
16
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
12
11
10
0x3b
19
18
0x3b
2
0x3a
srai
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
12
11
10
19
18
17
C
7
16
0x3a
Altera Corporation
76
NII51017
2015.04.02
srl
Bit Fields
0x3a
IMM5
0x3a
srl
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x1b
12
11
10
19
18
17
C
7
16
0x1b
0x3a
srli
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
77
stb / stbio l
Description
Usage
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x1a
12
11
10
19
18
17
C
7
IMM5
16
0x1a
0x3a
stb / stbio l
Instruction
Operation
Assembler Syntax
Example
Description
Usage
Altera Corporation
78
NII51017
2015.04.02
sth / sthio
Exceptions
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
17
16
IMM16
7
IMM16
2
0x05
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x25
sth / sthio
Instruction
Operation
Assembler Syntax
Example
Altera Corporation
NII51017
2015.04.02
sth / sthio
79
Description
Usage
Exceptions
Instruction Type
Instruction Fields
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
17
16
IMM16
7
IMM16
2
0x0d
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
Altera Corporation
80
NII51017
2015.04.02
stw / stwio
Bit Fields
IMM16
0x2d
stw / stwio
Instruction
Operation
Mem32[rA + (IMM16)] rB
Assembler Syntax
Example
Description
Usage
Exceptions
Instruction Type
Instruction Fields
Altera Corporation
NII51017
2015.04.02
sub
81
17
16
17
16
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x15
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
IMM16
IMM16
2
0x35
sub
Instruction
subtract
Operation
rC rA rB
Assembler Syntax
Example
Description
Altera Corporation
82
NII51017
2015.04.02
sub
Usage
Exceptions
None
Instruction Type
Altera Corporation
NII51017
2015.04.02
subi
Instruction Fields
83
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
0x39
12
11
10
19
18
17
C
7
16
0x39
0x3a
subi
Instruction
subtract immediate
Operation
rB rA (IMMED)
Assembler Syntax
Example
Description
Usage
Pseudo-instruction
sync
Instruction
memory synchronization
Operation
None
Assembler Syntax
sync
Example
sync
Description
Altera Corporation
84
NII51017
2015.04.02
trap
Exceptions
None
Instruction Type
Instruction Fields
None
Bit Fields
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
0
13
0x36
12
11
10
19
18
17
16
0x36
0x3a
trap
Instruction
trap
Operation
estatus status
PIE 0
U 0
ea
PC + 4
trap
trap imm5
Example
Description
trap
Usage
Exceptions
Trap
Instruction Type
Altera Corporation
NII51017
2015.04.02
wrctl
Instruction Fields
85
31
30
29
28
27
26
25
0
15
14
24
23
22
21
20
0
13
12
11
10
0x2d
19
18
17
0x1d
IMM5
16
0x2d
0x3a
wrctl
Instruction
Operation
ctlN rA
Assembler Syntax
wrctl ctlN, rA
Example
wrctl ctl6, r3
Description
Exceptions
Supervisor-only instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x2e
12
11
10
19
18
17
0
7
16
0x2e
0x3a
wrprs
Instruction
Operation
prs.rC rA
Assembler Syntax
wrprs rC, rA
Example
wrprs r6, r7
Altera Corporation
86
NII51017
2015.04.02
xor
Description
Usage
Exceptions
Supervisor-only instruction
Illegal instruction
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
0
13
0x14
12
11
10
19
18
17
C
7
16
0x14
0x3a
xor
Instruction
Operation
rC rA ^ rB
Assembler Syntax
Example
Description
Exceptions
None
Altera Corporation
NII51017
2015.04.02
xorhi
Instruction Type
Instruction Fields
87
30
29
28
27
26
25
A
15
14
24
23
22
21
20
B
13
12
11
10
0x1e
19
18
17
16
0x1e
0x3a
xorhi
Instruction
Operation
rB rA ^ (IMM16 : 0x0000)
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
IMM16
10
18
17
16
IMM16
7
2
0x3c
xori
Instruction
Instruction Set Reference
Send Feedback
88
NII51017
2015.04.02
Operation
rB rA ^ (0x0000 : IMM16)
Assembler Syntax
Example
Description
Exceptions
None
Instruction Type
Instruction Fields
31
30
29
28
27
26
25
A
15
14
24
23
22
21
20
19
B
13
12
11
10
18
17
16
IMM16
7
IMM16
2
0x1c
April 2015
Version
2015.04.02
Changes
Maintenance release.
February 2014
13.1.0
May 2011
11.0.0
Maintenance release.
December 2010
10.1.0
July 2010
10.0.0
November 2009
9.1.0
March 2009
9.0.0
November 2008
8.1.0
Maintenance release.
Altera Corporation
NII51017
2015.04.02
Date
Version
Changes
May 2008
8.0.0
Added MMU.
Added an Exceptions section to all instructions.
October 2007
7.2.0
May 2007
7.1.0
March 2007
7.0.0
Maintenance release.
November 2006
6.1.0
Maintenance release.
May 2006
6.0.0
Maintenance release.
October 2005
5.1.0
July 2005
5.0.1
May 2005
5.0.0
Maintenance release.
December 2004
1.2
September 2004
1.1
May 2004
1.0
Initial release.
89
Altera Corporation