Flip Flops
Flip Flops
Bistable elements(latches and flipflop) exhibits two stable states. The are capable of residing in either of these two states indefinitely. The two states are called SET and RESET. Because of their ability to retain a given state,bistable elements are useful as storage (memory) devices.
5/2/2012 VHDL Training Version 1.0 1
Latch
The latch is a type of bistable device Latches are basically similar to flipflops because they are bistable devices that can reside In either of two states by virtue of a feedback arrangement. The main difference between latches and flip-flops is in the method used for changing their state.
5/2/2012 VHDL Training Version 1.0 3
S-R Latch
An active-low input SR latch is formed with two cross-coupled NAND gates as shown in fig. Notice that the output of each gate is connected to an input of the opposite gate. This produces the feedback that is characteristic of all multivibrators.
5/2/2012
Q R
Operation(for active-low input S-R latch) When both inputs are high there will be no change in the output i.e. flipflop will remain in the present state. When S is low and R is kept high latch will set. When S is high and R is low ,latch will reset. When both inputs are low , there will be a invalid condition.
5/2/2012 VHDL Training Version 1.0 5
Inputs
outputs
S
1 0 1
R 1 1 0
Q
NC 1 0 1
Q
NC 0 1
Comments
No change. Latch remains In present state. Latch SETS. Latch RESETS. Invalid condition
5/2/2012
5/2/2012
FLIP-FLOP
A flip flop is a bistable electronic circuit that has two stable states, --I.e. its output ie either 0 or +5 volts dc The flip - flop also has memory. For instance, when the flip - flop has its output set at 0 V dc, it can be regarded as storing a logic 0 and when its output is set at +5 V dc, as storing a logic 1.
5/2/2012 VHDL Training Version 1.0 8
FLIP-FLOP
Flip - flops are synchronous devices The term edge-triggered means that the flip-flop changes state either at the positive edge or at the negative edge of the clock pulse. Flip-flop is sensitive to its inputs only at this transition of the clock. Three basic types of edge-triggered flip-flops are S-R, D and J-K flip-flop.
5/2/2012 VHDL Training Version 1.0 9
S clk R
5/2/2012
10
Outputs
Comments
R
0 1 0
C
X
Q Q
0 1 Invalid
Q
1 0
No change Reset
Set
Invalid
5/2/2012
11
Function of S R flip-flop
The S and R inputs of the S-R flipflop are called the synchronous inputs. When S is high R is low, the Q output goes high on the triggering edge of the clock pulse and the flipflop is set. When S is low and R is high, the q output goes and the flip-flop is reset.
5/2/2012 VHDL Training Version 1.0 12
Function of S R flip-flop
When both S and R low, the output does not change from its prior state. An invalid condition exists when both S and R are high.
5/2/2012
13
Timing Diagram
clk 1 2 3 4 5
S R
Q Q
5/2/2012
14
clk
D flip-flop
5/2/2012
15
Function of D flip-flop
If there is a high in the D input when a clock pulse is applied, the flip-flop will SET,and the high on the D input is stored by the flip-flop in the positive leading edge of the clock pulse. If there is a low on the D input when clock pulse is applied, the flip-flop will reset, and low on the D input is stored by the flip-flop on the leading edge of the clock pulse.
5/2/2012 VHDL Training Version 1.0 16
Inputs D C
Outputs Comments Q Q
Set (stores a 1)
Reset (stores a 0)
5/2/2012
17
Timing Diagram
clk 1 2 3 4 5
5/2/2012
18
J-K flip-flop
The J-K flip-flop is very versatile and is perhaps the most widely used type of flip-flop. The functioning of the J-K flip-flop is identical to that of the S-R flip-flop in SET,RESET, and no-change conditions of operation. The difference is that the J-K flip-flop has no invalid state as does the S-R flip-flop.
5/2/2012 VHDL Training Version 1.0 19
JK flip-flop
J clk Q
5/2/2012
20
Truth-Table
J
0
K 0
clk
Q Q
Q Q 1 0
Q
21
0 1 1
5/2/2012
1
0
0
1 Q
VHDL Training Version 1.0
Operation of JK Flip-flop
When J and K are both low, both AND gates are disabled, clock pulses have no effect and Q retains last value. When J is high and K is low, the flip-flop will set. When J is low and K is high, the flip-flop will reset.
5/2/2012 VHDL Training Version 1.0 22
Operation of JK Flip-flop
When J and K are both high , the flip-flop will toggle. Toggle means to switch to the opposite state. Propagation delay prevents the JK flip-flop from racing(toggling more than once in a clock).
5/2/2012 VHDL Training Version 1.0 23
5/2/2012
24
Prevention of racing
Propagation delay prevents the JK flip-flop from racing. Racing can be prevented by using JK Master-slave flip-flop The basic idea in the masterslave flip-flop is the slave copies the master on the negative clock edge.
5/2/2012 VHDL Training Version 1.0 25
JK Master-slave flip-flop
J
clk master
slave
Q
5/2/2012
26
T flip-flop
The T flip-flop derives its name from its operation, which is toggle. The word implies a change of state when the T input is asserted.
Truth table
T flip-flop T FLIP-FLOP
Q 0 1
clk
5/2/2012
27
5/2/2012
28
Operating Characteristics
1)Propagation Delay tPLH measured from the triggering edge of the clock pulse to the LOW-TO-HIGH transition of the output.
50% point on triggering edge
tPLH
5/2/2012 VHDL Training Version 1.0 29
tPHL
5/2/2012 VHDL Training Version 1.0 30
50% point
tPLH
5/2/2012 VHDL Training Version 1.0 31
CLR
Q
50% point
50% point
tPHL
5/2/2012 VHDL Training Version 1.0 32
ts
5/2/2012 VHDL Training Version 1.0 33
th
5/2/2012 VHDL Training Version 1.0 34
5/2/2012
35
Flip-flop conversion
Convert the S R flip-flop to a D flip-flop. The model used to convert one flipflop to another is as follows.
Q Flip-flop conversion logic Given
flip-flop
5/2/2012
36
Conversion Table
Qn 0 Qn + 1 0 1 0 DL 0
Qn 0 0
1
S 0 1 0 X
R X 0 1 0
0
1 1
1
0 1
5/2/2012
37
D Q 0 1 0 1 Q
D 0 0 1
X 0
R=D
0
0
0
S=D
5/2/2012
38
R Q
D
Q
=
Q Q
5/2/2012
39
GLOSSARY
Bistable :- Having two stable states. Buffer Register :- A group of memory elements,often flip-flops, that can be store a binary word. Edge Triggering :- A electronic circuit that has two stable state. Hold Time:- The minimum amount of time that data must be present after the clock trigger arrives.
5/2/2012 VHDL Training Version 1.0 40
GLOSSARY contd..
Setup Time:-The minimum amount of time that data must be present before the clock trigger arrives. Propagation Delay:- The amount of time it takes for the output to change states after an input trigger. Synchronous :- When outputs change states in time with a clock. Fan-in:- It is used to define no. of inputs of a gate. Version 1.0 5/2/2012 VHDL Training 41
GLOSSARY contd..
Fan-out:- It is used define no. output of a gate. Asynchronous:- Independent of clocking. The output can change without having to wait for a clock pulse. Schmitt Trigger:- A bistable circuit used to produce a rectangular output waveform.
5/2/2012 VHDL Training Version 1.0 42
Exercises
1) Convert RS flip-flop to T flip-flop 2) Convert RS flip-flop to JK flip-flop 3) Convert JK flip-flop to D flip-flop 4) Convert D flip-flop to JK flip-flop 5)Convert JK flip-flop to RS flip-flop
5/2/2012
43
SET
JK=1,1 JK=1,0
RESET
JK=1,1
5/2/2012
44