Upload
taqi-shah
View
218
Download
0
Embed Size (px)
Citation preview
8/3/2019 Hardware Slides 07
1/31
DOC112: Computer Hardware Lecture 07 Slide 1
Lecture 7:
Flip-Flops
8/3/2019 Hardware Slides 07
2/31
DOC112: Computer Hardware Lecture 07 Slide 2
S
R
P
Q
The R-S flip flop
0
1
01
S R P Q
0 0 1 10 1 1 0
1 0 0 1
1 1 ? ?
We analysed this circuit in the last lecture.
8/3/2019 Hardware Slides 07
3/31
DOC112: Computer Hardware Lecture 07 Slide 3
Non determinism
For input 1,1 we can only compute the output if we knowwhat is was at the previous time interval
S R Pp Qp P Q1 1 0 0 1 1 Unstable
1 1 0 1 0 1 Stable
1 1 1 0 1 0 Stable
1 1 1 1 0 0 Unstable
S
R
P
Q
8/3/2019 Hardware Slides 07
4/31
DOC112: Computer Hardware Lecture 07 Slide 4
The nature of the non-determinism
Theoretically the circuit could flip between thetwo unstable states, oscillating indefinitely.
In practice the two gates will not haveidentical time delays, so one will change
before the other and the circuit will fall into
a stable state.
We do not know what that stable state is.
8/3/2019 Hardware Slides 07
5/31
DOC112: Computer Hardware Lecture 07 Slide 5
?
Logic Level
Time
S
R
Q
Non determinism when the circuitis switched on
8/3/2019 Hardware Slides 07
6/31
DOC112: Computer Hardware Lecture 07 Slide 6
The flip flop and memory
The R-S flip flop can be looked upon as a verysimple memory.
It has two states which can be thought of asQ=1 and Q=0, or to put it another way it is a
one bit memory.
The inputs are labeled S for set and R for
reset.
8/3/2019 Hardware Slides 07
7/31DOC112: Computer Hardware Lecture 07 Slide 7
Sequential Circuits
Notice that we can only describe the behaviour ofthe R-S if we know the time sequence of the
inputs. For this reason it is referred to as a
sequential circuit.
In all practical cases we shall avoid using S=R=0,
and thus it will always be the case that P=Q
The input S=R=1 ensures that the output cannot
change
8/3/2019 Hardware Slides 07
8/31DOC112: Computer Hardware Lecture 07 Slide 8
The D-Type latch
The set-reset mechanism of the R-S flip flop isnot very convenient.
It would be much better if a memory circuitcould be set to one or zero depending on its
input.
This is the purpose of the D-type latch.
8/3/2019 Hardware Slides 07
9/31DOC112: Computer Hardware Lecture 07 Slide 9
S
R
Q'
Q
D
Latch
If the latch is 1 then S=D=Q and R=D=(Q)
D
DD
D
The D type latch, open
D
D
1
1
8/3/2019 Hardware Slides 07
10/31DOC112: Computer Hardware Lecture 07 Slide 10
S
R
Q'
Q
D
Latch
If the latch is 0, then S=R=1 Q and Q cannot change
D
0
0
D
1
1
The D type latch, closed
8/3/2019 Hardware Slides 07
11/31DOC112: Computer Hardware Lecture 07 Slide 11
D Q
Latch
Q'
Symbol for a D-Type latch
8/3/2019 Hardware Slides 07
12/31DOC112: Computer Hardware Lecture 07 Slide 12
D Q
Latch
Q'
Problem Break
For the given values of D and L calculate the values ofQ and Q
101010100
111000111
8/3/2019 Hardware Slides 07
13/31DOC112: Computer Hardware Lecture 07 Slide 13
D Q
Latch
Q'
Problem Break
For the given values of D and L calculate the values ofQ and Q
101010100
010000011
101111100
111000111
8/3/2019 Hardware Slides 07
14/31DOC112: Computer Hardware Lecture 07 Slide 14
Limitations of a D-Type latch
The value that is held on the Q output of a D-Type latch is the value of D at the instant at
which the latch goes from 1 to 0.
When the latch is at 1, any change on D causes
a change of Q, and this is undesirable.
8/3/2019 Hardware Slides 07
15/31DOC112: Computer Hardware Lecture 07 Slide 15
Latch
D
Q
Undesirable output on Q whenlatching
8/3/2019 Hardware Slides 07
16/31
DOC112: Computer Hardware Lecture 07 Slide 16
Edge triggering
In order to avoid the undesirable "spike", weadapt the circuit so that the value of D is
transferred to Q only when the control input
goes from 1 to 0.
This is called an edge triggered circuit
8/3/2019 Hardware Slides 07
17/31
DOC112: Computer Hardware Lecture 07 Slide 17
Making a D-Type flip flop from twolatches
D Q
L
Q
L
Q'
D
Clock
8/3/2019 Hardware Slides 07
18/31
DOC112: Computer Hardware Lecture 07 Slide 18
Making a D-Type flip flop from twolatches
D Q
L
Q
L
Q'
D
Clock
00011100
10110110
11100011
00010111 00000011
8/3/2019 Hardware Slides 07
19/31
DOC112: Computer Hardware Lecture 07 Slide 19
D QQ'
C
D
C
Q1'
Q1
Q2
Q2'
The Master-Slave D-Type flip flop
8/3/2019 Hardware Slides 07
20/31
DOC112: Computer Hardware Lecture 07 Slide 20
Clocks
Notice that in the master slave design of the D typeflip flop we have started to refer to the control
input as a clock.
Computers have clocks to drive their sequences of
actions. Essentially they control the storage of
bits on D-Type flip flops. They produce simply
square waves.
8/3/2019 Hardware Slides 07
21/31
DOC112: Computer Hardware Lecture 07 Slide 21
Flip flops as finite state machines
Flip flops can be thought of as circuits thathave only two states:
Q=0
Q=1They can change state only when falling edge
is applied to the clock input.
They can be thought of as finite state
machines.
8/3/2019 Hardware Slides 07
22/31
DOC112: Computer Hardware Lecture 07 Slide 22
D Q
C
0 1
1
0
0 1
The D-Type flip flop and its finitestate machine
8/3/2019 Hardware Slides 07
23/31
DOC112: Computer Hardware Lecture 07 Slide 23
T Q
C
0 10 0
1
1
The T-Type flip flop (toggle)
8/3/2019 Hardware Slides 07
24/31
DOC112: Computer Hardware Lecture 07 Slide 24
J
K
Q
C
0 100
0100
10
11, 10
11, 01
The J-K flip flop
8/3/2019 Hardware Slides 07
25/31
DOC112: Computer Hardware Lecture 07 Slide 25
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
8/3/2019 Hardware Slides 07
26/31
DOC112: Computer Hardware Lecture 07 Slide 26
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
0
1
1
8/3/2019 Hardware Slides 07
27/31
DOC112: Computer Hardware Lecture 07 Slide 27
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
0
1
1
1
0
1
8/3/2019 Hardware Slides 07
28/31
DOC112: Computer Hardware Lecture 07 Slide 28
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
1
0
1
1
0
1
8/3/2019 Hardware Slides 07
29/31
DOC112: Computer Hardware Lecture 07 Slide 29
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
0
1
1
0
1
0
8/3/2019 Hardware Slides 07
30/31
DOC112: Computer Hardware Lecture 07 Slide 30
CLOCK
D
Q
Q'
The (rising) edge triggered flipflop
1
1
0
0
1
0
8/3/2019 Hardware Slides 07
31/31
Slid 31
PRESET
CLOCK
CLEAR
D
Q
Q'