MIPS
MIPS
MIPS
MIPS 32 1
Computer Architecture
CISC
Complex Instruction Set Computer
Intels x86.
RISC
Reduced Instruction Set Computer
Any computer architecture defined after 1984
MIPS
Microcomputer without Interlocked Pipeline Stages
Millions of Instructions Per Second
Strongly pipelined architecture
DECs Alpha, HPs Precision
MIPS 32 2
MIPS Architecture
Microprocessor without Interlocked Pipeline Stages
Developed at Stanford 1985
Reduced Instruction Set Computer (RISC)
Load-Store Architecture i.e. Memory reference only in
Load or Store instruction
ALU instructions are (3, 0)
64-bit version came in 1999 called MIPS64
Memory byte addressable with 64 bit address
Instruction length 32 bit fixed
Opcode length fixed 6 bit
MIPS 32 3
Registers
32-bit registers
32 general-purpose registers (GPR) named R0, R1, ... R31
32 floating-point registers (FPR) named F0, F1, ..., F31
with single precision(32 bits) and double precision (64 bits)
R0 always holds zero
Data sizes for Integers 8-bit, 16-bit (half word),
32-bit (word).
Data sizes for Floating-point 32-bit (single
precision) and 64-bit( double precision).
Operations on integers of all sizes are 32-bit
operations (adding zeros or the sign bit on left).
MIPS 32 4
Registers
32 in Number are 32-bit (word) registers
$a0 - $a3: argument registers
$v0 - $v1: return values
$ra: return address register
$sp: stack pointer
$fp: frame pointer
$gp: global pointer
$zero: always equals 0
$s0 - $s7: preserved on a procedural call
$t0 - $t9: not preserved by callee on a procedural call
MIPS 32 5
Arithmetic Operations
e.g. add a, b, c # a = b + c
add $t0, $s1, $s2
e.g. sub a, b, c # a = b c
sub $s0, $t0, $t1
MIPS 32 6
Data Transfer
lw $t0, 8($s3) # load $t0 with data from memory
# base address in $s3, offset 8
sw $t0, 48($s3) # store word
MIPS 32 7
Branch Instruction
j 32000 # PCPC+[sign extend to 32 bits (32000)]
6 bits 26 bits
J-type op address
MIPS 32 8
MIPS Fields for R and I-Type
R-type op rs rt rd shamt funct
MIPS 32 9
Examples of Machine Code
op rs rt rd shamt funct
op rs rt address
MIPS 32 10
Some Examples of Other Instructions
MIPS 32 11
MIPS Addressing Mode
Register addressing: the operand is a register
Base or displacement addressing: the
operand is at the memory whose address is
the sum of a register and a constant
Immediate addressing: the operand is a
constant
PC (Program Counter)-relative addressing:
address is the sum of PC and a constant in
the instruction
MIPS 32 12
Steps for MIPS Instructions
1. Fetch instruction from memory
2. Read registers while decoding the instruction
3. Execute the operation or calculate an address
4. Access an operand in data memory (for lw and sw)
5. Write the result into a register
MIPS 32 13
Implement Instruction Fetch
Add
PC Read
address
Instruction
Instruction
memory
MIPS 32 14
Datapath for R-type Instructions
5 Read Control
register 1 Read 32
data 1
5 Read
register 2
Instruction
Registers
ALU
5 Result 32
Write
register
Read 32
Write data 2
data
Reg_write
MIPS 32 15
Instruction Set of MIPS
MIPS 32 16
MIPS 32 17
MIPS 32 18
MIPS 32 19
MIPS 32 20
MIPS 32 21
MIPS 32 22
MIPS 32 23
MIPS 32 24
MIPS 32 25
MIPS 32 26
Thank You
MIPS 32 27