Chapter Five The Processor: Datapath and Control - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Chapter Five The Processor: Datapath and Control

Description:

Unclocked vs. Clocked. Clocks used in synchronous logic ... state (value) is based on the clock. Latches: whenever the inputs change, and the clock is asserted ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 23
Provided by: TodA1
Category:

less

Transcript and Presenter's Notes

Title: Chapter Five The Processor: Datapath and Control


1
Chapter FiveThe Processor Datapath and Control
2
The Processor Datapath Control
  • We're ready to look at an implementation of the
    MIPS
  • Simplified to contain only
  • memory-reference instructions lw, sw
  • arithmetic-logical instructions add, sub, and,
    or, slt
  • control flow instructions beq, j

3
Generic Implementation
  • use the program counter (PC) to supply
    instruction address
  • get the instruction from memory
  • read registers
  • use the instruction to decide exactly what to do
  • All instructions use the ALU after reading the
    registers
  • Why? memory-reference? arithmetic? control
    flow?

4
More Implementation Details
  • Abstract / Simplified ViewTwo types
    of functional units
  • elements that operate on data values
    (combinational)
  • elements that contain state (sequential)

5
State Elements
  • Unclocked vs. Clocked
  • Clocks used in synchronous logic
  • when should an element that contains state be
    updated?

6
An unclocked state element
  • The set-reset latch
  • output depends on present inputs and also on past
    inputs

7
Latches and Flip-flops
  • Latches and flip-flops are the simplest memory
    elements.
  • Output is equal to the stored value inside the
    element(don't need to ask for permission to look
    at the value)
  • Change of state (value) is based on the clock
  • Latches whenever the inputs change, and the
    clock is asserted
  • Flip-flop state changes only on a clock
    edge (edge-triggered methodology)

A clocking methodology defines when signals can
be read and written Wouldn't want to read a
signal at the same time it was being written
8
D-latch
  • Two inputs
  • the data value to be stored (D)
  • the clock signal (C) indicating when to read
    store D
  • Two outputs
  • the value of the internal state (Q) and it's
    complement
  • When the latch is open (C asserted), the value of
    Q changes as D changes? transparent latch.

9
D flip-flop
  • Flip-flops are not transparent
  • Output changes only on the clock edge
  • The first latch, called the master, is open and
    follows the input D when C is asserted. When the
    clock input falls, the first latch is closed, but
    the 2nd latch, called the slave, is open and gets
    its input from the output of the master latch.

Q
Q
Q
D
D
D
D
D
_
_
l
a
t
c
h
l
a
t
c
h
Q
Q
C
C
C
10
Set-up time and Hold time
  • Set-up time the minimum time that the input must
    remain valid before the clock edge
  • Hold time the minimum time that the input must
    be valid after the clock edge (usually very
    small)

D
Set-up time
Hold time
C
11
Our Implementation
  • An edge triggered methodology
  • Typical execution
  • read contents of some state elements,
  • send values through some combinational logic
  • write results to one or more state elements

S
t
a
t
e
S
t
a
t
e
e
l
e
m
e
n
t
C
o
m
b
i
n
a
t
i
o
n
a
l

l
o
g
i
c
e
l
e
m
e
n
t
1
2
C
l
o
c
k

c
y
c
l
e
12
Register File
  • A register file consists of a set of registers
    that can be read and written by supplying a
    register number to be accessed.
  • Built using D flip-flops and decoders (specify
    register number)
  • Read part (left) supply a register number as
    input, and the output is the information stored
    in that register.
  • A register file with 2 read ports and 1 write
    ports. (right)

R
e
a
d

r
e
g
i
s
t
e
r
n
u
m
b
e
r

1
R
e
g
i
s
t
e
r

0
R
e
a
d

r
e
g
i
s
t
e
r
R
e
g
i
s
t
e
r

1
R
e
a
d
n
u
m
b
e
r

1
M
d
a
t
a

1
u
R
e
a
d

d
a
t
a

1
R
e
a
d

r
e
g
i
s
t
e
r
x
R
e
g
i
s
t
e
r

n

?

1
n
u
m
b
e
r

2
R
e
g
i
s
t
e
r

n
R
e
g
i
s
t
e
r

f
i
l
e
W
r
i
t
e
r
e
g
i
s
t
e
r
R
e
a
d

