DSD Module-5 Prakash V
DSD Module-5 Prakash V
PRAKASH
Asst. Professor, SENSE,
VIT Chennai
Combinational logic circuits are designed by combining the basic logic gates
output is determined from the present combination of inputs
The information stored in the memory elements at any given time defines the
present state of the sequential circuit.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 6
SEQUENTIAL LOGIC CIRCUITS
The present state and the external circuit determine the output and the next
state of sequential circuits.
Thus in sequential circuits, the output variables depend not only on the
present input variables but also on the past history of input variables.
Latches checks all of its inputs continuously and changes its outputs
accordingly at any time independent of clocking signal.
Enable signal is provided with the latch circuit, when enable signal is active
output changes occur as the input changes else it do not affect the output.
Flip-Flop is used for a sequential device that normally samples its inputs and
changes its outputs only at times determined by clocking signal.
The two NAND gates are cross-coupled so that the output of NAND gate 1 is
connected to one of the inputs of NAND gate 2 and vice versa. The latch has
two stable outputs Q and Q’ and two inputs, set and reset.
To understand how this circuit functions, recall that a HIGH on any input to a
NOR gate forces its output LOW.
A latch that is sensitive to the inputs only when an enable input is active is
known as gated SR latch. The circuit behaves like SR latch when EN= 1. It
retains its previous state when EN= 0.
Latches are controlled by enable signal, and they are level triggered.
(i). High level triggered: The output of the latch responds to the input changes
only when the enable input is 1(HIGH).
(ii). Low level triggered: The output of the latch responds to the input changes
only when the enable input is 0 (LOW).
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 19
TRIGGERING OF FLIP-FLOPS
Edge Triggering: The output responds to the changes in the input only at the
positive or negative edges of the clock pulse at the clock input.
Flip-Flops are different from latches because pulse or clock edge triggered
instead of level triggered.
(i). Positive edge triggering: Here the output responds to the changes in the input only
at the positive edge of the clock pulse at the clock input.
(ii). Negative edge triggering: Here the output responds to the changes in the input
only at the negative edge of the clock pulse at the clock input.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 20
TRIGGERING OF FLIP-FLOPS
The basic 1-bit digital memory circuit is known as a flip-flop. Flip-Flops are
synchronous bistable devices (has two outputs Q and Q’).
If Q is 1 i.e., Set, then Q' is 0; if Q is 0 i.e., Reset, then Q' is 1 which signify
that the output Q and Q' are always complementary to each other.
The term synchronous means that the output changes state only at a specified
point on the triggering input called the clock (CLK)
There are different types of flip-flops depending on how their inputs and
clock pulses cause transition between two states.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 22
SR FLIP-FLOPS
There are four types of flip-flops namely SR, D, JK, and T. Basically D, JK,
and T are three different modifications of the S-R flip-flop.
When S is HIGH and R is LOW, the Q output goes HIGH on the triggering
edge of the clock pulse, and the Flip-Flop is SET.
When S is LOW and R is HIGH, the Q output goes LOW on the triggering
edge of the clock pulse, and the Flip-Flop is RESET.
When both S, R are LOW, the output does not change from its prior state.
Logic Symbol
Logic diagram
The excitation table used to find the Flip-Flop input Input and output waveform
conditions that will cause the required transition, when the
present state (Qn) and the next state (Qn+1) are known.
The D (delay or data) Flip-Flop has one input called delay input and clock
pulse input.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 28
D FLIP-FLOPS
Logic Symbol
Logic diagram
D Flip-flop using SR
TEST BENCH:
VERILOG HDL CODE (Behavioural): module D_FF_TB;
module D_FF(Q,QB,D,CLK); reg D,CLK;
input D,CLK; wire Q, QB;
output Q,QB; D_FF uut (.Q(Q), .QB(QB), .D(D), .CLK(CLK));
reg Q,QB; always #100 CLK=~CLK;
always @(posedge CLK) initial
begin begin
Q=D; CLK=1;
QB=~Q; #200 D=1;
end #200 D=0;
endmodule end
endmodule
The data input J and the output Q’ are applied to the first AND gate and its
output (JQ’) is applied to the S input of SR Flip-Flop.
Similarly, the data input K and the output Q is applied to the second AND
gate and its output (KQ) is applied to the R input of SR Flip-Flop.
The function of JK flip flop using SR flip flop and AND gate can also be
performed by adding extra input terminal to input terminals of NAND gates.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 33
JK FLIP-FLOP
Logic Symbol
Logic diagram
JK Flip-flop using SR
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 34
JK FLIP-FLOP
Regardless of the present state, the Flip-Flop complements its output when the
clock pulse occurs while input T= 1.
Logic Symbol
T Flip-flop using JK
Logic diagram
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 38
T FLIP-FLOP
TEST BENCH:
VERILOG HDL CODE (Behavioural): module T_FF_TB;
module T_FF(Q,QB,T,CLK); reg T,CLK;
input T,CLK; wire Q, QB;
output Q,QB; T_FF uut (.Q(Q), .QB(QB), .T(T), .CLK(CLK));
reg Q,QB; always #100 CLK=~CLK;
always @(posedge CLK) initial
begin begin
case(T) CLK=1;
1'b0:Q=Q; #200 T=0;
1'b1:Q=~Q; #200 T=1;
endcase #200 T=0;
QB=~Q; #200 T=1;
end end
endmodule endmodule
The number of Flip-Flops used and the way in which they are connected
determine the number of states (called the modulus) and also the specific
sequence of states that the counter goes through during each complete cycle.
Counters are classified into two types according to the way they are clocked:
Synchronous counters : clock input is connected to all of the Flip-Flops so that they
are clocked simultaneously
Asynchronous counters : clocked by the external clock pulse and then each
successive Flip-Flop is clocked by the output of the preceding Flip-Flop.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 43
SYNCHRONOUS vs ASYNCHRONOUS COUNTER
S.No Asynchronous (ripple) counter Synchronous counter
1 All the Flip-Flops are not clocked simultaneously. All the Flip-Flops are clocked simultaneously.
2 The delay times of all Flip-Flops are added. There is minimum propagation delay.
Therefore there is considerable propagation
delay.
3 Speed of operation is low Speed of operation is high.
4 Logic circuit is very simple even for more number Design involves complex logic circuit as number
of states. of state increases.
5 Cheaper than synchronous counters. Costlier than ripple counters.
6 Example: Example:
OUTPUT WAVEFORM:
OUTPUT WAVEFORM:
OUTPUT WAVEFORM:
The counter can be designed using any types of Flip flop. But in general
T-Flip flop is used to design counter.
The use of MOD counter in to counter value for specific number of times.
For example, MOD-5 Counter means it can counter the values from 0 to 4
and it get reset. So, it count in the sequence of
000,001,0110,011,100,000,001,etc.,
The number of flip flop required to design MOD counter is depends on the
number of count it performs.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 56
SYNC. MOD COUNTER DESIGN
KA= QC KB= QC KC = 1
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 60
EXAMPLE:1 DESIGN OF MOD-6 COUNTER USING JK FLIP FLOP
In 2-bit asynchronous binary counter, the clock (CLK) is applied to the clock
input of first Flop-Flop(FF) which is always the least significant bit (LSB).
The second Flip-Flop is triggered by the QA, but changes only when FF is
triggered by a negative-going pulse of the QA.
Because of the inherent propagation delay time through a FF, input clock
pulse (CLK) and a transition of the QA never occur at exactly the same time.
Condition Operation
Initially let both the FFs
• QBQA = 00 initially
be in the reset state
• As soon as the 1st negative clock edge is applied, FF-A will toggle and QA will be equal to 1.
After 1st negative clock • QA is connected to clock input of FF-B, since QA has changed from 0 to 1, it is treated as the positive clock
edge edge by FF-B. There is no change in QB because FF-B is a negative edge triggered FF.
• QBQA = 01 after the first clock pulse.
• On the arrival of 2nd negative clock edge, FF-A toggles again and QA = 0.
After 2nd negative
• The change in QA acts as a negative clock edge for FF-B, so it will also toggle and QB will be 1.
clock edge • QBQA = 10 after the second clock pulse.
• On the arrival of 3rd negative clock edge, FF-A toggles again and QA become 1 from 0.
After 3rd negative
• Since this is a positive edge, FF-B does not respond so QB does not change and continues to be equal to 1.
clock edge • QBQA = 11 after the third clock pulse.
• On the arrival of 4th negative clock edge, FF-A toggles again and QA becomes 0 from 1.
After 4th negative
• This negative change in QA acts as clock pulse for FF-B, hence it toggles to change QB from 1 to 0.
clock edge • QBQA = 00 after the fourth clock pulse.
OUTPUT WAVEFORM:
Logic diagram
Timing diagram
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 77
78
The Flip-Flops must be connected such that the binary number can be entered
(shifted) into the register and possibly shifted out.
The bits in a binary number (data) can be removed from one place to
another in either of two ways.
There are two ways to shift into a register (serial or parallel) and similarly
two ways to shift the data out of the register.
Serial-in Serial-out
Serial-in Parallel-out
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 81
SISO SHIFT REGISTERS
The serial in/serial out shift register accepts data serially, i.e., one bit at a
time on a single line. It produces the stored information on its output also in
serial form.
TEST BENCH:
VERILOG HDL CODE (Behavioural): module tb_pipo;
reg clk;
module pipo(pi,clk,po);
reg [3:0] pi;
input [3:0] pi; wire [3:0] po;
input clk; pipo p1(pi,clk,po);
initial clk=1'b1;
output [3:0] po;
always #5 clk=~clk;
reg [3:0] po; initial
always @ (posedge clk) begin
pi=4'b1001;
begin
#10 pi=4'b1100;
po<=pi; #10 pi=4'b0000;
end #10 pi=4'b1010;
endmodule end
endmodule
SHIFT/ LOAD input is the control input, when SHIFT/LOAD is LOW, gates G1,
G2, G3 and G4 are enabled, allowing each data bit to be applied to the D
input of its respective Flip-Flop.
When a clock pulse is applied, the Flip-Flops with D = 1 will set and those
with D = 0 will reset, thereby storing all four bits simultaneously.
When SHIFT/LOAD is HIGH, gates G1, G2, G3 and G4 are disabled and
gates G5, G6 and G7 are enabled, allowing the data bits to shift right from
one stage to the next.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 93
PISO SHIFT REGISTERS
The OR gates allow either the normal shifting or the parallel data-entry operation,
depending on which AND gates are enabled by the SHIFT/LOAD input.
The ring counter is a cascaded connection of flip flops, in which the output of
last flip flop is connected to input of first flip flop.
The input is shifted between the flip-flops in a ring shape which is why it is
known as a Ring counter.
A typical 4-bit ring counter is made of D-flip flops connected in cascade with
the non-complemented output of the last stage connected as an input to the
first stage.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 97
SHIFT REGISTER COUNTER - RING
Ring counter’s state needs to be set before the operation, since there are no
external inputs except the clock signal.
For example, to set its state to initial state 1000 manually by setting the first
stage flip-flop and clearing the rest of the stages to obtain the state 1000.
Whenever the first clock edge hits the counter the outputs of each stage shifts
to the next succeeding stage and the output of the last will shift to the first
stage making the state 0100.
For next two consecutive clock cycles, each stage will update its state
according to its input and produces 0010 and 0001.
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 98
SHIFT REGISTER COUNTER - RING
Now upon next clock cycle, ‘1’ from the last stage will shift back to the first
stage making the initial state 1000 and it starts again from the first state.
Ring counters can also be used for counting or rotating data around a
continuous loop, to detect or recognise various patterns.
Ring counter
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 99
SHIFT REGISTER COUNTER - RING
CLK Q0 Q1 Q2 Q3
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
5 1 0 0 0
6 0 1 0 0
7 0 0 1 0
8 0 0 0 1
Truth table Timing sequence
It is a modified design of ring counter, where the inverted output from the
last flip-flop is connected to the input of the first flip-flop.
When compared to the ring counter, it uses only half of the number of flip-
flops. So, the MOD will be 2n, if there are n flip-flops.
A “n-stage” Johnson counter will circulate a single data bit giving sequence
of 2n different states and can be considered as a “mod-2n counter”.
The Johnson counter counts up and then down as the initial logic “1” passes
through it to the right replacing the preceding logic “0”.
A 4-bit Johnson ring counter passes blocks of four logic “0” and then four
logic “1” thereby producing an 8-bit pattern.
Johnson counter
MODULE-5 BECE102L-DIGITAL SYSTEM DESIGN 103
SHIFT REGISTER COUNTER - JOHNSON
CLK Q0 Q1 Q2 Q3
1 1 0 0 0
2 1 1 0 0
3 1 1 1 0
4 1 1 1 1
5 0 1 1 1
6 0 0 1 1
7 0 0 0 1
8 0 0 0 0
Truth table Timing sequence
Keyboard encoders
Pulse extender