DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Sequential circuits
1. UNIT III
Sequential Circuits
By Dr. Dhobale J V
Associate Professor
School of Engineering & Technology
RNB Global University, Bikaner
RNB Global University, Bikaner. 1Course Code - 19004000
2. Objectives
Various types of flip-flops and their
conversions.
Registers, Timing issues, Counters-
Synchronous, Asynchronous.
Finite state machines.
Design of Synchronous sequential circuits.
Design of Asynchronous circuits, cycles,
races and hazards.
2RNB Global University, Bikaner.Course Code - 19004000
3. Flip-flops
Computers and calculators use Flip-flop for
their memory. A combination of number of flip
flops will produce some amount of memory.
Flip flop is formed using logic gates, which are
in turn made of transistors.
Flip flop are basic building blocks in the
memory of electronic devices.
Each flip flop can store one bit of data.
These are also called as sequential logic
circuits.
3RNB Global University, Bikaner.Course Code - 19004000
4. Flip-flops
Flip – flops have two stable states and hence
they are bistable multivibrators.
The two stable states are High (logic 1) and
Low (logic 0).
The term flip – flop is used as they can switch
between the states under the influence of a
control signal (clock or enable) i.e. they can
‘flip’ to one state and ‘flop’ back to other state.
Flip – flops are a binary storage device
because they can store binary data (0 or 1).
4RNB Global University, Bikaner.Course Code - 19004000
5. Flip-flops
Flip – flops are edge sensitive or edge
triggered devices i.e. they are sensitive to the
transition rather than the duration or width of
the clock signal.
They are also known as signal change
sensitive devices which mean that the change
in the level of clock signal will bring change in
output of the flip flop.
Flip flops are also used to control the digital
circuit’s functionality. They can change the
operation of a digital circuit depending on the
state. 5RNB Global University, Bikaner.Course Code - 19004000
7. Flip-flops
Where we use flip flops?
Registers: As the flip flops have two stable
states, we use them in memory elements like
registers, for data storage. Generally we use
registers in electronic devices like computers.
Counters: The groups of interconnected flip
flops are uses as counters, to count the
increment or decrement of an event
occurrence.
7RNB Global University, Bikaner.Course Code - 19004000
8. Flip-flops
Where we use flip flops?
Frequency division: Flip flops are used as
frequency division circuits, which divide the
input frequency to exactly to its half.
Frequency division circuits are used to
regularize the frequency of electronic circuits.
Data transfer: We use shift registers (A
special-type of registers) to transfer the data
from one flip flop to another, which are
connected in a specific order.
8RNB Global University, Bikaner.Course Code - 19004000
9. Flip-flops
SR flip-flop: Besides the CLOCK input, an SR
flip-flop has two inputs, labeled SET and
RESET.
If the SET input is HIGH when the clock is
triggered, the Q output goes HIGH. If the
RESET input is HIGH when the clock is
triggered, the Q output goes LOW.
9RNB Global University, Bikaner.Course Code - 19004000
10. Flip-flops
SR flip-flop:
Note that in an SR flip-flop, the SET and
RESET inputs shouldn’t both be HIGH when
the clock is triggered.
This is considered an invalid input condition,
and the resulting output isn’t predictable if this
condition occurs.
10RNB Global University, Bikaner.Course Code - 19004000
13. Flip-flops
D flip-flop:
D flip flop is actually a slight modification of the
clocked SR flip-flop.
From the figure you can see that the D input is
connected to the S input and the complement
of the D input is connected to the R input.
The D input is passed on to the flip flop when
the value of CP is ‘1’. When CP is HIGH, the
flip flop moves to the SET state. If it is ‘0’, the
flip flop switches to the CLEAR state.
13RNB Global University, Bikaner.Course Code - 19004000
15. Flip-flops
J-K flip-flop:
A J-K flip flop can also be defined as a
modification of the S-R flip flop. The only
difference is that the intermediate state is
more refined and precise than that of a S-R
flip flop.
The behavior of inputs J and K is same as the
S and R inputs of the S-R flip flop. The letter J
stands for SET and the letter K stands for
CLEAR.
15RNB Global University, Bikaner.Course Code - 19004000
16. Flip-flops
J-K flip-flop:
When both the inputs J and K have a HIGH
state, the flip-flop switch to the complement
state. So, for a value of Q = 1, it switches to
Q=0 and for a value of Q = 0, it switches to
Q=1.
The circuit includes two 3-input AND gates.
The output Q of the flip flop is returned back
as a feedback to the input of the AND along
with other inputs like K and clock pulse [CP].
16RNB Global University, Bikaner.Course Code - 19004000
17. Flip-flops
J-K flip-flop:
So, if the value of CP is ‘1’, the flip flop gets a
CLEAR signal and with the condition that the
value of Q was earlier 1.
Similarly output Q’ of the flip flop is given as a
feedback to the input of the AND along with
other inputs like J and clock pulse [CP].
So the output becomes SET when the value of
CP is 1 only if the value of Q’ was earlier 1.
17RNB Global University, Bikaner.Course Code - 19004000
18. Flip-flops
J-K flip-flop:
The output may be repeated in transitions
once they have been complimented for J=K=1
because of the feedback connection in the JK
flip-flop.
This can be avoided by setting a time duration
lesser than the propagation delay through the
flip-flop. The restriction on the pulse width can
be eliminated with a master-slave or edge-
triggered construction.
18RNB Global University, Bikaner.Course Code - 19004000
19. Flip-flops
T flip-flop:
This is a much simpler version of the J-K flip
flop. Both the J and K inputs are connected
together and thus are also called a single input
J-K flip flop.
When clock pulse is given to the flip flop, the
output begins to toggle. Here also the
restriction on the pulse width can be
eliminated with a master-slave or edge-
triggered construction.
19RNB Global University, Bikaner.Course Code - 19004000
21. Flip-flops - Conversions
As flip-flops are bistable devices, these
sequential circuits are sometimes called
“latches” because their outputs are locked or
latched onto their input state until there is
another change to its input condition.
The interconnection of digital logic gates to
produce a memory device leads to
applications such as switch debounce circuits,
shift registers and counters, etc.
21RNB Global University, Bikaner.Course Code - 19004000
22. Flip-flops - Conversions
For the conversion of one flip flop to another,
a combinational circuit has to be designed
first.
If a JK Flip Flop is required, the inputs are
given to the combinational circuit and the
output of the combinational circuit is
connected to the inputs of the actual flip flop.
Thus, the output of the actual flip flop is the
output of the required flip flop.
22RNB Global University, Bikaner.Course Code - 19004000
23. Flip-flops - Conversions
SR Flip Flop to JK Flip Flop:
J and K will be given as external inputs to S
and R.
As shown in the logic diagram below, S and R
will be the outputs of the combinational circuit.
The truth tables for the flip flop conversion are
given below.
The present state is represented by Qp and
Qp+1 is the next state to be obtained when the
J and K inputs are applied.
23RNB Global University, Bikaner.Course Code - 19004000
24. Flip-flops - Conversions
SR Flip Flop to JK Flip Flop:
For two inputs J and K, there will be eight
possible combinations.
For each combination of J, K and Qp, the
corresponding Qp+1 states are found.
Qp+1 simply suggests the future values to be
obtained by the JK flip flop after the value of
Qp.
24RNB Global University, Bikaner.Course Code - 19004000
25. Flip-flops - Conversions
SR Flip Flop to JK Flip Flop:
25RNB Global University, Bikaner.Course Code - 19004000
26. Flip-flops - Conversions
JK Flip Flop to SR Flip Flop:
This will be the reverse process of the above
explained conversion.
S and R will be the external inputs to J and K.
As shown in the logic diagram below, J and K
will be the outputs of the combinational circuit.
Thus, the values of J and K have to be
obtained in terms of S, R and Qp. The logic
diagram is shown below.
26RNB Global University, Bikaner.Course Code - 19004000
27. Flip-flops - Conversions
JK Flip Flop to SR Flip Flop:
A conversion table is to be written using S, R,
Qp, Qp+1, J and K.
For two inputs, S and R, eight combinations
are made.
For each combination, the corresponding
Qp+1 outputs are found
27RNB Global University, Bikaner.Course Code - 19004000
28. Flip-flops - Conversions
JK Flip Flop to SR Flip Flop:
28RNB Global University, Bikaner.Course Code - 19004000
29. Flip-flops - Conversions
SR Flip Flop to D Flip Flop:
As shown in the figure, S and R are the actual
inputs of the flip flop and D is the external
input of the flip flop.
The four combinations, the logic diagram,
conversion table, and the K-map for S and R
in terms of D and Qp are shown below.
29RNB Global University, Bikaner.Course Code - 19004000
30. Flip-flops - Conversions
SR Flip Flop to D Flip Flop:
30RNB Global University, Bikaner.Course Code - 19004000
31. Flip-flops - Conversions
D Flip Flop to SR Flip Flop:
D is the actual input of the flip flop and S and
R are the external inputs.
Eight possible combinations are achieved from
the external inputs S, R and Qp. But, since the
combination of S=1 and R=1 are invalid, the
values of Qp+1 and D are considered as “don’t
cares”.
The logic diagram showing the conversion
from D to SR, and the K-map for D in terms of
S, R and Qp are shown below.
31RNB Global University, Bikaner.Course Code - 19004000
32. Flip-flops - Conversions
D Flip Flop to SR Flip Flop:
32RNB Global University, Bikaner.Course Code - 19004000
33. Flip-flops - Conversions
JK Flip Flop to T Flip Flop:
J and K are the actual inputs of the flip flop
and T is taken as the external input for
conversion.
Four combinations are produced with T and
Qp. J and K are expressed in terms of T and
Qp.
The conversion table, K-maps, and the logic
diagram are given below.
33RNB Global University, Bikaner.Course Code - 19004000
34. Flip-flops - Conversions
JK Flip Flop to T Flip Flop:
34RNB Global University, Bikaner.Course Code - 19004000
35. Flip-flops - Conversions
JK Flip Flop to D Flip Flop:
D is the external input and J and K are the
actual inputs of the flip flop. D and Qp make
four combinations. J and K are expressed in
terms of D and Qp.
The four combination conversion table, the K-
maps for J and K in terms of D and Qp, and
the logic diagram showing the conversion from
JK to D are given below.
35RNB Global University, Bikaner.Course Code - 19004000
36. Flip-flops - Conversions
JK Flip Flop to D Flip Flop:
36RNB Global University, Bikaner.Course Code - 19004000
37. Flip-flops - Conversions
D Flip Flop to JK Flip Flop:
In this conversion, D is the actual input to the
flip flop and J and K are the external inputs. J,
K and Qp make eight possible combinations,
as shown in the conversion table below. D is
expressed in terms of J, K and Qp.
The conversion table, the K-map for D in terms
of J, K and Qp and the logic diagram showing
the conversion from D to JK are given in the
figure below.
37RNB Global University, Bikaner.Course Code - 19004000
38. Flip-flops - Conversions
D Flip Flop to JK Flip Flop:
38RNB Global University, Bikaner.Course Code - 19004000
39. Registers
A register is made out of multiple flip-flops
connected to each other used to store multiple
bits of data. If we have ‘n’ flip-flops, we can
store ‘n’ bits of data.
39RNB Global University, Bikaner.Course Code - 19004000
40. Registers
The binary data in a register can be moved
within the register from one flip-flop to another.
The registers that allow such data transfers
are called as shift registers. There are four
mode of operations of a shift register.
1. Serial Input Serial Output
2. Serial Input Parallel Output
3. Parallel Input Serial Output
4. Parallel Input Parallel Output
40RNB Global University, Bikaner.Course Code - 19004000
41. Registers
1. Serial Input Serial Output:
Let all the flip-flop be initially in the reset
condition i.e. Q3 = Q2= Q1 = Q0 = 0.
If an entry of a four bit binary number 1 1 1 1 is
made into the register, this number should be
applied to Din bit with the LSB bit applied first.
The D input of FF-3 i.e. D3 is connected to
serial data input Din. Output of FF-3 i.e. Q3 is
connected to the input of the next flip-flop i.e.
D2 and so on.
41RNB Global University, Bikaner.Course Code - 19004000
45. Registers
Serial In Parallel Out (SIPO): For this kind of
register, data bits are entered serially in the
same manner as discussed in the last section.
The difference is the way in which the data bits
are taken out of the register.
Once the data are stored, each bit appears on
its respective output line, and all bits are
available simultaneously.
45RNB Global University, Bikaner.Course Code - 19004000
46. Registers
Serial In Parallel Out (SIPO):
In the table below, we can see how the four-bit
binary number 1001 is shifted to the Q outputs
of the register.
46RNB Global University, Bikaner.Course Code - 19004000
47. Registers
Serial In Parallel Out (SIPO):
47RNB Global University, Bikaner.Course Code - 19004000
48. Registers
Parallel In Serial Out (PISO): A four-bit parallel
in - serial out shift register is shown below.
The circuit uses D flip-flops and NAND gates
for entering data (ie writing) to the register.
48RNB Global University, Bikaner.Course Code - 19004000
49. Registers
Parallel In Serial Out (PISO):
D0, D1, D2 and D3 are the parallel inputs,
where D0 is the most significant bit and D3 is
the least significant bit.
49RNB Global University, Bikaner.Course Code - 19004000
50. Registers
Parallel In Serial Out (PISO): To write data in,
the mode control line is taken to LOW and the
data is clocked in.
The data can be shifted when the mode
control line is HIGH as SHIFT is active high.
The register performs right shift operation on
the application of a clock pulse, as shown in
the table below.
50RNB Global University, Bikaner.Course Code - 19004000
51. Registers
Parallel In Serial Out (PISO):
51RNB Global University, Bikaner.Course Code - 19004000
52. Registers
Parallel In Serial Out (PISO): To write data in,
the mode control line is taken to LOW and the
data is clocked in.
The data can be shifted when the mode
control line is HIGH as SHIFT is active high.
The register performs right shift operation on
the application of a clock pulse, as shown in
the table below.
52RNB Global University, Bikaner.Course Code - 19004000
53. Registers
Parallel In Parallel Out (PIPO): For parallel in -
parallel out shift registers, all data bits appear
on the parallel outputs immediately following
the simultaneous entry of the data bits.
The following circuit is a four-bit parallel in -
parallel out shift register constructed by D flip-
flops.
53RNB Global University, Bikaner.Course Code - 19004000
54. Registers
Parallel In Parallel Out (PIPO):
The D's are the parallel inputs and the Q's are
the parallel outputs.
54RNB Global University, Bikaner.Course Code - 19004000
55. Registers
Parallel In Parallel Out (PIPO):
Once the register is clocked, all the data at the
D inputs appear at the corresponding Q
outputs simultaneously.
55RNB Global University, Bikaner.Course Code - 19004000
56. Registers
Bidirectional Shift Register: The registers
discussed so far involved only right shift
operations.
Each right shift operation has the effect of
successively dividing the binary number by
two.
If the operation is reversed (left shift), this has
the effect of multiplying the number by two.
56RNB Global University, Bikaner.Course Code - 19004000
57. Registers
Bidirectional Shift Register: With suitable
gating arrangement a serial shift register can
perform both operations.
A bidirectional, or reversible, shift register is
one in which the data can be shift either left or
right.
A four-bit bidirectional shift register using D
flip-flops is shown below.
57RNB Global University, Bikaner.Course Code - 19004000
59. Registers
Bidirectional Shift Register: Here a set of
NAND gates are configured as OR gates to
select data inputs from the right or left
adjacent bistables, as selected by the
LEFT/RIGHT control line.
59RNB Global University, Bikaner.Course Code - 19004000
60. Counters
Counter is a sequential circuit.
A digital circuit which is used for a counting
pulses is known counter.
Counter is the widest application of flip-flops.
It is a group of flip-flops with a clock signal
applied.
Counters are of two types:
1. Asynchronous.
2. Synchronous counters.
60RNB Global University, Bikaner.Course Code - 19004000
61. Counters
In an asynchronous counter, an
external event is used to directly SET or
CLEAR a flip-flop when it occurs.
In a synchronous counter however,
the external event is used to produce a
pulse that is synchronised with the
internal clock.
61RNB Global University, Bikaner.Course Code - 19004000
62. Counters
1. Asynchronous : The logic diagram of a 2-bit
ripple up counter is shown in figure.
The toggle (T) flip-flop are being used. But
we can use the JK flip-flop also with J and K
connected permanently to logic 1.
External clock is applied to the clock input of
flip-flop A and QA output is applied to the
clock input of the next flip-flop i.e. FF-B.
62RNB Global University, Bikaner.Course Code - 19004000
68. Counters
1. Asynchronous : Operations
68RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
Initially let both the FFs
be in the reset state
QBQA = 00 initially
After 1st negative clock
edge
As soon as the first negative clock
edge is applied, FF-A will toggle and
QA will be equal to 1.
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 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.
69. Counters
1. Asynchronous :
69RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
After 2nd negative clock
edge
On the arrival of second negative clock
edge, FF-A toggles again and QA = 0.
The change in QA acts as a negative
clock edge for FF-B. So it will also
toggle, and QB will be 1.
QBQA = 10 after the second clock
pulse.
70. Counters
1. Asynchronous :
70RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
After 3rd negative clock
edge
On the arrival of 3rd negative clock
edge, FF-A toggles again and
QA become 1 from 0.
Since this is a positive going change,
FF-B does not respond to it and
remains inactive. So QB does not
change and continues to be equal to 1.
QBQA = 11 after the third clock pulse.
71. Counters
1. Asynchronous :
71RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
After 4th negative clock
edge
On the arrival of 4th negative clock
edge, FF-A toggles again and
QA becomes 1 from 0.
This negative change in QA acts as
clock pulse for FF-B. Hence it toggles
to change QBfrom 1 to 0.
QBQA = 00 after the fourth clock pulse.
72. Counters
2. Synchronous Counter: If the "clock" pulses
are applied to all the flip-flops in a counter
simultaneously, then such a counter is called
as synchronous counter.
2-bit Synchronous up counter
The JA and KA inputs of FF-A are tied to logic
1. So FF-A will work as a toggle flip-flop. The
JB and KB inputs are connected to QA.
72RNB Global University, Bikaner.Course Code - 19004000
74. Counters
2. Synchronous Counter: Operations
74RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
Initially let both the FFs
be in the reset state
QBQA = 00 initially.
After 1st negative clock
edge
As soon as the first negative clock
edge is applied, FF-A will toggle and
QA will change from 0 to 1.
But at the instant of application of
negative clock edge, QA , JB = KB = 0.
Hence FF-B will not change its state.
So QB will remain 0.
QBQA = 01 after the first clock pulse.
75. Counters
2. Synchronous Counter: Operations
75RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
After 2nd negative clock
edge
On the arrival of second negative clock
edge, FF-A toggles again and
QA changes from 1 to 0.
But at this instant QAwas 1. So JB =
KB= 1 and FF-B will toggle. Hence
QB changes from 0 to 1.
QBQA = 10 after the second clock
pulse.
76. Counters
2. Synchronous Counter: Operations
76RNB Global University, Bikaner.Course Code - 19004000
Condition Operation
After 3rd negative clock
edge
On application of the third falling clock
edge, FF-A will toggle from 0 to 1 but
there is no change of state for FF-B.
QBQA = 11 after the third clock pulse.
After 4th negative clock
edge
On application of the next clock pulse,
QAwill change from 1 to 0 as QB will
also change from 1 to 0.
QBQA = 00 after the fourth clock pulse.
77. Counters
Classification of Counter: Depending on the
way in which the counting progresses, the
synchronous or asynchronous counters are
classified as follows −
1. Up counters
2. Down counters
3. Up/Down counters
77RNB Global University, Bikaner.Course Code - 19004000
78. Counters
Classification of Counter: A ripple counter is
an asynchronous counter where only the
first flip-flop is clocked by an external clock. All
subsequent flip-flops are clocked by the output
of the preceding flip-flop.
Asynchronous counters are also
called ripple-counters because of the way the
clock pulse ripples it way through the flip-flops.
78RNB Global University, Bikaner.Course Code - 19004000
79. Counters
Up/Down counters: Up counter and down
counter is combined together to obtain an
UP/DOWN counter.
A mode control (M) input is also provided to
select either up or down mode.
A combinational circuit is required to be
designed and used between each pair of flip-
flop in order to achieve the up/down
operation.
Type of up/down counters
UP/DOWN ripple counters
UP/DOWN synchronous counter 79RNB Global University, Bikaner.Course Code - 19004000
80. Counters
UP/DOWN Ripple Counters: In the
UP/DOWN ripple counter all the FFs operate
in the toggle mode.
So either T flip-flops or JK flip-flops are to be
used. The LSB flip-flop receives clock
directly. But the clock to every other FF is
obtained from (Q = Q bar) output of the
previous FF.
80RNB Global University, Bikaner.Course Code - 19004000
81. Counters
UP/DOWN Ripple Counters:
UP counting mode (M=0) − The Q output of
the preceding FF is connected to the clock of
the next stage if up counting is to be achieved.
For this mode, the mode select input M is at
logic 0 (M=0).
DOWN counting mode (M=1) − If M = 1, then
the Q bar output of the preceding FF is
connected to the next FF. This will operate the
counter in the counting mode.
81RNB Global University, Bikaner.Course Code - 19004000
84. Counters
Modulus Counter (MOD-N Counter): The 2-bit
ripple counter is called as MOD-4 counter and 3-bit
ripple counter is called as MOD-8 counter.
MOD counters are defined based on the number of
states that the counter will sequence through before
returning back to its original value.
For example, a 2-bit counter that counts from 002 to
112 in binary, that is 0 to 3 in decimal, has a modulus
value of 4 ( 00 → 01 → 10 → 11 , return back to 00 )
so would therefore be called a modulo-4, or mod-4,
counter.
So in general, an n-bit ripple counter is called as
modulo-N counter.
Where, MOD number = 2n.
84RNB Global University, Bikaner.Course Code - 19004000
86. Counters
Modulus Counter (MOD-N Counter): It is also
called as Johnson Counter.
86RNB Global University, Bikaner.Course Code - 19004000
87. Counters
Ring Counter: A ring counter is a Shift
Register (a cascade connection of flip-flops)
with the output of the last flip flop connected to
the input of the first.
It is initialised such that only one of the flip flop
output is 1 while the remander is 0. ... It can be
implemented using D-type flip-flops (or JK-
type flip-flops).
87RNB Global University, Bikaner.Course Code - 19004000
89. Finite State Machines
There are many ways of modeling the
behavior of systems, and the use of state
machines is one of the oldest and best known.
State machines allow us to think about the
“state” of a system at a particular point in time
and characterize the behavior of the system
based on that state.
The use of this modeling technique is not
limited to the development of software
systems.
89RNB Global University, Bikaner.Course Code - 19004000
90. Finite State Machines
In fact, the idea of state-based behavior can
be traced back to the earliest considerations of
physical matter.
For example, H2O can exist in 3 different
states easily observable in nature: solid (ice),
liquid (water), and gaseous (steam, fog,
clouds).
In each of these states, the behavior of H2O is
different. The means of forcing transitions
between the 3 states is also well-defined.
90RNB Global University, Bikaner.Course Code - 19004000
91. Finite State Machines
Many other natural and artificial systems may
also be modeled by defining
1. The possible states the system can occupy,
2. The behavior in each of those states, and
3. How the system transitions between the
states, including which states are “connected”
and which are not.
91RNB Global University, Bikaner.Course Code - 19004000
92. Finite State Machines
We can use a similar technique to model and
design software systems by identifying what
states the system can be in, what inputs or
events trigger state transitions, and how the
system will behave in each state.
92RNB Global University, Bikaner.Course Code - 19004000
93. Finite State Machines
An FSM, in its most general form, is a set of
flipflops that hold only the current state, and a
block of combinational logic that determines
the the next state given the current state and
some inputs.
The output is determined by what the current
state is.
Take a look at the following diagram.
93RNB Global University, Bikaner.Course Code - 19004000
94. Finite State Machines
This is what an FSM looks like in hardware. The only
storage it has is for the current state. Since the main
block of logic is combinational, there can't be any flip-
flops inside of it. Remember, combinational
logic will produce the same outputs given the same
set of inputs at any time. 94RNB Global University, Bikaner.Course Code - 19004000
95. Finite State Machines
The first thing to do when designing an FSM is
to figure out what states you will need.
Since we are going to use the FSM to control
a robot, we need to think about the behavior
we want.
First, the robot has two contact switches
mounted on the front of it as shown below.
95RNB Global University, Bikaner.Course Code - 19004000
97. Finite State Machines
These are wired up so that when they are not
being pressed, the signal line is connected to
ground, but when pressed, it get connected
to +5V.
By using these switches, the robot can realize
when it runs into something. For some basic
object avoidance, we will make the robot
back up when it hits something then turn right
if the left switch was pressed or turn left if the
right switch was pressed.
97RNB Global University, Bikaner.Course Code - 19004000
98. Finite State Machines
When the robot hasn't hit anything it will just
drive forward.
This leads us to five states.
1. FORWARD
2. BACKUP_RIGHT
3. TURN_RIGHT
4. BACKUP_LEFT
5. TURN_LEFT
98RNB Global University, Bikaner.Course Code - 19004000
99. Finite State Machines
Notice that there are two versions of
the BACKUP state, BACKUP_RIGHT and BA
CKUP_LEFT. This is because we need to
encode in the states which one will turn right
after it backs up and which will turn left. If we
didn't have separate states, we would have to
read the state of the switch after it backed up
and at that point the switch would not be
pressed anymore.
99RNB Global University, Bikaner.Course Code - 19004000
101. Finite State Machines
State Transitions:
101RNB Global University, Bikaner.Course Code - 19004000
102. Design of Sequential Circuits
Design problem normally starts with a word
description of input output relation and ends
with a circuit diagram having sequential and
combinatorial logic elements.
Sequential logic circuit design refers to
synchronous clock-triggered circuit because of
its design and implementation advantages.
102RNB Global University, Bikaner.Course Code - 19004000
103. Design of Sequential Circuits
Steps involved in design of sequential
circuit:
1. Input output relation.
2. State transition diagram or Algorithmic State
Machine (ASM)chart.
3. State synthesis table –
1. Flip Flop based implementation - excitation tables are
used to generate design equations through Karnaugh Map.
2. Read Only Memory (ROM) based implementation -
excitation tables are not required but flip-flops are used as
delay elements
103RNB Global University, Bikaner.Course Code - 19004000
104. Design of Sequential Circuits
Steps involved in design of sequential
circuit:
4. Circuit diagram is developed from these
design equations.
104RNB Global University, Bikaner.Course Code - 19004000
105. Design of Sequential Circuits
State machine design: There are two
different approaches of state machine design
called Moore model and Mealy model.
In Moore model circuit outputs, also called
primary outputs are generated solely from
secondary outputs or memory values.
105RNB Global University, Bikaner.Course Code - 19004000
106. Design of Sequential Circuits
State machine design: In Mealy model circuit
inputs, also known as primary inputs combine
with memory elements to generate circuit
output.
106RNB Global University, Bikaner.Course Code - 19004000
107. Design of Sequential Circuits
107RNB Global University, Bikaner.Course Code - 19004000
108. Design of Sequential Circuits
CONVERSION FROM ONE MODEL TO
OTHER:
Conversion from one model to other can be
done through state diagram representation.
Depending on application requirements we
choose one of these two models or a mixed
model where a part of the circuit follows Mealy
model and the other Moore model.
108RNB Global University, Bikaner.Course Code - 19004000
109. Design of Sequential Circuits
Sequential Circuit Design Steps: The design
of sequential circuit starts with verbal
specifications of the problem.
109RNB Global University, Bikaner.Course Code - 19004000
110. Design of Sequential Circuits
Sequential Circuit Design Steps:
The next step is to derive the state table of the
sequential circuit. A state table represents the
verbal specifications in a tabular form.
In certain cases state table can be derived
directly from verbal description of the problem.
In other cases, it is easier to first obtain a state
diagram from the verbal description and then
obtain the state table from the state diagram.
110RNB Global University, Bikaner.Course Code - 19004000
111. Design of Sequential Circuits
Sequential Circuit Design Steps:
A state diagram is a graphical representation
of the sequential circuit.
In the next step, we proceed by simplifying the
state table by minimizing the number of states
and obtain a reduced state table.
The states in the reduced state table are then
assigned binary-codes. The resulting table is
called output and state transition table.
111RNB Global University, Bikaner.Course Code - 19004000
112. Design of Sequential Circuits
Sequential Circuit Design Steps:
From the state transition table and using flip-
flop’s excitation tables, flip-flops input
equations are derived. Furthermore, the output
equations can readily be derived as well.
Finally, the logic diagram of the sequential
circuit is constructed.
An example will be used to illustrate all these
concepts.
112RNB Global University, Bikaner.Course Code - 19004000
113. Design of Sequential Circuits - Example
Sequence Recognizer:
A sequence recognizer is to be designed to
detect an input sequence of ‘1011’. The
sequence recognizer outputs a ‘1’ on the
detection of this input sequence. The
sequential circuit is to be designed using JK
and D type flip-flops.
A sample input/output trace for the sequence
detector is shown in Table below.
113RNB Global University, Bikaner.Course Code - 19004000
114. Design of Sequential Circuits - Example
Sequence Recognizer:
We will begin solving the problem by first
forming a state diagram from the verbal
description.
A state diagram consists of circles (which
represent the states) and directed arcs that
connect the circles and represent the
transitions between states. 114RNB Global University, Bikaner.Course Code - 19004000
115. Design of Sequential Circuits - Example
Sequence Recognizer:
In a state diagram:
1. The number of circles is equal to the number
of states. Every state is given a label (or a
binary encoding) written inside the
corresponding circle.
2. The number of arcs leaving any circle is 2n,
where n is the number of inputs of the
sequential circuit.
115RNB Global University, Bikaner.Course Code - 19004000
116. Design of Sequential Circuits - Example
Sequence Recognizer:
Before we begin our design, the following
should be noted
1. We do not have an idea about how many
states the machine will have.
2. The states are used to “remember”
something about the history of past inputs.
For the sequence 1011, in order to be able to
produce the output value 1 when the final 1 in
the sequence is received, the circuit must be
in a state that “remembers” that the previous
three inputs were 101. 116RNB Global University, Bikaner.Course Code - 19004000
117. Design of Sequential Circuits - Example
Sequence Recognizer:
Before we begin our design, the following
should be noted.
3. There can be more than one possible state
machine with the same behavior.
117RNB Global University, Bikaner.Course Code - 19004000
118. Design of Sequential Circuits - Example
Deriving the State Diagram :
Let us begin with an initial state (since a state
machine must have at least one state) and
denote it with ‘S0’ as shown in Figure below :
118RNB Global University, Bikaner.Course Code - 19004000
119. Design of Sequential Circuits - Example
Deriving the State Diagram :
Two arcs leave state ‘S0’ depending on the input
(being a 0 or a 1). If the input is a 0, then we return
back to the same state. If the input is a 1, then we
have to remember it (recall that we are trying to detect
a sequence of 1011). We remember that the last input
was a one by changing the state of the machine to a
new state, say ‘S1’. This is illustrated in Figure below :
119RNB Global University, Bikaner.Course Code - 19004000
120. Design of Sequential Circuits - Example
Deriving the State Diagram :
‘S1’ represents a state when the last single bit
of the sequence was one. Outputs for both
transitions are zero, since we have not
detected what we are looking for.
120RNB Global University, Bikaner.Course Code - 19004000
121. Design of Sequential Circuits - Example
Deriving the State Diagram :
Again in state ‘S1’, we have two outgoing arcs.
If the input is a 1, then we return to the same
state and if the input is a 0, then we have to
remember it (second number in the
sequence). We can do so by transiting to a
new state, say ‘S2’. This is illustrated in Figure
below:
121RNB Global University, Bikaner.Course Code - 19004000
122. Design of Sequential Circuits - Example
Deriving the State Diagram :
Note that if the input applied is ‘1’, the next
state is still ‘S1’ and not the initial state ‘S0’.
This is because we take this input 1 as the first
digit of new sequence. The output still remains
0 as we have not detected the sequence.
122RNB Global University, Bikaner.Course Code - 19004000
123. Design of Sequential Circuits - Example
Deriving the State Diagram :
State ‘S2’ represents detection of ‘10’ as the last two
bits of the sequence. If now the input is a ‘1’, we have
detected the third bit in our sequence and need to
remember it. We remember it by transiting to a new
state, say ‘S3’ as shown in Figure below. If the input is
‘0’ in state ‘S2’ then it breaks the sequence and we
need to start all over again. This is achieved by
transiting to initial state ‘S0’. The outputs are still 0.
123RNB Global University, Bikaner.Course Code - 19004000
124. Design of Sequential Circuits - Example
Deriving the State Diagram :
In state ‘S3’, we have detected input sequence ‘101’.
Another input 1 completes our detection sequence as
shown in Figure 2 below. This is signaled by an output
1. However we transit to state ‘S1’ instead of ‘S0’
since this input 1 can be counted as first 1 of a new
sequence. Application of input 0 to state ‘S3’ means
an input sequence of 1010. This implies the last two
bits in the sequence were 10 and we transit to a state
that remembers this input sequence, i.e. state ‘S2’.
Output remains as zero.
124RNB Global University, Bikaner.Course Code - 19004000
125. Design of Sequential Circuits - Example
Deriving the State Table:
A state table represents time sequence of
inputs, outputs, and states in a tabular form.
The state table for the previous state diagram
is shown in Table below.
125RNB Global University, Bikaner.Course Code - 19004000
126. Design of Sequential Circuits - Example
Deriving the State Table:
The state table can also be represented in an
alternate form as shown in Table:
126RNB Global University, Bikaner.Course Code - 19004000
127. Design of Sequential Circuits - Example
Deriving the State Table:
Here the present state and inputs are
tabulated as inputs to the combinational
circuit. For every combination of present state
and input, next state column is filled from the
state table.
The number of flip-flops required is equal to
[log2(number of states)].
Thus, the state machine given in the figure will
require two flip-flops [log2(4)]=2. We assign
letters A and B to them
127RNB Global University, Bikaner.Course Code - 19004000
128. Design of Sequential Circuits - Example
State Assignment :
The states in the constructed state diagram
have been assigned symbolic names rather
than binary codes.
It is necessary to replace these symbolic
names with binary codes in order to proceed
with the design.
In general, if there are m states, then the
codes must contain n bits, where 2n ≥ m, and
each state must be assigned a unique code.
128RNB Global University, Bikaner.Course Code - 19004000
129. Design of Sequential Circuits - Example
State Assignment :
There can be many possible assignments for
our state machine. One possible assignment is
show in Table below:
129RNB Global University, Bikaner.Course Code - 19004000
130. Design of Sequential Circuits - Example
State Assignment :
The assignment of state codes to states
results in state transition table as shown -
130RNB Global University, Bikaner.Course Code - 19004000
131. Design of Sequential Circuits - Example
State Assignment :
It is important to mention here that the binary
code of the present state at a given time t
represents the values stored in the flip-flops;
and the next-state represents the values of the
flip-flops one clock period later, at time t+1.
131RNB Global University, Bikaner.Course Code - 19004000
132. Design of Sequential Circuits - Example
General Structure of Sequence Recognizer:
The specifications required using JK and D
type flip-flops.
Referring to the general structure of sequential
circuit shown in Figure below, our synthesized
circuit will look like that as shown in the figure.
Observe the feedback paths.
132RNB Global University, Bikaner.Course Code - 19004000
133. Design of Sequential Circuits - Example
General Structure of Sequence Recognizer:
133RNB Global University, Bikaner.Course Code - 19004000
134. Design of Sequential Circuits - Example
General Structure of Sequence Recognizer:
The state transition table as shown can now
be expanded to construct the excitation table
for the circuit.
Since we are designing the sequential circuit
using JK and D type flip-flops, we need to
correlate the required transitions in state
transition table with the excitation tables of JK
and D type-flip-flops.
134RNB Global University, Bikaner.Course Code - 19004000
135. Design of Sequential Circuits - Example
General Structure of Sequence Recognizer:
The functionality of the required combinational
logic is encapsulated in the excitation table.
Thus, the excitation table is next simplified
using map or other simplification methods to
yield Boolean expressions for inputs of the
used flip-flops as well as the circuit outputs.
135RNB Global University, Bikaner.Course Code - 19004000
136. Design of Sequential Circuits - Example
Deriving the Excitation Table:
Excitation table for D flip-flop-
136RNB Global University, Bikaner.Course Code - 19004000
137. Design of Sequential Circuits - Example
Deriving the Excitation Table:
Excitation table for J-K flip-flop-
137RNB Global University, Bikaner.Course Code - 19004000
138. Design of Sequential Circuits - Example
Deriving the Excitation Table:
The excitation table (See Table below)
describes the behavior of the combinational
portion of sequential circuit.
138RNB Global University, Bikaner.Course Code - 19004000
139. Design of Sequential Circuits - Example
Deriving the Excitation Table:
For deriving the actual circuitry for the
combinational circuit, we need to simplify the
excitation table in a similar way we used to
simplify truth tables for purely combinational
circuits.
Whereas in combinational circuits, our concern
were only circuit outputs; in sequential circuits,
the combinational circuitry is also feeding the
flip-flops inputs. Thus, we need to simplify the
excitation table for both outputs as well as flip-
flops inputs. 139RNB Global University, Bikaner.Course Code - 19004000
140. Design of Sequential Circuits - Example
Deriving the Excitation Table:
We can simplify flip-flop inputs and output
using K-maps as shown in Figure
140RNB Global University, Bikaner.Course Code - 19004000
141. Design of Sequential Circuits - Example
Deriving the Excitation Table:
Finally the logic diagram of the sequential
circuit can be made as shown in Figure
141RNB Global University, Bikaner.Course Code - 19004000
142. Design Asynchronous Circuits
Used when speed of operation is important.
Response quickly without waiting for a clock pulse.
„Used in small independent systems. „
Only a few components are required .„
Used when the input signals may change
independently of internal clock .„
Asynchronous in nature.„
Used in the communication between two units
that have their own independent clocks. „
Must be done in an asynchronous fashion.
142RNB Global University, Bikaner.Course Code - 19004000
143. Design Asynchronous Circuits
Definition of Asynchronous Circuits:
Inputs / Outputs.
Delay elements: „
Only a short term memory. „
May not really exist due to original gate delay.
Secondary variable: „
Current state (small y).
Excitation variable: „
Next state (big Y). „
Have some delay in response to input changes.
143RNB Global University, Bikaner.Course Code - 19004000
144. Design Asynchronous Circuits
Operation Mode:
Steady-state condition: „
Current states and next states are the same. „
Difference between Y and y will cause a transition. „
Fundamental mode: „
No simultaneous changes of two or more
variables. „
The time between two input changes must be
longer than the time it takes the circuit to a stable
state. „
The input signals change one at a time and only
when the circuit is in a stable condition. 144RNB Global University, Bikaner.Course Code - 19004000
145. Design Asynchronous Circuits
A race condition or race hazard is the
behavior of an electronic, software, or other
system where the output is dependent on the
sequence or timing of other uncontrollable
events.
A race condition is said to be exist in
asynchronous sequential circuit when two or
more binary state variables change value in
response to change in an input variable.
145RNB Global University, Bikaner.Course Code - 19004000
146. Design Asynchronous Circuits
When the S and R inputs of an SR flipflop is
at logical 1 and then the input is changed to
any other condition, then the output becomes
unpredictable and this is called the race
around condition.
146RNB Global University, Bikaner.Course Code - 19004000
147. Reviews
Various types of flip-flops and their
conversions.
Registers, Timing issues, Counters-
Synchronous, Asynchronous.
Finite state machines.
Design of Synchronous sequential circuits.
Design of Asynchronous circuits, cycles,
races and hazards.
147RNB Global University, Bikaner.Course Code - 19004000