r
e
g
i
s
t
e
r
R
e
a
d
n
u
m
b
e
r

2
d
a
t
a

2
W
r
i
t
e
d
a
t
a
W
r
i
t
e
M
u
R
e
a
d

d
a
t
a

2
x
13
Register File
  • Write part need 3 inputs a register number, the
    data to write, and a clock that controls the
    writing into the register.
  • Note we still use the real clock to determine
    when to write

W
r
i
t
e
C
0
R
e
g
i
s
t
e
r

0
1
D
n
-
t
o
-
1
C
R
e
g
i
s
t
e
r

n
u
m
b
e
r
d
e
c
o
d
e
r
R
e
g
i
s
t
e
r

1
D
n

?

1
n
C
R
e
g
i
s
t
e
r

n

?

1
D
C
R
e
g
i
s
t
e
r

n
D
R
e
g
i
s
t
e
r

d
a
t
a
14
Simple Implementation
  • Basic components
  • two state elements instruction memory and program
    counter are needed to store and access
    instructions.
  • An adder is needed to compute the next
    instruction address.
  • Since the instruction memory is read-only, we can
    treat it as combinational logic.

I
n
s
t
r
u
c
t
i
o
n
a
d
d
r
e
s
s
P
C
I
n
s
t
r
u
c
t
i
o
n
A
d
d
S
u
m
I
n
s
t
r
u
c
t
i
o
n
m
e
m
o
r
y
a
.

I
n
s
t
r
u
c
t
i
o
n

m
e
m
o
r
y
b
.

P
r
o
g
r
a
m

c
o
u
n
t
e
r
c
.

A
d
d
e
r
15
Fetching instruction and incrementing PC
  • A portion of the datapath used for fetching
    instructions and incrementing Program Counter

A
d
d
4
R
e
a
d
P
C
a
d
d
r
e
s
s
I
n
s
t
r
u
c
t
i
o
n
I
n
s
t
r
u
c
t
i
o
n
m
e
m
o
r
y
16
R-Format ALU operations
  • R-format instruction has 3 register operands, 2
    read and 1 write

3
17
Datapath for R-type Instruction

A
L
U

o
p
e
r
a
t
i
o
n
3
R
e
a
d
r
e
g
i
s
t
e
r

1
R
e
a
d
d
a
t
a

1
R
e
a
d
Z
e
r
o
r
e
g
i
s
t
e
r

2
I
n
s
t
r
u
c
t
i
o
n
R
e
g
i
s
t
e
r
s
A
L
U
A
L
U
W
r
i
t
e
r
e
s
u
l
t
r
e
g
i
s
t
e
r
R
e
a
d
d
a
t
a

2
W
r
i
t
e
d
a
t
a
R
e
g
W
r
i
t
e
18
Load and Store Instructions
  • Load and store instructions compute a memory
    address by adding the base register, to a 16-bit
    signed offset field contained in the instruction.

M
e
m
W
r
i
t
e
R
e
a
d
A
d
d
r
e
s
s
d
a
t
a
1
6
3
2
S
i
g
n
e
x
t
e
n
d
D
a
t
a
W
r
i
t
e
m
e
m
o
r
y
d
a
t
a
M
e
m
R
e
a
d
b
.

S
i
g
n
-
e
x
t
e
n
s
i
o
n

u
n
i
t
a
.

D
a
t
a

m
e
m
o
r
y

u
n
i
t
19
Datapath for load and store instructions

A
L
U

o
p
e
r
a
t
i
o
n
3
M
e
m
W
r
i
t
e
R
e
g
W
r
i
t
e
M
e
m
R
e
a
d
20
J-type Instruction
  • Branch datapath
  • Needs to compute the branch target address
  • PC4 is the address of the next instruction
  • Offset field is left-shifted two bits to make a
    word offset.
  • Needs to compare register contents

21
Branch Datapath

A
L
U

o
p
e
r
a
t
i
o
n
3
r
e
g
i
s
t
e
r

1
R
e
a
d
r
e
g
i
s
t
e
r

2
W
r
i
t
e
d
a
t
a
R
e
g
W
r
i
t
e
22
Building the Datapath
Use multiplexors to stitch them together
Write a Comment
User Comments (0)
About PowerShow.com