COMP0068 Lecture6 MIPS Processor
COMP0068 Lecture6 MIPS Processor
Systems
Lecture 6: MIPS Processor
Background Reading:
Harris & Harris, Chapter 6.
Patterson & Hennessey, Chapter 2.
Overview of this Lecture
3
R3000 Processor (MIPS32)
Released:1988 Transistor count: 110,000
Used in high-end workstations (e.g. Silicon Graphics SGI Personal IRIS 4D/20)
5
The Imaginations Creative Ci40 single board
computer - like a Raspberry Pi but with a MIPS32
processor
6
A Processors’ (or Programmers’) Abstract
View of a Computer Peripherals
Data Bus (Input/Output
Devices)
Address Bus
INPUT/OUTPUT
CPU MEMORY
INTERFACES
7
R3000 Processor (MIPS32)
• MIPS addresses are 32 bits long Ø thus PC holds 32 bits
MEMORY
0040001C
00400018
00400014
00400010 Instruction
0040000C
00400008
00400004
PC: 00400010 00400000
8
Arithmetic and Registers
$0 0 0 0 0 0 0 0 0
• MIPS – 32 registers ($0 to $31)
$1 0 0 0 0 0 0 1 4 – Arithmetic only allowed on data read
$2 0 0 4 F 2 0 0 3 from registers
…
9
MIPS Instructions
• MIPS has 3 instruction formats:
ØR-type - Register operands – all arithmetic
ØI-type - Immediate operands – load, store, some branches
(operand value immediately available in instruction)
ØJ-type - Jump operands – other branches
op rs rt rd shamt funct
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
op rs rt rd shamt funct
6-bits 5-bits 5-bits 5-bits 5-bits 6-bits
Instruction Fields
0 4 5 10 0 0x22
0 6 7 11 0 0x22
0 10 11 12 0 0x20
Machine Code
Machine
000000 00100 00101 01010 00000 100010
000000 00110 00111 01011 00000 100010
000000 01010 01011 01100 00000 100000 14
Examples of R-Type Instructions
A B A and B
0 0 0 “and” Truth Table
0 1 0
and $3, $1, $2
1 0 0
1 1 1
00000001111000001111111111111111 … Register $1
00000111100000000000111111111111 … Register $2
00000001100000000000111111111111 … Register $3
17
The bitwise logical operations:
and, or, xor & nor
Truth Tables of the other logical operations
(where True is represented by 1 and False by 0)
18
The I-Type Instruction Format
op rs rt offset
6-bits 5-bits 5-bits 16-bits
Offset may be a 16-bit signed value: -215 <= offset <= 215-1
or a 16-bit unsigned value: 0 <= offset <= 216-1
depending on the instruction.
op rs rt offset
6-bits 5-bits 5-bits 16-bits
op rs rt offset
6-bits 5-bits 5-bits 16-bits
Machine Code
10101101111010001000000000000000
$8 àMem[$15 + 0xFFFF8000] 21
I-Type (Immediate Value Instructions)
op rs rt Immediate Value
6-bits 5-bits 5-bits 16-bits
op rs rt constant
6-bits 5-bits 5-bits 16-bits
26