Sequential Logic
Sequential Logic
Sequential logic
Author: David Martínez Antón
Contact
Email: [email protected]
Sequential logic: introduction
Sequential logic can be described as a type of logic circuits whose outputs depends not only on the
present values of its inputs signals but also on the sequence of past outputs. This is in contrast to
combinational logic, whose outputs depends only of the present inputs. This means that sequential
logic has state (memory) while combinational does not:
Basic sequential
Basic combinational logic scheme
logic scheme
S-R and R-S Latches:
Latches are a temporal storage device of two states that can remain in any of their two states thanks
to their “feedback”, due to the fact that each of their outputs are connected to their inputs. Flip-
flops and latches can be considered as the building blocks of computer memory.
SR and RS latches, can be thought of a “1 bit memory”. The circuits remember the state until it is
triggered by another input pulse or until the power is removed, this is why this type of circuits are
known as a bistable latch. In order to understand this type of devices we must first remember the
behavior of an or gate and an and gate and their truth tables:
7 8
6
R-S latch: how it works (V)
Now the “Reset” pulse is removed, the latch is currently storing a “0” for “Q”, both “R” and “S” are
“0” again, and output “Q” remains in “0” and its inverse “” is “1”. A set pulse is applied, “S” is “1”
and “R” is “0”, the output “Q” becomes “1” and “” becomes “0”.
10
9 11
R-S latch: how it works (VI), forbidden state
The set pulse is removed, “Q” is “1” and “” is “0”. The only circumstance that have not been
considered is when both inputs “R” and “S” are set to “1” at the same time. If this will to occur, we
will be telling the latch to set the value “1” and “0” simultaneously, but in reality “Q” will become
“0” and “” will also become “0”. This will sort itself out if one of the inputs fell to “0” before the
other, for example, if “R” fell to “0” first with “S” still “1” then “Q” will become “1”again. If however,
both inputs are at “1” and both fell to “0” at the same time, we have what it is known as a race
condition between the two gates, since they will be racing each other to feed back their new
output, being impossible to know which one will “win”.
Remember:
S=1 and R=1 To consider:
is the invalid state • Normal condition
for an R-S latch • Forbidden state
S-R latch: how it works
The wiring of an S-R latch is the same as the R-S latch, but now it is build out of “NAND” gates and
the “S” input is located at the top while the “R” is at the bottom. Notice that the output truth table
now is different from the one in the “R-S latch”. In this type (“S-R latch”), “S” and “R” are kept high
most of the time.
NAND gate
“Active-low” SR latch truth table
A B Output S R Q
0 0 1 0 0 1 1
0 1 1 0 1 1 0
1 0 1 1 0 0 1
1 1 0 0 1
1 1
1 0
3
1 2
S-R latch: how it works (III) resetting the
latch
When “R” is set low momentarily, the output “” is forcibly going to be a “1”, this is feed back into
the inputs of the top “NAND” gate, being the output “Q” “0”. “R” can then return to its normal high
value and the latch is now storing a “0” again
2
1 To consider: then the S-R
latch will ignore any
further set signals after it
has already been set
To consider: when the switch connects
input “S” to earth, it will make it low
3
thereby changing the output “Q” of the
S-R latch from low to high
S-R latch: chronogram exercise
Provided the following “time-chart” (chronogram), find the corresponding square wave of the
output “Q”. Consider the starting state of “Q” as “0”:
Q
S-R latch: chronogram exercise solution
S-R latch circuit scheme
Q
Gated R-S latch: introduction and application
A gated set-reset latch is an SR latch that can only change state while it is enabled. Application: an
application of the “gated SR latch” could be for example used in an air conditioning system in a
building, each room could have its own cooling unit controlled independently by its own SR latch,
coming from a temperature sensor the “Set” and “Reset” signals, or a humidity sensor in the room.
Since these are gated SR latches, a control panel could be used to enable or disable the switching
“on” and “off” of these units on a room-by-room basis:
To consider: the input
Abstraction symbol Gated R-S latch “E” can be used to enable
of a “gated S-R latch” or disable the latching
effect.
NAND gate
truth table
A B Output
0 0 1
0 1 1
1 0 1
1 1 0
Gated S-R latch: chronogram example 2
Now let’s examine an example where input “E” varies. The starting state here is “0” for “Q”, and
because “E” is low, the latch is disabled, so as we can check, if “S” goes “high”, it has no effect on
the output “Q” since input “E” is disabled. Remember that input “S” and “R” are only going to
affect the latch if “E” is enabled, but being “E” enabled does not imply that “S” and “R” change the
output “Q”:
NAND gate
truth table
A B Output
0 0 1
0 1 1
1 0 1
1 1 0
Gated S-R and gated R-S latches: summary
An R-S latch (the one built from “NOR” gates), can be turned into a “gated R-S latch” by adding a par
of “AND” gates to it. An S-R latch (the one built from “NAND” gates) can be turned into a “gated S-R
latch” by adding a pair of “NAND” gates to it. This changes the “S-R latch” from an “active-low S-R
latch” to an “active-high S-R latch”
Gated S-R latch
Gated R-S latch Logic symbol
1 2
3 4
Gated D latch: how it works (II) and rewiring
the circuit
As you can see, the latch now will not respond to changes in input “D”, since input “E” is not
enabled, so it is locked in its current state.
5 6
D latch rewired
Newer one 1
Old version 2
Gated D latch rewired: how it works (I)
Let’s continue checking how the states evolves depending on the changes that we apply. Now “E”
goes low and the output “Q” remains with the same value, “0”. “E” is still low, “D” becomes high,
but there is no change in the output “Q” since the latch is still disabled. Now “E” becomes high
again, being “D” already high, so output “Q” goes high
4
3
Remember: since it is
a “gated” latch, input “E”
must be enabled so as to 5
the input “D” can affect
the circuit
Gated D latch: chronogram example
Let’s try to analyze the following example of a chronogram for a gated D latch. Remember that since
“” is the opposite of the output “Q”, is not going to be consider in the chronogram:
NAND gate
truth table
A B Output
Remember: the D latch can be implemented either 0 0 1
with the “NOT gate” circuit or with the “rewired one” 0 1 0
1 0 0
1 1 0
Gated D latch: summary and applications
“Gated D latches” or just “D latches” can be built from a “gated S-R latch”, either including a NOT
gate or by rewiring the existing NAND gates. Its behavior can be described as that the output “Q”
follows the input “D” while the latch is enabled, that is, while input “E” is high. If the latch is
disabled, it retains its current state. It can be used to store 1 bit of data, so it is a 1 bit memory
device:
D latch “abstraction
D latch using a “NOT” gate D latch rewired symbol”
1 2
3
To consider: as we can see
this effect of the NOT
gate “lagging” can be used
to implement the
raising edge
Flip-flops: implementation of the raising edge (IV),
adding it to the circuit and chronogram example
We can finally add our “raise detector device” to our circuit . Let’s check an example to see how
it works:
D Flip flop
“abstraction
symbol”
triggered by
Final implementation raising edge
in a “D latch”
Flip-flops: raising edge problematic and
falling edge detector implementation
One of the problem with using this particular “raising edge detector device” is that the pulse that it
produces may not be wide enough to open the latch an let data in. This actually depends on
several factors including the operating characteristics of the electronic components and the specific
voltage levels being applied. However, we can increase the delay of our edge detector and
therefore the pulse by adding several NOT gates.
D Flip flop
“abstraction NOR gate truth
To consider:
symbol” table
we need an odd
triggered by
number of not gate A B Output
falling edge
to invert the signal
0 0 1
0 1 0
Falling edge implementation
1 0 0
To consider: we can build a “falling edge
detector” using a NOR gate instead. 1 1 0
When both are momentarily low at the
negative edge of the clock cycle, we will
get a high output
S-R flip flops: how it works
Now that we have learned how to implement the raising edge detector and the falling edge
detector, let’s see how it works in a S-R flip-flop. Remember than in flip-flops the input data “S” and
“R” are only transferred to the output only with the clock pulse. Let’s summarize the behavior of a
“triggered raising edge flip-flop” with the following table:
INPUT OUTPUT NOR gate truth
COMMENTS table
S R CLK Q
Remember: 0 0 X No change A B Output
“clk” stands 0 0 1
0 1 0 1 RESET
for “clock pulse”
1 0 1 0 SET 0 1 1
1 1 ? ? Invalid condition 1 0 1
1 1 0
To consider:
we can see flip flops also build De Morgan’s Laws
with “negative-OR” gates instead of with
NAND gates, since their = *
behavior and therefore truth table is the NAND Negative - OR
same since we can apply the DeMorgan’s = +
theorems
S-R flip flops: how it works (II)
So the electronic scheme for an S-R flip flop could be the following one. Remember that the
“negative-OR” gates are equivalent to the NAND ones:
To consider: “R-E-D”
S stands for “Raising Edge
Q Device” and “F-E-D” stands
for “Falling Edge Device”
CLK R-E-D/
F-E-D
Remember: a flip-flop cannot
𝑄 change state except during
R the raising edge or the falling
edge. This implies also that inputs
“S” and “R” can change while the
Steering gates Latch
clock input is high and there will
be no change in the output “Q”,
except during a small period of time
S-R Flip-Flop during the clock transitions from
low to high or high to low
S-R flip flops: chronogram example
Provided the following “time-chart” (chronogram), find the corresponding square wave of the
output “Q”. Consider the starting state of “Q” as “0”:
INPUT OUTPUT
COMMENTS
S R CLK Q
0 0 X No change
0 1 0 1 RESET
1 0 1 0 SET
Invalid
1 1 ? ?
condition
S-R flip flops: chronogram example 2
Provided the following “time-chart” (chronogram), find the corresponding square wave of the output “Q”.
Consider the starting state of “Q” as “0”:
INPUT OUTPUT
COMMENTS
S R CLK Q
0 0 X No change
0 1 0 1 RESET
1 0 1 0 SET
Invalid
1 1 ? ?
condition
D flip flops: how it works
D flip flops are useful when we need to store only a 1 bit memory (1 or 0). The implementation of
this flip flop is done by adding a NOT gate to a S-R flip flop. The behavior of this flip flop can be
summarized with the following table:
Implementing a D flip flop
To consider: we can add our “raising edge” using an S-R flip flop
detector or our “falling edge” detector
to each of the 3 flip flops that
we are going to learn: S-R flip flop, D flip flop
and J-K flip flop
INPUT OUTPUT
COMMENTS
D CLK Q
1 1 0 SET (stores a “1”)
0 0 1 RESET (stores a “0”)
D flip flops: chronogram example
Provided the following “time-chart” (chronogram), find the corresponding square wave of the
output “Q”. Consider the starting state of “Q” as “0”:
INPUT OUTPUT
COMMENTS
D CLK Q
1 1 0 SET (stores a “1”)
0 0 1 RESET (stores a “0”)
J-K flip flops: how it works
It is one of the more used flip flops. Its behavior is really similar to the S-R flip flop for the SET and
RESET operation as well as for the “no change” case. The main difference between this type of flip
flop and S-R ones is that the J-K flip flop does not have “invalid conditions”. As we can see, its
circuit implementation is exactly the same as the S-R ff but now the outputs are feed back to the
inputs, so we are going to use two “3 inputs” NAND gates: NAND gate
truth table
Remember: “Negative-OR” gates behaves
exactly in the same way as “NAND” ones A B C Output
0 0 0 1
R-E-D/ 0 0 1 1
F-E-D 0 1 0 1
NAND Negative - OR
0 1 1 1
1 0 0 1
Remember: “R-E-D”
Steering gates Latch 1 0 1 1
stands for “Raising Edge
Device” and “F-E-D” stands 1 1 0 1
for “Falling Edge Device” J-K Flip-Flop 1 1 1 0
J-K flip flops: how it works (II)
Let’s check the following table that summarizes the behavior of the J-K flip flop. Now, the non-valid
condition of a S-R ff just changes to the opposite state of the ff for the outputs. This is known as
“toggle state”. Let’s check the following truth table that summarizes the behavior of this ff:
INPUT OUTPUT
COMMENTS
Remember: S R CLK Q
the main difference 0 0 No change
between the S-R ff
and the J-K is that 0 1 0 1 RESET
in the J-K there a 1 0 1 0 SET
are no invalid states 1 1 Toggle
J-K flip flops: chronogram example
Provided the following “time-chart” (chronogram), find the corresponding square wave of the
output “Q”. Consider the starting state of “Q” as “0”. Also indicate all of the states in the changes:
INPUT OUTPUT
COMMENTS
S R CLK Q
0 0 No change
0 1 0 1 RESET
1 0 1 0 SET
1 1 Toggle No
Toggle change Reset Set Set
Summary: synchronous vs asynchronous
sequential logic
Asynchronous Synchronous
Synchronous sequential circuits are Asynchronous sequential circuits
digital sequential circuits in which are digital sequential circuits in
Definition the feedback to the input for next which the feedback to the input for
output generation is governed by next output generation is not
clock signals. governed by clock signals.
The memory unit which is being get Unclocked flip flop or time delay is
Memory unit used for governance is clocked flip used as memory element in case of
flop. Asynchronous sequential circuits.
The states of Synchronous there are chances for the
sequential circuits are always Asynchronous circuits to enter into
predictable and thus reliable. a wrong state because of the time
State
difference between the arrivals of
inputs. This is called as race
condition.
S-R and R-S latches, Gated S-R S-R flip flops, D flipflops, J-K flip
Examples
latches, D latches flops
Bibliography:
• Floyd, T. L. (2000). Fundamentos de Sistemas Digitales, 9ª. Edición,
Capítulo, 2, 2-10.