Beruflich Dokumente
Kultur Dokumente
1. D Latch
Figure 1 illustrates the internal and block diagram of a D latch
D Q
D Q
En En
Q’ Q’
(a) (b)
2. Flip Flops
2.1 Overview
• Latches are known as level-sensitive devices. Their outputs follow their inputs as
long as they are enabled.
• Their state can therefore change during the entire time when the En signal is
asserted.
• There are situations where it is more convenient and useful to have the output
changes only at the rising or falling edges of the enable signal.
• This signal is the synchronizing clock signal
• Flip Flops (FFs) are such devices. They are edge-triggered devices.
2.2 General Representation of a FF
Figure 2 below illustrates a general representation of a FF.
Asynchronous
Input
PR
Synchronous
Input(s) Q
FF Outputs
Q’
Clock
CLR
Asynchronous
Input
Figure 2 Block diagram of a generic flip flop
1
In general, a FF has
• A clock input signal (Clk)
• One or two synchronous control inputs (depending on the FF’s type)
- D for D-FF
- T for T-FF
- J,K for JK-FF
• Two asynchronous inputs Preset (PR) and Clear (CLR)
• Usually 2 outputs (Q and Q’)
(Q’ stands for Q bar)
A FF has2 stable states (reason why FFs are also called Bistables): state-0 and state-1.
• When Q = 1, Q’ = 0; the FF is in the SET state or state 1.
• When Q = 0, Q’ = 1; the FF is in the RESET (Clear) state or state 0.
Normally, a FF can remain in either state for an infinite period of time until it is triggered
into the alternate state by an input(s) signal(s) either synchronously (via synchronous
control inputs and the clock) or asynchronously via (PR and CLR).
This D-FF type uses 2 D latches connected in series, Figure 3. The clock (Clk) signal is
connected to the Enable input of the latches; one directly, and one through an inverter.
MASTER SLAVE
Qm Qs
Q’s
(b)
(a)
• The master stage is active during ½ of the clock cycle, the slave during the 2nd half.
o When Clk = 0, the MASTER is enabled:
• Qm follows D i.e., Qm = D
• Qs remains unchanged (frozen)
2
o When Clk = 1, the MASTER latch is disabled, while the SLAVE is enabled.
• Qm is transferred to the output Q of the FF
• The slave is enabled all the time Clk = 1, but its content
changes only when the Clk signal changes from 0 to 1 that is,
at the positive edge of the Clk.
If the slave D-latch is enabled when the Clk is LOW, then it is referred to as a negative
edge-triggered MS D-FF.
You have certainly remarked the difference between a D-LATCH and a D-FF resides in
the synchronizing input signal.
FF’s synchronizing signals are provided with arrows to represent edges
Absence of arrows on latches means these devices are level sensitive.
D Q D Q D Q D Q
D-Latch D-Latch D-FF D-FF
En Q’ En Q’ Clk Q’ Clk Q’
Clk
x x
D x x x
Qm
3
Figure 5 shows a sample trace for the positive edge-triggered D flip-flop.
When Clk = 0, Qm follows D, and the output of the slave latch, Q, remains constant.
On the other hand, when Clk = 1, Q follows Qm, and the output of the master latch, Qm,
remains constant.
NB: If we consider Clk, D, and Q, we notice that the output Q changes only at the positive
edges of the Clk signal. The output Q takes the value of D at the occurrence of the positive
edge. The output Q remains frozen (unchanged) between 2 successive positive edges
D Q
D-FF
Clock Q’
This configuration requires 6 NAND gates compared to the MS D-FF which uses 11
NAND gates.
4
1. Suppose D = 0 at the rising edge of the Clock, then P2 = 0, which keeps P4 = 1
regardless of the value of the D input.
2. If D = 1 at the rising edge of the Clock, then P1 = 0 which forces P3 = P2 = 1
regardless of the value of input D.
Therefore, the D-FF ignores changes in the D input while clock = 1.
The input data to a D flip-flop is transferred to the output and held there on a 0 to1
transition of the Cock pulse. In other words, the D flip-flop is triggered on the positive
edge of the Clock.
2.4. Description of a FF
There are 5 ways to describe the functionality of a FF. they are
1. Logic symbol
2. State (characteristic) table
3. State (characteristic) equation
4. Excitation table
5. State diagram.
D Q D Q
D-FF D-FF
Clk Q’ Clk Q’
(a) (b)
Where Q(t) (or Q) is the present state, and Q(t+1) (or Q+)the next state.
5
Q Q+ D The state table tells what the FF’s inputs should be in order to change
0 0 0 from FF’s present state (Q) to the next state (Q+).
0 1 1 This table is usually used in the synthesis of sequential circuits such as
1 0 0 counters, registers, FSM etc.
1 1 1 For example, line 2 (Q= 0; Q+ = 1; D =1), we read this line as follows:
If PS is 0 and we want the NS to be 1, how should we excite the FF?
By making D =1. (Given that D = Q+)
D=1
D=0 D=1
D=0
We read the diagram as follows:
• If PS is 0 (Q =0) and D =1, then the NS will be Q=1
• If PS is 0 and D=0, then NS will be Q=0
• If PS is 1 and D=1 then NS will be Q=1
• If PS is 1 and D = 0 then NS will be Q = 0.
6
2.5 Flip Flop Variants
The JK-FF has two inputs that act like the S and R but the combination J = k =1 toggles the
FF.
J K Q+ Q+’ Mode
0 0 Q Q’ Memory or hold Q’ stands for Q bar
0 1 0 1 Reset (Complement of Q)
1 0 1 0 Set
1 1 Q’ Q Toggle
Q J K Q+
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
Q+ = K’Q + JQ’
1 1 1 0
7
2.5.2 The T-FF (Toggle)
The T-FF has one input T (stands for toggle), in addition to the clock signal.
The T-FF operates as follows:
• When T = 1, the T-FF state toggles (changes state) at each active edge of the clock.
• When T = 0, the T-FF keeps its current state
2.5.2.1 The State table
Q T Q+ Mode
0 0 0 Hold
0 1 1 Toggle
1 0 1 Hold
1 1 0 toggle
Q+ = Q O
+ T
Summary
The state equations of the three FFs are
D-FF QD+ = D or QD(t+1) = D(t)
T-FF QT+ +T
=QO
JK-FF Q +JK = KQ + J Q
Clk
8
2.8 Asynchronous inputs
Figure 8 illustrates the logic symbols of a negative edge-triggered D-FF with (a) active
LOW asynchronous inputs and (b) active HIGH asynchronous inputs
PR PR
D Q D Q
D-FF D-FF
Clk Q’ Clk Q’
CLR CLR
(a) (b)
Figure 8 (a) active LOW asynchronous inputs;
(b) active HIGH asynchronous inputs
Because asynchronous inputs override the synchronous ones, therefore, to operate the FF
in the synchronous mode, PR and CLR must be disabled
• Active LOW asynchronous inputs are disabled by making them equal to 1.
• Active HIGH asynchronous inputs are disabled by making them equal to 0.
Asynchronous inputs should never be active at the same time. (There is no practical
application that requires the FF to be SET and RESET at the same time).
Therefore, ONLY one input can be active at one time or both disabled.
9
1
2 5
3 6
1. Asynchronous RESET
RESET = 0 => G2 = G4 = G6 = 1 Q = 1
With SET = 1, then G5 =0 Q = 0
2. Asynchronous SET
SET = 0 G1 = G5 =1 Q =1
With RESET = 1 then
i- if Clock = 1 G2 = 0 G3 = 1 Q = 0
ii- if Clock = 0 G3 = 1 Q = 0
PR
J Q
JK-FF
Clk
Q’
K
CLR
Figure 10 Logic symbol of JK-FF with asynchronous inputs
10
The functionality of the logic symbol of Figure 10 can be described by
1. A functional table
2. A timing diagram
Clk
CLR
PR
Q’
Toggle mode
Asy Clr
Asy Set
11