CSN221_Lec_16.pdf MIPS ISA and Datapath design

ssuser034ce1 5 views 16 slides Sep 09, 2024
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

CSN221_Lec_16 MIPS ISA and Datapath design


Slide Content

Course Website: http://faculty.iitr.ac.in/~sudiproy.fcs/csn221_2015.html
Piazza Site: https://piazza.com/iitr.ac.in/fall2015/csn221  
Dr. SudipRoy
CSN‐221: COMPUTER ARCHITECTURE 
AND MICROPROCESSORS
MIPS ISA & DatapathDesign
(Lecture -16)

Dr. Sudip Roy2

Dr. Sudip Roy3
Slowest instruction determines the clock cycle time:
If all instructions must complete within one clock cycle, then the cycle time has to 
be large enough to accommodate the slowestinstruction.
For example, lw $t0, –4($sp) needs 8ns, assuming the delays shown here
reading the instruction memory 2ns
reading the base register $sp 1ns
computing memory address $sp-4 2ns
reading the data memory 2ns
storing data back to $t0 1ns
8ns
If we make the cycle time 8ns then every instruction will take 8ns, even if they 
don’t need that much time.
For example, the instruction add $s4, $t1, $t2 really needs just 6ns.
6ns
reading the instruction memory 2ns
reading registers $t1 and $t2 1ns
computing $t1 + $t2 2ns
storing the result into $s0 1ns

Dr. Sudip Roy4
Micro‐Operations of Program Execution:
A computer executes a program
Fetch/execute cycle
Each cycle has a number of steps
Multi‐cycle or pipelined datapath
Called micro‐operations
Each step does very little
Atomic operation of CPU

Dr. Sudip Roy5
Constituent Elements of Program Execution:
Each clock pulse defines a time unit, which are of equal duration.
Micro‐operationsare performed within this time unit.
If multiple micro‐operationsdo not interfere with one another then 
grouping of micro‐operations can be performed within one time unit.

Dr. Sudip Roy6
Fetch ‐4 Registers:

Memory Address Register (MAR)  
Connected to address bus

Specifies address for read or write op

Memory Buffer Register (MBR)  
Connected to data bus

Holds data to write or last data read

Program Counter (PC)  
Holds address of next instruction to be fetched

Instruction Register (IR)  
Holds last instruction fetched

Dr. Sudip Roy7
Sequence of events in Fetch cycle: 
Address of next instruction is in PC

Address (MAR) is placed on address bus

Control unit issues READ command

Result (data from memory) appears on data bus

Data from data bus copied into MBR

PC incremented by 1 (in parallel with data fetch from memory)

Data (instruction) moved from MBR to IR

MBR is now free for further data fetches

Dr. Sudip Roy8
Fetch Sequence (symbolic):
(tx= time unit/clock cycle) 
t1: MAR <‐(PC)

t2: MBR <‐(memory)

PC <‐(PC) +1

t3: IR <‐(MBR)
or

t1: MAR <‐(PC)

t2: MBR <‐(memory)

t3: PC <‐(PC) +1 

IR <‐(MBR)

Dr. Sudip Roy9
Rules for Clock Cycle Grouping:

Proper sequence must be followed 
MAR <‐(PC) must precede MBR <‐(memory)

Conflicts must be avoided 
Must not read & write same register at same time

MBR <‐(memory) & IR <‐(MBR) must not be in same cycle

Also:  PC <‐(PC) +1 involves addition 
Use ALU

May need additional micro‐operations

Dr. Sudip Roy10
Indirect Cycle:

MAR <‐(IR
address
)  ‐address field of IR

MBR <‐(memory)

IR
address
<‐(MBR
address
)

MBR contains an address

Dr. Sudip Roy11
Interrupt Cycle:

t1: MBR <‐(PC)

t2: MAR <‐save‐address

PC <‐routine‐address

t3: memory <‐(MBR)

This is a minimum 
May be additional micro‐ops to get addresses

N.B. saving context is done by interrupt handler routine, not 
micro‐ops

Dr. Sudip Roy12
Execute Cycle (ADD):

Different for each instruction

e.g., ADD R1,X ‐add the contents of location X to Register 1 , 
result in R1

t1: MAR <‐(IR
address
)

t2: MBR <‐(memory)

t3: R1 <‐R1 + (MBR)

Note no overlap of micro‐operations

Dr. Sudip Roy13
Execute Cycle (ISZ):

ISZ X ‐increment and skip if zero

t1: MAR <‐(IRaddress)

t2: MBR <‐(memory)

t3: MBR <‐(MBR) + 1

t4: memory <‐(MBR)

if (MBR) == 0 then PC <‐(PC) + 1

Notes:

if is a single micro‐operation

Micro‐operations done during t4

Dr. Sudip Roy14
Execute Cycle (BSA):

BSA X ‐Branch and save address

Address of instruction following BSA is saved in X

Execution continues from X+1

t1: MAR <‐(IRaddress)

MBR <‐(PC)

t2: PC <‐(IRaddress)

memory <‐(MBR)

t3: PC <‐(PC) + 1

Dr. Sudip Roy15
Instruction Cycle:

Each phase decomposed into sequence of elementary micro‐
operations

E.g. fetch, indirect, and interrupt cycles

Execute cycle 
One sequence of micro‐operations for each opcode

Need to tie sequences together

Assume new 2‐bit register 
Instruction cycle code (ICC) designates which part of cycle 
processor is in 
00: Fetch

01: Indirect

10: Execute

11: Interrupt

Dr. Sudip Roy16
Flowchart for Instruction Cycle:
Tags