Beruflich Dokumente
Kultur Dokumente
Flip-flops
Lecturer on flipflops
Rajesh.k
Lecturer in Physics
SRR GDC Karimnagar
Flip-flops
0
1
1
1
1
x
0
0
1
1
x
0
1
0
1
1
1
1
0
0
1
1
0
1
0
No change
No change
0 (reset)
1 (set)
Avoid!
D latch
Finally, a D latch is based on an SR latch. The additional gates generate the S and
0
1
1
x
0
1
No change
0
1
Also, this latch has no bad input combinations to avoid. Any of the four possible
assignments to C and D are valid.
Flip-flops
S
X
Q
ALU
Latches
D
C
Lets say these latches contain some value that we want to increment.
The ALU should read the current latch value.
It applies the G = X + 1 operation.
The incremented value is stored back into the latches.
At this point, we have to stop the cycle, so the latch value doesnt get
S
X
ALU
Latches
D
C
The problem is exactly when to disable the latches. You have to wait long
+1
S
X
ALU
Latches
G
0001
0000
Flip-flops
D
C
After the ALU has finished its increment operation, the latch can be
enabled, and the updated value is stored.
+1
S
X
ALU
Latches
0001
0001
G
D
C
The latch must be quickly disabled again, before the ALU has a chance
+1
S
to read the new value 0001 and produce
a new
ALU
G result 0010.
X
0010
0001
Q
Latches
Flip-flops
D
C
Flip-flops
clock period
The time it takes the clock to change from 1 to 0 and back to 1 is called the
10
Flip-flops
11
+1
S
X
ALU
Latches
G
D
C
12
Flip-flops
The second issue was how to enable a latch for just an instant.
Here is the internal structure of a D flip-flop.
The flip-flop inputs are C and D, and the outputs are Q and Q.
The D latch on the left is the master, while the SR latch on the right is
called the slave.
master
slave
13
slave
Flip-flops
14
As soon as C becomes 1,
The master is disabled. Its output will be the last D input value seen
Flip-flops
15
x
0
1
No change
0 (reset)
1 (set)
Flip-flops
16
Direct inputs
0
0
1
1
1
1
0
1
0
1
1
1
x
x
x
0
1
1
x
x
x
x
0
1
Avoid!
1 (set)
0 (reset)
No change
0 (reset)
1 (set)
Flip-flops
17
S
X
ALU
Flip-flops
0000
Q0
G0
During
the clock
cycle, the ALU outputs 0001, but this does not affect
+1
S
C
G
the flip-flops yet. ALU
X
0001
0000
Q
Flip-flops
D
C
Flip-flops
Q0
G0
18
Example continued
The ALU output is copied into the flip-flops at the next positive edge
of the clock signal.
+1
S
X
ALU
Flip-flops
0001
0001
G
D
C
Q0
G0
The flip-flops automatically shut off, and no new data can be written
until +1
the next
S positive clock edge... even though theC ALU produces a
ALU
G
new output. X
0010
Q0
0001
Q
Flip-flops
D
C
Flip-flops
G0
19
Flip-flop variations
Qnext
0
1
1
1
1
x
0
0
1
1
x
0
1
0
1
No change
No change
0 (reset)
1 (set)
Qcurrent
Qnext
0 x No change
A T flip-flop can only maintain or complement
its current state.
1
1
0
1
Flip-flops
No change
Qcurrent
20
Characteristic tables
Flip-flops
Q(t+1)
Operation
0
1
0
1
Reset
Set
Q(t+1)
Operation
0
0
1
1
0
1
0
1
Q(t)
0
1
Q(t)
No change
Reset
Set
Complement
Q(t+1)
Operation
0
1
Q(t)
Q(t)
No change
Complement
21
Characteristic equations
We can also write characteristic equations, where the next state Q(t+1)
is defined in terms of the current state Q(t) and inputs.
D
Q(t+1)
Operation
0
1
0
1
Reset
Set
Q(t+1)
Operation
0
0
1
1
0
1
0
1
Q(t)
0
1
Q(t)
No change
Reset
Set
Complement
Q(t+1)
Operation
0
1
Q(t)
Q(t)
No change
Complement
Q(t+1) = D
22
23
Similarly, the values of J, K and Q at the second positive clock edge can
be used to find the value of Q during the third clock cycle.
When we do this, Q(2) is now referred to as the present state, and
Q(3) is now the next state.
Flip-flops
24
One final point to repeat: the flip-flop outputs are affected only by the
input values at the positive edge.
In the diagram below, K changes rapidly between the second and
third positive edges.
But its only the input values at the third clock edge (K=1, and J=0
and Q=1) that affect the next state, so here Q changes to 0.
This is a fairly simple timing model. In real life there are setup times
and hold times to worry about as well, to account for internal and
external delays.
1
C
J
K
Q
Flip-flops
25
Summary
Flip-flops
26
Q(t+1)
Operation
0
1
0
1
Reset
Set
27
A)AB + QA
B) AB + QA
C) 1
D)AB+ QB+
A
Y
X
Q
Flip-flops
0
0
1
1
0
1
0
1
Z
B
28