Multicycle Datapath - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Multicycle Datapath

Description:

ECE 4436. ECE 5367. Multi-cycle Datapath. ECE 4436. ECE 5367. Single Cycle Review. S. h. i ... What are some of the main steps in the instruction execution? ... – PowerPoint PPT presentation

Number of Views:125
Avg rating:3.0/5.0
Slides: 43
Provided by: egr5
Category:

less

Transcript and Presenter's Notes

Title: Multicycle Datapath


1
  • Multi-cycle Datapath

2
Single Cycle Review
3
Instruction Flow
  • What are some of the main steps in the
    instruction execution? (refer to previous slide)
  • Is this an efficient use of hardware? Why or why
    not?
  • Do we really need 2 adders?

4
Multicycle Implementation
  • Key elements (How many cycles is this? What are
    they?)

5
Examples
  • add 1,2,3
  • lw 2,10(3)
  • sw 2,10(3)
  • beq 7,8,40
  • j 0x2ABCDEF

We will be ignoring the control signals for now!
6
add 1,2,3
1.
2.
3.
4.
IR MemPC PC PC 4
A 1st Reg Src B 2nd Reg Src
ALUout A B
Rdest ALUOut
4 clock cycles for an ADD
7
lw 2,10(3)
1.
2.
3.
4.
5.
IR MemPC PC PC 4
A Addr Reg Src
ALUout A Imm.
MDR MemALUOut
Rdest MDR
5 clock cycles for a Load Word
8
sw 2,10(3)
1.
2.
3.
4.
IR MemPC PC PC 4
A Addr Reg Src B Store Reg Src
ALUout A Imm.
MemALUOut B
4 clock cycles for a Load Word
9
beq 7,8,40
1.
2.
3.
4.
IR MemPC PC PC 4
A 1st Reg Src B 2nd Reg Src
if (AB) ? PC ALUOut
3 clock cycles for a Branch Equal
10
j 0x2ABCDEF
1.
2.
3.
4.
IR MemPC PC PC 4
Decode Jump 1
PC PC31-28 (IR25-0ltlt2
3 clock cycles for a Jump
11
CPI Revisited
  • Now you see why we have such a thing as effective
    CPI.
  • Different instruction types have different time
    requirements.
  • And we havent even talked about floating-point
    instructions yet!

12
Multicycle in MIPS (basic, w/o JUMP)
13
Instruction Steps
  • Instruction fetch (IF)
  • Instruction decode and register fetch (ID/RF)
  • Execution, EA Comp., or Branch Completion (EX)
  • Memory access or R-type completion (MEM/WB)
  • Memory read completion (WB)

14
1. IF
  • Hardware
  • Instruction Memory
  • PC Adder
  • Instruction Register
  • Operation
  • IR MemoryPC
  • PC PC 4

15
Complete Multicycle Datapath (IF)
16
2. ID/RF
  • Operation
  • A RegIR25-21
  • B RegIR20-16
  • ALUOut PC (sign-extend (IR15-0 ltlt 2
  • Hardware
  • Instruction Register
  • Register File
  • Registers A B
  • Sign Extension
  • Shift by 2
  • ALU ALUOut

17
Complete Multicycle Datapath (ID/RF)
18
3. EX
  • Operation
  • Memory reference
  • ALUOut A sign-extend (IR15-0)
  • Arithmetic/Logic
  • ALUOut A op B
  • Branch
  • if (AB) then PC ALUOut
  • Jump
  • PC PC31-28 (IR25-0ltlt2)
  • Hardware
  • ALU
  • ALUOut
  • PC
  • PC Shift

19
Complete Multicycle Datapath (EX)
20
4. MEM ( also R-type WB)
  • Operation
  • Memory reference
  • MDR MemoryALUOut
  • or
  • MemoryALUOut B
  • Arithmetic/Logical
  • RegIR15-11 ALUOut
  • Hardware
  • MDR
  • Data memory
  • B
  • Register File
  • ALUOut

R-type WB
21
Complete Multicycle Datapath (MEM)
22
5. WB (memory type)
  • Operation
  • Load
  • RegIR20-16 MDR
  • Hardware
  • Register file
  • MDR

23
Complete Multicycle Datapath (WB)
24
A Word About Pipelining
  • Note the overlap of stages in different types of
    instructions
  • Can we exploit this?

IF ID/RF EX MEM WB
25
MC Datapath with Control
26
Complete MC Datapath
27
Defining the Control
  • MC is more complex cuz instruction is executed
    in a series of steps
  • MC datapath must specify both control signals and
    next step in sequence.
  • 2 different techniques for specifying control
  • finite state machine
  • microprogramming
  • Both allow detailed implementation to be
    synthesized by a CAD system

28
Defining the State Machine
  • Consists of a set of states and directions on how
    to change states
  • Each state also specifies a set of output that
    are asserted when the machine is in that state.
  • Each state takes 1 cc
  • Initial two states will be common for all
    instructions (why?)
  • Steps 3-5 will differ, depending on instruction
    class
  • FSM will return to initial state to begin next
    fetch

29
Finite State Machine Control
S
t
a
r
t
I
n
s
t
r
u
c
t
i
o
n

f
e
t
c
h
/
d
e
c
o
d
e

a
n
d

r
e
g
i
s
t
e
r

f
e
t
c
h
(
F
i
g
u
r
e

5
.
3
2
)
M
e
m
o
r
y

a
c
c
e
s
s
R
-
t
y
p
e

i
n
s
t
r
u
c
t
i
o
n
s
B
r
a
n
c
h

i
n
s
t
r
u
c
t
i
o
n
J
u
m
p

i
n
s
t
r
u
c
t
i
o
n
i
n
s
t
r
u
c
t
i
o
n
s
(
F
i
g
u
r
e

5
.
3
4
)
(
F
i
g
u
r
e

5
.
3
5
)
(
F
i
g
u
r
e

5
.
3
6
)
(
F
i
g
u
r
e

5
.
3
3
)
30
FSM Diagram for IF ID/RF
31
Multicycle Datapath
32
(No Transcript)
33
(No Transcript)
34
(No Transcript)
35
S
t
a
r
t
I
n
s
t
r
u
c
t
i
o
n

f
e
t
c
h
/
d
e
c
o
d
e

a
n
d

r
e
g
i
s
t
e
r

f
e
t
c
h
(
F
i
g
u
r
e

5
.
3
7
)
M
e
m
o
r
y

a
c
c
e
s
s
R
-
t
y
p
e

i
n
s
t
r
u
c
t
i
o
n
s
B
r
a
n
c
h

i
n
s
t
r
u
c
t
i
o
n
J
u
m
p

i
n
s
t
r
u
c
t
i
o
n
i
n
s
t
r
u
c
t
i
o
n
s
(
F
i
g
u
r
e

5
.
3
9
)
(
F
i
g
u
r
e

5
.
4
0
)
(
F
i
g
u
r
e

5
.
4
1
)
(
F
i
g
u
r
e

5
.
3
8
)
36
(No Transcript)
37
(No Transcript)
38
(No Transcript)
39
Control Block Diagram
Combinational Control logic
outputs inputs
Data path control outputs
Next state
State register
Inputs from instruction register opcode field
40
New MC Datapath with Exception Handling
41
New States for Exception Handling
IntCause 1 CauseWrite ALUSrcA 0 ALUSrcB
01 ALUOp 01 EPCWrite PCWrite PCSource 11
11
IntCause 0 CauseWrite ALUSrcA 0 ALUSrcB
01 ALUOp 01 EPCWrite PCWrite PC Source 11
10
To state 0 to begin next instruction
42
Complete FSM with Exception Handling
Write a Comment
User Comments (0)
About PowerShow.com