Unit 4
Unit 4
Unit 4
4.0 INTRODUCTION
By now you are aware of the basic configuration of computer systems, how the data is
represented in computer systems, logic gates and combinational circuits. In this unit
you will learn how all the computations are performed inside the system. You will
come across terms like flip flops, registers, counters, sequential circuits etc. Here, you
will also learn how to make circuits using combinational and sequential circuits.
These circuit design will help you in performing practicals in MCSL-017 lab course.
4.1 OBJECTIVES
After going through this unit you will be able to:
define the flip-flops and latch;
describe behaviour of various flip-flops;
define significance of excitation tables and state diagrams;
r
define some of the useful circuits of a computer system like registers counters
etc.; and
construct logic circuits involving sequential and combinational circuits.
+ + Present state
Flip-flops
b
Clock
I I
These sequential circuits unlike combinational circuits are time dependent. The
sequential circuits are broadly classified, depending upon the time at which these are
observed and their internal state changes. The two broad classifications of sequential
circuits are:
Synchronous
Asynchronous
Synchronous circuits use flip-flops and their status can change only at discrete
intervals (Doesn't it seems as good choice for discrete digital devices such a
computers?). Asynchronous sequential circuits may be regarded as combinational
circuit with feedback path. Since the propagation delays of output to input are small,
they may tend to become unstable at times Thus, complex asynchronous circuits are
difficult to design.
The synchronization in a sequential circuit is achieved by a clock pulse generator,
which gives continuous clock pulse. Figure. 4.2. shows the form of a clock pulse.
m
- m
rising edge
Clock pulse
falling edge
A clock pulse can have two states: - 0 or 1; disabled or active state. The storage
elements can change their state only when a clock pulse occurs. Sequential circuits
that have clock pulses as input to flip-flops are called clocked sequential circuit.
4.3 FLIP-FLOPS
Let us see flip-flops in detail. A flip-flop is a binary cell, which stores 1-bit of
information. It itself is a sequential circuit. By now we know that flip-flop can change
its state when clock pulse occurs but when? Generally, a flip-flop can change its state
when the clocks transitions from 0 to I (rising edge) or from 1 to 0 (falling edge) and
not when clock is 1. If the storage element changes its state when clock is exactly at 1
then it is called latch. In simple words, flip-flopis edge-triggered and latch is level-
triggered.
88
I
1
4.3.1
0.
Basic Flip-flops
Let us first see a basic latch. A latch or a flip-flop can be constructed using two NOR
or NAND gates. Figure 4.3 (a) shows logic diagram for S-R latch using NOR gates.
The latch has two inputs S & R for set and reset respectively. When the output is
Q=l & Q =0, the latch is said to be in the set state. When Q=O & Q =1, it is the reset
state. Normally, The outputs Q &G are complement of each other. When both inputs
are equal to 1 at the same time, an undefined state results, as both outputs are equal to
S
1
0
R
0
0
Q
1
1
Q
0
0 Set State
Principles of Logic
Circuits I1
0 1 0 1
0 0 0 1 Reset State
1 1 0 0 Undefined
Figure 4.3 (b) Shows truth table for S-R latch. Let us examine the latch more
close1y. I
i) Say, initially 1 is applied to S leaving R to 0 at this time. As soon as S=l, the
output of NOR gate 'b' goes to 0 i.e. Q becomes 0 and almost immediately Q
becomes 1 as both the inputs ( 6 & R) to NOR gate 'a' become 0. The change in
the value of S back to 0 does not change Q as the input to NOR gate 'b' now
areQ , flip-flop stays in set state even after s returns to 0.
= I & S=O.~ h u sthe
iii) When both S & R go to 1 simultaneously, the two outputs go to 0. This gives
undefined state.
Let us try to construct most common flip- flops from this basic latch.
I
R-S Flip flop - The graphic symbol of S-R flip-flop is shown in Fig 4.4. It has three
h inputs, S (set), R (reset) and C (for clock). The Q(t+l) is the next state of flip-flop
after the occurrence of a clock pulse. Q(t) is the present state, that is present Q value
(Set- 1 or Reset- 0).
S-
(b) Logic Diagram
C S R Q(t+l)
0 0 0 Q(t) N o change in state
0
1 0 1 0 Reset
1 1 0 1 Set
1 1 1 x undefined
(c) Characteristic Table
Figure 4.4: R-S Flipflop
In figure 4.4 (a), the arrowhead symbol in front of clock pulse C indicates that the
flip-flop responds to leading edge (from 0 to 1) of input clock signal.
Operation of R-S flip-flop can be summarised as:
1) If no clock signal i.e. C=O then output can not change irrespective of R & S
values
2) When clock signal changes from 0 to 1 and S=l, R=O then output Q=l & =O 6
(Set)
3) If R=l S=O & clock signal C changes from 0 to 1 then output Q=O & =I 6
(Reset)
4) During positive clock transition if both S & R become 1 then output is not
defined, as it may become 0 or 1 depending upon internal timing delays
occurring in circuit.
D Flip -Flop
The D (data) flip-flop is modification of RS flip-flop. The problem of undefined
output in SR flip-flop when both R & S become 1 gets avoided in D flip-flop. The
simple solution to avoid such condition is by providing just a single input. Thus, the
non-clocked inputs to AND gates (S &R of fig 4.4 (b)) are guaranteed to be opposite
of each other by inserting an inverter between them. The logic diagram and
characteristic table of D flip flop is shown in figure 4.5.
I J-K flip-flopa I
I The J-K flip-flop is also a modification of SR flip-flop, it has 2 inputs like S & R and
all possible inputs combinations are valid in J K flip-flop.
Figure. 4.6 shows implementation of J K flip-flop. The inputs J & K behave exactly
like input S & R to set and reset flip-flop, respectively. When J & K are 1, the f l i p
I
I
flop output is complemented with clock transition. [Try this as an exercise]
I I
I I /' 0 0
I Q(t) No Change I
0 Clear
1 Set
-
Q(t) Complement
T flip-flop 4r
T (Toggle) flip-flop is obtained from JK flip-flop by joining inputs J &K together. The
implementation of T flip-flop is shown in figure. 4.7. When T=O, the clock pulse
transition does not change the state. When T=l, the clock pulse transition compismmt
the state of the flipflop.
t--
T
o
I
Q(t) No Change
( t i t ) Complement
(c) Characteristic Table
Figure 4.7: T- Flip flop
Introduction to Digital 4.3.2 .Excitation Tables
Circuits
The characteristic tables of flip-flops provide the next state when inputs and the
present state are known. These tables are useful for analysis of sequential circuits.
But, during the design process, we know the required transition from present state to
next state and wish to find the required flip-flop inputs. Thus comes the need of a
table that lists the required input values for given change of state. Such a table is
called excitation Table. Fig 4.8 shows excitation tables for all flip-flops.
Q(t) & Q(t+l) indicates present and next state for flip a flop, respectively. The symbol
X in the table means don't care condition i.e. doesn't matter whether input is 0 or 1.
Let us discuss more deeply, how these excitation tables are formed. For this, we take
an example of J-K Flip flop.
I) The state transition from present state 0 to next state 0 (Figure 408 (a) can be
achieved when
2) The state transition fiom present state 0 to next state 1 can be achieved when
4) For state transition from present state 1 to next state 1 can be achieved when
(i) When the clock pulse is 0, the master flip-flop is disabled but the slave
6
becomes active and it's output Q & becomes equal to Y and Y
respectively. Why? Well the possible combination of the value of Y and Y'
are either Y=l , Y -0 or Y=O Y =l. Thus, the slave flip-flop can have
following combinations: -
(ii) When inputs are applied at JK and clock pulse becomes 1, only master gets
activated resulting in intermediate output Y going to state 0 or 1 depending on
the input and previous state. Remember that during this time slave is also
maintaining its'previous state only. As the clock pulse becomes 0, the master
becomes inactive and slave acquires the same state as master as explained in (a)
and (b) conditions above.
But why do we require this master-slave combination? To understand this, consider a
situation where output of one flipflop is going to be input of other flip-flop. Here, the
assumption is that clock pulse inputs of all flipflops are synchronized and occur at the
same time. The change of state of master occurs when the clock pulse goes to 1 but
during that time the output of slave still has not changed, thus the state of the flip-
flops in the system can be changed simultaneously during the same clock pulse even
though output of flip-flops are connected to the inputs of other flipflops.
The effective positive clock transition includes a minimum time called setup time, for
which the D input must be maintained at constant value before the occurrence of clock
transition. Similarly, a minimum time called hold time, for which the D input must
not change after the application of positive transition of the pulse.
Check Your Progress 2
1. What are the advantages of master- slave flipflop?
......................................................................................................................................
Let us take an example to illustrate the above procedure. Suppose we want to design
2-bit binary counter using D flip-flop. The circuit goes through repeated binary states
00, 0 1, 10 and 1 1 when external input X = 1 is applied. The state of circuit will not
change when X = 0. The state table & state diagram for this is shown in figure 4.12.
But how do we make this state diagram? Please note the number of flip-flops- 2 in
our example as we are designing 2 bits counter. Various states of two bit input would
be 00 01 10 and 11. These are shown in circle. The arrow indicate the transitions
on an input value X. For example, when the counter is in state 00 and input value
X=O occurs, the counter remains in 00 state. Hence the loop back on X= 0. However,
on encountering X=l the counter moves to state 01. Like wise in all other states
similar transition occur. For making state table remember the excitation table of D
flip-flop given in figure 4.8 (c).
The present state of the two flip-flops and next states of the flip-flops are put into the
table along with any input value. For example, if the present state of flip-flops is 01
and input value is 1 then counier will move to state 10. Notice these values in the
fourth row of the values in the state table (figure 4.12 (a).
Or we can write as
A A (Next) B (Next)
0 1X=1 1 0
This implies that flip-flop. A has moved from state clear to set. As we are making the
counter using D flip-flop, the question is what would be the input DAvalueof A flip-
flop that allows this transition that is Q(t) = 0 to Q(t+l) =1 possible for A flip flop.
On checking the excitation table for D Flip-flop, we find the value of D input of A
flip-flop (called DAin this example) would be 1. Similarly, the B flip-flop have a
transition Q(t) = 1 to Q(t+l)=O, thus, DB,would be 0. Hence notice the values of flip-
flop inputs DAand D,. (Row 3).
A B X A B D* DL4
0 0 0 0 0 0 0
0 0 1 0 1 0 I
0 1 0 0 1 0 I
0 1 1 I 0 1 0
1 0 0 1 0 1 0
1 0 1 I 1 1 1
1 I 0 1 1 1 1
1 1 1 0 0 0 0
L/
(a) State Table (b) State Diagram
Figure 4.12: Binary C~unterDesign
Next step indicates simplification of input equation to flip-flop which is done using
K-Maps as shown in fig 4.13. But why did we make K-map for DAor DBwhich
happens to be flip-flop input values? Please note in sequential circuit design, we are
96
~
~
designing the combinational logic that controls the state transition of flipflops. Thus, Principle I of Logit
each input to a flipflop is one output of this combinational logic and the present state Circuits II
of flip-flops and any other input value form the input values to this combinational
1!' logic.
r\
I
Clock
clear
A shift kgistei is used for shifting the data to the left or right. A shift register operates
in serial input-output mode i.e. data is entered in the register one bit at a time from one
end of the register and can be read from the other end as one bit at a time. Fig. 4.16
shows a Cbit right shift register using b logical shift functions.
I I I I I
.. I I
shift enable .
Clear
I I .. ,
.
.
. .
-C..,
~ b 4.16:
h 4-b@right rbm h -. :
r ".
Prineipks of i,qk
Please note that In thje register signal shift enable is used instead of clock pulse, why?
Circuits 11 ,
Because it is not necessary that we want the register to perform shift on each clock
pulse.
A register, which shifts data only in one direction, is called uni-direetio~alshift
regbter and a register, which egn shift data in both directions, is called M-dircctmnal
shin register, Shift reghter crrn be consttvcted for bi-directional shift with parallei
input-output. A general shift register 8tructure may have parallel data transfer to or
from the register along with added facility of left or right shift. This structure will
require additional control linse for indicating whether parallel or serial output is
deslred and left or right shlb is required, A general symbolic diagram is s h a m in Fig.
4.17 for this register.
There are 3 main control lines shown in the @bowfigure. If parallel load enable is
-
active, parallel input-output operatIan is done otherwise serial input- output shift
select Hne for selecting rlght or left $hilt. If it has value 0 then right shift is p e r f o n d
and for value 1, left shift is done, Shift enable aignal indicates when to start shift. '
P
Right shift data input
w U w
Enable for t
parallel,l o a d
b
!I
r
Parallel d.~r.iInput
1
circuits of digital systems where saquence and control operatiom are performed, for
example, in CPU we have program counter (PC).
Counters CIM be classified into two categories, based on the way thoy operate:
P Asynchronous and synchronous counters. In Asynchronous countem, the oh- in
stat'e of one flipflop triggers the other flip-flops. Synchronous counters arc relatively
faster because the state of all flip-flops can be changed at the same time,
1
~1
~
Asynchronous Counters :This is more often referred to as ripple counter, as*
change, which occurs in order to increment the counter ripples through it fnnn one
end to the other. Fig 4.1 8 shows an implementation of 4-bit ripple counter using J-K
flipflops. This counter is incremental on the occurrence of each clock pulse and
counts from 0000 to 1 1 11 (i.e. 0 to 15).
!
#
>$.
Introduction to Digital
Circuits Logleal I
-J Q - - 1 0- 1 Q- J Q-
C'lcrch --> CU: --> CUC -- >aX
K -K -K -- K
W I
C C C C
Clew
0 0 0, 0, 0,
The input line to J & K of all flipflops .is kept high i.e. logic]. Each time a clock
pulse occurs the value of flipflop is complemented (Refer to characteristictable of J
K flipflop in Figure. 4.6 (c). Please note that the clock pulse is given only to first flip-
flop and second flipflop onwards, the output of previous flipflop is fed as clock
signal. This implies that these flipflops will be complemented if the previous flipflop
has a value 1. Thus, the effect of complement will ripple through these flipflops.
J Q J Q- J
0-
-> ax -->ax -> aK
-- K -- K -- K
ad
I I I
0. 9 0,
You can understand the working of this counter by analyzing the sequence of states
(O,, O,, 0,) given in Figure 4.20
Here we will confine our discussion, in general to the RAM only as an example of
sequential circuit. A memory unit is a collection of storage cells or flip flops
alongwith associated circuits required to transfer information in and out of the device.
I
The access time and cycle time it takes are constant and independent of the location,
hence the name random access memory. 1
I
I
Select
I
K
Q ~ I
I
I
Readkite (W/R) J Q-
-.,
-
ReadlWrite
I
RAMS are organized (logically) as words of fixed length. The memory communicates
with other devices through data input and output lines, address selection lines and
control lines that specify the direction of transfer.
Now, let us try to understand how data is stored in memory. The internal construction
of a RAM of 'm' words and 'n' bits per word consists of m x n binary cells and ~
associat~d,circuitsfor dectecting individual words. Figure 4.21 shows logic diagram
and block digram of a binary cell.
The input is fed to AND gate 'a' in complemented form. The read operation is I
I
indicated by 1 on read1 write signal. Therefore during the read operation only the
'AND' gate 'c' becomes active. If the cell has been selected, then the output will I
. I
become equal to the state of flip flop i.e. the data value stored in flip flop is read. In
write operation 'a' & 'b' gates become active and they set or clear the J-K flip flop
depending upon the input value. Please note in case input is 0, the flip flop will go to I
clear state and if input is 1, the flip flop will go to set state. In effect, the input data is
i
101
IMm&xtion to Digital reflected in the state of flip-flop. Thus, we say that input data has been store&in flip
cws flop or binary cell.
Fig 4.22 is the extension of this binary cell to an IC RAM circuit, where a 2 x 4
decoder is used to seled one of the four words. (For 4 words we need 2 address lines)
Please note that each decoder output is connected to a 4bit word and the readlwrite
signal is given to each binary cell. Once the decoder selects the word, the readlwrite
input tells the operation. This is derived using an OR gate, since all the non-selected
cells will produce a zero output. When the memory select input to decoder is 0,none
of the words is selected and the contents of the cell are unchanged irrespective of
readwrite input.
Bit Inputs
Bit
4
Word 0
Word 2
Word 3
Bit Bit
Bit
4 3 Bit
2 I
mrlput
Figure-4.22: 4 X 4 RAM
.Ifter discussing so much about combinational circuits and sequential circuits, let us Principlrs o f I.o:ic
Circuits 11
discuss in the next section an example having a combination of both circuits.
[NOTE : Remember excitation table for J-K flip flop given in fig 4.81
There are 4 flip-flop inputs f@rdecade counter i.e. A, B, C, D. The next state of
flip-flop is given in the table. J, & K, indicates the flip flop input corresponding to
flip-flopA. Please note this counter require 4-flip-flops.
From this the flip flop input equations are simplified using K-Maps as shown in figure
4.24. The unused minterrns from 1010 through 1 11 1 are taken as don't care
conditions.
I, - BCD
Introduction + Digital
Circuits
->c A
- -
- .
K, A i
........,.....,......,......,......,.... .................,............,..........
,,
'Jn B
->C B
-
-R
Kn
I)
Clock
Count enable
Principles of Z.ogic
Check Your Progress 3 . Circuits I1
1) Differentiate between synchronous & asynchronous counters?
.....................................................................................................................................
.....................................................................................................................................
2) Can ripple counter be constructed from a shift register?
4.7 SUMMARY
As told to you earlier this unit provides you information regarding sequential circuits
which is the foundation of digital design. Flip-flops are basic storage unit in sequential
circuits are derived from the latches. The sequential circuit can be formed using
combinational circuits (discussed in the last unit) and flip flops. The behavior of
sequential circuit can be analyzed using tables & state diagrams.
Registers, counters etc. are structured sequential blocks. This unit has outlined the
construction of registers, counters, RAM etc. Lastly, we discussed how a circuit can
be designed using both sequential & combinational circuits. For more details, the
students can refer to further reading.
2) Flip flop is the basic storage element for synchronous sequential circuits.
Whereas latches are bistable devices whose state normally depends upon the
asynchronous inputs and are not suitable for use in synchronous sequential
circuits using single clock
3) Excitation table indicates that if present and next state are known then what will
be inputs whereas a characteristics table indicates just opposite of this i.e. inputs
are known the, next state has to be found.
2) Yes, but this: circuit will generate sequence of states where only 1-bit changes
atatime i.e. 0000,1000, 1100, 1110, 111 1,0111,0011,0001
3) Yes, We require 2' i.e. three flip flops for the sequence 0, 1,2,3,4,5&6.
0 0 0 0 0 1 O X 0 X 1 X
0 0 1 0 1 0 0 X 1 X X 1
0 1 0 0 1 1 O X X 0 1 X
0 1 1 1 0 0 1 X X 1 X 1
1 0 0 1 0 1 X 0 0 X 1 X
1 0 1 1 1 0 x 0 1 X X 1
1 1 0 0 0 0 X 1 X 1 0 X
The state is don't care condition: Make the suitable K-maps. The following are the
flip-flop input values:
. JA=BC KA=B
Jg=C I$=C+A
- -
Jc= A + B Kc= 1
Clock
Logical I