Download Understanding MIPS Architecture: Fetch-Decode-Execute Cycle, Datapath, Control Unit and more Lecture notes Computer System Design and Architecture in PDF only on Docsity!
Introduction to the MIPS Architecture
January 14โ16, 2013
Unofficial textbook
MIPS Assembly Language Programming
by Robert Britton
A beta version of this book (2003) is available free online
Outline
Overview of the MIPS architecture What is a computer architecture? Fetch-decode-execute cycle Datapath and control unit
Components of the MIPS architecture Memory Other components of the datapath Control unit
What is a computer architecture?
One view: The machine language the CPU implements
Instruction set architecture (ISA)
- (^) Built in data types (integers, floating point numbers)
- Fixed set of instructions
- (^) Fixed set of on-processor variables (registers)
- Interface for reading/writing memory
- (^) Mechanisms to do input/output
How a computer executes a program
Fetch-decode-execute cycle (FDX)
- fetch the next instruction from memory
- decode the instruction
- execute the instruction
Decode determines:
- (^) operation to execute
- arguments to use
- (^) where the result will be stored
Execute:
- (^) performs the operation
- determines next instruction to fetch (by default, next one)
Datapath and control unit
Datapath
Major hardware components of the FDX cycle
- path of instructions and data through the processor
- (^) components connected by buses
Bus โ parallel path for transmitting values
- (^) in MIPS, usually 32 bits wide
Outline
Overview of the MIPS architecture What is a computer architecture? Fetch-decode-execute cycle Datapath and control unit
Components of the MIPS architecture Memory Other components of the datapath Control unit
Components of the MIPS architecture
http://www.cise.ufl.edu/~mssz/CompOrg/Figure4.3-MIPSarch2.gif
Major components of the datapath:
- program counter (PC)
- (^) instruction register (IR)
- register file
- (^) arithmetic and logic unit (ALU)
- memory
Control unit
Memory: text segment vs. data segment
Distinction may or may not be reflected in the hardware:
- (^) von Neumann architecture โ single, shared memory
- Harvard architecture โ physically separate memories
Memory addressing in MIPS
For reading/writing the data segment
Base address plus displacement
Memory address computed as base+offset:
- (^) base is obtained from a register
- offset is given directly as an integer
Load word (read word from memory into register): lw $t1,8($t2) โ $t1 := Memory[$t2+8]
Store word (write word from register into memory): sw $t1,4($t2) โ Memory[$t2+4] := $t
Weโll talk about addressing in the text segment later
Incrementing the PC
In MIPS, each instruction is exactly 32-bits long
What is the address of the next instruction?
PC+
(Each address refers to one byte, and 32/ 8 = 4)
Instruction register (IR)
Instruction register
Register that holds the instruction currently being decoded
Note condition signals from the IR to the control unit!
Register names and conventions
Number Name Usage Preserved? $0 $zero constant 0x00000000 N/A
$1 $at assembler temporary 7
$2 โ $3 $v0 โ $v1 function return values 7
$4 โ $7 $a0 โ $a3 function arguments 7
$8 โ $15 $t0 โ $t7 temporaries 7
$16 โ $23 $s0 โ $s7 saved temporaries 3
$24 โ $25 $t8 โ $t9 more temporaries 7
$26 โ $27 $k0 โ $k1 reserved for OS kernel N/A
$28 $gp global pointer 3
$29 $sp stack pointer 3
$30 $fp frame pointer 3
$31 $ra return address 3
Arithmetic and logic unit (ALU)
Implements binary arithmetic and logic operations
Inputs :
- (^) operands โ 2 ร 32-bit
- (^) operation โ control signal
Outputs :
- (^) result โ 1 ร 64-bit (usually just use 32 bits of this)
- status โ condition signals