Fork me on GitHub

Specification info

link

R4300i

download

Description:

MIPS processor of the Nintendo 64. The R4300i is a 64-bit processor. It supports the MIPS III ISA introduction set.

CPU clock speed:

93.75 MHz

Address bus:

32-Bit

CPU caches:

Name Size Comment
L124 KBDivided into 16 KB for instructions and 8 KB for data.

Document version:

1.0.0

Sources:

Glossary

link

Glossary

Name Description
rs5-bit source register specifier
rt5-bit target (source/destination) register or branch condition
rd5-bit destination register specifier
sa5-bit shift amount
fs5-bit floating point source register specifier
ft5-bit floating point target (source/destination) register or branch condition
fd5-bit floating point destination register specifier
base5-bit value
imm16 bit immediate value
offset16 bit branch displacement or address displacement
target26 bit jump target address

Registers

link

Main-Processor

Name Value Size (Bits)
r0/reg00x0064
at/reg10x0164
v0/reg20x0264
v1/reg30x0364
a0/reg40x0464
a1/reg50x0564
a2/reg60x0664
a3/reg70x0764
t0/reg80x0864
t1/reg90x0964
t2/reg100x0A64
t3/reg110x0B64
t4/reg120x0C64
t5/reg130x0D64
t6/reg140x0E64
t7/reg150x0F64
s0/reg160x1064
s1/reg170x1164
s2/reg180x1264
s3/reg190x1364
s4/reg200x1464
s5/reg210x1564
s6/reg220x1664
s7/reg230x1764
t8/reg240x1864
t9/reg250x1964
k0/reg260x1A64
k1/reg270x1B64
gp/reg280x1C64
sp/reg290x1D64
s8/reg300x1E64
ra/reg310x1F64
link

COP0-Processor

Name Value Size (Bits)
Index0x0064
Random0x0164
EntryLo00x0264
EntryLo10x0364
Context0x0464
PageMask0x0564
Wired0x0664
*RESERVED*0x0764
BadVAddr0x0864
Count0x0964
EntryHi0x0A64
Compare0x0B64
Status0x0C64
Cause0x0D64
EPC0x0E64
PRevID0x0F64
Config0x1064
LLAddr0x1164
WatchLo0x1264
WatchHi0x1364
XContext0x1464
*RESERVED*0x1564
*RESERVED*0x1664
*RESERVED*0x1764
*RESERVED*0x1864
*RESERVED*0x1964
PErr0x1A64
CacheErr0x1B64
TagLo0x1C64
TagHi0x1D64
ErrorEPC0x1E64
*RESERVED*0x1F64

Load and Store Instructions

link

LB

Opcode:

32

Format:

LB rt, offset(base)

Purpose:

To load a byte from memory as a signed value.

Implementation:

