Digital Electronics PDF
Digital Electronics PDF
Digital Electronics PDF
a
y
b
NOT AND (NAND) Gate
Symbol
a
y
Truth-table Boolean
b a y .
b
a y
0
0
1
1
b
0
0
1
1
0 1
1 1
y is TRUE if a is FALSE or b is FALSE (or
both)
y is FALSE only if a is TRUE and b is
TRUE
NOT OR (NOR) Gate
Symbol
a
y
Truth-table Boolean
b a y
b
a y
0
0
1
1
b
0
0
1
0
0 0
1 1
y is TRUE only if a is FALSE and b is
FALSE
y is FALSE if a is TRUE or b is TRUE (or
both)
Boiler Example
If chimney is not blocked and the house is
cold and the pilot light is lit, then open the
main fuel valve to start boiler.
b = chimney blocked c = house is cold
p = pilot light lit v = open fuel valve
p c b v . .
b
c
p
Boolean Algebra
In this section we will introduce the laws
of Boolean Algebra
We will then see how it can be used to
design combinational logic circuits
Combinational logic circuits do not have
an internal stored state, i.e., they have
no memory. Consequently the output is
solely a function of the current inputs.
Later, we will study circuits having a
stored internal state, i.e., sequential
logic circuits.
Boolean Algebra
OR AND
a a 0
a a a
1 1 a
1 a a
0 0 . a
a a a .
a a 1 .
0 . a a
AND takes precedence over OR, e.g.,
) . ( ) . ( . . d c b a d c b a
Boolean Algebra
Commutation
Association
Distribution
Absorption
a b b a
a b b a . .
) ( ) ( c b a c b a
) . .( ). . ( c b a c b a
) . ( ) . ( ) .( c a b a c b a
NEW ). ).( ( ) . . ( c a b a c b a
NEW ) . ( a c a a
NEW ) .( a c a a
Boolean Algebra - Examples
Show
b a b a a . ) .(
b a b a b a a a b a a . . 0 . . ) .(
Show
b a b a a ) . (
b a b a b a a a b a a ) .( 1 ) ).( ( ) . (
Boolean Algebra
A useful technique is to expand each
term until it includes one instance of each
variable (or its compliment). It may be
possible to simplify the expression by
cancelling terms in this expanded form
e.g., to prove the absorption rule:
a b a a .
a a b b a b a b a b a b a b a 1 . ) .( . . . . .
Boolean Algebra - Example
Simplify
z y x z x z y y x . . . . .
z y x z y x z y x z y x z y x z y x z y x . . . . . . . . . . . . . .
z y x z y x z y x z y x . . . . . . . .
) .( . ) .( . x x z y z z y x
1 . . 1 . . z y y x
z y y x . .
DeMorgans Theorem
. . . c b a c b a
. . . c b a c b a
. . . c b a c b a
. . . c b a c b a
In a simple expression like (or )
simply change all operators from OR to
AND (or vice versa), complement each
term (put a bar over it) and then
complement the whole expression, i.e.,
c b a c b a . .
DeMorgans Theorem
For 2 variables we can show
and using a truth table.
b a b a .
b a b a .
0
1
0
0
1 0
0
0
1
0
1 1
b a a b b a. a b
b a. b a
0
1
1
1
0
1
1
0
0
0
1
1
0
0
1
0
0
1
1
1
Extending to more variables by induction
c b a c b a c b a c b a . . ). . ( . ) (
DeMorgans Examples
Simplify ) .( ) .( . c b b c b a b a
(DeMorgan) . . . . . c b b c b a b a
0) b (b. . . . c b a b a
n) (absorbtio .b a
DeMorgans Examples
Simplify
d c b a d b c b a . ). . ) . .( . (
Morgan) (De . ). ) .( . ( d c b a d b c b a
e) (distribut . ). . . . . . . ( d c b a d b a b b a c b a
) 0 . . ( . ). . . . . ( b b a d c b a d b a c b a
e) (distribut . . . . . . . . . . . d c b d c a d c d b a d c b a
) 0 . . . . ( . . . . . . . d c d b a d c b d c a d c b a
e) (distribut . . ) . ( d c b a b a
(DeMorgan) . . ) . . ( d c b a b a
1) . . ( . b a b a d c
DeMorgans in Gates
To implement the function we
can use AND and OR gates
d c b a f . .
a
b
c
d
f
However, sometimes we only wish to
use NAND or NOR gates, since they
are usually simpler and faster
DeMorgans in Gates
To do this we can use bubble logic
a
b
c
d
f
x
y
Two consecutive bubble (or
complement) operations cancel,
i.e., no effect on logic function
See AND gates are
now NAND gates
What about this gate?
DeMorgan says
y x y x .
Which is a NOT
AND (NAND) gate
So is equivalent to
DeMorgans in Gates
So the previous function can be built
using 3 NAND gates
a
b
c
d
f
a
b
c
d
f
DeMorgans in Gates
Similarly, applying bubbles to the input
of an AND gate yields
x
y
f
What about this gate?
DeMorgan says
y x y x .
Which is a NOT OR
(NOR) gate
So is equivalent to
Useful if trying to build using NOR gates
Logic Minimisation
Any Boolean function can be implemented
directly using combinational logic (gates)
However, simplifying the Boolean function will
enable the number of gates required to be
reduced. Techniques available include:
Algebraic manipulation (as seen in examples)
Karnaugh (K) mapping (a visual approach)
Tabular approaches (usually implemented by
computer, e.g., Quine-McCluskey)
K mapping is the preferred technique for up to
about 5 variables
Truth Tables
f is defined by the following truth table
x y z f
minterms
0 0 0 1
z y x . .
0 0 1 1
z y x . .
0 1 0 1
z y x . .
0 1 1 1
z y x . .
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
z y x . .
A minterm must contain
all variables (in either
complement or
uncomplemented form)
Note variables in a
minterm are ANDed
together (conjunction)
One minterm for each
term of f that is TRUE
So is a minterm but is not z y x . .
z y.
Disjunctive Normal Form
A Boolean function expressed as the
disjunction (ORing) of its minterms is said
to be in the Disjunctive Normal Form (DNF)
A Boolean function expressed as the
ORing of ANDed variables (not necessarily
minterms) is often said to be in Sum of
Products (SOP) form, e.g.,
z y x z y x z y x z y x z y x f . . . . . . . . . .
le truth tab same the have functions Note .z y x f
Maxterms
A maxterm of n Boolean variables is the
disjunction (ORing) of all the variables either
in complemented or uncomplemented form.
Referring back to the truth table for f, we can
write,
Applying De Morgan (and complementing) gives
So it can be seen that the maxterms of are
effectively the minterms of with each variable
complemented
z y x z y x z y x f . . . . . .
) ).( ).( ( z y x z y x z y x f
f
f
Conjunctive Normal Form
A Boolean function expressed as the
conjunction (ANDing) of its maxterms is said
to be in the Conjunctive Normal Form (CNF)
A Boolean function expressed as the ANDing
of ORed variables (not necessarily maxterms)
is often said to be in Product of Sums (POS)
form, e.g.,
) ).( ).( ( z y x z y x z y x f
) ).( ( z x y x f
Logic Simplification
As we have seen previously, Boolean
algebra can be used to simplify logical
expressions. This results in easier
implementation
Note: The DNF and CNF forms are not
simplified.
However, it is often easier to use a
technique known as Karnaugh mapping
Karnaugh Maps
Karnaugh Maps (or K-maps) are a
powerful visual tool for carrying out
simplification and manipulation of logical
expressions having up to 5 variables
The K-map is a rectangular array of
cells
Each possible state of the input variables
corresponds uniquely to one of the cells
The corresponding output state is written in
each cell
K-maps example
x y z f
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
From truth table to K-map
y z
11 00 01 10
0
1
x
1 1 1 1
1 x
z
y
Note that the logical state of the
variables follows a Gray code, i.e.,
only one of them changes at a time
The exact assignment of variables in
terms of their position on the map is
not important
K-maps example
Having plotted the minterms, how do we
use the map to give a simplified
expression?
Group terms
Having size equal to a power of
2, e.g., 2, 4, 8, etc.
Large groups best since they
contain fewer variables
Groups can wrap around edges
and corners
y z
11 00 01 10
0
1
x
1 1 1 1
1 x
z
y
x
z y.
So, the simplified func. is,
.z y x f as before
K-maps 4 variables
K maps from Boolean expressions
Plot . . . d c b b a f
11 00 01 10
00
01
11
10
b a
d c
1 1 1 1
1
a
b
c
d
See in a 4 variable map:
1 variable term occupies 8 cells
2 variable terms occupy 4 cells
3 variable terms occupy 2 cells, etc.
K-maps 4 variables
For example, plot
b f .d b f
11 00 01 10
00
01
11
10
b a
d c
1
1
1
1
a
b
c
d
11 00 01 10
00
01
11
10
b a
d c
1
1 1 1 1
a
b
c
d
1 1 1
K-maps 4 variables
Simplify,
. . . . . . . . d c d c b a d c b d b a f
11 00 01 10
00
01
11
10
b a
d c
1
a
b
c
d
1 1
1
1
1
1
b a.
d c.
So, the simplified func. is,
. . d c b a f
POS Simplification
Note that the previous examples have
yielded simplified expressions in the
SOP form
Suitable for implementations using AND
followed by OR gates, or only NAND gates
(using DeMorgans to transform the result
see previous Bubble logic slides)
However, sometimes we may wish to
get a simplified expression in POS form
Suitable for implementations using OR
followed by AND gates, or only NOR gates
POS Simplification
To do this we group the zeros in the map
i.e., we simplify the complement of the function
Then we apply DeMorgans and
complement
Use bubble logic if NOR only
implementation is required
POS Example
Simplify into POS form.
. . . d c b b a f
11 00 01 10
00
01
11
10
b a
d c
1 1 1 1
1
a
b
c
d
Group
zeros
11 00 01 10
00
01
11
10
b a
d c
1 1 1 1
1
a
b
c
d
0 0 0 0
0 0 0
0 0 0 0
b
d a.
c a.
. . d a c a b f
POS Example
Applying DeMorgans to
. . d a c a b f
) ).( .( d a c a b f
) ).( .( d a c a b f
f
a
c
a
d
b
f
a
c
a
d
b
gives,
f
a
c
a
d
b
Expression in POS form
Apply DeMorgans and take
complement, i.e., is now in SOP form
Fill in zeros in table, i.e., plot
Fill remaining cells with ones, i.e., plot
Simplify in usual way by grouping ones
to simplify
f
f
f
f
Dont Care Conditions
Sometimes we do not care about the
output value of a combinational logic
circuit, i.e., if certain input combinations
can never occur, then these are known
as dont care conditions.
In any simplification they may be treated
as 0 or 1, depending upon which gives
the simplest result.
For example, in a K-map they are entered
as Xs
Dont Care Conditions - Example
Simplify the function
. . . . . . d c a d c a d b a f
With dont care conditions,
. . . , . . . , . . . d c b a d c b a d c b a
11 00 01 10
00
01
11
10
b a
d c
1
a
b
c
d
X 1
1
1
1
X
X
b a.
d c.
d c b a f . .
See only need to include
Xs if they assist in making
a bigger group, otherwise
can ignore.
or,
d c d a f . .
Some Definitions
Cover A term is said to cover a minterm if that
minterm is part of that term
Prime Implicant a term that cannot be further
combined
Essential Term a prime implicant that covers a
minterm that no other prime implicant covers
Covering Set a minimum set of prime
implicants which includes all essential terms plus
any other prime implicants required to cover all
minterms
Number Representation,
Addition and Subtraction
Binary Numbers
It is important to be able to represent
numbers in digital logic circuits
for example, the output of a analogue to digital
converter (ADC) is an n-bit number, where n is
typically in the range from 8 to 16
Various representations are used, e.g.,
unsigned integers
2s complement to represent negative numbers
Binary Numbers
Binary is base 2. Each digit (known as a
bit) is either 0 or 1.
Consider these 6-bit unsigned numbers
32
5
2
1 0
16
4
2
1 0 0 1
3
2
2
2
1
2
0
2
8 4 2 1 Binary
coefficients
10
42
MSB LSB
32
5
2
0 0
16
4
2
1 0 1 1
3
2
2
2
1
2
0
2
8 4 2 1 Binary
coefficients
10
11
MSB LSB
MSB most
significant bit
LSB least
significant bit
Unsigned Binary Numbers
In general, an n-bit binary number,
has the decimal value,
i
n
i
i
b 2
1
0
0 1 2 1
b b b b
n n
So we can represent positive integers from
0 to
In computers, binary numbers are often 8
bits long known as a byte
A byte can represent unsigned values from
0 to 255
1 2
n
Unsigned Binary Numbers
Decimal to binary conversion. Perform
successive division by 2.
Convert into binary
10
42
1 remainder 0 2 / 1
0 remainder 1 2 / 2
1 remainder 2 2 / 5
0 remainder 5 2 / 10
1 remainder 10 2 / 21
0 remainder 21 2 / 42
So the answer is (reading upwards)
2
101010
Octal: Base 8
We have seen base 2 uses 2 digits (0 & 1),
not surprisingly base 8 uses 8 digits : 0, 1,
2, 3, 4, 5, 6, 7.
0 2
5
1
8
0
8
8 1
Octal
coefficients
10
42
MSB LSB
64
2
8
To convert from decimal to base 8 either
use successive division, i.e.,
5 remainder 0 8 / 5
2 remainder 5 8 / 42
So the answer is (reading upwards)
8
52
Octal: Base 8
Or alternatively, convert to binary, divide
the binary number into 3-bit groups and
work out the octal digit to represent
each group. We have shown that
2 10
101010 42
So,
1 0 1 0 0 1
5
8
2
10
42
MSB
LSB
Hexadecimal: Base 16
For base 16 we need 16 different digits.
Consequently we need new symbols for
the digits to represent 10-15
16 10 2
16 10 2
16 10 2
C 12 1100
B 11 1011
A 10 1010
16 10 2
16 10 2
16 10 2
F 15 1111
E 14 1110
D 13 1101
0
16
A 2
1
16
0
16
16 1 Hex
coefficients
10
42
MSB LSB
256
2
16
Hex: Base 16
To convert from decimal to base 16 use
either use successive division by 16, i.e.,
2 remainder 0 16 / 2
A remainder 2 16 / 42
So the answer is (reading upwards)
8
A 2
Hex: Base 16
Or alternatively, convert to binary, divide
the binary number into 4-bit groups and
work out the hex digit to represent each
group. We have shown that
2 10
101010 42
So,
1 0 1 0 0 1
2
16
A
10
42
MSB
LSB
0 0
Hex: Base 16
Hex is also used as a convenient way of
representing the contents of a byte (an
8 bit number), so for example
2
11100010
1 0 0 0 0 1
E
16
2
16
2 E
MSB
LSB
1 1
Negative numbers
So far we have only been able to represent
positive numbers. For example, we have
seen an 8-bit byte can represent from 0 to
255, i.e., 2
8
= 256 different combinations of
bits in a byte
If we want to represent negative numbers,
we have to give up some of the range of
positive numbers we had before
A popular approach to do this is called 2s
complement
2s Complement
For 8-bit numbers:
0
127 128 1
H
0
H
F 7
positive negative
H
80
H
FF
Note all negative numbers have the
MSB set
The rule for changing a positive 2s
complement number into a negative 2s
complement number (or vice versa) is:
Complement all the bits and add 1.
2s Complement
What happens when we do this to an 8 bit
binary number x ?
Invert all bits:
Add 1:
Note: 256 (= 100
H
) will not fit into an 8 bit
byte. However if we ignore the overflow bit,
then behaves just like
That is, we can use normal binary arithmetic
to manipulate the 2s complement of x and it
will behave just like -x
) 255 ( x x
) 256 ( x x
x 256 x 0
2s Complement Addition
0 0 1 0 0 0 0 0
1 1 1 0 0 0 0 0 7
1 1 0 1 0 0 0 0
11 ) 0 (
4
To subtract, negate the second number, then add:
1 0 0 1 1 1 1 1
1 1 1 0 0 0 0 0 7
0
) 1 (
7
0 0 0 0 0 0 0 0
1 0 0 1 1 1 1 1
1 0 0 1 0 0 0 0 9
2
) 1 (
7
0 1 0 0 0 0 0 0
2s Complement Addition
1 0 0 1 1 1 1 1
0 0 1 0 0 0 0 0 4
3
) 0 (
7
1 0 1 1 1 1 1 1
1 0 0 1 1 1 1 1
1 0 0 1 1 1 1 1 7
14
) 1 (
7
0 1 0 0 1 1 1 1
2s Complement
Note that for an n-bit number ,
the decimal equivalent of a 2s complement
number is,
i
n
i
i
n
n
b b 2 2
2
0
1
1
0 1 2 1
b b b b
n n
For example,
0 1 0 0 1 1 1 1
14 2 16 32 64 128
2 1 2 1 2 1 2 1 2 1
2 2
1 4 5 6 7
6
0
7
7
i
i
i
b b
2s Complement Overflow
For example, when working with 8-bit
unsigned numbers, we can use the
carry from the 8th bit (MSB) to indicate
that the number has got too big.
With signed numbers we deliberately
ignore any carry from the MSB,
consequently we need a new rule to
detect when a result is out of range.
2s Complement Overflow
The rule for detecting 2s complement
overflow is:
The carry into the MSB does not equal the
carry out from the MSB.
We will now give some examples.
2s Complement Overflow
1 1 1 1 0 0 0 0
1 1 1 1 0 0 0 0 15
30 ) 0 (
15
0 1 1 1 1 0 0 0
OK
1 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 127
128 ) 0 (
1
0 0 0 0 0 0 0 1
overflow
2s Complement Overflow
1 0 0 0 1 1 1 1
1 0 0 0 1 1 1 1 15
30 ) 1 (
15
0 1 0 0 0 1 1 1
OK
0 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 127
127 ) 1 (
2
1 1 1 1 1 1 1 0
overflow
Binary Coded Decimal (BCD)
Each decimal digit of a number is coded
as a 4 bit binary quantity
It is sometimes used since it is easy to
code and decode, however it is not an
efficient way to store numbers.
1000 0100 0010 0001 1248
BCD 10
or alternatively,
) .( .
1 i i i i i i
b a c b a c
So,
i i i i i i i
i i i i i i
i i i i
c p p g p g c
p c g p g c
p c g c
. . .
) . .(
.
1 1 1 2
1 1 2
1 1 1 2
Fast Carry Generation
Similarly,
i i i i i i i i i i
i i i i i i i i
i i i i
c p p p g p g p g c
p c g p g p g c
p c g c
. . . ) . .(
)) . .( .(
.
1 2 1 1 2 2 3
1 1 2 2 3
2 2 2 3
and
i i i i i i i i i i i i i
i i i i i i i i i i i i
i i i i
c p p p p g p g p g p g c
c p p p g p g p g p g c
p c g c
. . . . )) . .( .(
) . . . ) . .( .(
.
1 2 3 1 1 2 2 3 3 4
1 2 1 1 2 2 3 3 4
3 3 3 4
Fast Carry Generation
So for example to generate c
4
, i.e., i = 0,
0 4
0 0 1 2 3 0 1 1 2 2 3 3 4
. . . . )) . .( .(
Pc G c
c p p p p g p g p g p g c
where,
0 1 2 3
0 1 1 2 2 3 3
. . .
)) . .( .(
p p p p P
g p g p g p g G
See it is quick to evaluate this function
Fast Carry Generation
We could generate all the carrys within an
adder block using the previous equations
However, in order to reduce complexity, a
suitable approach is to implement say 4-bit
adder blocks with only c
4
generated using
fast generation.
This is used as the carry-in to the next 4-bit
adder block
Within each 4-bit adder block, conventional RCA
is used
Fast Carry Generation
a
0
b
0
c
0
a b
c
out
sum
c
in
s
0
a b
c
out
sum
c
in
s
1
a b
c
out
sum
c
in
s
2
a b
c
out
sum
c
in
s
3
a
1
b
1
a
2
b
2
a
3
b
3
c
4
Fast Carry Generation
c
0
Other Ways to Implement
Combinational Logic
We have seen how combinational logic
can be implemented using logic gates,
e.g., AND, OR etc.
However, it is also possible to generate
combinational logic functions using
memory devices, e.g., Read Only
Memories (ROMs)
ROM Overview
A ROM is a data storage device:
Usually written into once (either at manufacture or
using a programmer)
Read at will
Essentially is a look-up table, where a group of
input lines (say n) is used to specify the address
of locations holding m-bit data words
For example, if n = 4, then the ROM has 2
4
= 16
possible locations. If m = 4, then each location
can store a 4-bit word
So, the total number of bits stored is , i.e.,
64 in the example (very small!) ROM
n
m 2
ROM Example
data
x y z f
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
address
(decimal)
0
1
2
3
4
5
6
7
D
0
D
1
D
2
D
3
X X X 1
X X X 1
X X X 1
X X X 1
X X X 0
X X X 0
X X X 0
X X X 1
64-bit
ROM
A
0
A
1
A
2
A
3
D
0
D
1
D
2
D
3
address data
z
y
x
' 0 '
Design amounts to putting
minterms in the appropriate
address location
No logic simplification
required
Useful if multiple Boolean
functions are to be
implemented, e.g., in this
case we can easily do up to
4, i.e., 1 for each output line
Reasonably efficient if lots of
minterms need to be
generated
ROM Implementation
Can be quite inefficient, i.e., become large in
size with only a few non-zero entries, if the
number of minterms in the function to be
implemented is quite small
Devices which can overcome these problems
are known as programmable array logic (PAL)
In PALs, only the required minterms are
generated using a separate AND plane. The
outputs from this plane are ORed together in
a separate OR plane to produce the final
output
Basic PAL Structure
Programmed by
selectively removing
connections in the AND
and OR planes
controlled by fuses or
memory bits
f
0
a
c
b
f
1
f
2
AND plane
OR plane
Other Memory Devices
Non-volatile storage is offered by ROMs (and
some other memory technologies, e.g.,
FLASH), i.e., the data remains intact, even
when the power supply is removed
Volatile storage is offered by Static Random
Access Memory (SRAM) technology
Data can be written into and read out of the
SRAM, but is lost once power is removed
Memory Application
Memory devices are often used in computer
systems
The central processing unit (CPU) often
makes use of busses (a bunch of wires in
parallel) to access external memory devices
The address bus is used to specify the
memory location that is being read or written
and the data bus conveys the data too and
from that location
So, more than one memory device will often
be connected to the same data bus
Bus Contention
In this case, if the output from the data pin of
one memory was a 0 and the output from the
corresponding data pin of another memory
was a 1, the data on that line of the data bus
would be invalid
So, how do we arrange for the data from
multiple memories to be connected to the
some bus wires?
Bus Contention
The answer is:
Tristate buffers (or drivers)
Control signals
A tristate buffer is used on the data output of
the memory devices
In contrast to a normal buffer which is either 1
or 0 at its output, a tristate buffer can be
electrically disconnected from the bus wire, i.e.,
it will have no effect on any other data currently
on the bus known as the high impedance
condition
Tristate Buffer
Output Enable
(OE) =1
OE =0
Bus line
OE =1
Bus line
OE =0
Symbol Functional
analogy
Control Signals
We have already seen that the memory
devices have an additional control input (OE)
that determines whether the output buffers are
enabled.
Other control inputs are also provided:
Write enable (WE). Determines whether data is
written or read (clearly not needed on a ROM)
Chip select (CS) determines if the chip is
activated
Note that these signals can be active low,
depending upon the particular device
Sequential Logic
Flip-flops and Latches
Sequential Logic
The logic circuits discussed previously
are known as combinational, in that the
output depends only on the condition of
the latest inputs
However, we will now introduce a type
of logic where the output depends not
only on the latest inputs, but also on the
condition of earlier inputs. These circuits
are known as sequential, and implicitly
they contain memory elements
Memory Elements
A memory stores data usually one bit per
element
A snapshot of the memory is called the state
A one bit memory is often called a bistable,
i.e., it has 2 stable internal states
Flip-flops and latches are particular
implementations of bistables
RS Latch
An RS latch is a memory element with 2
inputs: Reset (R) and Set (S) and 2
outputs: and . Q Q
Q
Q
R
S
Q
0
0
1
0
0
1
0
0 1
1 1
Q
R S
comment
Q Q
1
0
0
hold
reset
set
illegal
Where is the next state
and is the current state
Q
Q
RS Latch - Operation
Q
Q
R
S
1
2
a y
0
1
1
b
0
0 0
0
1 0 0
1 1
b complemented
NOR truth table
always 0
R = 1 and S = 0
Gate 1 output in always 0 condition,
Gate 2 in complement condition, so
This is the (R)eset condition
0 Q
1 Q
RS Latch - Operation
Q
Q
R
S
1
2
a y
0
1
1
b
0
0 0
0
1 0 0
1 1
b complemented
NOR truth table
always 0
S = 0 and R to 0
Gate 2 remains in complement condition,
Gate 1 into complement condition,
This is the hold condition
0 Q
1 Q
RS Latch - Operation
Q
Q
R
S
1
2
a y
0
1
1
b
0
0 0
0
1 0 0
1 1
b complemented
NOR truth table
always 0
S = 1 and R = 0
Gate 1 into complement condition,
Gate 2 in always 0 condition,
This is the (S)et condition
1 Q
0 Q
RS Latch - Operation
Q
Q
R
S
1
2
a y
0
1
1
b
0
0 0
0
1 0 0
1 1
b complemented
NOR truth table
always 0
S = 1 and R = 1
Gate 1 in always 0 condition,
Gate 2 in always 0 condition,
This is the illegal condition
0 Q
0 Q
RS Latch State Transition Table
A state transition table is an alternative
way of viewing its operation
1
0
0
1
Q
R S
comment
hold
reset
set
illegal
1
0
0
0
0
1
1
0
0
1
1 1
Q
0
0
0
0
1
1
1
1
0
0
1
0
1
0
1
0
hold
reset
set
illegal
A state transition table can also be
expressed in the form of a state diagram
RS Latch State Diagram
A state diagram in this case has 2
states, i.e., Q=0 and Q=1
The state diagram shows the input
conditions required to transition
between states. In this case we see that
there are 4 possible transitions
We will consider them in turn
RS Latch State Diagram
1
0
0
1
Q
R S
comment
hold
reset
set
illegal
1
0
0
0
0
1
1
0
0
1
1 1
Q
0
0
0
0
1
1
1
1
0
0
1
0
1
0
1
0
hold
reset
set
illegal
0 Q 0
Q
From the table we can see:
R S R S S S
R S S R S R R S
R S R S R S
) ).( (
. . ) .(
. . .
1 Q 1
Q
From the table we can see:
R
S S R R S R S ) .( . .
RS Latch State Diagram
1
0
0
1
Q
R S
comment
hold
reset
set
illegal
1
0
0
0
0
1
1
0
0
1
1 1
Q
0
0
0
0
1
1
1
1
0
0
1
0
1
0
1
0
hold
reset
set
illegal
1 Q 0
Q
From the table we can see:
R S S R
R S R S
) .(
. .
0 Q 1
Q
From the table we can see:
R S.
RS Latch State Diagram
Which gives the following state diagram:
0 Q 1 Q
R S R
R S.
R
A similar diagram can be constructed for the
output
We will see later that state diagrams are a
useful tool for designing sequential systems
Q
Clocks and Synchronous Circuits
For the RS latch we have just described, we
can see that the output state changes occur
directly in response to changes in the inputs.
This is called asynchronous operation
However, virtually all sequential circuits
currently employ the notion of synchronous
operation, that is, the output of a sequential
circuit is constrained to change only at a time
specified by a global enabling signal. This
signal is generally known as the system clock
Clocks and Synchronous Circuits
The Clock: What is it and what is it for?
Typically it is a square wave signal at a
particular frequency
It imposes order on the state changes
Allows lots of states to appear to update
simultaneously
How can we modify an asynchronous
circuit to act synchronously, i.e., in
synchronism with a clock signal?
Transparent D Latch
We now modify the RS Latch such that its
output state is only permitted to change when
a valid enable signal (which could be the
system clock) is present
This is achieved by introducing a couple of
AND gates in cascade with the R and S inputs
that are controlled by an additional input
known as the enable (EN) input.
Transparent D Latch
Q
Q
R
S
D
EN
D Q
EN
Symbol
a y
0
1
1
0
b
0
0
1
0
0 0
1 1
AND truth table
See from the AND truth table:
if one of the inputs, say a is 0, the output
is always 0
Output follows b input if a is 1
The complement function ensures
that R and S can never be 1 at the
same time, i.e., illegal avoided
Transparent D Latch
Q
Q
R
S
D
EN
RS hold
Q
0 1
0
1 1
Q
D
comment
Q Q
1
0
RS reset
RS set
EN
0
X
1
See Q follows D input provided EN=1.
If EN=0, Q maintains previous state
Master-Slave Flip-Flops
The transparent D latch is so called level
triggered. We can see it exhibits transparent
behaviour if EN=1. It is often more simple to
design sequential circuits if the outputs
change only on the either rising (positive
going) or falling (negative going) edges of
the clock (i.e., enable) signal
We can achieve this kind of operation by
combining 2 transparent D latches in a so
called Master-Slave configuration
Master-Slave D Flip-Flop
Symbol
D Q
D Q D Q
D
CLK
Q
Master Slave
Q
int
To see how this works, we will use a timing diagram
Note that both latch inputs are effectively connected
to the clock signal (admittedly one is a complement
of the other)
Master-Slave D Flip-Flop
D Q D Q
D
CLK
Q
Master Slave
Q
int
CLK
CLK
D
int
Q
Q
Note propagation delays
have been neglected in
the timing diagram
See Q changes on rising
edge of CLK
D Flip-Flops
The Master-Slave configuration has
now been superseded by new F-F
circuits which are easier to implement
and have better performance
When designing synchronous circuits it
is best to use truly edge triggered F-F
devices
We will not consider the design of such
F-Fs on this course
Other Types of Flip-Flops
Historically, other types of Flip-Flops
have been important, e.g., J -K Flip-
Flops and T-Flip-Flops
However, J -K FFs are a lot more
complex to build than D-types and so
have fallen out of favour in modern
designs, e.g., for field programmable
gate arrays (FPGAs) and VLSI chips
Other Types of Flip-Flops
Consequently we will only consider
synchronous circuit design using D-type
FFs
However for completeness we will
briefly look at the truth table for J -K and
T type FFs
J -K Flip-Flop
The J -K FF is similar in function to a
clocked RS FF, but with the illegal state
replaced with a new toggle state
Q
0
1
0
0
1
0
0 1
1 1
Q
K J
comment
Q Q
1
0
hold
reset
set
toggle
Where is the next state
and is the current state
Q
Q
Q
Q
Symbol
J
K
Q
Q
T Flip-Flop
This is essentially a J -K FF with its J
and K inputs connected together and
renamed as the T input
Q
0
1
Q
T
comment
Q Q hold
toggle
Where is the next state
and is the current state
Q
Q
Q Q
Symbol
T
Q
Q
Asynchronous Inputs
It is common for the FF types we have mentioned
to also have additional so called asynchronous
inputs
They are called asynchronous since they take
effect independently of any clock or enable inputs
Reset/Clear force Q to 0
Preset/Set force Q to 1
Often used to force a synchronous circuit into a
known state, say at start-up.
Timing
Various timings must be satisfied if a FF
is to operate properly:
Setup time: Is the minimum duration that
the data must be stable at the input before
the clock edge
Hold time: Is the minimum duration that the
data must remain stable on the FF input
after the clock edge
Applications of Flip-Flops
Counters
A clocked sequential circuit that goes through a
predetermined sequence of states
A commonly used counter is an n-bit binary
counter. This has n FFs and 2
n
states which are
passed through in the order 0, 1, 2, .2
n
-1, 0, 1, .
Uses include:
Counting
Producing delays of a particular duration
Sequencers for control logic in a processor
Divide by m counter (a divider), as used in a digital
watch
Applications of Flip-Flops
Memories, e.g.,
Shift register
Parallel loading shift register : can be used for
parallel to serial conversion in serial data
communication
Serial in, parallel out shift register: can be used
for serial to parallel conversion in a serial data
communication system.
Counters
In most books you will see 2 basic types
of counters, namely ripple counters and
synchronous counters
In this course we are concerned with
synchronous design principles. Ripple
counters do not follow these principles
and should generally be avoided if at all
possible. We will now look at the
problems with ripple counters
Ripple Counters
A ripple counter can be made be cascading
together negative edge triggered T-type FFs
operating in toggle mode, i.e., T =1
See that the FFs are not clocked using the
same clock, i.e., this is not a synchronous
design. This gives some problems.
T
Q
Q
1
CLK
T
Q
Q
1
T
Q
Q
1
0
Q
1
Q
2
Q
Ripple Counters
We will now draw a timing diagram
0
Q
CLK
1
Q
2
Q
0 1 2 3 4 5 6 7 0
Problems:
See outputs do not change at the same time, i.e., synchronously.
So hard to know when count output is actually valid.
Propagation delay builds up from stage to stage, limiting
maximum clock speed before miscounting occurs.
Ripple Counters
If you observe the frequency of the counter
output signals you will note that each has half
the frequency, i.e., double the repetition
period of the previous one. This is why
counters are often known as dividers
Often we wish to have a count which is not a
power of 2, e.g., for a BCD counter (0 to 9).To
do this:
use FFs having a Reset/Clear input
Use an AND gate to detect the count of 10 and
use its output to Reset the FFs
Synchronous Counters
Owing to the problems identified with ripple
counters, they should not usually be used to
implement counter functions
It is recommended that synchronous counter
designs be used
In a synchronous design
all the FF clock inputs are directly connected to the clock
signal and so all FF outputs change at the same time, i.e.,
synchronously
more complex combinational logic is now needed to
generate the appropriate FF input signals (which will be
different depending upon the type of FF chosen)
Synchronous Counters
We will now investigate the design of
synchronous counters
We will consider the use of D-type FFs
only, although the technique can be
extended to cover other FF types.
As an example, we will consider a 0 to 7
up-counter
Synchronous Counters
To assist in the design of the counter we will make
use of a modified state transition table. This table
has additional columns that define the required FF
inputs (or excitation as it is known)
Note we have used a state transition table previously
when determining the state diagram for an RS latch
We will also make use of the so called excitation
table for a D-type FF
First however, we will investigate the so called
characteristic table and characteristic equation for a
D-type FF
Characteristic Table
In general, a characteristic table for a FF
gives the next state of the output, i.e., in
terms of its current state and current inputs
Q
Q
1
0
0
1
Q
D Q
0
0
1
1
0
1
0
1
Which gives the characteristic equation,
D Q '
i.e., the next output state is equal to the
current input value
Since is independent of
the characteristic table can
be rewritten as
1
0
Q
D
0
1
Q
Q
Excitation Table
The characteristic table can be modified to
give the excitation table. This table tells us
the required FF input value required to
achieve a particular next state from a given
current state
1
0
0
1
Q
D Q
0
0
1
1
0
1
0
1
As with the characteristic table it can
be seen that , does not depend
upon, , however this is not
generally true for other FF types, in
which case, the excitation table is
more useful. Clearly for a D-FF,
Q
Q
' Q D
Characteristic and Excitation
Tables
Characteristic and excitation tables can
be determined for other FF types.
These should be used in the design
process if D-type FFs are not used
We will now determine the modified
state transition table for the example 0
to 7 up-counter
Modified State Transition
Table
In addition to columns representing the
current and desired next states (as in a
conventional state transition table), the
modified table has additional columns
representing the required FF inputs to
achieve the next desired FF states
Modified State Transition Table
For a 0 to 7 counter, 3 D-type FFs are needed
Current
state
0
Q
1
Q
2
Q
0 0 0
1
0
1
0
1 1
1 0 0
0 1 0
0
1
1 0 1
0 1 1
1
'
0
Q
'
1
Q
'
2
Q
0
D
1
D
2
D
1
0
1
1
0
0
0
1
1
0
0
1
1 1
0
0
0
1
1
1
1
0 0 0
1
0
1
1
0
0
0
1
1
0
0
1
1 1
0
0
0
1
1
1
1
0 0 0
Next
state
FF
inputs
Note: Since (or ) for a D-FF, the
required FF inputs are identical to the Next state
D Q '
The procedure is to:
Write down the desired
count sequence in the
current state columns
Write down the required
next states in the next
state columns
Fill in the FF inputs
required to give the
defined next state
' Q D
Synchronous Counter Example
Also note that if we are using D-type FFs, it
is not necessary to explicitly write out the
FF input columns, since we know they are
identical to those for the next state
To complete the design we now have to
determine appropriate combinational logic
circuits which will generate the required FF
inputs from the current states
We can do this from inspection, using
Boolean algebra or using K-maps.
Synchronous Counter Example
Current
state
0
Q
1
Q
2
Q
0 0 0
1
0
1
0
1 1
1 0 0
0 1 0
0
1
1 0 1
0 1 1
1
'
0
Q
'
1
Q
'
2
Q
0
D
1
D
2
D
1
0
1
1
0
0
0
1
1
0
0
1
1 1
0
0
0
1
1
1
1
0 0 0
1
0
1
1
0
0
0
1
1
0
0
1
1 1
0
0
0
1
1
1
1
0 0 0
Next
state
FF
inputs
By inspection,
0 0
Q D
Note: FF
0
is toggling
Also,
1 0 1
Q Q D
Use a K-map for ,
2
D
1
Q
0
Q
11 00 01 10
0
1 1 1
1
1
2
Q
2 0
.Q Q
2
Q
1
Q
0
Q
2 1
.Q Q
2 1 0
. . Q Q Q
Synchronous Counter Example
1
Q
0
Q
11 00 01 10
0
1 1 1
1
1
2
Q
2 0
.Q Q
2
Q
1
Q
0
Q
2 1
.Q Q
2 1 0
. . Q Q Q
So,
2 1 0 1 0 2 2
2 1 0 2 1 2 0 2
. . ) . .(
. . . .
Q Q Q Q Q Q D
Q Q Q Q Q Q Q D
D
Q
Q
CLK
0
Q
0
D
D
Q
Q
1
Q
1
D
D
Q
Q
2
Q
2
D
Combinati-
onal logic
0
Q
0
Q
1
Q
1
Q
2
Q
2
Q
Synchronous Counter
A similar procedure can be used to design
counters having an arbitrary count sequence
Write down the state transition table
Determine the FF excitation (easy for D-types)
Determine the combinational logic necessary to
generate the required FF excitation from the
current states Note: remember to take into
account any unused counts since these can be
used as dont care states when determining the
combinational logic circuits
Shift Register
A shift register can be implemented
using a chain of D-type FFs
D
Q
Q
D
Q
Q
0
Q
1
Q
2
Q
D
Q
Q
D
in
CLK
Has a serial input, D
in
and parallel
output Q
0
, Q
1
and Q
2
.
See data moves one position to the
right on application of clock edge
Shift Register
Preset and Clear inputs on the FFs can
be utilised to provide a parallel data
input feature
Data can then be clocked out through
Q
2
in a serial fashion, i.e., we now have
a parallel in, serial out arrangement
This along with the previous serial in,
parallel out shift register arrangement
can be used as the basis for a serial
data link
Serial Data Link
CLK
0
Q
1
Q
2
Q
Parallel in
serial out
0
Q
1
Q
2
Q
Serial in
parallel out
Serial Data
One data bit at a time is sent across the serial
data link
See less wires are required than for a parallel
data link
Synchronous State Machines
Synchronous State Machines
We have seen how we can use FFs (D-types
in particular) to design synchronous counters
We will now investigate how these principles
can be extended to the design of synchronous
state machines (of which counters are a
subset)
We will begin with some definitions and then
introduce two popular types of machines
Definitions
Finite State Machine (FSM) a deterministic
machine (circuit) that produces outputs which
depend on its internal state and external inputs
States the set of internal memorised values,
shown as circles on the state diagram
Inputs External stimuli, labelled as arcs on the
state diagram
Outputs Results from the FSM
Types of State Machines
Two types of state machines are in
general use, namely Moore machines
and Mealy machines
In this course we will only look in detail
at FSM design using Moore machines,
although for completeness we will
briefly describe the structure of Mealy
machines
Machine Schematics
Outputs
Next state
combinational
logic
m
CLK
Optional
combinational
logic
D
Q
Q
m
Inputs
n
Current state
Moore
Machine
Mealy
Machine
Next state
combinational
logic
D
Q
Q
m
CLK
combinational
logic
m
Inputs
n
Current state
Outputs
Moore vs. Mealy Machines
Outputs from Mealy Machines depend upon
the timing of the inputs
Outputs from Moore machines come directly
from clocked FFs so:
They have guaranteed timing characteristics
They are glitch free
Any Mealy machine can be converted to a
Moore machine and vice versa, though their
timing properties will be different
Moore Machine - Example
We will design a Moore Machine to implement
a traffic light controller
In order to visualise the problem it is often
helpful to draw the state transition diagram
This is used to generate the state transition
table
The state transition table is used to generate
The next state combinational logic
The output combinational logic (if required)
Example Traffic Light Controller
R
R
G
A A
See we have 4 states
So in theory we could
use a minimum of 2 FFs
However, by using 3 FFs
we will see that we do not
need to use any output
combinational logic
So, we will only use 4 of
the 8 possible states
In general, state assignment is a
difficult problem and the optimum
choice is not always obvious
Example Traffic Light Controller
By using 3 FFs (we will use
D-types), we can assign one
to each of the required
outputs (R, A, G), eliminating
the need for output logic
State
010
R
R
G
A A
State
100
State
001
State
110
We now need to write down
the state transition table
We will label the FF outputs
R, A and G
Remember we do not need to
explicitly include columns for FF
excitation since if we use D-types
these are identical to the next state
Example Traffic Light Controller
Current
state
G A R
0 0 1
0 1
0 1 1
1 0 0
0
'
G
'
A
'
R
0
1
0
0
1
0
1
0
1
0
0
1
Next
state
R
R
G
A A
State
100
State
001
State
110
State
010
Unused states, 000, 011, 101 and
111. Since these states will never
occur, we dont care what output
the next state combinational logic
gives for these inputs. These dont
care conditions can be used to
simplify the required next state
combinational logic
Example Traffic Light Controller
Current
state
G A R
0 0 1
0 1
0 1 1
1 0 0
0
'
G
'
A
'
R
0
1
0
0
1
0
1
0
1
0
0
1
Next
state
Unused states, 000,
011, 101 and 111.
We now need to determine the next
state combinational logic
For the R FF, we need to determine D
R
To do this we will use a K-map
A G
11 00 01 10
0
1
1
1 X
A R.
R
R
G
A
X
X
X
A R.
A R A R A R D
R
. .
Example Traffic Light Controller
Current
state
G A R
0 0 1
0 1
0 1 1
1 0 0
0
'
G
'
A
'
R
0
1
0
0
1
0
1
0
1
0
0
1
Next
state
Unused states, 000,
011, 101 and 111.
By inspection we can also see:
A D
A
and,
A R D
G
.
Example Traffic Light Controller
D
Q
Q
CLK
A
A
D
D
Q
Q
R
R
D
D
Q
Q
G
G
D
FSM Problems
Consider what could happen on power-up
The state of the FFs could by chance be in
one of the unused states
This could potentially cause the machine to
become stuck in some unanticipated sequence of
states which never goes back to a used state
FSM Problems
What can be done?
Check to see if the FSM can eventually
enter a known state from any of the
unused states
If not, add additional logic to do this, i.e.,
include unused states in the state transition
table along with a valid next state
Alternatively use asynchronous Clear and
Preset FF inputs to set a known (used)
state at power up
Example Traffic Light Controller
Does the example FSM self-start?
Check what the next state logic outputs
if we begin in any of the unused states
Turns out:
Start
state
Next state
logic output
000 010
011 100
101 110
111 001
Which are all
valid states
So it does
self start
Example 2
We extend Example 1 so that the traffic
signals spend extra time for the R and G
lights
Essentially, we need 2 additional states, i.e.,
6 in total.
In theory, the 3 FF machine gives us the
potential for sufficient states
However, to make the machine combinational
logic easier, it is more convenient to add
another FF (labelled S), making 4 in total
Example 2
FF labels
R A G S
R
G
R
A A
State
1000
State
0010
State
1100
State
0101
R
G
State
1001
State
0011
See that new FF
toggles which
makes the next
state logic easier
As before, the first
step is to write
down the state
transition table
Example 2
FF
labels
R A G S
R
G
R
A A
State
1000
State
0010
State
1100
State
0101
R
G
State
1001
State
0011
Current
state
A R G
'
G
'
A
'
R
Next
state
S
0 1 0 0 0 1 0
'
S
1
0 1 1 1 0 0 0
0 1 0 0 0 1 1 0
1
1 0 0 1 0 0 1 0
0 1 0 0 1 1 1 0
1 0 0 0 1 0 0 1
Clearly a lot of unused states.
When plotting k-maps to determine
the next state logic it is probably
easier to plot 0s and 1s in the map
and then mark the unused states
Example 2
We will now use k-maps to determine
the next state combinational logic
Current
state
A R G
'
G
'
A
'
R
Next
state
S
0 1 0 0 0 1 0
'
S
1
0 1 1 1 0 0 0
0 1 0 0 0 1 1 0
1
1 0 0 1 0 0 1 0
0 1 0 0 1 1 1 0
1 0 0 0 1 0 0 1
For the R FF, we need to determine D
R
11 00 01 10
00
01
11
10
A R
S G
1
R
A
G
S
1
0
1
A R.
A R.
0 0
X X
X X X
X X X
X X
A R A R A R D
R
. .
Example 2
We can plot k-maps for D
A
and D
G
to give:
Current
state
A R G
'
G
'
A
'
R
Next
state
S
0 1 0 0 0 1 0
'
S
1
0 1 1 1 0 0 0
0 1 0 0 0 1 1 0
1
1 0 0 1 0 0 1 0
0 1 0 0 1 1 1 0
1 0 0 0 1 0 0 1
By inspection we can also see:
S G S R D
A
. . or
S R S R S R D
A
. .
S G A R D
G
. .
or
S A S G D
G
. .
S D
S
State Assignment
As we have mentioned previously, state
assignment is not necessarily obvious or
straightforward
Depends what we are trying to optimise, e.g.,
Complexity (which also depends on the
implementation technology, e.g., FPGA, 74 series
logic chips).
FF implementation may take less chip area than you may
think given their gate level representation
Wiring complexity can be as big an issue as gate complexity
Speed
Algorithms do exist for selecting the optimising
state assignment, but are not suitable for manual
execution
State Assignment
If we have m states, we need at least
FFs (or more informally, bits) to encode the
states, e.g., for 8 states we need a min of 3
FFs
We will now present an example giving
various potential state assignments, some
using more FFs than the minimum
m
2
log
Example Problem
We wish to investigate some state
assignment options to implement a divide by
5 counter which gives a 1 output for 2 clock
edges and is low for 3 clock edges
CLK
Output
Sequential State Assignment
Here we simply assign the states in an
increasing natural binary count
As usual we need to write down the
state transition table. In this case we
need 5 states, i.e., a minimum of 3 FFs
(or state bits). We will designate the 3
FF outputs as c, b, and a
We can then determine the necessary
next state logic and any output logic.
Sequential State Assignment
Unused states, 101,
110 and 111.
Current
state
a b c
0 0 0
1 0 0
0 1 0
a
b
1
0
1
0
1
1
0
0
0
1 1 0 0 0 1
Next
state
0 0 1 0 0 0
By inspection we can see:
The required output is from FF b
Plot k-maps to determine the
next state logic:
For FF a:
b a
11 00 01 10
0
1
1 1
X
c
X X
c
a
b
c a.
c a D
a
.
Sequential State Assignment
Unused states, 101,
110 and 111.
Current
state
a b c
0 0 0
1 0 0
0 1 0
a
b
1
0
1
0
1
1
0
0
0
1 1 0 0 0 1
Next
state
0 0 1 0 0 0
For FF b:
b a
11 00 01 10
0
1
1
X
c
X X
c
a
b
b a.
b a b a b a D
b
. .
1
b a.
For FF c:
b a
11 00 01 10
0
1
1
X
c
X X
c
a
b
b a.
b a D
c
.
Sliding State Assignment
Unused states, 010,
101, and 111.
Current
state
a b c
0 0 0
1 0 0
1 1 0
a
b
1
1
0
0
1
1
0
0
1
0 1 1 0 0 1
Next
state
0 0 1 0 0 0
For FF a:
b a
11 00 01 10
0
1
1 1
X
c
X
X
c
a
b
c b.
c b D
a
.
Plot k-maps to determine the
next state logic:
By inspection we can see that
we can use any of the FF
outputs as the wanted output
Sliding State Assignment
Unused states, 010,
101, and 111.
Current
state
a b c
0 0 0
1 0 0
1 1 0
a
b
1
1
0
0
1
1
0
0
1
0 1 1 0 0 1
Next
state
0 0 1 0 0 0
By inspection we can see that:
For FF b:
For FF c:
a D
b
b D
c
Shift Register Assignment
As the name implies, the FFs are connected
together to form a shift register. In addition,
the output from the final shift register in the
chain is connected to the input of the first
FF:
Consequently the data continuously cycles
through the register
Shift Register Assignment
Unused states. Lots!
Current
state
a
1
0
0
0
Next
state
1
b c
1 0
1 1
0 1
0 0
0 0
a
0
0
0
1
0
0
1
1
0
1 0 0
1 1 0
0
0
1
1
0
d e
0
0
0
1
1
0
1
1
0
0
d
0
0
1
1
0
Because of the shift register
configuration and also from the
state table we can see that:
e D
a
a D
b
b D
c
c D
d
d D
e
By inspection we can see that
we can use any of the FF
outputs as the wanted output
See needs 2 more FFs, but no logic and simple wiring
One Hot State Encoding
This is a shift register design style where only
FF at a time holds a 1
Consequently we have 1 FF per state,
compared with for sequential assignment
However, can result in simple fast state
machines
Outputs are generated by ORing together
appropriate FF outputs
m
2
log
One Hot - Example
We will return to the traffic signal example,
which recall has 4 states
R
R
G
A A
For 1 hot, we need 1 FF for
each state, i.e., 4 in this case
The FFs are connected to form
a shift register as in the
previous shift register example,
however in 1 hot, only 1 FF
holds a 1 at any time
We can write down the state
transition table as follows
One Hot - Example
R
R
G
A A
Unused states. Lots!
Current
state
Next
state
a
0
0
0
1
g
0
0
1
0
ra
0
1
0
0
1
0
0
0
r
a
0
0
1
0
g
0
1
0
0
a r
1
0
0
0
0
0
0
1
r