rt = byte[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LBU

Opcode:

36

Format:

LBU rt, offset(base)

Purpose:

To load a byte from memory as an unsigned value.

Implementation:

rt = byte[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LD

Opcode:

55

Format:

LD rt, offset(base)

Purpose:

To load a doubleword from memory.

Implementation:

rt = doubleword[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LDL

Opcode:

26

Format:

LDL rt, offset(base)

Purpose:

To load the most-significant part of a doubleword from an unaligned memory address.

Implementation:

left(rt) = right[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LDR

Opcode:

27

Format:

LDR rt, offset(base)

Purpose:

To load the least-significant part of a doubleword from an unaligned memory address.

Implementation:

right(rt) = left[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LH

Opcode:

33

Format:

LH rt, offset(base)

Purpose:

To load a halfword from memory as a signed value.

Implementation:

rt = halfword[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LHU

Opcode:

37

Format:

LHU rt, offset(base)

Purpose:

To load a halfword from memory as an unsigned value.

Implementation:

rt = halfword[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LL

Opcode:

48

Format:

LL rt, offset(base)

Purpose:

To load a word from memory for an atomic read-modify-write.

Implementation:

Nothing or missing documentation

How to decode:

opcode base rt offset
6 5 5 16
link

LLD

Opcode:

52

Format:

LLD rt, offset(base)

Purpose:

To load a doubleword from memory for an atomic read-modify-write.

Implementation:

Nothing or missing documentation

How to decode:

opcode base rt offset
6 5 5 16
link

LW

Opcode:

35

Format:

LW rt, offset(base)

Purpose:

To load a word from memory as a signed value.

Implementation:

rt = word[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LWL

Opcode:

34

Format:

LWL rt, offset(base)

Purpose:

To load the most-significant part of a word as a signed value from an unaligned memory address.

Implementation:

left(rt) = right[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LWR

Opcode:

38

Format:

LWR rt, offset(base)

Purpose:

To load the least-significant part of a word from an unaligned memory address as a signed value.

Implementation:

right(rt) = left[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

LWU

Opcode:

39

Format:

LWU rt, offset(base)

Purpose:

To load a word from memory as an unsigned value.

Implementation:

rt = word[base+offset]

How to decode:

opcode base rt offset
6 5 5 16
link

SB

Opcode:

40

Format:

SB rt, offset(base)

Purpose:

To store a byte to memory.

Implementation:

byte[base+offset] = rt

How to decode:

opcode base rt offset
6 5 5 16
link

SC

Opcode:

56

Format:

SC rt, offset(base)

Purpose:

To store a word to memory to complete an atomic read-modify-write.

Implementation:

Nothing or missing documentation

How to decode:

opcode base rt offset
6 5 5 16
link

SCD

Opcode:

60

Format:

SCD rt, offset(base)

Purpose:

To store a doubleword to memory to complete an atomic

Implementation:

Nothing or missing documentation

How to decode:

opcode base rt offset
6 5 5 16
link

SD

Opcode:

63

Format:

SD rt, offset(base)

Purpose:

To store a doubleword to memory.

Implementation:

doulbeword[base+offset] = rt

How to decode:

opcode base rt offset
6 5 5 16
link

SDL

Opcode:

44

Format:

SDL rt, offset(base)

Purpose:

To store the most-significant part of a doubleword to an unaligned memory address.

Implementation:

right[base+offset] = left(rt)

How to decode:

opcode base rt offset
6 5 5 16
link

SDR

Opcode:

45

Format:

SDR rt, offset(base)

Purpose:

To store the least-significant part of a doubleword to an unaligned memory address.

Implementation:

left[base+offset] = right(rt)

How to decode:

opcode base rt offset
6 5 5 16
link

SH

Opcode:

41

Format:

SH rt, offset(base)

Purpose:

To store a halfword to memory.

Implementation:

halfword[base+offset] = rt

How to decode:

opcode base rt offset
6 5 5 16
link

SW

Opcode:

43

Format:

SW rt, offset(base)

Purpose:

To store a word to memory.

Implementation:

word[base+offset] = rt

How to decode:

opcode base rt offset
6 5 5 16
link

SWL

Opcode:

42

Format:

SWL rt, offset(base)

Purpose:

To store the most-significant part of a word to an unaligned memory address.

Implementation:

right[base+offset] = left(rt)

How to decode:

opcode base rt offset
6 5 5 16
link

SWR

Opcode:

46

Format:

SWR rt, offset(base)

Purpose:

To store the least-significant part of a word to an unaligned memory address.

Implementation:

left[base+offset] = right(rt)

How to decode:

opcode base rt offset
6 5 5 16
link

SYNC

Opcode:

0

Format:

SYNC (stype = 0 implied)

Purpose:

To order loads and stores to shared memory in a

Implementation:

Nothing or missing documentation

How to decode:

opcode 0000 0000 0000 000 stype 001111 (15)
6 15 5 6

Atithmetic Instructions

link

ADD

Opcode:

0

Format:

ADD rd, rs, rt

Purpose:

To add 32-bit integers. If overflow occurs, then trap. Comment: ADD rd, r0, rs is equal to a MOVE rd, rs

Implementation:

rd = rs + rt

How to decode:

opcode rs rt rd 00000 100000 (32)
6 5 5 5 5 6
link

ADDI

Opcode:

8

Format:

ADDI rt, rs, immediate

Purpose:

To add a constant to a 32-bit integer. If overflow occurs, then trap.

Implementation:

rt = rs + immediate

How to decode:

opcode rs rt immediate
6 5 5 16
link

ADDIU

Opcode:

9

Format:

ADDIU rt, rs, immediate

Purpose:

To add a constant to a 32-bit integer.

Implementation:

rt = rs + immediate

How to decode:

opcode rs rt immediate
6 5 5 16
link

ADDU

Opcode:

0

Format:

ADDU rd, rs, rt

Purpose:

To add 32-bit integers.

Implementation:

rd = rs + rt

How to decode:

opcode rs rt rd 00000 100001 (33)
6 5 5 5 5 6
link

AND

Opcode:

0

Format:

AND rd, rs, rt

Purpose:

To do a bitwise logical AND.

Implementation:

rd = (rs AND rt)

How to decode:

opcode rs rt rd 00000 100100 (36)
6 5 5 5 5 6
link

ANDI

Opcode:

12

Format:

ANDI rt, rs, immediate

Purpose:

To do a bitwise logical AND with a constant.

Implementation:

rt = (rs AND immediate)

How to decode:

opcode rs rt immediate
6 5 5 16
link

DADD

Opcode:

0

Format:

DADD rd, rs, rt

Purpose:

To add 64-bit integers. If overflow occurs, then trap.

Implementation:

rd = rs + rt

How to decode:

opcode rs rt rd 00000 101100 (44)
6 5 5 5 5 6
link

DADDI

Opcode:

24

Format:

DADDI rt, rs, immediate

Purpose:

To add a constant to a 64-bit integer. If overflow occurs, then trap.

Implementation:

rt = rs + immediate

How to decode:

opcode rs rt immediate
6 5 5 16
link

DADDIU

Opcode:

25

Format:

DADDIU rt, rs, immediate

Purpose:

To add a constant to a 64-bit integer.

Implementation:

rt = rs + immediate

How to decode:

opcode rs rt immediate
6 5 5 16
link

DADDU

Opcode:

0

Format:

DADDU rd, rs, rt

Purpose:

To add 64-bit integers.

Implementation:

rd = rs + rt

How to decode:

opcode rs rt rd 00000 101101 (45)
6 5 5 5 5 6
link

DDIV

Opcode:

0

Format:

DDIV rs, rt

Purpose:

To divide 64-bit signed integers.

Implementation:

LO = rs / rt; HI = rs MOD rt

How to decode:

opcode rs rt 0000 0000 00 011110 (30)
6 5 5 10 6
link

DDIVU

Opcode:

0

Format:

DDIVU rs, rt

Purpose:

To divide 64-bit unsigned integers.

Implementation:

LO = rs / rt; HI = rs MOD rt

How to decode:

opcode rs rt 0000 0000 00 011111 (31)
6 5 5 10 6
link

DIV

Opcode:

0

Format:

DIV rs, rt

Purpose:

To divide 32-bit signed integers.

Implementation:

LO = rs / rt; HI = rs MOD rt

How to decode:

opcode rs rt 0000 0000 00 011010 (26)
6 5 5 10 6
link

DIVU

Opcode:

0

Format:

DIVU rs, rt

Purpose:

To divide 32-bit unsigned integers.

Implementation:

LO = rs / rt; HI = rs MOD rt

How to decode:

opcode rs rt 0000 0000 00 011011 (27)
6 5 5 10 6
link

DMULT

Opcode:

0

Format:

DMULT rs, rt

Purpose:

To multiply 64-bit signed integers.

Implementation:

LO = low(rs*rt); HI = high(rs*rt)

How to decode:

opcode rs rt 0000 0000 00 011100 (28)
6 5 5 10 6
link

DMULTU

Opcode:

0

Format:

DMULTU rs, rt

Purpose:

To multiply 64-bit unsigned integers.

Implementation:

LO = low(rs*rt); HI = high(rs*rt)

How to decode:

opcode rs rt 0000 0000 00 011101 (29)
6 5 5 10 6
link

DSLL

Opcode:

0

Format:

DSLL rd, rt, sa

Purpose:

To left shift a doubleword by a fixed amount -- 0 to 31 bits.

Implementation:

rd = rt << sa

How to decode:

opcode 00000 rt rd sa 111000 (56)
6 5 5 5 5 6
link

DSLL32

Opcode:

0

Format:

DSLL32 rd, rt, sa

Purpose:

To left shift a doubleword by a fixed amount -- 32 to 63 bits.

Implementation:

rd = rt << (sa+32)

How to decode:

opcode 00000 rt rd sa 111100 (60)
6 5 5 5 5 6
link

DSLLV

Opcode:

0

Format:

DSLLV rd, rt, rs

Purpose:

To left shift a doubleword by a variable number of bits.

Implementation:

rd = rt << rs

How to decode:

opcode rs rt rd 00000 010100 (20)
6 5 5 5 5 6
link

DSRA

Opcode:

0

Format:

DSRA rd, rt, sa

Purpose:

To arithmetic right shift a doubleword by a fixed amount -- 0 to 31 bits.

Implementation:

rd = rt >> sa

How to decode:

opcode 00000 rt rd sa 111011 (59)
6 5 5 5 5 6
link

DSRA32

Opcode:

0

Format:

DSRA32 rd, rt, sa

Purpose:

To arithmetic right shift a doubleword by a fixed amount -- 32-63 bits.

Implementation:

rd = rt >> (sa+32)

How to decode:

opcode 00000 rt rd sa 111111 (63)
6 5 5 5 5 6
link

DSRAV

Opcode:

0

Format:

DSRAV rd, rt, rs

Purpose:

To arithmetic right shift a doubleword by a variable number of bits.

Implementation:

rd = rt >> rs

How to decode:

opcode 00000 rt rd rs 010111 (23)
6 5 5 5 5 6
link

DSRL

Opcode:

0

Format:

DSRL rd, rt, sa

Purpose:

To logical right shift a doubleword by a fixed amount -- 0 to 31 bits.

Implementation:

rd = rt >> sa

How to decode:

opcode 00000 rt rd sa 111010 (58)
6 5 5 5 5 6
link

DSRL32

Opcode:

0

Format:

DSRL32 rd, rt, sa

Purpose:

To logical right shift a doubleword by a fixed amount -- 32 to 63 bits.

Implementation:

rd = rt >> (sa+32)

How to decode:

opcode 00000 rt rd sa 111110 (62)
6 5 5 5 5 6
link

DSRLV

Opcode:

0

Format:

DSRLV rd, rt, rs

Purpose:

To logical right shift a doubleword by a variable number of bits.

Implementation:

rd = rt >> rs

How to decode:

opcode 00000 rt rd rs 010110 (22)
6 5 5 5 5 6
link

DSUB

Opcode:

0

Format:

DSUB rd, rs, rt

Purpose:

To subtract 64-bit integers; trap if overflow.

Implementation:

rd = rs - rt

How to decode:

opcode rs rt rd 00000 101110 (46)
6 5 5 5 5 6
link

DSUBU

Opcode:

0

Format:

DSUBU rd, rs, rt

Purpose:

To subtract 64-bit integers.

Implementation:

rd = rs - rt

How to decode:

opcode rs rt rd 00000 101111 (47)
6 5 5 5 5 6
link

LUI

Opcode:

15

Format:

LUI rt, immediate

Purpose:

To load a constant into the upper half of a word.

Implementation:

rt = immediate * 10000h

How to decode:

opcode 00000 rt immediate
6 5 5 16
link

MFHI

Opcode:

0

Format:

MFHI rd

Purpose:

To copy the special purpose HI register to a GPR.

Implementation:

rd = HI

How to decode:

opcode 0000 0000 00 rd 00000 010000 (16)
6 10 5 5 6
link

MFLO

Opcode:

0

Format:

MFLO rd

Purpose:

To copy the special purpose LO register to a GPR.

Implementation:

rd = LO

How to decode:

opcode 0000 0000 00 rd 00000 010010 (18)
6 10 5 5 6
link

MTHI

Opcode:

0

Format:

MTHI rs

Purpose:

To copy a GPR to the special purpose HI register.

Implementation:

Nothing or missing documentation

How to decode:

opcode rs 0000 0000 0000 000 010001 (17)
6 5 15 6
link

MTLO

Opcode:

0

Format:

MTLO rs

Purpose:

To copy a GPR to the special purpose LO register.

Implementation:

Nothing or missing documentation

How to decode:

opcode rs 0000 0000 0000 000 010011 (19)
6 5 15 6
link

MULT

Opcode:

0

Format:

MULT rs, rt

Purpose:

To multiply 32-bit signed integers.

Implementation:

LO = low(rs*rt); HI = high(rs*rt)

How to decode:

opcode rs rt 0000 0000 00 011000 (24)
6 5 5 10 6
link

MULTU

Opcode:

0

Format:

MULTU rs, rt

Purpose:

To multiply 32-bit unsigned integers.

Implementation:

LO = low(rs*rt); HI = high(rs*rt)

How to decode:

opcode rs rt 0000 0000 00 011001 (25)
6 5 5 10 6
link

NOR

Opcode:

0

Format:

NOR rd, rs, rt

Purpose:

To do a bitwise logical NOT OR.

Implementation:

rd = (rs NOR rt)

How to decode:

opcode rs rt rd 00000 100111 (39)
6 5 5 5 5 6
link

OR

Opcode:

0

Format:

OR rd, rs, rt

Purpose:

To do a bitwise logical OR.

Implementation:

rd = (rs OR rt)

How to decode:

opcode rs rt rd 00000 100101 (37)
6 5 5 5 5 6
link

ORI

Opcode:

13

Format:

ORI rt, rs, immediate

Purpose:

To do a bitwise logical OR with a constant. Comment: ORI rt, r0, imm is equal to a LI rt, imm

Implementation:

rt = (rs OR immediate)

How to decode:

opcode rs rt immediate
6 5 5 16
link

SLL

Opcode:

0

Format:

SLL rd, rt, sa

Purpose:

To left shift a word by a fixed number of bits. Comment: SLL r0, r0, 0 is equal to a NOP (No OPeration)

Implementation:

rd = rt << sa

How to decode:

opcode 00000 rt rd sa 000000 (0)
6 5 5 5 5 6
link

SLLV

Opcode:

0

Format:

SLLV rd, rt, rs

Purpose:

To left shift a word by a variable number of bits.

Implementation:

rd = rt << sa

How to decode:

opcode rs rt rd 00000 000100 (4)
6 5 5 5 5 6
link

SLT

Opcode:

0

Format:

SLT rd, rs, rt

Purpose:

To record the result of a less-than comparison.

Implementation:

if rs < rt then rd = 1 else rd = 0

How to decode:

opcode rs rt rd 00000 101010 (42)
6 5 5 5 5 6
link

SLTI

Opcode:

10

Format:

SLTI rt, rs, immediate

Purpose:

To record the result of a less-than comparison with a constant.

Implementation:

if rs < immediate then rd = 1 else rd = 0

How to decode:

opcode rs rt immediate
6 5 5 16
link

SLTIU

Opcode:

11

Format:

SLTIU rt, rs, immediate

Purpose:

To record the result of an unsigned less-than comparison with a constant.

Implementation:

if rs < immediate then rd = 1 else rd = 0

How to decode:

opcode rs rt immediate
6 5 5 16
link

SLTU

Opcode:

0

Format:

SLTU rd, rs, rt

Purpose:

To record the result of an unsigned less-than comparison.

Implementation:

if rs < rt then rd = 1 else rd = 0

How to decode:

opcode rs rt rd 00000 101011 (43)
6 5 5 5 5 6
link

SRA

Opcode:

0

Format:

SRA rd, rt, sa

Purpose:

To arithmetic right shift a word by a fixed number of bits.

Implementation:

rd = rt >> sa

How to decode:

opcode 00000 rt rd sa 000011 (3)
6 5 5 5 5 6
link

SRAV

Opcode:

0

Format:

SRAV rd, rt, rs

Purpose:

To arithmetic right shift a word by a variable number of bits.

Implementation:

rd = rt >> rs

How to decode:

opcode rs rt rd 00000 000111 (7)
6 5 5 5 5 6
link

SRL

Opcode:

0

Format:

SRL rd, rt, sa

Purpose:

To logical right shift a word by a fixed number of bits.

Implementation:

rd = rt >> sa

How to decode:

opcode 00000 rt rd sa 000010 (2)
6 5 5 5 5 6
link

SRLV

Opcode:

0

Format:

SRLV rd, rt, rs

Purpose:

To logical right shift a word by a variable number of bits.

Implementation:

rd = rt >> rs

How to decode:

opcode rs rt rd 00000 000110 (6)
6 5 5 5 5 6
link

SUB

Opcode:

0

Format:

SUB rd, rs, rt

Purpose:

To subtract 32-bit integers. If overflow occurs, then trap. Comment: SUB rd, r0, rt is equal to a NEG rd, rt

Implementation:

rd = rs - rt

How to decode:

opcode rs rt rd 00000 100010 (34)
6 5 5 5 5 6
link

SUBU

Opcode:

0

Format:

SUBU rd, rs, rt

Purpose:

To subtract 32-bit integers. No trap on overflow. Comment: SUBU rd, r0, rs is equal to a NEGU rd, rs

Implementation:

rd = rs - rt

How to decode:

opcode rs rt rd 00000 100011 (35)
6 5 5 5 5 6
link

XOR

Opcode:

0

Format:

XOR rd, rs, rt

Purpose:

To do a bitwise logical EXCLUSIVE OR.

Implementation:

rd = (rs XOR rt)

How to decode:

opcode rs rt rd 00000 100110 (38)
6 5 5 5 5 6
link

XORI

Opcode:

14

Format:

XORI rt, rs, immediate

Purpose:

To do a bitwise logical EXCLUSIVE OR with a constant.

Implementation:

rd = (rs XOR immediate)

How to decode:

opcode rs rt immediate
6 5 5 16

Jump and Branch Instructions

link

BEQ

Opcode:

4

Format:

BEQ rs, rt, offset

Purpose:

To compare GPRs then do a PC-relative conditional branch. Comment: BEQ rs, r0, offset is equal to a BEQZ rs, offset BEQ r0, r0, offset is equal to a B offset

Implementation:

branch if rs = rt

How to decode:

opcode rs rt offset
6 5 5 16
link

BEQL

Opcode:

20

Format:

BEQL rs, rt, offset

Purpose:

To compare GPRs then do a PC-relative conditional branch; execute the delay slot only if the branch is taken. Comment: BEQL rs, r0, offset is equal to a BEQZL rs, offset

Implementation:

branch if rs = rt

How to decode:

opcode rs rt offset
6 5 5 16
link

BGEZ

Opcode:

1

Format:

BGEZ rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch.

Implementation:

branch if rs >= 0 (signed)

How to decode:

opcode rs 00001 (1) offset
6 5 5 16
link

BGEZAL

Opcode:

1

Format:

BGEZAL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional procedure call. Comment: BGEZAL r0, offset is equal to a BAL offset

Implementation:

branch if rs >= 0 (signed) (return address in ra)

How to decode:

opcode rs 10001(17) offset
6 5 5 16
link

BGEZALL

Opcode:

1

Format:

BGEZALL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional procedure call; execute the delay slot only if the branch is taken.

Implementation:

branch if rs >= 0 (signed) (return address in ra)

How to decode:

opcode rs 10011(19) offset
6 5 5 16
link

BGEZL

Opcode:

1

Format:

BGEZL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch; execute the delay slot only if the branch is taken.

Implementation:

branch if rs >= 0 (signed)

How to decode:

opcode rs 00011 (3) offset
6 5 5 16
link

BGTZ

Opcode:

7

Format:

BGTZ rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch.

Implementation:

branch if rs > 0 (signed)

How to decode:

opcode rs 00000 offset
6 5 5 16
link

BGTZL

Opcode:

23

Format:

BGTZL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch; execute the delay slot only if the branch is taken.

Implementation:

branch if rs > 0 (signed)

How to decode:

opcode rs 00000 offset
6 5 5 16
link

BLEZ

Opcode:

6

Format:

BLEZ rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch.

Implementation:

branch if rs <= 0 (signed)

How to decode:

opcode rs 00000 offset
6 5 5 16
link

BLEZL

Opcode:

22

Format:

BLEZL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch; execute the delay slot only if the branch is taken.

Implementation:

branch if rs <= 0 (signed)

How to decode:

opcode rs 00000 offset
6 5 5 16
link

BLTZ

Opcode:

1

Format:

BLTZ rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch.

Implementation:

branch if rs < 0 (signed)

How to decode:

opcode rs 00000 offset
6 5 5 16
link

BLTZAL

Opcode:

1

Format:

BLTZAL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional procedure call.

Implementation:

branch if rs < 0 (signed) (return address in ra)

How to decode:

opcode rs 10000 offset
6 5 5 16
link

BLTZALL

Opcode:

1

Format:

BLTZALL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional procedure call; execute the delay slot only if the branch is taken.

Implementation:

branch if rs < 0 (signed) (return address in ra)

How to decode:

opcode rs 10010 offset
6 5 5 16
link

BLTZL

Opcode:

1

Format:

BLTZL rs, offset

Purpose:

To test a GPR then do a PC-relative conditional branch; execute the delay slot only if the branch is taken.

Implementation:

branch if rs < 0 (signed)

How to decode:

opcode rs 00010 (2) offset
6 5 5 16
link

BNE

Opcode:

5

Format:

BNE rs, rt, offset

Purpose:

To compare GPRs then do a PC-relative conditional branch. Comment: BNE rs, r0, offset is equal to a BNEZ rs, offset

Implementation:

branch if rs <> rt

How to decode:

opcode rs rt offset
6 5 5 16
link

BNEL

Opcode:

21

Format:

BNEL rs, rt, offset

Purpose:

To compare GPRs then do a PC-relative conditional branch; execute the delay slot only if the branch is taken. Comment: BNEL rs, r0, offset is equal to a BNEZL rs, offset

Implementation:

branch if rs <> rt

How to decode:

opcode rs rt offset
6 5 5 16
link

J

Opcode:

2

Format:

J target

Purpose:

To branch within the current 256 MB aligned region.

Implementation:

Nothing or missing documentation

How to decode:

opcode instr_index
6 26
link

JAL

Opcode:

3

Format:

JAL target

Purpose:

To procedure call within the current 256 MB aligned region.

Implementation:

return address in ra

How to decode:

opcode instr_index
6 26
link

JALR

Opcode:

0

Format:

JALR rs, rd

Purpose:

To procedure call to an instruction address in a register.

Implementation:

return address in rd

How to decode:

opcode rs 00000 rd 001001 (9)
6 5 5 5 6
link

JR

Opcode:

0

Format:

JR rs

Purpose:

To branch to an instruction address in a register.

Implementation:

PC = rs

How to decode:

opcode rs 0000 0000 0000 000 001000 (8)
6 5 15 6

Special instructions

link

BREAK

Opcode:

0

Format:

BREAK offset

Purpose:

To cause a Breakpoint exception.

Implementation:

Nothing or missing documentation

How to decode:

opcode code 001101 (13)
6 20 6
link

SYSCALL

Opcode:

0

Format:

SYSCALL offset

Purpose:

To cause a System Call exception.

Implementation:

Nothing or missing documentation

How to decode:

opcode code 001100 (12)
6 20 6

Exception Instructions

link

TEQ

Opcode:

0

Format:

TEQ rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs = rt then trap

How to decode:

opcode rs rt code 110100 (52)
6 5 5 10 6
link

TEQI

Opcode:

1

Format:

TEQI rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs = immediate then trap

How to decode:

opcode rs 01100(12) immediate
6 5 5 16
link

TGE

Opcode:

0

Format:

TGE rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs >= rt then trap

How to decode:

opcode rs rt code 110000 (48)
6 5 5 10 6
link

TGEI

Opcode:

1

Format:

TGEI rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs >= immediate then trap

How to decode:

opcode rs 01000 (8) immediate
6 5 5 16
link

TGEIU

Opcode:

1

Format:

TGEIU rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs >= immediate then trap

How to decode:

opcode rs 01001 (9) immediate
6 5 5 16
link

TGEU

Opcode:

0

Format:

TGEU rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs >= rt then trap

How to decode:

opcode rs rt code 110001 (49)
6 5 5 10 6
link

TLT

Opcode:

0

Format:

TLT rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs < rt then trap

How to decode:

opcode rs rt code 110010 (50)
6 5 5 10 6
link

TLTI

Opcode:

1

Format:

TLTI rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs < immediate then trap (signed)

How to decode:

opcode rs 01010(10) immediate
6 5 5 16
link

TLTIU

Opcode:

1

Format:

TLTIU rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs < immediate then trap

How to decode:

opcode rs 01011(11) immediate
6 5 5 16
link

TLTU

Opcode:

0

Format:

TLTU rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs < rt then trap

How to decode:

opcode rs rt code 110011 (51)
6 5 5 10 6
link

TNE

Opcode:

0

Format:

TNE rs, rt

Purpose:

To compare GPRs and do a conditional Trap.

Implementation:

if rs <> rt then trap

How to decode:

opcode rs rt code 110110 (54)
6 5 5 10 6
link

TNEI

Opcode:

1

Format:

TNEI rs, immediate

Purpose:

To compare a GPR to a constant and do a conditional Trap.

Implementation:

if rs <> immediate then trap

How to decode:

opcode rs 01110(14) immediate
6 5 5 16

System Control Processor (COP0) Instructions

link

CACHE

Opcode:

47

Format:

CACHE op, offset(base)

Purpose:

The 16-bit offset is sign-extended and added to the contents of general register base to form a virtual address. The virtual address is translated to a physical address using the TLB, and the 5-bit sub-opcode specifies a cache operation for that address.

Implementation:

Nothing or missing documentation

How to decode:

opcode base op offset
6 5 5 16
link

ERET

Opcode:

10000

Format:

ERET

Purpose:

ERET is the R4300 instruction for returning from an interrupt,

Implementation:

Nothing or missing documentation

How to decode:

opcode CO 0000 0000 0000 0000 000 011000 (24)
6 1 19 6
link

MFC0

Opcode:

10000

Format:

MFC0 rt, rd

Purpose:

To copy a word from an FPR to a GPR.

Implementation:

rt = COP rd

How to decode:

opcode 00000 (0) rt fs 0000 0000 000
6 5 5 5 11
link

MTC0

Opcode:

10000

Format:

MTC0 rt, rd

Purpose:

To copy a word from a GPR to an FPR.

Implementation:

COP rd = rt

How to decode:

opcode 00100 (4) rt fs 0000 0000 000
6 5 5 5 11
link

TLBP

Opcode:

10000

Format:

TLBP

Purpose:

The Index register is loaded with the address of the TLB entry

Implementation:

Nothing or missing documentation

How to decode:

opcode CO 0000 0000 0000 0000 000 001000 (8)
6 1 19 6
link

TLBR

Opcode:

10000

Format:

TLBR

Purpose:

The G bit (which controls ASID matching) read from the TLB is

Implementation:

Nothing or missing documentation

How to decode:

opcode CO 0000 0000 0000 0000 000 000001 (1)
6 1 19 6
link

TLBWI

Opcode:

10000

Format:

TLBWI

Purpose:

The G bit of the TLB is written with the logical AND of the G bits

Implementation:

Nothing or missing documentation

How to decode:

opcode CO 0000 0000 0000 0000 000 000010 (2)
6 1 19 6
link

TLBWR

Opcode:

10000

Format:

TLBWR

Purpose:

The G bit of the TLB is written with the logical AND of the G bits

Implementation:

Nothing or missing documentation

How to decode:

opcode CO 0000 0000 0000 0000 000 000110 (6)
6 1 19 6

Floating-point Unit, FPU (COP1) instructions

link

ABS.fmt

Opcode:

10001

Format:

ABS.S fd, fs ABS.D fd, fs

Purpose:

To compute the absolute value of an FP value.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 000101 (5)
6 5 5 5 5 6
link

ADD.fmt

Opcode:

10001

Format:

ADD.S fd, fs, ft ADD.D fd, fs, ft

Purpose:

To add FP values.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt ft fs fd 000000 (0)
6 5 5 5 5 6
link

BC1F

Opcode:

10001

Format:

BC1F offset

Purpose:

To test an FP condition code and do a PC-relative conditional branch.

Implementation:

Nothing or missing documentation

How to decode:

opcode 01000 (8) 000 nd (0) tf (0) offset
6 5 3 1 1 16
link

BC1FL

Opcode:

10001

Format:

BC1FL offset

Purpose:

To test an FP condition code and do a PC-relative conditional branch; execute the delay slot only if the branch is taken

Implementation:

Nothing or missing documentation

How to decode:

opcode 01000 (8) 000 nd (1) tf (0) offset
6 5 3 1 1 16
link

BC1T

Opcode:

10001

Format:

BC1T offset

Purpose:

To test an FP condition code and do a PC-relative conditional branch.

Implementation:

Nothing or missing documentation

How to decode:

opcode 01000 (8) 000 nd (0) tf (1) offset
6 5 3 1 1 16
link

BC1TL

Opcode:

10001

Format:

BC1TL offset

Purpose:

To test an FP condition code and do a PC-relative conditional branch; execute the delay slot only if the branch is taken.

Implementation:

Nothing or missing documentation

How to decode:

opcode 01000 (8) 000 nd (1) tf (1) offset
6 5 3 1 1 16
link

C.cond.fmt

Opcode:

10001

Format:

C.cond.S fs, ft C.cond.D fs, ft

Purpose:

To compare FP values and record the Boolean result in

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt ft fs 000 00 11 cond
6 5 5 5 3 2 2 4
link

CEIL.L.fmt

Opcode:

10001

Format:

CEIL.L.S fd, fs CEIL.L.D fd, fs

Purpose:

To convert an FP value to 64-bit fixed-point, rounding up.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001010 (10)
6 5 5 5 5 6
link

CEIL.W.fmt

Opcode:

10001

Format:

CEIL.W.S fd, fs CEIL.W.D fd, fs

Purpose:

To convert an FP value to 32-bit fixed-point, rounding up.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001110 (14)
6 5 5 5 5 6
link

CFC1

Opcode:

10001

Format:

CFC1 rt, fs

Purpose:

To copy a word from an FPU control register to a GPR.

Implementation:

rt = fs

How to decode:

opcode 00010 (2) rt fs 0000 0000 000
6 5 5 5 11
link

CTC1

Opcode:

10001

Format:

CTC1 rt, fs

Purpose:

To copy a word from a GPR to an FPU control register.

Implementation:

fs = rt

How to decode:

opcode 00110 (6) rt fs 0000 0000 000
6 5 5 5 11
link

CVT.D.fmt

Opcode:

10001

Format:

CVT.D.S fd, fs CVT.D.W fd, fs CVT.D.L fd, fs

Purpose:

To convert an FP or fixed-point value to double FP.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 100001 (33)
6 5 5 5 5 6
link

CVT.L.fmt

Opcode:

10001

Format:

CVT.L.S fd, fs CVT.L.D fd, fs

Purpose:

To convert an FP value to a 64-bit fixed-point.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 100101 (37)
6 5 5 5 5 6
link

CVT.S.fmt

Opcode:

10001

Format:

CVT.S.D fd, fs CVT.S.W fd, fs CVT.S.L fd, fs

Purpose:

To convert an FP or fixed-point value to single FP.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 100000 (32)
6 5 5 5 5 6
link

CVT.W.fmt

Opcode:

10001

Format:

CVT.W.S fd, fs CVT.W.D fd, fs

Purpose:

To convert an FP value to 32-bit fixed-point.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 100100 (36)
6 5 5 5 5 6
link

DIV.fmt

Opcode:

10001

Format:

DIV.S fd, fs, ft DIV.D fd, fs, ft

Purpose:

To divide FP values.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt ft fs fd 000011 (3)
6 5 5 5 5 6
link

DMFC1

Opcode:

10001

Format:

DMFC1 rt, fs

Purpose:

To copy a doubleword from an FPR to a GPR.

Implementation:

Nothing or missing documentation

How to decode:

opcode 00001 (1) rt fs 0000 0000 000
6 5 5 5 11
link

DMTC1

Opcode:

10001

Format:

DMTC1 rt, fs

Purpose:

To copy a doubleword from a GPR to an FPR.

Implementation:

Nothing or missing documentation

How to decode:

opcode 00101 (5) rt fs 0000 0000 000
6 5 5 5 11
link

FLOOR.L.fmt

Opcode:

10001

Format:

FLOOR.L.S fd, fs FLOOR.L.D fd, fs

Purpose:

To convert an FP value to 64-bit fixed-point, rounding down.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001011 (11)
6 5 5 5 5 6
link

FLOOR.W.fmt

Opcode:

10001

Format:

FLOOR.W.S fd, fs FLOOR.W.D fd, fs

Purpose:

To convert an FP value to 32-bit fixed-point, rounding down.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001111 (15)
6 5 5 5 5 6
link

LDC1

Opcode:

53

Format:

LDC1 ft, offset(base)

Purpose:

To load a doubleword from memory to an FPR.

Implementation:

COP ft = doubleword[base+offset]

How to decode:

opcode base ft offset
6 5 5 16
link

LWC1

Opcode:

49

Format:

LWC1 ft, offset(base)

Purpose:

To load a word from memory to an FPR. Comment: LWC1 ft, offset(base) is equal to a L.S ft, offset(base)

Implementation:

COP ft = word[base+offset]

How to decode:

opcode base ft offset
6 5 5 16
link

MFC1

Opcode:

10001

Format:

MFC1 rt, fs

Purpose:

To copy a word from an FPU (CP1) general register to a GPR.

Implementation:

rt = COP fs

How to decode:

opcode 00000 (0) rt fs 0000 0000 000
6 5 5 5 11
link

MOV.fmt

Opcode:

10001

Format:

MOV.S fd, fs MOV.D fd, fs

Purpose:

To move an FP value between FPRs.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 000110 (6)
6 5 5 5 5 6
link

MTC1

Opcode:

10001

Format:

MTC1 rt, fs

Purpose:

To copy a word from a GPR to an FPU (CP1) general register.

Implementation:

COP fs = rt

How to decode:

opcode 00100 (4) rt fs 0000 0000 000
6 5 5 5 11
link

MUL.fmt

Opcode:

10001

Format:

MUL.S fd, fs, ft MUL.D fd, fs, ft

Purpose:

To multiply FP values.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt ft fs fd 000010 (2)
6 5 5 5 5 6
link

NEG.fmt

Opcode:

10001

Format:

NEG.S fd, fs NEG.D fd, fs

Purpose:

To negate an FP value.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 000111 (7)
6 5 5 5 5 6
link

ROUND.L.fmt

Opcode:

10001

Format:

ROUND.L.S fd, fs ROUND.L.D fd, fs

Purpose:

To convert an FP value to 64-bit fixed-point, rounding to nearest.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001000 (8)
6 5 5 5 5 6
link

ROUND.W.fmt

Opcode:

10001

Format:

ROUND.W.S fd, fs ROUND.W.D fd, fs

Purpose:

To convert an FP value to 32-bit fixed-point, rounding to nearest.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001100 (12)
6 5 5 5 5 6
link

SDC1

Opcode:

61

Format:

SDC1 ft, offset(base)

Purpose:

To store a doubleword from an FPR to memory.

Implementation:

doubleword[base+offset] = COP rt

How to decode:

opcode base ft offset
6 5 5 16
link

SQRT.fmt

Opcode:

10001

Format:

SQRT.S fd, fs SQRT.D fd, fs

Purpose:

To compute the square root of an FP value.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 000100 (4)
6 5 5 5 5 6
link

SUB.fmt

Opcode:

10001

Format:

SUB.S fd, fs, ft SUB.D fd, fs, ft

Purpose:

To subtract FP values.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt ft fs fd 000001 (1)
6 5 5 5 5 6
link

SWC1

Opcode:

57

Format:

SWC1 ft, offset(base)

Purpose:

To store a word from an FPR to memory. Comment: SWC1 ft, offset(base) is equal to a S.S ft, offset(base)

Implementation:

word[base+offset] = COP rt

How to decode:

opcode base ft offset
6 5 5 16
link

TRUNC.L.fmt

Opcode:

10001

Format:

TRUNC.L.S fd, fs TRUNC.L.D fd, fs

Purpose:

To convert an FP value to 64-bit fixed-point, rounding toward zero.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001001 (9)
6 5 5 5 5 6
link

TRUNC.W.fmt

Opcode:

10001

Format:

TRUNC.W.S fd, fs TRUNC.W.D fd, fs

Purpose:

To convert an FP value to 32-bit fixed-point, rounding toward zero.

Implementation:

Nothing or missing documentation

How to decode:

opcode fmt 00000 fs fd 001101 (13)
6 5 5 5 5 6