EE242 - Class - Notes - Logic Design PDF
EE242 - Class - Notes - Logic Design PDF
SPRING 2015
LOGIC CIRCUIT DESIGN EE242
Topics to be covered:
Chapter 1: Implementation of Logic Functions
Chapter 2: Design of Combinational Circuits
Chapter 3: Sequential Circuits
Chapter 4: Design of Synchronous Sequential Circuits
Chapter 5: Introduction to Counters, Registers, and HDL language
Grading Policy:
Midterm 30
LAB 30
Final 90
ILOs of the Logic Circuit Design EE242
1. Comprehend and use the main blocks of combinational circuits, MUXs, ROMs, PLAs, PALs,
Decoders and Encoders
2. Design combinational circuits using different blocks.
3. Carry out a project using the NI- LabVIEW software package to design and test combinational
circuits, if time allows.
4. Differentiate between combinational and sequential circuits
5. Review all types of Flip Flops used in sequential circuits and represent their functions by state
diagrams.
6. Convert verbally stated design problems into state diagrams and hence state tables.
7. Differentiate between Mealy and Moore finite state machines.
8. Follow up the design procedure of sequential circuits starting from implication tables through
partition tables, state transition tables, excitations maps and eventually the hardware
implementation.
9. Use the Verilog/VHDL language to design come known logic circuits, combinational and/or
sequential
10. Comprehend and design synchronous and asynchronous counters
..
CHAPTER
FOUR
Implementation of
Logic Functions _ _ _ _ ----I
4.2 Universal Logic In practice many logic circuits are built using only NAND and
NOR gates because the basic gates in some of the logic families such
Elements as TTL and CMOS are NAND and NOR, respectively. NAND
and NOR gates are considered universal logic elements since they
both can be easily manipulated to obtain all possible logic func
tions. This simplification follows directly from, Boolean theorems
that we have discussed in the earlier chapters.
A close inspection of the truth table of these two functions, as
described in Section 1. 7, reveals that the NAND and NOR opera
tors are duals of each other. Recall also from Chapter 1 that the
dual of a Boolean expression is obtained by replacing every OR
with AND, AND with OR, 0 with 1, and 1 with O. Six of these dual
properties are listed as follows:
NAND NOR
l.a·O=l a+l=O
2. a:l = a a + 0 =a
3. a' a = a a+a= a
4. a' h = a+ b a + b = a' b
5. a. h = a + b a+ b = a • b
6. a' = a • b a+ b= a+ b
OR A+B ~=L>O-A+B
B
X-DR A A
B B
EXAMPLE4.i SOLUTION
Implement A El) B using only There are two different ways to implement this function: (a) using NAND
NAND gates. equivalents ofan X-OR gate and of a NOT gate, and (b) using the NAND
equivalents of either the SOP or the POS tenns.
a. The first possibility results in the circuit of Figure 4.2.
h. Otherwise, A El) B can be ~ressed in the SOP fonn as AB
+ All Consequently: the circuit appears as in Figun: 4.3. The
circuit of Figure 4.3 can be reduced further since X = X. There
fore, the circuit reduces to that of Figure 4.4. Note also that the
function could be expressed in the POS form. Consequently, A El)
B = (A + B)(A + B), which leads to another variation of an X
NOR circuit as shown in Figure 4.5. The circuit of Figure 4.5
100 CHAPTER FOUR Implementation of Logic Functions
FIGURE 4.2
A--'--i
B--+--;
X-OR NOT
FIGURE 4.3
A~~--~-------;~
B -!---.-------'-------i--i
D--A(±)B
NOT AND OR
FIGURE 4.4
A--~----------------------~
B--r~------~------------~
The first and the third fonns, as shown in Figures 4.2 and 4.4, require five
NAND gates each, and the fifth, as shown in Figure 4.6, requires a total of
six. NAND gates.
4.3 Function Implementation Using NANDs 101
FIGURE 4.5
\
A---e>--...
NOT OR
AND
B -......
FIGURE 4.6
B - -.....
4.3 Function It is quite easy to realize any SOP function using two levels of
NAND gates. This method makes use of the fact that comple
Implementation Using menting a function twice returns the function to its original form.
NANDs This result is achieved in two steps:
1. The function is complemented by complementing the
ANDed terms and replacing the OR signs with AND signs.
2. The original function is then recovered by complementing
the complement function .. "
f = ABC' ABc· CD
The final circuit, therefore, is obtained as shown in Figure 4.7. The circuit
requires three three-input NAND gates and one two-input NAND gate
provided Band C inputs are also available in the complemented form.
A
h
I"'" f(A,B,C,D)
C
C
D
\.
t,
4.4 Function The implementation of an SOP function using only NOR gates is
Implementation Using possible only if the function is first converted to the equivalent POS
form. The process includes the following steps:
NORs
1. Plot the function on a K-map and obtain the comple
mented function by grouping all zeros.
4.4 Function Implementation Using NORs 103
FIGURE4.B ~
A
-
1 1 W 1
r0
O 1 1 0
0 0 0 01
,.......,
I
1 0 0 1
'----y----'
and one four-input NOR gate provided the inputs are als9 available in the
complemented form.
8----\
C----I
x..r--- f
B----\
5----1"---
A----;
0----1
"---
o
E
3
F----------~
Therefore,
'---y------'
Data select
[a]
00
)
r--
0 1
}
f--
O2
)
~
0 3 ~ )~ 7
0 4
)i
0 5
)
06
0 ( )
~
0 7
) '.
{'.
[b]
\
4.5 Function Implementation Using MUXs 107
[a] [b]
B E Do
E
Do
01
01
O2
O2 03
f f
03 1-of-8
1-of-8 04 f
f
04 MUX 05 MUX
05 06
06 07
0 7 12 0
B c
0 A C 0 A B 0
[c] [d]
4.13[a], lJ is seen to be tied to five of the data inputs. The gate that
provides lJ must then have a fan~out of at least five. If we limit our
selves to the four choices of Figq.re 4.13, it is apparent that Figure
4.13[d] provides the most preferable circuit, because the Cvariable
needs to be fed directly to only two of the data inputs. Example 4.5
illustrates the meChanism of obtaining a multi-level multiplexer
circuit.
4.5 Function Implementation Using MUXs 109
FIGURE 4.14:
C E
Do
o
01 7
1-of-4
O2 MUX
03 f ((A,B,C,D)
C
i5
11 10
A B
h. Also,
f(A,B,C,D) = AB[C(O) + C(D)] + AB[C(D) + C(O)]
+ AB[C(l) + C(D)] + AB[C(D) + C(l)]
This implies that a two-level MUX circuit would be able to gen
erate this function. The firSt level of a 1-of-2 MUX essentially
eliminates the need for discrete gates. The resultant circuit is
obtained as shown in Figure 4.15. However it can be shown that
C(O) + C(D) == C(l) + C(D)
and
C(D) + C(O) = C(D} + C(l)
Note also that the MUXs usually are provided with an additional
output for providing the complemented result. Consequently, two
of the first-level l-of-2 MUXs may be removed. The resulting
reduced multi-level MUX circuit is obtained as shown in Figure
4.16.
110 CHAPTER FOUR Implementation of Logic Functions
FIGURE 4.15
D [j 0 t5 D 0
01 Do D1 Do D1 Do D1 Do
1-of-2 1-of-2 1-of-2 E 1-of-2
C /0 E C /0 E C /0 C /0 E
MUX MUX MUX MUX
f 7 f 7 f f f
A
1-of-4 MUX E
a
f 7
f(A,a,C,D)
FIGURE 4.16
0 Do
r
1-of-2
MUX
f
D D1
/0 Do
D1 f
C
1-of-4
I D2 MUX
!(A,a,C,D)
E 03
/1 10
t5 Do
1
1-of- 2
MUX A a
f
0 Dl
/0
1 0 fo
! ~
E E
.. Do Do
01 ~ 01
..... O2 ~.D2
11 ROM
III Outputs
10 fo
FIGURE 4.20
Xn Xn-l Xn -2 x, Xo X-l
D2 D1 Do
S 11 ~ "-~~-'
11
1-of-4 MUX E 1-of-4 MUX E E
d 10 10
.f f f f
Yn-l Yo
114 CHAPTER FOUR Implementation of Logic Functions
4.6 Function A read-onry memory (ROM), as the name implies, is intended to hold
fIxed information that can only be read, not altered. The primary
Implementation Using use of the ROM is to provide a means for storing binary informa
ROMs tion. The storing is done during the fabrication of the ROM and
may not be altered without undergoing a signifIcantly involved pro
cess. The same is true for a combinational network that has been
designed, fabricated, tested, and encapsulated with only the inputs
and the outputs available. The ROM has become an important
part of many digital systems because of the ease with which com
plex functions such as code conversion, program storage, and char
acter generation can be implemented. The chip count of circuits, for
which the access time of the ROM is not a restriction, may be
greatly reduced by using ROMs.
A 2m X n ROM is an array of memory cells organized into 2m
wordsofn bits each, as shown by the block diagram of Figure 4.21.
Such a ROM is accessed by means of m address lines and the stored
information is retrieved via a total of n data-out lines, one for each
bit of the word. The ROM corresponds to a combinational network
with n outputs, where each of the outputs is associated with up to 2m
different minterms. A ROM may be provided with one or more
chip-select lines to permit cascading smaller ROMs to form a ROM
with more words (allowing implementation of functions of more
variables).
Pull-up
resistors
01
O2
A2 12
3~8jine 03
A1 . 11 decoder 0
4 OR matrix
Ao 10
Outputs
SOLUTION
.. Use ROM to realize the implemen~ The function truth table is obtained as shown in Figure 4.23. A 2-4 line
tation of the integer function decoder would
. be .sufficient to decode the numbers 0, 1, 2, and 3, and it is
apparent that a maximum of five output lines are needed to represent the
forO < x <3
cube of the largest number. The two select lines, Ao and Ah can be used to
. select anyone of these four outputs. .
116 CHAPTER FOUR Implementation of Logic Functions
0 0 00000
1 1 00001
2 8 01000
3 27 11011
r---~--~---'--~~-------+V
FIGURE 4.24
Pull-up
resistors
E
11 0 1 [)-4I!----t-4t---Hl---+___~f__--+----
2-4 line
decoder
~ 02O'--+---~.-~~~~--+----
output
FIGURE 4.26
Inputs Outputs
P Q R S T U V D C B A
1 ·1 1 1 1 1 0 0 0 0 0
0 1 1 0 0 0 0 0 0 0 1
1 1 0 1 1 0 1 0 0 1 0
1 1 1 1 0 0 1 0 0 1 1
0 1 1 0 0 1 1 0 1 0 0
1 0 1 1 0 1 1 0 1 0 1
0 0 1 1 1 1 1 0 1 1 0
1 1 1 0 0 0 0 0 1 1 1
1 1 1 1 1 1 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1
FIGURE 4.28
z y X U V D C B A
0 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 1
0 1 0 0 1 0 0 1 0
0 1 1 0 1 0 0 1 1
0 0 1 1 1 0 1 d 0
1 0 0 1 1 0 1 0 1
1 0 1 1 1 0 1 1 0
1 1 0 0 0 0 1 1 1
0 0 0 1 1 1 0 0 0
1 1 0 1 1 1 0 0 1
118 CHAPTER FOUR Implementation of Logic Functions
the ROM size to about half of the originaL The ROM implementation of
the circuit, therefore, is given by the multi-level circuit of Figure 4.29.
FIGURE 4.29 p
Q
jf
R
Inputs
Outputs
B
A
-
Although the diode matrix serves to demonstrate the ROM con
cept, ROMs are presently manufactured using bipolar and MOS
transistors, as shown in Figure 4.30. The presence of a connection
from a row line to either a transistor base or a MOSFET gate repre
sents a logic 0, and the absence of such a connection represents a
logic 1. For economical reasons MOS ROM is preferred to bipolar
ROM for large numbers of bits. Access time for bipolar ROM,
however,is much less than that ofMOS ROM.
4.7 Function Examples 4.7 and 4.8 illustrated how a ROM may be used to
implement SOP logic expressions. There is another aspect of the
Implementation Using ROM that deserves attention, however. A ROM consists of a level
PLAs and PALs of AND gates, which constitute the decoder part, followed by a sec
ond level of OR gates (made up of diodes or transistors), which con
stitute the encoder section. A ROM may be thought of as a
programmable array of logic gates. With this array of AND and
OR gates, every combination of minterms of the input variables
(addresses) can be formed. This flexibility is costly in that, when
implementing complex functions, not all minterms are necessary to
realize a given expression. For example, a ROM that processes 12
variables requires a total of 4K byte (eight bits are called a byte)
memory. For example, such an arrangement is needed for the Hol
lerith code conversion circuit that has up to 12 input variables, but
has only 96 eight-bit output combinations of these variables. This
situation implies that 4000 out of 4096 bytes will remain unused.
Such waste can be eliminated by the use of a programmable logic array
(PLA).
A PLA consists of an array of AND-OR logic along with inverters
that may be programmed to realize the desired output. In essence a
PLA may be regarded as being made up of two separate ROMs: an
AND ROM and an OR ROM. A typical PLA configuration is
shown in Figure 4.31 in a 12 X 32 X 8 format. The circuit consists
+v .---e-----+----i II
. . .... . . ..
. .....
~---.,v~-~
Inputs Outputs
120 CHA.PTER FOUR Implementation of Logic Functions
O2 = BDF + DE + eE + "CDEF
0 3 = "CD + AE + DE
04 = "CD + liDF
B
Ltxt
c
Ltxt
Inputs
D
4: AND matrix
'"'"
E
Lr>~
F
Ltxt
OR matrix Outputs
03
04 ,
4.7 Function Implementation Using PLAs and PALs 121
L... '-
PLA
·· PLA
·
- -
[a] [b]
Fusible links
Output
A B
PLA with the low cost and easy programmability of the PROM.
A B C o
A B c o
~ ~ ~ ~
OR array t-- ..- ...- ...- OR array
(programmable)
A fixed
~
"------~
~, ( () () ( () ()
,
=<
--I
y v
AND a!ray AND array
(programmable)
(programmable)
[a] [b]
4.8 Bridging The bridging technique is not so much a self-contained design algo
rithm as it is a way to bend the c4aracteristics of a Boolean function
Technique that cannot be reduced further. If after using K-maps or the Q-M
technique, the function is still large and unwieldy due to the
minterms being logically separated, the function might be bridged by
using known functions that exhibit similar patternS of logically sep
124 CHAPTER FOUR Implementation of Logic Functions
A A A A
-.~-
1 0 1 0 0 1 0 1 0 0 1 1
L--
0 1 0 1
_
1
..
0 1 0 1 1 0 0
B
AEBC
A A
0 1 0 1 0 1 1 0 1 0 1 0
C{ 0 1 0 1 1 0
'---y------'
0 1 1 0 1 0
'---v----'
B B
BEBC ACB8
A A
0 1 0 1 0 0 1 1 0 1 0 1 I 1 1 0 0
1 0 1 0 1 1 0 0 1 0 1 0 0 0 1 1
0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0
1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1
AEBBEBCEBD AEBCEBD
0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 0
1 1 1 1 1 0 0 1 0 0 1 1 0 1 0 1
0 0 0 0 1 .0 0 1 1 1 0 0 1 0 1 0 ID
1 1 1 1 0 1 1 0 1 1 0 o i 0 1 0 1
'---y------' '---v-----'
B B
BEBD AEBC
4.8 Bridging Technique 125
FIGURE 4.37
)
1 0 0 o i
1 0 0 1
1 0 1 O·
0 1 0 1
'-----v----'
B
126 CHAPTER FOUR Implementation of Logic Functions
they are not exactly alike. They differ at three minterm locations: 1,5, and
12. The two functions may be bridged, therefore, as shown in Figure 4.38.
The bridging between the two functions F and f required that certain con
straints, as listed in Figure 4.39, be met in determining X and Y functions.
These constraints follow directly from the equation F = f . X + Y.
FIGURE 4.38
1 0 0 0 1 0 1 0 d - 0 - d 0 I 0 0
1 0 0 1 0 1 0 1 0 d 1 0 0 d
+
1 0 1 0 1 0 1 0 d d d 0 d 0
0 1 0 1 0 1 0 1 d d 0 d 0 d
'--v----' ~ ~ -----.,,-
B B B B
FIGURE 4.39 The d's in the table of Figure 4.39 indicate that either X or Y or both
must equal 1. In other words, X and Y cannot simultaneously be 0 when F
= f = 1. This use of d, however, permits many choices for the selection of
F f X Y
X and Y. It can be seen that if all d's in X are set equal to 0, then F = Y,
0 0 - 0 which is contrary to what is expected in bridging. When F = Y no bridg
0 1 0 0 ing is needed. On the other hand, if all d's in X are set equal to 1, then
1 0 1
Y =ABCD
1 1 d d
X=B+C
Therefore,
F = (A EB B EB C EB D) • (B + C) + ABC
The resultant circuit is obtained as shown in Figure 4.40. This bridged cir
cuit is certainly better than the circuit that could be obtained by using only
FIGURE 4.40
------j.....-:~\
oA -------I'--....J
B-+......-I
Problems 127
The bridge scheme is very general and it does not have to involve
only X-OR functions. This technique ~an be used for generating a
complex function when a like function of the same variables already
exists (see Problem 16).
4.9 Summary In this chapter various practical techniques were introduced for
realizing combinational circuits. In particular, circuits using only
NAND gates, only NOR gates, only MUXs, only ROMs, only
PLAs, and only PAls were discussed. In addition, the bridging
technique was introduced to handle functions that are otherwise not
reducible.
Problems 1. Obtain the circuit for the following functions using only
NAND gates:
a. f(A,B,C,D) = ~m(I,4,10,11,13,15)
b. f(A,B,G,D) = ~m(I,3,4;9,1O,13)
c. f(A,B,C,D) = ~m(I,8-1O,15)
d. f(A,B,G,D,E) = ~m(I,3-7,11,14-17,22,24-27,30)
e. f(A,B,C,D,E) = ~m(I,8-1O,13-17,21,25-27,30,31)
2. Obtain NOR circuits for the functions of Problem 1.
3. a. Use a single level of l-of-8 MUXs and a few assorted
gates (if needed) to obtain a combinational circuit for
each of the functions of Problem 1.
b. For each of your solutions, complement one variable and
rearrange the inputs so that the function is still correct.
4. Using l-of-4 MUXs, obtain a two-level MUX circuit for each
of the functions of Problem 1.
5. Obtain the circuit for the functionf(X,Y,2:,U, V) = ~m(0,1,6,
7,9,12,13,15,18,20,22,24-26,28) using two levels of l-of-4
MUXs and a few assorted gates.
6. Use bridging to implement the following functions using X
OR gates:
a. f(A,B,C,D) = ~m(I,2,5,7,8,10,13,14)
b. f(A,B,G,D) = ~m(2,3,6,7,9,11,12,13)
c. fCW,X,Y,Z) = ~m(0,2,3,6-8,1O,13)
d. f(W,X,Y,Z) = ~m(0,6,9,1O,15)
7. Implement the functions of Problem 6 using ROMs.
8. Implement the functions of Problem 6 using PLAs.
128 CHAPTER FOUR Implementation of Logic Functions
FIGURE4.Pl
;:---lr--)----i-~)r---f(A,B,C,D)
~------------------~--~-
5.1 Introduction A combinational logic circuit, as shown by the block diagram of Figure
5.1, is defined as a combination of logic devices whose output is a
function of the present values of the input variables and indepen
dent of the past values. After propagation time through the circuit,
input variable changes cause output changes that are dependent
orily on the present input values.
\
5.2.1 Half Adder (HA) The half adder (HA) unit is a simple multiple-output combina
tional circuit used for adding two bits without a carry-in. The truth
table for the two inputs, Ai and Bi, and the output sum, Si' and
carry-out, Gi , are shown in Figure 5.2.
[a] [b]
Using a Karnaugh map, the equations for the sum, Sj, and carry,
Gi , are as follows:
S·I = A·ll + A·~· = A· lD
I I rut W B· I t [5.1]
C·t = A·B·
I I [5.2]
FIGURE 5.3 HA Circuit: [a] illustrates four ways to implement the HA functions. Circuits using
Using AND and X-OR Gates, [b] [a] an AND and an X-OR gate, [b] NOR gates, [cJ NAND gates,
Using NOR Gates, [c] Using and [dJ multiplexers are shown.
NAND Gates, and [d] Using
MUXs.
A
C; Cj
B;
A
Bj D-Si Sj
[a] [bJ
Bj 0 B; Bj
Sj
Aj 1-of-2
10 MUX E
Cj
Cj S;
[c] [d]
5.2.2 Full Adder (FA) Afoll adder (FA) is a three-input, two-output logic circuit that
adds two binary digits, Aj and Bi, and a carry-in from the i - I bit
position, Gi - 1• The block diagram and the corresponding truth
table are shown in Figures 5.4[a-b]. The K-maps for the sum bit, Si,
and the carry-out, Gil are constructed from the truth table and
shown in Figure 5.4[c]. The equations for the sum and carry-out
can then be obtained from the K-maps as follows:
Si(Ai,Bj,Gi - 1) = AjB,ci-l + AJ3,Ci-l + A;B,Ci - 1
. + AJ3jGi - 1 [5.3]
and
Gi(Aj,Bj,Gj_l) = AiBi + A,ci-l + B,ci-l [5.5]
= Aj + Bi + Ai + Ci - 1 + Bi + Ci - 1 [5.6]
134 CHAPTER FIVE Design of Combinational Circuits
[a] [b]
A;8i Ai8 j
Ci - 1 00 Ci- 1 00 01 11 10
o O· 0 o 0 IT] 0 IT]
1 0 lIT] 0 IT] 0
[c]
Now recall that Ai EB Bj is the sum output and A/3i is the carry
5.2 Binary Adders 135
A
fj.
- I
Ci- 1
Ai
Bi
Ci - 1
(a]
(b]
out for an HA. Thus. the HAs designed in the last section may be
used for realizing an FA. Expressing the FA equations in terms of
the HA equations, Equations [5.1] and [5.2], gives
Si = Si(HA) E11 Ci- 1 [S.9]
Ci = Si(HA) • Ci - 1 + Ci(HA) [S.10]
where Si(HA) and Ci(HA) are the sum and carry-out of the HA. Note
also that Equation [5.9] involves an X-OR operation between the
carry-in and the HA sum. If the sum output of the HA and the
carry-in are fed into a second HA, the final sum output will be the
136 CHAPTER FIVE Design of Combinational Circuits
FA sum, Si' In addition, if the carry-outs from both of the HAs are
ORed together, the FA carry-out, Gi, is obtained. Figure 5.6[a]
shows the FA circuit using two HAs and an OR gate. The circuit
corresponding to Equations [5.7] and [5.8] also may be imple
mented using only NAND gates or only NOR gates. The resultant
NAND equivalent circuit is shown in Figure 5.6[b]. This NAND
circuit requires only nine NAND gates and a total of 18 gate inputs.
We have designed an FA circuit using three fewer gates and 13
fewer gate inputs than would be necessary had we not made use of
the X-OR K-map structure and bridging.
Ci - 1
[aJ
Ci _ 1- - - - - - - - I - - - - - - - - - - - l
D - - - - - - Ci
[b]
AI B, Ao Bo
X Y
FAn- 2 Cj FAa Ci 0
Co S Co S S Co S
Co
SI
[a]
Ao Bo
C, Co
So
[b]
X = augend Co carry-out
Y = addend S sum
Cj carry-in
make an n-bit adder.· The delay of this n-bit ripple adder is n!:J.
FIGURE 5.8 Multiplication of where !f:. is the propagation delay of the carry-out of a single FA.
Two Three·Bit Numbers.
This delay is accumulated when the carry into the multi-bit adder
has to propagate through all.ofthe FAs to get to the final carry-out.
B2 B, Bo
Consequently, this delay beComes more and more significant as n
A2 . A, Ao
becomes larger.
AoB2 AoB, AoBo Multiplication of binary numbers makes use of addition just
A,B2 AlB, A,Bo as multiplication of decimal numbers does. The multiplication of
A2B2 A2B1 A2Bo two three-bit numbers, A = A~ lAo and B == Br/3I Bo, is symbolicilly
obtained as shown in Figure 5.8, where P5P.,;P3P'lflPO forms the prod
138 CHAPTER FIVE Design of Combinational Circuits
uct. Note that for the multiplication of two n-bit numbers, the product
has the possibility of 2n bits.
Later in the text sequential design techniques will be presented
that will allow designing a multiplier that uses a repetitive algo
rithm for multiplication. It is possible, however, to design a combi
national circuit using FAs that will pedorm the multiplication of
two binary numbers by pedorming the sum of the three partial
products of two numbers. This combinational circuit must be able
to add columns of bits. Example 5.1 will demonstrate how FAs can
be used to do similar functions.
where XI and X2 are the carry-outs and YI andyz are the respective sums. As
a next step the least significant bits,YI and Y2, may be added as follows:
YI
Y2
o
where X3 and So are the carry-out and the sum, respectively. Finally, Xb X2,
and X3 could be fed into a fourth FA to yield the carry-out, S2, and the sum,
Sil as follows:
The complete circuit, therefore, would require four FAs. The resulting cir
cuit is obtained as shown
. . in Figure 5.9.
5.2 Binary Adders 139
FIGURE 5.9 as a4 a2 81
1
B
FA C, a3 FA C, 80
S
X1 Yl
A B
FA Cj FA Cj 0
• - % ';";;;-:;.'~
Co S S
So
A augend Co carry-out
B == addend S == sum
Cj == carry-in
rsmr L 11
FIGURES.II
4 4 4
y x Y
4-bit
4-bit 4-bit 4-bit
multiplier ROM
multiplier ROM multiplier ROM multiplier ROM
Z
o 8
CO- 3
V U V
4·bit FA
w W
4 4
4 AO- 3
A4- 7 4
U V U V
U
w w W
4 4 4
P8-11 PO- 3
A good approach to any design problem is to break the given problem into
several simpler problems. This procedure is necessary in this example i.p.
order to make the problem fit the devices that are provided. Consider the
mqItiplication of two eight-bit numbers, Xl and X2, each consisting of a
5.3 Binary Subtracters 141
least significant four bits, Li , and a most significant four bits, Mi' The eight
bit number can then be expressed as the sum of the two four-bit parts:
x I = 24(M·)! +L !
where Mi is shifted to the left four places (multiplied by 24) before being
added to Li. The product, P, may now be expressed as
Each of these four partial products may be obtained using four four-bit
multiplier units. The four multiplier units would respectively have (a) Ml
and M2, (b) MI and ~, (c) M2 and LI , and (d) Ll and ~ as inputs. This
configuration would result in a total of four eight-bit outputs: AJ BJ CJ and
D, respectively. Since two eight-bit quantities are being multiplied, a 16
bit product is expected. Note also that D should be added to the sum of B
and C that have been shilled to the left four places, and this in tum should
be added to A that have been shilled to the left eight places. A network of
six four-bit FAs may be employed, as shown in Figure 5.11, to obtain the
16-bit sum of the shilled partial products. The final product is obtained by
adding the partial products. Care must be taken to connect the partial
products at the correct bit positions relative to their power of2. The shill
ing is implicit in the interconnection pattern of the adder modules.
Note that a single ROM for multiplying two eight-bit numbers would
require a total of 1,048,576 bits, that is, 16 bits of address and 16 bits in
each location, to store the 16-bit product, or 216 X 16 bits. Each ROM
that we used in this example had a size of only 2048 bits, giving a total of
8192 bits. This design would probably be less expensive but would be
. slower due to the time required to perform the additions. Such time and
money trade-otfs will be a typical design decision that must be made by
every engmeer.
5.3 Binary Subtracters Many arithmetic circuits also require a unit for subtraction. A sub
tracter circuit could be designed from scratch. However, recall from
Chapter 1 that subtraction also is possible by adding the comple
ment of the subtrahend to the minuend. Consequently, rather than
designing a straightforward subtracter, a multi-bit subtracter can
be made using complement arithmetic. This design would involve
the use of a multi-bit parallel adder circuit that isfed with the com
plemented subtrahend and the minuend.
In order to accoinplodate the multi-bit parallel adder to the
requirement of our preseIlt desigy{, certain modification is necessary
for complementing the subtrahend. If each bit of the subtrahend is
individually complemented, the corresponding 1's complement will
be obtained. A 2's complement could be formed by adding a one to
the LSB of the corresponding 1'8 complement, that is, by making
the carry-in to the LSB position of the adder a 1. To perform the
142 CHAPTER FIVE Design of Combinational Circuits
~----------~~----------~~----------~~----'---E
B1 Bo
Ao
x X X Y X
FA Cj FA Ci FA Ci FA Ci
S S Co S Co S
C2 C1 Co
C3 S3 S2 Sl So
X = augend Ci carry-in
y addend Co carry-out
S sum
FIGURE 5.13
5.4 Carry Look~Ahead The particular multi-bit parallel adder circuit developed in the pre
vious section is sometimes referred to as a ripple adder because a
(CLA) Adders carry from one unit of the adder may have to ripple through several
units before the sum is obtained. Such ripple adders have also been
used to form either 2's complement, or l's complement sign-and
magnitude binary adder/subtracters. The performance of a ripple
adder/subtracter, however, is limited by the time required for the
carries to ripple through all of the stages of the circuit. For such
devices the maximum delay is directly proportional to the number
of FA units.
One particular method of speeding up the combinational addi
tion process is known as carry look-ahead (CLA). In Figure 5.14 it may
be seen that the carry-out is the same as the carry-in as long as one
144 CHAPTER FIVE Design of Combinational Circuits
o o
x y
o
Co S Co S
o o o
X = augend Co carry-out
Y = addend S sum
C, = carry-in
where Ajand Bi are the addend and augend, respectively, of the ith
full adder.
The FA equations, Equations [5.7] and [5.8], can then be rewrit
ten as
s· I
= p. \Il
1
ffi C· 1
I [5.13]
C·I = G· + Pc.
I I 1 I [5.14]
For a four-bit adder the carries for the various stages are as follows:
Co = Go + POC- I [5.15]
CI = GI + PICO
= G1 + P1GO+ PIPOC- 1 [5.16]
C2 = G2 + P2Cr
= P2 + P2G1 + P2P1GO+ P~IPOC-I [5.171
and
C3 = G3 + P3C2
I
= G3 + P3G2 + P~2Gl + P~2PIGO + P3P2PIPOC-I [5.18]
5.4 Carry look-Ahead (CLA) Adders 145
and
[522]
~t
~r .
quite problematic. It was seen in Chapter 3 that NAND gates with
too many inputs are hard to come by. This limitation is com
pounded by the fact that the carry-in, C_ b must drive a total of n
I + 1 gates. In addition, the propagate functions will be subjected to
~Si'
I
c/,·
a fan-out requirement on the order of (n + 1)2/4. All of these
~ ~:.". . . .•.
together result in a serious fan-in problem for n too large.
,
~~:~
146 CHAFFER FIVE Design of Combinational Circuits
CLA
SO-3
[a]
Xo Yo
11 11 11 11 Propagate
PG 3 PG 2 PG , PG o generate
section
P3 G3 P2 G2 PI G1 Po Go
i
1_
IIII
CL3 CL2 CL 1 CLo Carry
look-ahead
section
C3 C2 C1 Co
-
I~ Sum
sU 3 I-+- sU 2 I+- su, ~ suo section
Cout
l 1 1 1
So
[b]
AI
P;
8;
~
/
G;
[a]
Si
[b]
eP:~
Go >-r>J }-e o
P3
P2
P1 P1
Po
Po
C 1 C- 1
P3
P2
P1 P1
C1 Go
Go
G1 P3
P2
C3
G1
P2
P1
Po P3
C- 1
G2
P2
P1
Go G3
C2
P2
G1
G2
[c)
148 CHAYI'ER FIVE Design of Combinational Circuits
hers of bits. Figure 5.17 shows the connections for performing the
addition of two 16-bit numbers with CLA.
Carry-propagate and carry-generate functions for more than
four bits can be derived continuing the same process used for deriv
FIGURE 5.17 Hi·Bit Addition ing C3 and S3' Circuit complexity makes such implementation
with CLA Modules. impractical except for special-purpose, high-speed requirements.
1
Addend Augend
1 1 Addend Augend
1 1 Addend
1
Augend
1
Addend Augend
1
Sum4-bit fast adder r-- Sum4-bit fast adder ,...- Sum4-bit fast adder
r- Sum4-bit fast adder r-
P G Cj Co P G Cj Co P G Ci Co P G CI _ Co
I I I T I
+
51 6 5 12-5 15
5 8 -5 11
I 5c 57 50-53
r-
I I I i r
P3 G3 P2 G2 P1 G1 Po Go Cj
P G C2 C1 Co
I I
T
I
For use with more than 16 bits
The first four equations are similar to Equations [5.15-18]. The last four
equations have a similar form, but C3 is treated as the carry-in to the fifth
bit. The resultant circuit may now be obtained, as shown in Figure 5.18, by
FIGURES.I8 having two separate units for the carry section .
.Addend
. Augend
PG 7 PG 6 PG s PG 4 PG 3 PG 2 PG I PG o
.'. P7 /G
7
,
,~6 G6 Ps IG s P4 fG 4 P3 IG 3 P2 G2 PI /G 1 Po IGo
I I .!
If rI f{ Tf 11 [{ J1 11
i
C7 C6 Cs C4 C3 C2 Cl CO
I
IP 7 I
IP6 IPs
I
P
I4 r 3
lP 2 lP I
lPo
I I I I I I I So
I
5.5 Code Converters It was pointed out in Chapter 1 that many different binary codes
exist that are used in various digital subsystems. Sometimes it is nec
essary to transfer data from one subsystem to another. Code converter
i
circuits are required to convert one form of binary code to another.
Many of these converters use combinational logic, and there are
many that use sequential logic as well.
~; The following examples will illustrate the combinational tech
~I t.',
niques in the design of various code converters. We shall consider
several conversion schemes: Gray-to-binary, binary-to-Gray,
i' :~
'j~,:'
FICURE5.J9
Gray Binary
G4 G3 G2 G1 Go B4 B3 B2 B1 Bo
0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 1
0 0 0 1 1 0 0 0 1 0
0 0 0 1 0 0 0 0 1 1
0 0 1 1 0 0 0 1 0 0
0 0 1 1 1 0 0 1 0 1
0 0 1 0 1 0 0 1 1 0
0 0 1 0 0 0 0 1 1 1
0 1 1 0 0 0 1 0 0 0
0 1 1 0 1 0 1 0 0 1
0 1 1 1 1 0 1 0 1 0
0 1 1 1 0 0 1 0 1 1
0 1 0 1 0 0 1 1 0 0
0 1 0 1 1 0 1 1 0 1
0 1 0 0 1 0 1 1 1 0
0 1 0 0 0 0 1 1 1 1
1 1 0 0 0 1 0 0 0 0
1 1 0 0 1 1 0 0 0 1
1 1 0 1 1 1 0 0 1 0
1 1 0 1 0 , 0 0 1 1
1 1 1 1 0 1 0 1 0 0
1 1 1 1 1 1 0 1 0 1
1 1 1 0 1 1 0 1 1 0
1 1 1 0 0 1 0 1 1 1
1 0 1 0 0 1 1 0 0 0
1 0 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 0 1 0
1 0 1 1 0 1 1 0 1 1
1 0 0 1 0 1 1 1 0 0
1 0 0 1 1 1 1 1 0 1
1 0 0 0 1 1 1 1 1. 0
1 0 0 0 0 1 1 1 1 1
The next step in the design process normally would be to produce five
five-variable K-maps for detennining B4, B3, B2, Bb and Bo as functions of
Col, G3, G2, Gh and Go- Note, however, that G4 and B4 are exactly alike. In
5.5 Code Converters 151
B4 = G4
B3 = G3 E9 G4
B2 = G2 E9 G3 E!1 G4
B I = G1 E!1 Gz E9 G3 E9 G4
Bo = Go E9 G1 E9 G2 E9 G3 E!1 G4
FIGURE 5.20
::~9-r5-=i ==::
}---+----- 82
G1 - - - - f
'----
GO _____________ ~~BO
G3 = B3 EEl B4
G2 = B2 EEl B3
G1 = Bl EEl B2
Go = Bo EEl BJ
The logic circuit of an n-bit binary-to-Gray converter is obtained as shown
in Figure 5.21.
FIGURE 5.21
(BJ33BzBl)
DJJ~-Pl =.
1
(BJ3~zBl + 0011) otherwise
The regular design ofthe conversion module would consist of obtaining the
minimized Boolean expressions for D4, D3 , D z, and Dl from the correspond
ing K-maps as shown in Figure 5.23. In the K-map, however, the output
5.5 Code Converters 153
84 83 82 8 1 80 0 7 0 6 Os 0 4 0 3 O2 0 1 Do
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 1
0 0 0 1 0 0 0 0 0 0 0 1 0
0 0 0 1 1 0 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0 0 0 1 0 0
0 0 1 0 1 0 0 0 0 0 1 0 1
0 0 1 1 0 0 0 0 0 0 1 1 0
0 0 1 1 1 0 0 0 0 0 1 1 1
0 1 0 0 0 0 0 0 0 1 0 0 0
0 1 0 0 1 0 0 0 0 1 0 0 1
0 1 0 1 0 0 0 0 1 0 0 0 0
0 1 0 1 1 0 0 0 1 0 0 0 1
0 1 1 0 0 0 0 0 1 0 0 1 0
0 1 1 0 1 0 0 0 1 0 0 1 1
0 1 1 1 0 0 0 0 1 0 1 0 0
0 1 1 1 1 0 0 0 1 0 1 0 1
1 0 0 0 0 0 0 0 1 0 1 1 0
1 0 0 0 1 0 0 0 1 0 1 1 1
1 0 0 1 0 0 0 0 1 1 0 0 0
1 0 0 1 1 0 0 0 1 1 0 0 1
FIGURE 523 8 28 1 8 28 1
83 11 10 83 00 01 11 10
00 01
00 0 0 0 0 00 0 0 0 0
.--
01 0 1 1 1 01 1 0 0 0
11 - 1- - - 11 -
i--
- - -
10 1 1 - - '10 0 1 - -
. "': . .
.- - 8 28 1 8 28 1
83 00 01 11 10 83 00 01 11 10
00 0 0
- 1 1 00 0 111 1\ 0
01 0 0 1 0 01 0 0 0
-1
11
r---
- - -
r--
- 11
r---
- - - --
I=-
10 1
I--
0
'--
- -
i....--i
10 1
r---
0 - -
"'--
154 CHAPTER FIVE Des' of Combinational Circuits
D4 = B3 Bl + B3 B2 + B4
D3 = B.lJl + Bsl12Bl
D2 = B2BI + B4Bl + B3B2
DI = B~3Bl + B3 B2Bj + B~l
FIGURES.24
I I I
The equations found for D4 , D3, D 2, and Dl are the equations that
would be implemented in a commercial binary-to-BCD Ie. Another solu
tion using an adder would involve designing a circuit that outputs a 1
whenever B.lJ3B2Bl > 0100. The circuit output is tied to the least signifi
cant two addend inputs of a foUr-bit adder while B4, B3, B2, and Bl are tied
to the corresonding augend inputs. The sum outputs of the four-bit adder
unit, as shown in Figure 5.25, would yield the desired BCD output.
FIGURES.2S
4-bit adder
FIGURE 5.26 Shifted BCD BCD Digits Shifted BCD Digits Corrected and
Digits. BCD Digits Left One Bit Then Shifted Left One Bit
0000 00000 00000
0001 00010 00010
0010 00100 00100
0011 00110 00110
0100 01000 01000
0101 01010 10000
0110 01100 10010
0111 01110 10100
1000 10000 1 0110
1001 10010 11000
Step 2. Correct-Shift: The four bits on the immediate left of the binary point
could be larger than 0100, and in the present case they are. A new correct-shift
operation is required, therefore:
1 0101 . 111 X 23 from previous operation
1 1000 . 111 X 23 corrected BCD prior to shift
11 0001 . 11 X 22 hybrid number after shift
Also,
[31 + (3/4)] X 22 = 12710
Keep in mind that the shift operation just performed brought in a.bit from
the right of the binary point to be included in the BCD portion. This move
is valid since our four-bit input binary-to-BCD converter actually converts
five bits, the four connected and the one immediately to the right of those
connected.
Prior to shifting, we again add 0011 to those BCD digits that could be
greater than 0100. The left-most BCD digit can at most be 0011, so no cor
rection prior to shifting is necessary.
Step 3. Correct-Shift:
11 0001 . 11 X 22 from previous stet>
11 0001 . 11 X 22 corrected BCD prior to shift
110 0011 . 1 X 21 hybrid nuinber after shift
Step 4. The next correction prior to shifting requires two devices since there
are sufficient bits in both BCD, digits to have values greater than 0100. Again,
the left-most binary-to-BCD has one input coruiected to 0 to allow for the pOs
sibility of a four-bit output with only three bits in:
5.5 Code Converters 157
FIGURE 5.27
Binary-to-BCD
Binary-la-BCD
04 03 O2 0,
I I
Binary-to-BCD
Binary-to-BCD Binary-to-BCD
2. Take the three least significant processed bits and the most
significant unprocessed bit as inputs to a converter module.
The most significant processed bit (MSPB), which is the MSB
of the left-most converter module, is considered in the next
step.
3. If there are three MSPBs, connect a 0 to the MSB position
of a converter module and the three MSPBs to the remain
ing three inputs; otherwise carry the MSPBs from above
operations to the next leveL
4. Once a converter module is added to a level, the number of
converter modules remains the same until three MSPBs
accumulate, at which time another is added.
5. This process is continued until the LSB is the only unpro
cessed bit.
EXAMPLES.9 SOLU110N
Use several of the modules designed The logic circuit necessary for obtaining the conversion of this II-bit
in Example 5.7 for converting the binary number follows directly from the previous discussion of the n-bit
binary number 110101101002 to its binary-to-BCD conversion algorithm. The resulting circuit configuration is
BCD equivalent. shown in Figure 5.28. After every three levels, the number of modules per
level increases by one. The output of the network is 1716BCD as expected.
otherwise
1
j
FIGURE 5.28 o o o 0
Binary-la-BCD
04 03 O2 01
1 0 10 11
B4 B3 B2 B1
Binary-to-BCD
04 03 O2 01
OJO J1 1
B4 B3 B2 Bl
Binary-la-BCD
Binary-to-BCD Binary-to-BCD
04 03 O2 01 04 03 O2 01
1 0 0 \0 10 0 1 1
B4 B3 B2 B1 B4 B3 B2 Bl
Binary-to-BCD Binary-to-BCD
04 03 O2 01 04 03 O2 01
o 0 10
\0 1 0 1 0
B4 B3 B2 Bl B4 B3 B2 B1
Binary-to-BCD Binary-la-BCD
04 03 O2 01 04 03 O2 01
o 1 0 0 \0 \0 1 0
I
~t
o
'----y---' '----.,y~--' '~--'Y--~
o
:';,!••.
;;:"
:p,;:
1 7 6
fi
.7,:·
.~
160 CHAPTER FIVE Design of Combinational Circuits
FIGURE 5.29
The truth table for such a module is obtained as shown in Figure 5.29.
The don't-ca.res in the binary table occur for six different input values that
I will never appear as uncorrected BCD digits. For example, a 0101 will never
0 4 0 3 O2 0 1 84 8 3 8 2 81 occur since that would imply the presence of an unlikely BCD number, either
0 0 0
1010 or 1011, prior to the shift-right operation. Examination of the truth table
0 0 0 0 0
indicates that BCD digits equal to or less than 0100 require no modification.
0 0 0 1 0 0 0 1
However, for BCD digits 8 through 12 a value of 3 must be subtracted for
0 0 1 0 0 0 1 0
correction. G:mstructing and minimizing the corresponding K-maps for B4, B3,
0 0 1 1 0 0 1 1
B2, and B1gives the following Boolean equations:
0 1 0 0 0 1 0 0
0 1 0 1 - - -
0 1 1 0 - - -
0 1 1 1 - - BI = DlJ4 + D)D4 = D) ED D4
1 0 0 0 0 1 0 1
B2 = D2D4 + DID~4 + D)D2
1 0 0 1 0 1 1 0
1 0 1 0 0 1 1 1 B3 = D2D4 + D)D2D4 + D)D3D"
1 0 1 1 1 0 0 0 B4 = D3D4 + D)D2D3
1 1 0 0 1 0 0 1
1 1 0 1 - -
1 1 1 0 - - - The circuit for the BCD-to-binary module may now be obtained as shown
1 1 1 1 -
in Figure 5.30.
FIGURE 5.30
01 ~
/~D 81
~~
V I \
1
.....- r- f-)
~
/~
BCD-to-Binary
1
~ \~L
I
/'
'- I
5.5 Code Converters 161
Use the module designed in As mentioned previously, this process should be the reverse of the binary
Example 5.10 to periorm the to-BCD conversion scheme developed earlier.
conversion of 12710 and
consequently develop an algorithm Step 1. Shift the BCD quantity to the right by one bit, which will replace
for use inann-bit BCD-to-binary one bit to the right of the decimal. We are considering a hybrid number again.
conversion. Note that The digits to the right of the radix point will be binary and those to the left
BCD. The process of shifting results in uncorrected BCD values. The BCD-to
12710 = 000100100111 BCD
binary converter is used to correct these uncorrected results:
Step 3. Correct-Shift:
0001 1000. 111 X 23 uncorrected BCD
0001 0101 . 111 X 23 corrected BCD
Step 1. Starting at the right end, skip the LSB and connect four-input,
BCD-to-binary converter modules to all remaining bits. If two or less bits
would be connected to the left-most converter, leave it off and extend the bits to
the next leveL If all bits at a level are connected to a converter module, the
MSB of the output will be zero and should not be carried to the next level.
Step 2. Skip the least significant processed bit at each level and reassign bits
162 CHAPTER FWE Design of Combinational Circuits
FIGURE 5.31 0 0 0 0
I
I I I I I ! I I
0 0 O 0
4 3 2 1 0 4 0 3 O2 0 1
BCD-to-Binary' BCD-to-Binary
84 83 82 81 84 83 82 81
BCD-to-Binary
84 83 82 81
BCD-to-Binary
BCD-to-Binary
5.6 BCD Arithmetic Even though most computers use regular binary numbers for their
arithmetic operations, some special-purpose computers and calcula
Circuits tors operate in the decimal number system using BCD. BCD-based
systems require morem~mory to store information because of less
efficient coding and complex arithmetic circuitry. However, the
final results in these systems do not have to be decoded prior to dis
play as decimal digits. BCD arithmetic is usually complicated by
the fact that some of the sums or differences are invalid. When two
BCD numbers are added on a binary adder, it is possible to obtain
16 different sUms, of which six are undefined. In addition, when
5.6 BCD Arithmetic Circuits 163
~1
0 0 0 0 0 0 0 0 0
... . . . . .. . . . No correction needed
0 1 0 0 1 0 1 0 0
0 1 0 1 0 1 0 0 0 0
0 1 0 1 1 1 0 0 0 1
0 1 1 0 0 1 0 0 1 0
0 1 1 0 1 1 0 0
1 1
0 1 1 1 0 1 0 1 0 0
0 1 1 1 1 1 0 1 0 1
1 0 0 0 0 1 0 1 1 0
1 0 0 0 1 1 0 1 1 1
1 0 0 1 0 1 1 0 0 0
1 0 0 1 1 1 1 0 0 1
0 0 1 1 1 - - -
0 0 1 1 1 - - -
'-
. _.--.,----'
S2
An adder made in this way is shown in Figure 5.34. The sum bits of
the first adder unit are introduced at the augend inputs of the sec
ondadder unit. When the corrected carry-out, C3, is a 0, theuncor
rected sum remains unchanged. When it is aI, the uncorrected sum
is added to 0110 to give the corrected sum at the output of the sec
ond four-bit FA.
At this time the designer may be concerned with the amount of
worst-case propagation delays; The propagation delays basically
arise .from the two FA subunits used in this circuit. A close examina
tion of the circuit, however, reveals that the correction does not
need all four of the single-bit FAs. So never needs any correction. An
improved version of the BCD adder may be obtained by having
only two HAs and on~ FA in the correction unit. This improved cir
cuit is shown in Figure 5.35. Another approach for designing BCD
adders would be first to convert the BCD numbers into binary, add
the resulting binary numbers, and then transform the binary sum
into the correct BCD sum. This design requires both postcorrection
and preconversion circuitries and, therefore, is more expensive than
the one already designed.
5.6 BCD Arithmetic Circuits 165
4-bit FA
Sum
S3 So
s~ s;
Addend
4-bitFA
Addend
4-bit FA
Sum
FIGURE 5.36 Truth Table for So
the BCD 9's Complement.
S;
13 12 11 10 0 3 O2 0 1 0 0
0 0 0 0 1 0 0 1
0 0 0 1 1 0 0 0
0 0 1 0 0 1 1 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 0 1
0 1 0 1 0 1 0 0
0 1 1 0 0 0 1 1
0 1 1 1 0 0 1 0
1 0 0 0 0 0 0 1
1 0 0 1 0 0 0 0
Carry-out S3 Sl So
11-~-.--;D- 0,
4-bit FA
'-------- 01
10 -----1[:>---- 00 '-----v-----'
9's complement
[a] [b]
5.6 BCD Aritlunetic Circuits 167
Once the 9's complementer is designed, the rest of the steps are
obvious. If X-OR gates are used in place of the inverters of Figure
5.37[b], a combined BCD adder/subtracter unit may result. The
BCD adder/subtracter unit so designed is shown in Figure 5.38.
Each decade unit consists of three four-bit FAs. The first one works
Augend/Minuend Addend/Subtrahend
.-------/-+---+--*---+-.--+-....... SUB/ADD
,I ['---_----.1 I I Jr------II 1
Augend Addend
- Co 4-bit FA
Sum
To the
next higher
decade
position
,'-
1 I
Augend Addend
4-bit FA Cj I (
Sum ..L
I-I
L - - - - - , - - - I, -I,,---'---'-1 ----I
Sum/Difference
168 CHAPTER FIVE Design of Combinational Circuits
as the 9's complementer unit, the second as the adder unit, and the
third works as part of the correction circuit. When the SUBI ADD
input is a 0, the unit performs simple addition as the complementer
unit leaves the addend unchanged. When SUBI ADD is a 1, the
subtrahend is complemented and is then added to the minuend.
Consequently, the sum appears at the final output when the SUBI
ADD input is a 0 and the difference is obtained otherwise. When
several such units are cascaded to make a multi-decade BCD
adderlsubtracter, the carry-out from the most significant decade
unit is fed into the carry-in of the least significant decade unit. This
arrangement guarantees the inclusion of an end-around-carry to
satisfy the need of the 10's complement system.
- 13 10 1110 11002
1101 1101 2 correction
1011 1001 2
-+ 0100 0110 2 = - (13)10
BCD BCD
Augend/Minuend Addend/Subtrahend
XS3 XS3
converter converter
To
next +----+-+--+--+--------------+-t--.--t--1f----t--t---.-- SUB/ADD
higher
decade
Carry to
next higher Augend Addend Carry-in from
decade
- - . - - - f Co 4-bitFA next lower
Sum decade
Augend Addend
4-bit FA
~_r~~--!-._-+_~--_r~f__------INVERT
~----------~v~-----------
Sum/Difference
170 CHAPTER FIVE Design of Combinational Circuits
When the SUB/ADD input is a 0, the addend arrives at the first adder
along with the augend. Otherwise, the complement of the subtrahend is
added to the minuend. The output of the first adder is added to either 0011
or 1101, depending on whether or not a carry is generated. The INVERT
input is activated when there is no end-around-carry, and in that event the
output is complemented to yield the final result.
5.7 Arithmetic Logic The examples presented in previous sections have shown some of
the multi-bit arithmetic functions that are used in digital systems.
Unit (ALU) Many times it may as well be necessary to perform bit-by-bit logic
operations between two multi-bit operands. A multi-function circuit
that can operate on groups of bits, therefore, proves to be extremely
advantageous in many complex digital systems. Combinational
design techniques generally are used to design such multi-fonction cir
cuits, otherwise known as arithmetic logic units (ALUs). The various
operations are usually selected by means of several control or select
lines.
The various logic operations are realized by routing the inputs to
circuits that perform various logic functions and using a MUX to
select anyone of the possible logic operations. There are commer
cially available ALUs that operate on two four-bit values with 32
arithmetic and 16 logic operations selectable by the combination of
four control inputs, a mode selector, and a carry-in. In this section
the design of a relatively less complex ALU will be considered to
demonstrate the process and some typical functions.
Consider an ALU with two four-bit inputs, A3A2AIAo and
B3B2BIBo. Let us fIrst consider bit-by-bit logic operations of several
types. Between any two inputs, X and Y, there could be a total of 16
different types oflogic outputs: 0, 1,.X, Y, X, Y, X + 1', X + 1', X
+ Y, Xl', Xl', xY, X + Y, XY, X EB Y, and X EB Y. All of these
outputs are achievable by means of logic gates.
Figure 5.41[a] shows a logic circuit consisting of a l-of-8 MUX
and only eight logic gates. This circuit is able to perform up to eight
different logic operations between its inputs, Ai and B,. A specillc
operation is selected by means of the three control inputs: S2, Sh
°
and So. The enable input, S3, is set to a to enable the MUX in all
of these eight cases. The truth table in Figure 5.41 [b] lists the possi
ble logic operations and the corresponding control conditions. For
example, when control input is O1QO, the D4 input of the l-of-8
MUX is activated, and consequently AtBi becomes available at the
MUX output. This l-of-8 MUX could have been replaced with a
l-of-16 MUX for realizing 16 different logic operations. In that
case, however, an additional control input would be necessary.
The arithmetic section may be designed around a four-bit ripple
or CLA adder circuit. If the carry-in is utilized, it is possible to
obtain a larger number of arithmetic operations for the. same
5.7 Arithmetic Logic Unit (ALU) 171
S3
Enable
A; 00
B; 01
O2
03
1-of-8 T
MUX
04 f F;
!
Control Inputs Output
S3 S2 S1 So Fi
0 0 0 0 Ai
0 0 0 1 Bi
0 0 1 0 A;Bi
0 0 1 1 Ai+ B;
0 1 0 0 A;B;
0 1 0 1 A;+Bi
0 1 1 0 Aj(t)B j
0 1 1 1 AEBB;
[a] [b]
I
arithmetic operations. The output of the MUX unit is fed into one
of the adder inputs while another of the FA inputs is tied to Ai
ilf~ directly.
Ii ~~:~
Figure 5.42[b] lists all of the arithmetic operations and the corre
sponding control inputs needed for operating this arithmetic unit.
1
-2":
-,.;."< The MUX output carries into the adder either a function of both Aj
<:·········
"
---
~~
~\ .
E
DO
~C> 01
0 O2
1 .03
~ 1-of-8 fp-
04 MUX
f
L
05
~ -
1 L
06
07 ~
Xi Yi
12 11 10
From
FA! Cj +- FA -
IS2 ISl Iso i 1
-
Co Sf
(8] To FA i + 1 I ~
Control Fi
S3 S2 Sl So Cj=O Cj = 1
1 0 0 0 Ai+Bi A;+ Bj + 1
1 0 0 1 . A;+ H; A+ 8 j + 1
1 0 1 0 A Aj + 1
1 0 1 1 A; 1 A
1 1 0 0 Aj+AiBi A+ABi+ 1
1 1 0 1 A+Ail
.f
J" I A+AiBi+ 1
1 1 1 0 Ai + (Ai + Bj) Ai + (A + Bj ) + 1
1 1 1 1 Ai + (Ai + 8d A + (Ai + B;) + 1
[b]
5.8 Decoders and Encoders 173
1/
I
r Ci
5.8 Decoders and Very often in digital systems it is necessary to convert one code to
another. The process that detennines what character, dIgit, or
Encoders
number a code represents is called decoding. A decoder is an integral
part of this process. It is a specially organized combinational circuit
that -translates a code to a more useful or meaningful fonn. In this
section we shall look at just a few of the many decoding functions.
One of the frequently used decoders is a BCD-to-seven-segment
decoder. This particular type of decoder accepts as inputs BCD and
provides outputs to drive a seven-segment LED display device, as
shown in Figure 5.44, in order to decode bits into readable digits.
The decimal inputs to a circuit are first changed to equivalent
binary fonn by means of BCD-to-binary converter modules for the
desired binary operation. The resultant binary output is finally
reconverted back to equivalent BCD output and is usually dis
174 CHAPTER FIVE Design of Combinational Circuits
FIGURE 5.44 Seven-Segment played by means of seven-segment display devices. These devices
Display Device. are used often in calculators.
The display device consists of seven light-emitting segments that
represent each of the ten decimal numbers when activated in suit
able combination. As an example, segments a,j, g, c, and d have to
be illuminated to represent a 5. There are two choices for represent
ing a 1: eitherf and e or band c. The normal decimal code for these
indicators is shown in Figure 5.45. A Boolean expression corre
sponding to each segment of the display may now be found. The
Boolean equations for the illumination of display segments may be
obtained as follows:
a(D,C,B,A) = (D + C + B + /1) + (D + 'C + B + A)
+ (D + r: + B + A)
b(D,C,B,A) = (D + C + B + /1) + (D + r: + B + A)
+ (D + r: + B + A)
c(D,C,B,A) = (D + C + B + A) + (D + C + B + A)
d(D, C,B,A) = (D + C + B + A) + (D + r: + B + A)
+ (D + r: + B + A) + 7J5 + C + B + 11)
e(D,B,C,A) = (D + C + B + 11) + (D + 'C + B + A)
+ (D + r: + B + A) + (D + C + 71 + A)
+ (D + C + B + A)
f(D,C,B,A) = (D + C + B + A) + (D + C + B + A)
+ (D + C + B+ A)
g(D,C,B,A) = (D + C + B + A) + (D + C + B + A)
+ (D + r: + B + 11)
8 DCBA
1 1 0 0 0 0
1 1 1 1 1 1 ,
9 DCBA 1 1 1 0 0 1 1
5.8 Decoders and Encoders 175
:§J-x o
c---\
;D-x. A - - - r ._ __'"
b
C -----\
A ~-__i. _______
~:E[}-x,
d
C-----\
A
raj
CiL}-D
_ B
A
.. /0
::8<-__)-"
~B )-,. ~i3 )-'5
~ 131-__)-" ~B r',
~B )-'9
176 CHAPTER FIVE Design of Combinational Circuits
Do
E ~~o!
DO 10
D3 P D3
[a] [b]
Do
E
Do
01
1-4 01
E line
DMUX O2
I, O2
03
10 03
A B
[a] [b]
A /1 2-4 Dl p--
line
decoder D2 p-
B 10
D3 b -
E
c .~
Do J-
- 11 2-4 Dl J-
line
decoder
10 D2 0--
D3 P-
E
)
B=2+3+6+7
C=4+5+6+7
D=8+9
00
0 1 P- -
O2 P- 00
0 3 P-
0 4 P-
- -
-
~
13 Os I-
4-16 06
- 12 0 7 P-
line
- 11 decoder 0 8 P- I-
~
09
- 10 0 10
0 11 P-
0 12 P- ~
0 13 P-
~
0 14
0 15
~
(a]
r-
)- -
~
I-
~
--
}-~
-r= ,.......
-
I-
-
08
r- f--
-rt= ~ ~
'+;":
"1;
)- '-
"
.... i--
-~ '--
I- '--
..
---<
.t l - i--
I--
I
~
I...--
[b1
180 CHAPTER FIVE Design of Combinational Circuits
Do
r--
D1
r- l -
-
-
I-
rL
-
f ~ - J
r - l~ J
L
./
r
r--
D8
-
r ~ -
L
J ~ -
-
D11
10 r
L
'-
'---
'---
5.8 Decoders and Encoders 181
FIGURE 5.53
o
C
----l BCD-to-
7,-segment
a
b
c
d I I
LED e
decoder
I
B
f
A
9
I
A high TDS input to the decoder implies that Tftis Decoder needs to he
§.earched. A high NDS output similarly implies that the Next Decoder needs to he
Searched as well. The NDS output of one input may be introduced to the
~ext unit on the right as the IDS input, and so on. This feature may be
accomplished by adding a circuit such as shown in Figure 5.55 to the
already available circuit.
182 CHAPTER FIVE Design of Combinational Circuits
1 1
I-I
I-I
FIGURE 5.55 C D
A B X > - - - - - - NOS
TDS-----~-~
""-_ _ _ _ _ T
o all the 10 first-stage
NAND gates of Figure 5.46[b]
When the BCD digit corresponds to a 0 and the TDS input is high, the
above circuit disables the decode circuit and suppresses the display. At the
same time the resulting NDS becomes a 1, resulting in further search for
zeros if there are any. If the BCD digit is not a 0, the .decoder.is..not dis
abled and further search is abandoned. The overall five-bit circuit is
FIGURE 5.56 obtained as shown in Figure 5.56.
BCD Inputs
f4 f4 f4 f4 f4
Decoder Decoder Decoder Decoder Decoder
- TDS NOS TDS NOS - TDS NOS ,....- TDS NOS r - TDS NOS
17 17 f7 17 17
,,
I-I I
-
I
-,,
-
-,-, I-I
1
-
5.8 Decoders and Encoders 183
Design a four-input priority encoder The block diagram for such a device may be as shown in Figure 5.57. As a
such that when two inputs, D j and beginning step, the corresponding truth table needs to be known. The truth
Dj , ard:tigh simultaneously, Di has table for such a device is easily obtained as shown in Figure 5.58. The
priority over Dj when i > j. The don't-cares are introduced under input columns whenever appropriate.
encoder produces a binary output The Boolean equations for the outputs are obtained directly as follows:
code corresponding to the input
that has the highest priority. fo = Ds + DID2
It = D2 + Ds
The four-input priority encoder circuit is obtained accordingly, as shown
in Figure 5.59. The request indicator, M, shows whether or not any of the
four inputs are active.
00
FIGURE 5.58 to
01
Inputs
O2
t1
0 0 0 1 O2 0 3 t1 to 03
1 0 0 0 0 0
E
1 0 0 0 1
- - 1 0 1 0
- -
"
"
- 1
·"~'i:";":":"
1 1
Enable
FIGURE 5.59
00
to
01
0'
2,
11
D3
Enable
184 CHAPTER FIVE Design of Combinational Circuits
5.9 Error-Control Errors may occur as digital codes are transmitted from one system
or subsystem to another. There is always a possibility, albeit small,
Circuits that a random-noise pulse will change a zero to a one or a one to a
zero. It is possible, however, to code the data so that the occurrence
of an error can be detected after the data have been received. The
simplest approach is to add an extra bit, called a parity bit, to each
of the number codes. If the coded data including the parity bit have
an even number of ones, the code is said to have even parity. If the
coded word including the parity bit has an odd number of ones, the
code is said to have odd parity. Prior to sending a code, the number of
ones are counted and the parity bit is set to make the number of
ones odd or even as determined by the parity scheme chosen. At the
receiving end, a check is made to see how many ones are present in
the coded word. If odd parity is used and an even number of ones
are received, it implies that an error has occurred. However, the
proposed parity bit scheme cannot detect the occurrence of an even
number of errors. For situations where the probability of multiple
errors is high, a more sophisticated coding scheme must be used. In
computers or communications equipment the possibility of random
noise causing changes in more than one bit is low.
In order to check for or generate the proper parity bit in a given
code, it is necessary to determine whether an odd or even number of
ones are present. An X-OR gate functions in such a way that the
output of an even number of ones is always a 0, and the output of
an odd number of ones is always a 1. As an example, the circuit of
Figure 5.60 makes use of these gates to generate an even parity bit
for normal BCD input and to check for a possible error that may
have been caused during transmission. The parity generator circuit
at the source end examines the contents of the four data lines and
.accordingly generates a parity bit so that the encoded message (five
bits in all) has even parity. At the receiver end the parity-checking
circuit determines if an error has occurred or not. A high output at
the parity-checking circuit indicates the occurrence of an error dur
ing transmission. This circuit could be made suitable for odd parity
by simply replacing the final X-OR gates of both generator and
checker circuits with X-NOR gates.
Several other schemes are also available, especially for coding
decimal digits. The most common of these are the 2-out-of-5 code
and 2-out-of-7 code. They are listed along with parity-coded BCD
in the table of Figure 5.61. The 2-out-of-7 code is also known as the
biquinary code. The zeroth through the sixth bit have positional
weights ofO, 1,2,3,4,0, and 5 respectively. In both of these m-out
of-n codes, there are m ones and (n - m) zeros. The advantages of
these schemes are understood by comparing the different permissi
ble codes. Two codes are said to be at a distance p if the codes differ
from each other in p locations. Clearly~ each code in an m-out-of-n
5.9 Error-Control Circuits 185
Source Receiver
Ds---*----------------------------------+---------------------------Ds
D4 D4
~ .;' ~
~ ~
Generator
Checker
scheme is at least distance two away from the next code. Conse
quently, these codes can be used to detect single errors.
To correct k errors the minimum distance between two code
words must not be smaller than 2k + 1. A total of k errors would
produce an error word· k distance away from the correct code word.
To be able to correct this error, no other Ie errors should be able to
produce this same error word. The error word, therefore, should be
at a distance at least k + 1 from any other code word. Accordingly,
the minimum distance between two code words should be 2k + 1.
A minimum <iistance of two provides single-error detectability; any
single error moves the code closer to where it was than to any other
186 CHAPTER FIVE Design of Combinational Circuits
rri +p m+p m
~ Encod~r Channel , Corrector ~
11m +p
12f!
P
Checking circuit Decoder t-
j
positions, including itself, that have a 1 in the same loca
5.9 Error-Control Circuits 187
EXAMPLES. IS SOLUTION
Determine the Hamming-coded The number of bits is m = 5; therefore, p = 4. This coding would result in
word for the,m,essage 10 10 1 \iSing a nine-bit coded word. The corresponding message bits (10101) are posi
even parity. tioned respectively in locations 3, 5, 6, 7, and 9. These locations are speci
fied in the table of Figure 5.63 as M I , M 2, M s, M'I> and Ms respectively. To
determine the exact value of each parity bit, each of the position designa
tions is expressed at first in binary. The parity bits are generated from the
following observations:
Bit Designation Pl P2 Ml P3 M2 M3 M4 P4 Ms
Bit Position 1 2 3 4 5 6 7 8 9
0001 0010 0011 0100 0101 0110 0111 1000 1001
Message Bits 1 0 1 0 1
I
Parity Bits 0 0 1 1
I
The test score is 0111. The bit in error is the seventh bit (0111); therefore,
the seventh bit is changed to O. Therefore, the correct coded word should
FIGURE 5.64 be 001101011. This result agrees with the earlier findings of Example 5.15.
Bit Designation P1 P2 M1 P3 M2 M3 M4 P4 Ms
Bit Position 1 2 3 4 5 6 7 8 9
0001 0010 0011 0100 0101 0110 0111 1000 1001
Received
Message 0 0 1. 1 0 1 1 1 1
P3, and P4' The rules for the generation of parity bits, as stated ear
lier, may be used to obtain
PI = Ml EB M2 EB M4 EB Ms
P2 = Ml EB M3 EB M4
P3 = M2 EB M3 EB M4
P4 = Ms
C1 = Y1 EB Y3 EB Y5 EB Y7 EB Y9
C2 = Y2 EB Y3 EB Y6 EB Y7
C3 = Y4 EB Ys EB Y6 EB Y7
C4 = Ya EB Y9
[)-C2
~---------------------------------------~
[a]
Corrected
data
bits
I
Problems 191
may be used to correct the bit. Our interest is in recovering the cor
rected data bits. Making use of the X-OR programmable inverter
function, the equations for the corrected bits are obtained as
follows:
D\ = (C4 ' C3 • G2 • G1) EB Y3
D2 = (C4 • G3 • C2 • G1) EB Y5
D3 = (V4 • G3 • G2 • VI) EB Y6
D4 = (C4 • G3 • Gz • G1) EB Y7
For example, if the parity test results are 0111, then the fourth data
bit (i.e., the seventh bit of the coded word) is in error. The bit in
error is corrected by complementing Y7• All of the other bits remain
unchanged. The corresponding error-correcting circuit is shown in
Figure 5.66[ b].
Problems 1. Design an FA circuit using logic gates suitable for adding two
bits of addend, two bits of augend, and carry-in input.
2. Obtain a single-bit FA using only MUXs.
3. Design a single-bit FA using only NOR gates.
4. Use the FAs designed in Problem 1 to perform addition of six
bit numbers. Show the configuration of the setup for adding
(llOllOh and (OOOOlOh.
5. Design a four-bit FA using combinational logic.
6. Design a four-bit FA using ROM technology.
7. Use bridging to implement a standard full subtracter circuit
(three inputs and two outputs) using X-OR gates.
8. Verify Equations [5.4] and [5.6].
9. Design a circuit for dividing a Jour-bit number by a four-bit
number.
10. The following message needs to be transmitted using the
Hamming code under even parity assumption. Determine the
192 CHAPTER FIVE Design of Combinational Circuits
parity bits and the order in which the coded message will be
sent. The to-be-coded message is 1010111001011. Show the
corresponding circuit.
11. Design a half subtracter circuit using (a) only NOR gates and
(b) only MUXs.
12. The Hamming-coded message received under odd parity
assumption is 1010 111001011. Determine if the message has
any error and write out the correct message bits only. Obtain
the corresponding correction circuit.
13. Design a full subtracter using half subtracter modules.
14. Using only a four-bit binary adder, design decimal code con
verters for the following conversions:
a. 8-4-2-1 to XS3
b. XS3 to BCD
c. XS6 to XS3
d. BCD to XS3
15. Remove the combinational FAs from the drcuit of Example
5.2 and replace these with equivalent ROMs. Show the ROM
logic for one of these units and determine the total ROM size
needed for the complete circuit.
16. Design a combinational circuit capable of comparing two
eight-bit binary integers (without sign bits) X and Y. The out
put Z should be a 1 whenever X > Y.
17. Design a controllable, dual-purpose, four-bit converter that
converts binary to Gray and also Gray to binary.
18. Use the module of Example 5.7 for obtaining the following
conversIOns:
a. 15-bit
b. 20-bit
c. 25-bit
Justify your designs using exemplary nontrivial binary inputs.
19. Use the module of Example 5.10 for obtaining the following
conversIOns:
a. 15-bit
b. 20-bit
c. 25-bit
Justify your designs using exemplary nontrivial BCD inputs.
20. Design an adderlsubtracterusing cascaded ALUs. Show how
it works when adding and when subtracting if A = 84 and B
= 32. Repeat the problem using base-16 equivalents of the
numbers.
21. Design a 12-bit FA in which carries are allowed to ripple after
the first six bits of addition.
Problems 193
22. Show how the ALU can be used to (a) subtract one from and
(b) add one to a number. Show the setup if the number is 76 10,
23. Show how a 3-8 line decoder could be used to generatej(A,B,
C) = ~m(0,1,3,5).
24. Design a logic circuit that multiplies an input decimal digit
(in BCD) by five. The output is also in BCD form. Show that
the outputs can be obtained from the input lines without using
any logic gates.
25. Implement the FA circuit of Problem 1 using MUXs.
26. Obtain the most minimal circuit that squares a three-bit
binary number.
27. Design a special-purpose unit using FAs (a) for adding 12
single-bit binary numbers and (b) for adding 17 single-bit
binary numbers.
28. Design a four-bit CLA circuit where the propagate function is
defined as p.I = A·I + B·I instead of p.I = A·1 &\I7 B·I' How does the
current design differ from the one discussed in Section 5.4?
29. Use the techniques considered in Section 5.4 to obtain a four
bit fast subtracter.
30. Obtain the CLA carry equations when n > 13 and show that
the maximum fan-out is dependent on variable P(n-2)/2 and is
equal to {[(n + 1)2/4] + 2} for odd n. Also show that for even
n, the maximum fan-out is dependent on both p(nl2)-t and
P{nI2) and is equal to {[n(n + 2)]/4 + 2}.
31. Design an n-bit binary comparator circuit to test if an n-bit
number A is equal to, larger than, or smaller than a second n
bit humber B. The problem could be broken into one unit of a
half comparator module and n - 1 units of full comparator
modules, as shown in Figure 5.Pl. Each of the modules gives
out two outputs: Gn and Ln , such that
a. Gn = 1 and Ln = 0 if An > Bn
b. Gn = 0 and Ln = 1 if An < Bn
c. When An = Bm then Gn = Gn - t and Ln = L n- t for a full
comparator and Gn = Ln = 0 for a half comparator.
FIGURES.PI
A, B, Ao Bo
1 G3 G2
1 G,
1 ...
Go
Fe L3 Fe L2 Fe L, Fe Lo
He
194 CHAPTER FIVE Design of Combinational Circuits
6.1 Introduction
A circuit is known as combinational as long as its steady-state out
puts depend only on its current inputs. If, on the other hand, the
present value of the outputs are dep<mdent on both the present val
ues of the inputs and the past values of the inputs, the circuit is con
sidered to be a sequential circuit. One of the important applications of
digital techniques is where digital signals are received and inter
preted by the system, and control outputs are generated in accor
dance with the sequence in which the input signals are received.
Therefore, such systems require circuits that respond to the past his
tory of the inputs. In general, sequential circuits have the capability
of storing information. Consequently, sequential circuits find wide
application in digital systems as counters, registers, control logic,
memories, and other complex functions.
The most common sequential circuit is the flip-flop. A jlil-flop
(FF) is an electronic device that has two stable states. One state is
. assigned the logic 1 value arid the other the logic 0 value. The out
put of the FF can assume either of the stable states based on input
events, and the output can be checked to determine what event
occurred in the pair. There are a number of FFs in common usage
in digital circuits, and they differ from one another in the number of
inputs they have and in the manner in which the binary state is
affected by the inputs. The possible changes in the FF outputs gen
erally have a direct correspondence to the frequency with which the
input is changing value. However, there is a type of sequential cir
cuit memory, device, known as a monostahle multivibrator, that pro
duces circuit output independent of the input frequency. This chap
ter iritroduces the logical behavior and control bf various types of
FFs. Mer studying this chapter, you should be able to:
o UnderStand the design and working principles oflatches;
o Understand the design and working principles ofFFs;
196
6.2 ~tches 197
monostable multivibrator;
6.2 Latches A latch is a bistable circuit that is the fundamental building block of
a flip-flop. The latch is basically a combinational circuit that has
one of its outputs fed back as an input. It can be realized from an
OR gate with its complemented output fed back as one of its inputs,
as shown in Figure 6.1. We have considered /);.t to be the lumped gate
delay (total of all propagation delays) of the gates that are used. If
the input II is held at logic 1, the OR output results in a 1 and,
therefore, the complemented output, O2, is a O. This O2 output is fed
back to the OR gate after a time equal to the lumped delay. As a
result the output of the OR gate is held at logic 1. Once the OR
output is set to this· condition, the gate output will remain in this
same state. This phenomenon is commonly known as the latching
effict. Consequently, this circuit could be used for the storage oflogic
1. This latching condition will prevail until the feedback path is
broken.
)--4_-0,
will return to its initial condition. When the input 12 is a 0, the out
put O2 is maintained at logic 0, and when I, is held at logic 1, the
output 0 1 remains at logic 1.
The latching concept developed in this section will be used next
to come up with a standardized latch suitable for subsequent devel
opment of FFs. An FF has the capability of storing a single binary
bit of information. When the values stored in the FFs change, we
say that the sequential circuit changes state. Generally, however, an
FF should have two outputs, called Qand Q, that are complements
of each other. The characteristic table of Figure 6.3 details the per
tinent working principles of one such basic latch unit, where t is
used to denote the time variable and 6.t is the short time duration
between a change in the input and a possible change in the output.
The interval 6.t is equivalent to the lumped delay of the circuit. The
two inputs S (set) and R (reset) are used to control the output based
on the current state of the output. If R = 0 and S = 1, the output is
turned on if not already on. If R = 1 and S = 0, the output is
turned off if not already off. When S = R~= 0, no output change
occurs. The to-be-designed latch circuit, however, manifests an
undesirable condition when both inputs go to 1 simultaneously.
When S = R = 1, the two outputs, Qand Q, would no longer be
complements of each other. In addition, the behavior of the latch
would become unpredictable once the inputs returned to 0, Conse
quently, the simultaneous existence of S = R = 1 is forbidden.
0 0
0 0
1 1
0 1
0 1
1 1
0 0
1 0
1 0
0 -
1 1
1
R(t)S(t)
o(t) 00 01 11 10
0 0 1 - 0
R---iL-----'"
1 1 1 - 0 o---e--Q
5---------------1
O(t + Llt)
[a] [b]
This equation, known also as the next-state equation, states that after a
short time, b.t, the new value of Qis determined by the values of Q,
R, and S at time t. The corresponding circuit is shown in Figure
6.4[b]. If Rand S values change at time t, a new value of Qwill
result b.t time later. b.t time in this circuit is the total gate delay of
the two NAND gates. The output of NAND gate 1 is traditionally
known as the Qoutput since the outputs of two NAND gates are
complements of each other.
FIGURE 6.5 Revised RS Latch The revised characteristic table of Figure 6.5 shows the corre
Characteristic Table. sponding characteristics of the RS latch (also called reset-set latch)
where the don't-care of the forbidden state is assumed to be equal to
OCt) R(t) O(t + Llt) a O. The equation for Q(t + b.t) may also be obtained as follows:
0 0 S(t) Q(t + b.t) = Q(t)R(t)S(t) + Q(t)R(t)
1
0 0
1
= R(t)[Q(t) + Q(t)S(t)]
1 0
1 1 0 = R(t)[Q(t) + S(t)]
~ "
= R(t) + [Q(t) + S(t)] [6.2]
S o 0-'-0
S---.o.
0--....... 0
R R R---J
"----
[al [b] (c]
200 CHAPTER SIX Sequential Devices
FIGURE 6.8
X
~I 4
I
8 12
L
16
Z
0 5 6 7 8 13141516
1
Y
0
4 5 6 7 12131415
Time---+
ililmISt
Therefore,
Q(t + t\ + t2) = R(t + tl)[S(t) + Q(t)] .[6.6]
-( t + :2
Q(t + dt) = R dt) [S(t) + Q(t)] [6.7]
Q
0
7 16
Q
0
8 15
Time ..
SOLUTION
Obtain the timing diagram for the FIGURE 6.10
latch of Figure 6.10 when the input
II changes from 1 to 0 for a
duration much shorter than the
total gate delay.
For this example the gate delays for the NAND and NOT gates are chosen
202 CHAPTER SIX Sequential Devices
FIGURE 6.11
11
0
O2
;~ n
8 9
n
13 14
n
18 19
01
;1 U
10 11
LJr---u
15 16 20 21
Time ----+
6.3 Clocked SR In the last section we introduced circuits for the SR FF. For depend
able operation of such devices one must attempt to prevent tran
Flip-Flop sient pulses from appearing on either of the inputs. It is advanta
geous to control the times when the SR FF output is allowed to
change by means of an additional input. This additional signal is
commonly called a clock. The clock pulses (CK) can be periodic or a
set of random pulses. Almost always, however, they are periodic.
The purpose of the clock input is to force the FF to remain in its
rest (or hold) state while changes occur on the set and reset inputs.
CK is set to logic 1 once the inputs have settled. The NAND and
NOR latches with clock input are shown in Figure 6.12. In order to
operate these devices effectively, the following conditions must be
met:
1. The FF inputs should be allowed to change only when CK
= 0.
2. The clock input should be long enough so that the outputs
will be able to reach steady states.
3. The condition S = R = 1 must not be allowed to occur
when CK is equal to logic 1. For proper operation, there
fore, S(t)R(t) should always equal zero.
It can be seen that the circuit action can occur only when the CK
signal is high. When CK = 0, the FF outputs do not change. The S
and R inputs may, however, be simultaneously high when the clock
is absent since the FF will be inhibited. The overall functioning of
the gated SR FF is illustrated by the characteristic table of Figure
6.13. Note in the timing diagram shown in Figure 6.14 that it is
6.3 Clocked SR Flip-Flop 203
CK CK
Q
R Q
R
[a] [b]
R
Q
CK
S
[c]
Q
o
necessary to consider the circuit only at the time CK changes from
low to high to see if the output changes.
It is now appropriate to introduce several operational character
istics that are, commonly associated with the FF usages. Figure 6.15
shows some of these specifications, of which setup and hold time are
the most important ones. The setup time, ts , is the time· necessary for
204 CHAPTER SIX Sequential Devices
1 t
,... s -H
I+- th-+l
---'"-----~---___
1
14 tNS
, I , 1
I 1
I
--,-~
,
I I
1"'4--~1------
I I
tp .11
I
I 14 I TcK I
~
I
the input data to stabilize before the triggering edge of the clock Its
value is extremely critical since it manifests itself either by ignoring
actions or by resulting in partial transient outputs, commonly
referred to as partial set and partial reset outputs. Consequently, it is
. possible to begin a set or reset mode, causing the output to start to
change, but to withdraw back to its initial state. In some cases the
output might even end up in a metastable state in which the FF is
neither set nor reset. Again, the hold time, th, is the time necessary for
the data to remain stabilized beyond the triggering edge of the
clock This is also a critical parameter in determining the correct
behavior of a FF.
The maximum allowable clock frequency for an FF is usually
determined from a knowledge'of setup time; hold time; FF propa
gation delay, tp; and propagation delay of the next-state decoder,
tNS' The maximum clock frequencY,!cK, under worst-case condition
is obtained from
[6.8]
The constraint of Equation [6.8] must be met when using any FF,
integrated or not.
CK
Y --..._---------i R Q
6.4 JK Flip-Flop 205
FIGURE 6.17
From Equation [6.1] the next-state equation follows as
6.4· J~~Flip- Flop We saw in the last section that the clocked SR FF has an indetermi
nate state. When using clocked SR FFs the designer is required to be
/ cautious about the FF inputs. This troublesome restriction can be
removed by modifying the SR FF; the refmed FF is known as theJK
FF. This modification involves feeding the outputs of the FF back
into the inputs of the circuit shown in Figure 6.12[a]. The resulting
circuit, its block diagram, and its functional behavior are shown in
Figures 6.l8[a-c].
[a] [b]
0 0 I
Reset 0 1
1 0
0 1
Set 1 0
1 1
I
i 0 1
Toggle 1 1
1 0
Ie]
206 CHAPTER SIX Sequential Devices
Even when the] and K inputs are both 1, the outputs of NAND
gates 1 and 2 cannot simultaneously be O. With Q = 0, NAND gate
2 outputs ai, and when Q = 1, NAND gate 1 outputs a 1. Conse
quently, the input restriction of the SR FF is automatically elimi
nated. The additional feedback provides for an additional switching
mode, called toggle, to the FF. The characteristic table of Figure
6. 18[c] describes in detail the actions of the FF. The next-state equa
tion may accordingly be obtained as follows:
Q(t + /).t) = ](t)OJ.t) + K(t)Q(t) [6.9]
Compu1eJK
inputs
1
J
No 0
K
0 I-t--TcK---+1
I
CK 1
0 I
1
Change FF Q
0 nJI
outputs
_____I At I+-
[a] [b] /
6.4 JK Flip-Flop 207
Edge-Triggered FFs. S Q
J Q S Q J Q
R Q K Q R Q K
-c~
!
'--- K, 0, K2 O2
CK
Figure 6.23 shows the timing diagram that is obtained readily by making
use of the function table of aJK FF. It may be seen that within two cycles
QI is set and Q2 is reset. The waveform will not change until Ql is reset
externally.
FIGURE 6.23
CK
O,------.....J
FIGURE 6.25
x
:1 3 8
:1 4 9
<I f - - - _ _ _- - - l n'----__
9 10
Time ,.
CK i'>
R RM OM Rs Os
~
V
As a result of the presence of the inverter, the master unit is
turned on. and the slave unit is turned off when CK = 1. When CK
= 0, the master unit is turned off and the slave unit is turned on.
The circuit works as follows: for all inputs of Sand R, except when S
= R, QM = Sand QM = R when CK = 1. At this time the slave
unit remains turned off. When the clock input goes to 0, Qs = QM,
Qs = QM, and the master uI1it is turned off.
210 CHAPTER SIX Sequential Devices
1
S
0
I
I
I
I
I
I
l
t I I I
1 I I L L
I
R
0 ~ I
I
I I
I
I
I I
1 I
I
OM
0 I I I
1
Os
0 I l
1
0
0 I I
CK--~------------~
7 D---e--+--OS
8 o--+--+--Os
K-,.,-------1 6
K ----------'
Os---------.....J
~It.:~'.:
reset (Q = 0) condition. Addition of these two control inputs
requires alteration of only the slave section of the FF. Figure 6.30
~.
..
~?:
shows the logic diagram and the corresponding slave section of the
. ~:.:
.'<~: FF that allows preset and clear inputs. Throughout this text both
preset and clear inputs are considered to be active when low. Often
!I~·t.·
.~..
.~( . ..
.'.
these two FF control inputs are not labeled in the FF logic diagram .
In such cases preset and clear inputs are always indicated by verti
,;;.
~r·
212 CHAPTER SIX Sequential Devices
D----+--Os
PR
J 0
K 0
CLR
CK
[a] [b]
cal inputs (with a bubble) respectively at the top and bottom of the
corresponding FF logic diagram.
6.6 Delay and Trigger There are two other types of flip-flops that are commonly used: the
delay (D) and the trigger (T) FFs. Unlike those in the previous sec
Flip-Flops tions, these two FFs have only one control input line besides the
clock (excluding set and preset). Both of these FFs can be realized
by externally manipulating the inputs of aJK FF.
Often it is necessary to have a sequential device that simply
retains the input data value between clock pulses. The D FF per
forms this function. The FF output follows the FF input whenever a
clock pulse is 1 and holds the value the input had when the clock
changed to O. The logic diagram and the characteristic table for a
D FF are shown in Figures 6.31[a-b]. A comparison of this charac
teristic table with that for theJK FF (Figure 6.18[c]) reveals that a
J
D FF is realizable from a JK FF by making K = and using J as
FIGURE 6.31 D FF: [a] Logic the D input, as illustrated in Figure 6.31 [c]. The next-state equation
Diagram, [b] Characteristic Truth of the D FF is given by
Table, and [c] Circuit
Implementation. Q(t + dt) = D(t) [6.10]
D 0
D(t) O(t) O(t + At) D- - - - I t - - - - - - I J 0
0 0
0
1 0
0 1 '------I K
1
1 1
o--~I--Q
CK--~---------~
'---_..-'
[b]
The T (trigger) FF, often called a toggle FF, has a single input
that causes the output to change each time a pulse occurs at the
input. The output remains unchanged as long as T = O. The logic
diagram and the characteristic table for a T FF are shown in
Figures 6.33[a-b]. It should be noted that theJK FF has this mode
available. The JK FF can be reorganized for realizing a T FF, as
shown in Figure 6.33[c]. As long as both the T input -and the CK
input are high, the FF output will change. Its next -state equation,
FIGURE 6.33 TFF: [a] Logic therefore, is obtained as follows:
Diagram, [b] Characteristic Table,
and [c]Circuitlmplementation. Q( t + 6.t) = Q( t) ffi T( t) [6.11]
T FF. The input data are then introduced at the original clock
input The corresponding circuit for the unclocked T FF is shown in
Figure 6.34.
o K o
The unclocked T FFs are very important but are not made com
mercially. The logic usually is obtained using aJK FF as shown in
Figure 6.34. One may even obtain this function from aD FF. In fact
it is also easy to transform an unclocked T FF back to a JK FF.
Such a conversion circuit is shown in Figure 6.35.
CK O---CI>T
K-----i
n----ID 01----..-
y-----l
CK Ol---e-
6.7 Monostable Flip-Flop 215
Q( t + !J.t) = D(t)
= Y(t)Q(t) + X(t)Q(t)
c R
rl( v Vee =5V
Al A2 81 82 T
) 1->0 1 1 1 0->1
Q 1 1->0 1 1 0->1
-
'
)r > -
0 -
0
0
0->1
0->1
1
1
1
0->1
0->1
0->1 0->1
Q
0 1 o -> 1 0->1
[a] [b]
/
216 CHAPTER SIX Sequential Devices
and the resistor, R, are external to the Ie one-shot and are used to
control the duration of the output pulse. Note that the trigger pulse,
T, is given by Al • A2 • BI • B2. The triggering conditions, as shown
in Figure 6.37[ b], cause T to change from a 0 to a 1.
The duration of the output pulse, lJt, is determined by the resis
tor-capacitor network. Adjustable resistors and I or capacitors may
be used to trim the output pulse to the desired width. In general, 5t
is given by
& = f(R,C) [6.12]
6.8 Sequential Circuits The general form ,of a sequential circuit .is shown .in}i'igure 6.38.
The circuit in consideration has p inputs, q outputs, and r FFs used
as memory. The combinational part of the circuit monitors the
r+~ __ ___ ~ ~-
FFcontrol
CK input - 1 - - - + - - - - - e
1,--1---- equations
(
/
01
FF
outputs
{: Memory
circuits
Or
\.. /
6.8 Sequential Circuits 217
input values, A;-, checks the FF states, Q.b and computes the FF con
trol variables to assure that the next initiating action causes the cor
rect changes to be made in the FF values. In addition the combina
tional part also computes the correct outputs, Z" for the circuit.
Thus the current inputs and the previous-state information stored in
the circuit's memory (FFs) are used to generate the current outputs
and to determine the next state in the sequential circuits. The clock
input is used only in clocked sequential circuits (the predominant
type of sequential circuit).
The memory part of the circuit may be provided by using bist
able devices such as FFs, relays, magnetic devices, switches, and so
on. The most commonly used bistable device, however, is the FF.
The control characteristics of various FFs are summarized in Figure
6.39, which provides the FF excitation inputs necessary to cause
change in the FF output, (2: For example, the output of aJK FF can
be changed from 1 to 0 by setting K = 1 while the J input could be
tied either to a 1 or to a O. The corresponding state transitions
between Q = 0 and Q = 1 for each of the four FFs are shown in
Figure 6.40 where the conditions for transitions are indicated next
FIGURE6:J9 FF Control
Characteristics. Q(t) Q(t + at) J K D T
0 0 0 0 0 0
0 1 1 0 1
0 0 1 1 0 1
0 0 0
SR 10 J= 1 K=O
R=O J=O
SR 01 K =1
[a] [b]
T=1
D 0 T=1
[c] [d]
218 CHAYI'ER SIX Sequential Devices
A2 82 Ao 80
Xi Y,
1
Xi Yi I
Xi i Xi Yi
Y I
FA Ci FA Ci ' FA Ci
Co Si Co Si Co S;
1
-
Co
6.8 Sequential Circuits 219
Addend Augend
FA Ci ....
Co Sum
Cj S;
to
to + Ml
1 I I
AI
o I
I I
I Ito + M2
'1 01 I I
A
I I I
B
1
I I
I
A '3 '2 0 I I, to + Ml + M3
I I
C '3 01 I
I
I
n I
{s] {b] I to + M2 + M3
220 CHAYrER SIX Sequential Devices
6.9 Summary In this chapter the concept of a sequential circuit was introduced.
The design and working principles of latches, various FFs, and the
monostable multivibrator were discussed. Particular emphasis was
placed on the various practical limitations that these devices have.
Finally, the possibility of having different classes of sequential cir
cuits was explored. The design and the characteristics of these
sequential systems will be presented respectively. in the next three
chapters.
Problems 1. The FA receives two external inputs X and Y; the third input
Z comes from the output of a D FF as shown in Figure 6.P 1.
The carry-out is transferred to the FF at every clock pulse.
FIGURE6.Pl x s
y FA
z -
Co
Q D
Q <' CK
Problems 221
FIGURE6:P2
~. J1 01 J2 O2
I
--c > "'-V'
i
1 K1 01 K2 Q2
CK
FIGURE6.P3
CK~---------------+--------------~
FIGURE6.P4 A--~
l--------I D 0
B--I---\
C---r----------------------------G> o
11 = XQ2 + YQ2
12 = XQl
Kl = XfQ2
K2 = Xf + Ql
Z = XYQl + XYQ2
FIGURE6.P5 r
x ~ ,~
V \
r- c- ) l
f
.
- Q S
< i
CK
'--- Q R
FIGURE6.P6
D Q L Q
A I
-
>T
CI(_ .
B ~~7= ""'
/'"'
I
Q
I
[a] . [bJ
FIGURE6.P7
A-~ Q
T
B--~------------~
Design of CHAPTER
SEVEN
Synchronous
Sequential Circuits-----'
7.1 Introduction
In this chapter we will examine clocked sequential citcuits. These
circuits will employ combinational circuits and flip-flops. All circuit
action will take place under the control of a periodic sequence of
pulses called a clock. Each clock pulse will permit the circuit to
either remain in its present state (present set of FF values) or move
to another state (a new set of FF values). The advantage of clocked
sequential circuits is that glitches that occur due to the imperfect
nature of the logic devices will have no effect. This is possible only if
we choose the clock period such that all glitches due to multiple
delay paths end before the FFs encounter future changes.
The synthesis of sequential circuits consists of obtaining a table
or diagram for the time sequence of inputs, outputs, and internal
states. Boolean expressions are then derived by incorporating the
behavior patterns of FF memory elements. In the following sections
we will introduce these design sequences along with several syn
chronous sequential circuit examples. After studying this chapter,
you should be able to:
o Obtain a state diagram for a synchronous sequential
machine;
7.2 State Diagrams and The functional interrelationship that exists among the input, the
output, the present state, and the next state is best illustrated by the
State Tables state diagram or the state table. The state diagram is a graphical rep
resentation of a sequential circuit in which the states are represented
by circles and transitions between states shown by arrows. We have
225
7.2 State Diagrams and State Tables 227
L;+
. Output
decoder
<4
L..:..,
t .. ·1 Mealy
outputs
raj
Inputs:
Next-state
decoder
Memory
Output • Moore
decoder • outputs
[b]
NS
PS x=o x 1 Z
A C B 0
B C A 1
C 0 C 0
0 A A 1
raj [bJ
228 CHAPTER SEVEN Design of Synchronous Sequential Circuits
the state diagram of part [a]. It is important to point out that both
Mealy- and Moore-type circuits are equally applicable to both syn
chronous and asynchronous circuits; and the minimum number of
external inputs to anyone of these circuits is one. For a synchronous
circuit, that one input must be the system clock.
EXAMPLE7.i SOLUTION
Obtain the state diagram of a The realization of the state diagram for the controller is very straightfor
controller for a serial machine that ward, as shown in Figure 7.5. This follows from Rule 2(b) of Section 1.4.
performs the 2's complement The 2's complement of a number is obtained by complementing all bits to
operation (see Example 5.3 for the the left of the least significant 1 in that number. State A takes care of the
equivalent parallel scheme). situation when none of the serial inputs are changed, whereas state B corre
sponds to the changing (1 's complement) of inputs. The controller remains
in state A as long as the low-order Os of the input are encountered. The first
input of 1 moves the machine to state B so that all subsequent inputs are
complemented. To begin a new conversion, the machine needs to be reset
back to state A (indicated by the broken line).
FIGURE 7.5
0/0
1/0 1/1
0/1
0/0
7.2 State Diagrams and State Tables 229
sequence, 00, is yet to begin. The state table of the machine readily follows
from the state diagram. It is shown in Figure 7.7.
FIGURE 7.7
NS,Z
PS x 0 x 1
A B,O A,O
B B,O C,l
C B,1 C,1
At this time each of the states has only one output associated with itself.
Accordingly one could obtain the equivalent Moore machine as shown in
Figure' 7.11. TIlls table has been constructed in a way so that it resembles
the format of Figure 7.4[b].
J7I(;l1~ 7.11 NS
PS x=O x= 1 Z
A C' A 0
B B A 0
C' 0" C" 0
C" 0" C" 1
0' 0' B 0
0" 0' B 1
E C" A -
NS
I PS x=O x=1 Z
A B C 0
B A C 0
C 0 C 0
0 0 E 1
E A F 0
F B· G 0
G A E 0
[a] [b]
B AB
B AB
C C
D D
E E
AB AB
F CG F
/ ,eG FG FG
AB AB AB
G CE EF G EF )
CEA ;' EG EG
A B C D F A B C D E F
E?
[a] [b]
F (FG)
E (EFG)
D (EFG)
C (EFG)
B (EFG)
A (AB)(EFG)
(AB)(C)(D)(EFG)
(e]
[a] [b]
I
7.4 State Assignments State assignment is the process of adopting a binary coding scheme for
the symbolic states of the state table so that it is possible for the cir
cuit to remember which state it is in. Each bit in the code represents
the output of an FF and is called a state variable. For n number of
states, a total of m FFs will be necessary such that m is the smallest
integer satisfying the relationship 2m > n. Any unique assignment is
valid; however, it is always better if an attempt is made to assign_
codes in such a way that the number of cases where more than one
bit in a code changes when states change is kept to a minimum.
When the symbolic states are replaced with the binary coding
scheme, a binary state table, commonJy known as the transition table,
results.
FIGURE 7.15 Transition Table The state diagram of Figure 7.1 has three unique states, and,
for the Circuit of Figure 7.1. therefore, at least two FFs are necessary for designing the corre
sponding logic circuit. This implies that of the four different codes
PS NS 00,01; 10 and ll-onJy three can be used. For this example, if one
0 10 2 x=o x=1 chooses to assign A = 00, B = 01, and C = 11, the resulting transi
00 01,0 00,0 tion table of Figure 7.15 is obtained.
We may see that the present state QIQ2 = 01, upon receiving
@ U,1 00,0
11 01,0
the input x = 0, moves to the next state 11 with the resultant out
00,0
10 --, ---, put of 1. During this transition the ~·value changes from 0 to 1, as
shown highlighted in the table. In the same present state when x =
7.5 Excitation Maps 235
FIGUKE 7.16 PS NS
0,0 2 X 0 x 1 Z
00 00 01 0
01 11 01 0
11 11 10 1
10 00 10 0
..
7.5 Excitation Maps Up to this point when considering FFs we have been concerned
with how they respond to various inputs. We will now encounter the
design problem. of determining their inputs such that the proper
values are present to cause the next state to result when the clock
input occurs. This input control is accomplished by deriving the
respective excitation equations. The output equations and the state
variable excitation equations are derived separately, as shown in
Figures 7.17[a-h]. The FF input maps are usually called excitation
maps.,> ;!~J.i-)
FIGUKE 7.17 [a] Output Table 00
1 2 00
1 2
1 0 0 0 -- 1 0 0 -1 - 1 0 -1 -0 -
z
[a] [b]
,,_., ,
Jl = XQ2
Kl = 1
J2 = x
K2 = Q,x + QIX = Ql EB x
Z = Q,Q2X' CK
Note that the clock input, CK, is ANDed with Ql Q~ to produce the
FIGURE 7.18 Circuit desired output of a synchronous machine. The resultant sequential
Implementation of the Example. circuit is obtained as shown in Figure 7.18.
J, 0, z
x
CK------~--------.-------------------------~----------~
/'
f-,!
I
"
PS NS,Z1
0 10 2 x=O X= 1 Z2
A 00 01,0 00,0 0
B 01 11,0 00,1 0
C 11 00,0 01,0 1
- 10 , ,
[a] [b]
o 1 00
1 2
O2 0 1 X 00 01 11 10
0 0 - 0 0 0 0 -
1 0 1 1 0 1 0 -
[c]
x ~J-~
Y
i } J1 0 1 f-- LJ2 O2 '---4
~i)
I
V
1
r---' )'
K1 01
r1.
h: [>
K2 O2 ......
CK Z1
[d]
only when the circuit is in state C. Figures 7.l9[bJc] show the steps
involved in obtaining the final circuit of Figure 7.19[d].
7.6 Design Algorithm We have examined the steps of the design of a synchronous sequen
tial machine in the last few sections. Figure 7.20 gives a comprehen
sive flowchart of an algorithm for the design.of sequential machines.
238 CHAPTER SEVEN Design of Synchronous Sequential Circuits
Redundance elimination
No
Has
the machine been
reduced enough?
Yes
These design steps often lead to a rather lengthy process that var
ies from problem to problem. The following examples illustrate the
implementation of the sequential design algorithm.
FIGURE 7.21
PS NS Z1 Z2
A B 00
B C 01
C D 10
D ,A 11
[a] [b]
Step 3. The four states-A, B, C, and D-are all different since they stand
for completely different events. Consequently, we may conclude without
any doubt that none of these are redundant states.
Step 5. The number of FFs are indeed two. This fact was also given in
the initial word statement of the problem. We might choose JK FFs, for
example. Consequently both the transition table and excitation map are
obtained as shown in Figure 7.22.
24{) CHAPTER SEVEN Design of Synchronous Sequential Circuits
FIGURE 7.22 PS
0,02 NS Z,Z2
0, 0,
00 01 00 O2 0 1 O2 0 1
01 10 01 "
:"<,
1~ 1
0 0 -0 V
10 11 10
11 00 11 1 1 -.1 -'--1 -1
[a1 [b1
KI = Q2 /
J2 = 1 V
K2 = 1
The outputs are easily realizable directly from Figure 7.22[aJ. They are as
follows:
ZI = QIQ2 + QIQ2 = Q,(Q2 + Q2) = Ql
Z2 = ~Q2 + QIQ2 = Q2(~ + Ql) = Q2
Step 7. The resulting circuit obtained from these excitation and output
equations is shown in Figure 7.23.
FIGURE 7.23
J, 0, f
1
J2 02 J
r-c :>
K1 0, f
K2 O2 r-
CK
1l = Q2
K, = Q2
12 = Q,
K2 = Q,
Z, = Ql
FIGURE 7.24 Zz = Q,Q'l + Q,Q2 = QI EB Q2
PS
0 10 2 NS Z1 Z2
01 01 01
00 01 00 O2 0
l--_~
02 0 1 O2 0 1
01 11 01
11 10 10 o 0 -1 0 1 0 0 00 11
10 00 11
-0 1 -0 -1 1 01 10
[a1 [b)
FIGURE 7.25
Complete the design of a clocked The state diagram consists of five states, A-E. States B, C, D, and E repre
sequential circuit that recognizes sent, respectively, the occurrence of the first, second, third, and fourth bits
the input sequence 1010, including of the sequence 1010. State E has a Moore output Z = 1 indicating the
overlapping such that for input x completion of a sequence. A subsequent input of 0 would move the circuit
= 00101001010101110 the to state~, which indicates the input is out of sequence. An input of 1 while
corresponding output Z is in E moves the circuit from state E to state D since sequence overlapping is
00000100001010000. allowed. The corresponding state diagram showing the transitions for each
value of x is provided in Figure 7.27.
FIGURE 7.27
f\
:j x ()
?L "
Upon power-up, the circuit begins from state A. As long as the string of
input is devoid of 1 (i.e., the first bit of a 1010 sequence), the circuit
remains at this be~nning state. Once a 1 h~ been located the circuit
moves to state B, indicating that the first bit has already been detected.
Subsequent detection of 0, 1, and 0, in that order, would amount to mov
ing the circuit to states C, D, apd E, respectively. Once the state E is
reached, the circuit gives an output indicating the completion of a 1010
FIGURE 7.28
sequence. However, while at state B if the circuit detects a 1, the circuit re
enters state B. This is due to the possibility that the most recently observed
1 might be the beginning of a 1010 sequence. For similar reasons, the
NS detection of a 1 at state D causes the circuit to move to state B also. Again
PS x=O x=1 Z
-
at state C, a detection of 0 eliminates the possibility of having the desired
sequence, 1010. So, the circuit resets back to state A. Likewise, the circuit
A A B 0
resets from state E to state A if it locates a O. However, an interesting case
B C B 0
happens when the circuit is at state E and it has just detected a 1. This
C A D 0
time the circuit moves back to state D. This is due to the fact that detection
D E B 0
of a 1 at state E is equivalent to detecting the third bit of a newer 1010
E A D 1
! sequence.
The problem involves five states requiring three FFs. Three of the eight
possible states will remain unused. The state table and transition table cor
PS NS
responding to the arbitrary assignments of A = 000, B = 001, C = 011, D
0 102 03 X=O X= 1 Z = 111, and E = 101 are shown in Figure 7.28. The'output and excitation
000 000 001 0 maps corresponding to the use ofiK FFs may now be obtained as shown in
001 011 001 0 Figure 7.29. Proper grouping of the K-map cells results in the following
011 000 111 0
equations:
111
101
101
000
001
111
0
1
Z= QIQ2' CK J
il = Q~
FIGURE 7.29 \
) ('"
~! .j .
0 1 '" '..<"""'" 01 01
' j '~''---.-'----r--.....~
'., ~": ~
-
J-' 0- -- -- --
~ t
O- 0
I
. r·
I O.,. :!
) ! 0-
c' -,
-- -- 0- 1
],
~i
0 - - - 0- 1- -1 -0 -0 -0 -0 -0
0
0 0 0 1
o 0- 0- -0 -1 -0 -1 -0 -1
If',
\
O2 O2
J2 K2 J3 K3
Kl = Q~ + Q2 X = Q2 EI1 X
12 = QIX + QIQ3X
K2 = X + Ql
13 = x
K3 = QIQ~ + QIQ2X = (Ql EI1 Q2)X
The sequential circuit of the 1010 sequence detector is obtained using the
above equations and is shown in Figure 7.30[a]. The timing diagram of
Figure 7.30[ b] shows the relationship between the output, the clock, and
the input. '
FIGURE 7.3Oa
W-U-====-- z
.:. :"-.,
CK--~---+-r--------~--~------+----~
[a]
244 CHAPTER SEVEN Design of Synchronous Sequential Circuits
\j
EXAMPLE 7.8 SOLUTION
Obtain a scale-of-seven up-counter, FIGURE 7.31
as shown in the state diagram of
Figure 7.31, using D FFs and PLA.
Assume that the counter is tied to a
seven-segment display device.
The state table of the counter may be obtained as shown in Figure 7.32.
FIGURE 7.32 PS
0 30 20 1 NS
000 001
001 010
010 all
011 f'--jOO
100 - 101
\
101
110
110
P9o.
/ ,! 1,
7.6 Design Algorithm 245
0 0 0 0 '1 0 0 1 0 0 0 1 1 0 1
1 0 I, 1 ::,) 1 1 f) 0 - (1" 1 0 0 - 0
-" r--J' ---~
0,
The PLA circuit configuration follows as'shovm in Figure 7.34. The dots in
the intersection matrix correspond to either an OR or an AND operation.
The segment allocation for the LED display has already been defined in
Example 4.8.
FIGURE 7.34
6543210
I
~ -" - ~-
r----- (, GJ ~
_ \1/'7\.-1 *' 0,
01
,,
f- .. - 0,
, ,
L \
\ - /
\/ (\"
p- Ol f
------
;
V ' 1- - -L
;
__--1-·
~i
1 -" O2 O2 f -
!
l-'
.I OR
i
-
r> O2 f -
POt ]-\'1 +7 ,
Q
RV'T 1 + Lr
( !, _ -', i -, Y 03
-_,-
03 f -
S
T
U
V > 03 f -
CK,
246 CHAPTER SEVEN Design of Synchronous Sequential Circuits
FIGURE 7.35
XiV, =
Q
o
FIGURE 7.36
NS
PS XiYi 00 01 11 10 Zl Z2
00 A ofCfA '13
() (.
A 00
\0 B !O 8 ;'B ·;8 ';8 10
-~5----:------~\~ __ _ ! In
,v . C ~. r C.rC
i"I: '~.
"" !C .JJC 01
--'1--,..~
XI(QO\ \.
01 LI __ \1 . !o
'\()
,,
0 1\'0 V'i \0
i
M, I (.
\\ ,I I0 I
we may assign A = 00, B = 10, and C = 01. These assignments would
l 0 \ to v \v i 0
allow us to derive circuit outputs directly from the FFs.'That this is possible
0 I \6 ! \
\
\01 Of 0)
!
i
I
(~
v
would become obvious by comparing Examples 7.5 and 7.6. Accordingly,
the excitation equations are given by
I f \ .,-- II Dl XJ',Q2 + Q;
=
-- -
,--,.,-,,-- ."~-.
I
..
I
I'
'
D2 = XiY,Q! + Q2
p~
1 f sLIG /
7.7 Incompletely Specified Diagrams 247
The resultant circuit for the sequential comparator may now be readily
obtained. The circuit is illustrated in Figure 7.37.
FIGURE 7.37
X;----i o 0,
Ci \
\ £\
, '",
y;--_.-i
o
11 o
I
.
\! :i
o
CK------~-------------~.
7.7 Incompletely All problems considered thus far in this chapter have been completely
specifud; that is, all next-state and output values were completely
Specified Diagrams defined in their state diagrams and state tables. In this section we
shall consider state diagrams and/or state tables that are termed
incompletely specified. Such sequential circuits include don't-care out
puts in their respective state tables and state diagrams. These cir
cuits have an added advantage over the completely specified cir
cuits since the presence of don't-cares may contribute to simpler
Boolean expressions.
The minimization process of state tables that contain don't-cares
is tedious and requires special consideration. Implication tables are
used for removing state redundancies, but the steps involved are dif
ferent from those for the completely speCified state tables (see Sec
tion 7.3 for details). The steps for incompletely specified state tables .
involve the following variations:
1. The entries in the implication table are made exactly as
before, but a don't-care in the output is considered to be a
1 or a 0 depending on whether this particular choice aids
the formation of an equivalent group.
/
248 CHAPTER SEVEN Design of Synchronous Sequential Circuits
2. Once the successive passes and crossing out of the cells have
been completed, the designer should make entries in the
equivalence partition table as before. However, it must be
understood that two equivalent pairs like (AB) and (AC)
do not automatically imply the existence of a larger equiv
alent group (ABC) unless there exists an equivalent group
(BC) or (BCX). This extra condition is necessary because
the don't-cares may have been treated as both 0 and 1
under different conditions.
3. The maximum number of states in the reduced circuit is
equal either to the number of sets of maximal compatibles
or to the number of states in the original circuit, whichever
is less.
4. A closure table is obtained by considering.the maximal com
patibles as states and grouping their next states under
respective input columns. The reduced state table is con
structed by renaming the sets of maximal compatibles.
Note, however, that the resulting reduced state table might
still be incompletely specified.
PS x 0 x 1
A A, B,1
B G, 0,0
C B,1
B,-!
0 A,1
B,
E C.-f
.
A-
F F-' C,+
.
' !
G G, G-
FIGURE 7.39
_.
',-',
E
1~')
!
" . F
f-)
G BG OG BG CG
A B C o E F
E (EG)(FG)
o (OG)(OF)(EG)(FG)
o (EG)(OFG) Using step 2
C (CG)(EG)(OFG)
B (BG)(BE)(BO)(BC)(CG)(EG)(OFG)
B (BEG)(OFG)(BCG)(BOG) Using step 2
NS,Z
(BDG). (BG), (BE), and (EG) yield (BEG); (BG), (BG), and (GG) yield
PS x=o x=1
(BGG); and (BG), (BD), and (DFG) yield (BDG). Note that (BG) has been
AOFG AFG,1 BCG,1 used in all three determinations, and such manipulations are valid. In the
BEG CG, AOG,O final form we haveJi.ve-possible sets renamed as follows:
-r.~(
BCG BG,1 BOG,O
P = (ADFG)
BOG AG,1 BOG,O
Q = (BEG)
R = (BGG)
FIGURE..7.42
S = (BDG)
NS,Z
The closure table can now be constructed as shown in Figure 7.41. In the
first row of the closure table, AFG are the next states for'states ADFG when
PS x 0 x 1 x = O. For x = 1, BGG are the next states for states ADFG. Now we may
construct the reduced state table by using the variables P, Q, R, and S. The
P P,1 R,1
table can be organized as shown in Figure 7.42. Corresponding to x = 0,
Q R, P,O
state R could move to anyone of the three states, Q, R, and S. This is
R QR$,1 $,0
because (BO) is present in all of those three sets of compatibles. Note that
$ P,1 $,0
the reduced table is still incompletely specified.
250 CHAPTER SEVEN Design of Synchronous Sequential Circuits
7.8 Ideal State In the previous sections state assignments were made arbitrarily
with no consideration of the consequences. It will be seen that the
Assignments combinational circuit complexity is different for different sets of
state assignments. The number of possible state assignments for any
given problem is impressive. For n present states and p flip-flops,
there are 2P!/[n!(2P - n)!] ways of selecting n out of the 212 possible
combinations. For each of these ways there are n! permutations of
assigning the n combinations to the n states. Again, for each of these
assignments there are 2P ways of interchanging logic 0 and logic 1
and there are pl ways of interchanging the FFs. Consequently, there
may be a total of[(2P - 1)!]/[(2P - n)!p!] unique assignments. For
example, the number of unique assignments for a nine-state system
can be calculated to be 10,810,800.
The optimum state assignment is one that reduces the amount of
combinational logic of a sequential system when compared to other
assignments. Many different approaches to this state assignment
problem have been developed. The complexity and cost of the cir
cuit will differ for different combinations of state assignments. The
identification of the best state assignments has been the subject of a
considerable amount of research. We can attempt to locate the best
set by generating those output and excitation tables that allow the
formation of large clusterings of ones. Use of the following guide
lines will probably result in simpler circuits:
1. Adjacent assignments should be given to those states that
have the same next state for any given input.
2. Two or more states that are the next states of the same
state, under adjacent inputs, should be given adjacent
assignments.
3.. States that have the same output for a given input should
be given adjacent assignments.
The term adjacent assignments means that the states appear next to
each other on the mapped representation of the state table. The
assignment guidelines work best with D and JK FFs. These rules
usually lead to a good, but not necessarily to the optimum, solution.
It may not always be possible to satisfY all of the guidelines at the
same time. In case of conflicts, rule 1 is preferable. An attempt
should be made to satisfY the maximum number of suggested adja
cencies. However, remember that an ideal state assignment may not
always reduce the cost, and it is true also that the cost of the devices
is often an insignificant part of the overall cost of a digital system.
7.9 Summary
In this chapter all aspects of the design of a synchronous sequential
circuit were considered. It is possible to design numerous types of
digital systems using synchronous sequential design. However, there
Problems 251
are many digital systems that are of the asynchronous type as well.
We will investigate the nature of both pulse-mode and fundamen
tal-mode circuits prior to elaborating an additional application of
sequential circuits. Chapter 10 presents a variety of such applica
tions that include sequential circuits of all three types and some
involving combinations of all three. Next, in Chapter 8, we shall
consider pulse-mode sequential circuits.
FIGURE7.PI
NS,Z
PS x=O x 1
A A,O C,O
8 0,1 A.O NS,Z
C F,O F,O
0 E,1 8,0 PS x=O ' x= 1
[a] [b]
252 CHAPTER SEVEN Design of Synchronous Sequential Circuits
FIGURE7.P2
,.
}~ z
x \
/
) )
L02 J, ----<
<
0, K, i--
CK
O2 Jz :-
<
02 K2
16. Design a BCD counter with (a)JK FFs and (b) D FFs.
17. Design a four-bit Gray code up-counter using (a) JK FFs and
(b) D FFs.
18. Design counters that follow each of the following binary
sequences. For example, "0, 1, 3, 2, 5, 7, 4, and repeat"
implies that the counter repeats the sequence 0,1,3,2,5, 7, 4,
0,1,3,2,5,7,4,0,1,3,2,5,7,4,0,1 and so on.
a. 0, 1,3,2,5, 7, 4, and repeat. Use SR FFs.
b. 0, 1,3, 2,6,4,5, and repeat. Use TFFs.
c. 0,2,4,6, 1, and repeat. UseJKFFs.
Problems 253
X X1 Z1 Z
Comb.
logic 1/0
X2 Z2
01"1 0/1
0 1/0
0
o CK
FIGURE7.P4
r- X1 Z1 ~
x X2 Z2 Z
'--- 0 0
0 < ~CK
20. Obtain the reduced state machine from the state tables shown
in Figure 7.PS. Obtain the corresponding sequential circuits
FIGURE ,7.P5 using D FFs.
NS, Z NS,Z'
x 1 NS,Z
PS x 0 x 1 PS x=O
PS x 0 x=1
A F,O 0,1 A C,O B,1
B C,1 F,1 B C,1 A,1 B,1
A , E,O
C F,1 B,1 C E,O B,1 B F,O 0,1
0 E,1 G,1 0 F,O A,O C E,O B,1
E A,1 0,1 E A,O G,1 0 F,O B,O
F G,O B,1 F 0,1 C,1 E C,O F,1
G A,O 0,1 G E,1 C,1 F B,O C,O
10.1 Introduction
With the study of flip-flops and sequential circuits behind us,the
study of counters and registers will be a natural and straigntfurward
extension. Counters and registers are essential to the design of
advanced circuits found in digital computers. Counters are employed
to keep track of a sequence of events, and registers are used to store
and manipulate data that contribute to all or many of these events.
In other words, most of the robust digital systems would have two
major functional units: a unit where the manipulations are con
ducted and a unit that is used for regulating the events (if the first
unit. Registers and associated logic subunits help to make the first
unit, and counters could be used for running the second unit.
Therefore, without an understanding of flip-flops, counters, and
registers, design of digital systems would be impossible.
Counters are particularly common in the control and arithmetic
units of processors, where they are used to keep track of the
sequence of instructions in a program, to distribute the sequence of
timing signals, for frequency division for causing time delays, for
counting, and a host of other similar operations. Counters may
count in binary or in nonbinary fashion. They are commercially
available in a large variety of mediuin-scale integrated devices. The
basic operational characteristic of a counter is sequential; for every.
present state there is a well-defined next state. The design of a
counter involves designing combinational logic that decodes the
present state and enables entry into the next state of~e counting
sequence. Counters are generally classified into two groups: syn
chronous and asynchronous. A synchronous counter qas all FFs 'change
state synchronously with the clock input whether a periodic clock or
an aperiodic pulse occurs. An asynchronous (or ripple) counter is made
up of FFs that do not change simultaneously with the clock input.
Another application for FFs is for storing bits of information.
When FFs are configured to store multi-bit information, they are
296
10.2 Synchronous Binary Counters 297
10.2 Synchronous
Synchronous counters are distinguished from asynchronous (or rip
pie) counters in that the clock pulses in synchronous count~rs initi
Binary Cpunters
ate changes in the FFs used in the counter. The simplest possible
counter is a single-bit counter that alternates between two states, 0
and 1. A toggle FF using a singleJK FF, with both inputs tied to 1
(J = K = 1), will function as a single-bivcounter alternating
between the two states with the occurrence of each clock. The out
put of the FF has a frequency that is one-half the clock frequency.
A two-bit binary up-counter with four states was already
designed in Example 7.5. Such a counter consists of two JK FFs
whose states Q2QI could be assumed to move in sequence through
00,01, 10, 11,00,01, and so on. The correspondingJ and K inputs
of the two FFs are given by
JI = KI = 1
J2 = K2 = Ql
Note that these equations are slightly different from those given in
Example 7.5. The positions of the FFs have been reversed and out
put equations are abandoned altogether. We can take the outputs
directly from the FFs.
We shall now attempt to synthesize a three-bit binary up-counter
of the nonterminal type. With every clock input the counter moves
to the next higher state. Consider the FF outputs to correspond to
the present state. The first step in the design sequence of a sequen
tial circuit is to begin with a state diagram and a state table fol
lowed by the assignment of states. The state diagram, the state
table, and excitation maps of a three-bit counter are shown in Fig
ure 10.1.
The excitation maps of Figure lO.1[c] may be used to obtain the
i K equations as follows:
il = Kl = 1
i2 = K2 =Ql
i3 = K3 = QIQ2
PS
0 30 20 1 NS
000 001
001 010
010 011
n on' 100
100 101
101 110
110 111
111 ~o\
; I \
I \
[a] [b]
(')
ex" ""'v I
'nil ' 0 f r r I}
1 - 1 0 1 - - 0 0 (1 ! 0
1 - - 1 0 1 - - - -
'l=J -
- 1 1 - - - 1 oI r-~"
1,
- 1, 1 - - - 1 oI o 0 1
L~~.
0
[c]
CLOCK--4---------~--------------~
f
,/
300 CHAYI'ER TEN Introduction to Counters, Registers, and RlL
On-l
[a]
On-2 ·On-3
On-l
CLEAR KnCLROn
COUNT
CLOCK
~~--------------~~-------------- ... --------~
10.2 Synchronous Binary Counters 301
used, one may even be able to set the counter to its maximum count
state.
There are many occasions in a digital system when a down
counter is required. A binary number is set into the counter that
then counts toward zero as the clock pluses occur. These counters
can be designed in the same way as up-counters. The equations for
the down-counters are also seen to have regularities. The i and K
equations for an n-bit binary down-counter are obtained as follows:
il = Kl = 1
i2 = K2 = Ql
il = Kl = 1
i2 = K2 = EQI + EQI
i3 = K3 = EQIQ2 + EQl~
FIGURE 10.5 Four-Bit Binary those of a down-counter. The implementation of a four-bit, up
Up-Down Counter. down counter is shown in Figure 10.5.
E-...---,
CLEAR
CLOCK
As pointed out earlier, a counter can be designed to count in a
nonbinary manner as well. Two examples of nonbinary counters
are a BCD decade counter and a Gray code counter. In the former,
the counter counts 0000 through 1001 and then resets back to 0000.
A four-bit Gray code counter, on the other hand, counts 0000, 0001,
0011,0010,0110,0111,0101,0100, 1100, 1101, 1111, 1110, lOlD,
1011, 1001, and 1000 in that order and then resets to 0000 before
resuming count-up operation again. Example 10.1 illustrates the
design of a BCD decade counter.
Obtain the J and K equations for a The design steps, followed in the usual sequence, consist of the state dia
BCD up-counter. gram (Figure 10.6), the state and transition table (Figure 10.7), and excita-
FIGURE 10.6
n
10.2 Synchronous Binary Counters 303
FIGURE 10.7 PS I
0 40 3 0 2 0, NS J4 K4 J3 K3 J 2 K2 J 1 K,
0000 0001 0 0 0 1
0001 0010 0 0 1 -1
0010 0011 0 0 0 1
0011 0100 0 1 -1 -1
0100 0101 0 -0 0 1
0101 0110 0 -0 1 -1
0110 0111 0 -0 0 1
0111 1000 1 -1 -1 -1
1000 1001 -0 0 0 1
1001 0000 -1 0 0 -1
,.-,,~.
tion maps (Figure 10.8). The resulting J and K equations are obtained
from Figure 10.8 as follows:
Jl = Kl = 1
J2 = QlQ4
K2 = Ql
Js = Ks = Q,Q2
J4 = Q,Q2Q3
K4 = Q,
FIGURE 10.8
~(i)
O2 '" <- \
~6;~~~.,? .', ,';
. ! "
0 0 0 0 0 0 1 0 0 1 - - c./J 1 ~p - 1
0 0 1 0 - - - - 0 1 - - .' ~
- - - -
- - - - - - - - - - - - - - - -
- - - - 0 0 -- - 0 0 - - 1 1 - - L
- - - - - - 1 0
0 0 1 0 - - 1 0 1
- - - - - - - - 1
- - - - - - - -
304 CHAPTER TEN Introduction to Counters, Registers, and RTL
1. = K. = 1
12 = Q.(Q3 + Q4)
K2 = Q.
13 Q.Q4
=
K3 = Q.Q2
14 = K4 = Q.Q2Q3
FIGURE 10.9 Synchronous BCD Consequently, the BCD counter may be obtained by modifying the
Up-Counter. modulo-16 counter circuit, as shown in Figure 10.9.
l l
1-4~ J 1 PR 0 1 ) J 2 PR O2 t - ) l J3 PR 0 3 I - ~J' JR O,
-< > r- iC~ r--< > rC ~
-
r K1CLR Q1 '-K2CLR02 -K3CLR03 r-- t
K4CLR04 '
\) \
CLOCK
COUNT
CLEAR
CLOCK~----~------------~~--r-----~
306 CHAPTER TEN Introduction to Counters, Registers, and RTL
This circuit can be analyzed by assuming a present state and using our
knowledge ofJK FF operation. Corresponding to each of the present states,
the next state is found by determining the corresponding J and K values of
each FF. WhenJK = 00, the corresponding Q remains unchanged; when
JK = 01, Qis reset; whenJK = 10, Qisset; and whenJK = 11, Qtoggles.
The resulting state table is obtained as shown in Figure 10.11. The circuit
has an irregular state sequence 0, 1,3,4,6, and repeat. Consequently this
circuit is an irregular counter.
FIGURE 10.11
PS I J3 K3 J2 K2 J 1 K1 NS
000 00 01 10 001
001 00 11 10 011
011 11 11 11 100
100 00 11 00 110
110 11 11 01 000
I
FIGURE 10.12 !
PS NS
I I
0 3 0 2 0 1 0 30 2 0 1 ! J3 K3 J2 K2 J 1K1
000 010 0- 1- 0
001 -- -- -- --
010 100 1- -1 0
".
100 011 -1 1- 1
101 --- -- -- --
110 111 I -0 -0 1
111 000
1 -1 -1 -1
to. 3 Asynchronous Binary Counters 307
1, = Q3
K, = 1
12 = 1
K2 = Ql EB Q3
13 = Q2
K3 = QI + Q2
FIGURE 10.13
CLOCK--~~--+-------------~---+----------~
CLEAR
10.3:t\synchronous
All of the counters considered thus far employed synchronous cir
cuits, that is, the FF actions were synchronized with the clock pulse.
Binary Counters .
The advantage of a synchronous counter is that tall bits of a count
change simultaneously except for slight differences in FF delays. If a
specific count is being decoded, all bits are' available at the same
time, eliminating momentary errors at the decode output. We shall
now introduce asynchronous counters, also known as ripple coun
ters. The FF clock inputs in a ripple counter are not tied together.
308 CHAPTER TEN Introduction to Counters, Registers, and RTL
In fact, the clock inputs are cascaded from output to input (almost
like the rippling of carries in a ripple adder). They are used to
reduce the amount of control logic required to construct a binary
counting sequence. Asynchronous counters have limitations but also
provide less expensive counter options for those cases where their
limitations will not affect the circuit. The AND gates between FFs
in the synchronous binary counter design may be eliminated by
observing the counter state table. The LSB needs to be changed in
every present-state to next-state transition. In all bit locations, Qi
changes each time 0-1 makes ~ transition from a 1 to a O.
A negative edge-triggeredJK FF in a toggle mode changes state
each time the signal connected to the clock input makes a 1 ~ 0
transition. An asynchronous counter using T-configuredJK FFs has
its least significant FF activated by the system clock. The 1 ~ 0
transitions of that FF may be used as the trigger (clock input) signal
for the next most significant FF. This process of triggering is contin
FIGURE 10.14 Four-Bit Ripple ued for as many bits as desired.
Counter: [a] Circuit and [b] The logic circuit of a four-bit ripple counter is shown in Figure
Timing Diagrams. 1O.14[a], where four T FFs are cascaded together. The output of
SET----I
CLEAR
[a]
01
O2
0 01 1 I 0 01 1 .I 0 01 1 I 0 01 1L
03
0 0 0 01 1 I 0 0 0 0/ 1L
0 0 0 0 0 0 0 01 1L
04
[b]
each FF provides the clock signal for the next FF. The timing dia
gram without delays for the four-bit ripple counter is shown in Fig
ure 1O.14[b]. Examination of the timing diagrams shows that the
frequency of the Q4 pulse is one-sixteenth of the frequency of the
input pulse x. Each stage of the counter divides the frequency of the
preceding stage by two.
Counters like the one shown in Figure 10.14[ a] are simple in con
cept, but have at least two disadvantages: a forced regular binary
sequence and speed. The first disadvantage is not so much of a seri
ous handicap, but the speed is. In reality, the rippling effect
through the FFs causes delay between each count that is propor
tional to the number of FFs in the counting chain. Consider the tim
ing diagram of Figure 10.15 that shows the situation existing in the
.: . counter when the count is 1111. Ql does not change to 0 coincident
with the trailing edge of the sixteenth x-pulse until time tp the prop
agation delay of each FF. The same is generally true for the syn
chronous counter, but for the asynchronous counter Q2, Q3, and Q4
change at times 2tjJ 3~, and 4~, respectively, 'Deyond the negative
edge of the sixteenth x-pulse. For an n-bit ripple counter to reach a
valid count before the next clock pulse, T > n~, where T is the
period of the input pulse. If the final count is all that is of interest,
the condition T > ~ is all that must be met. In this situation,
changes in the LSB are constantly rippling to higher-order bits.
After the last pulse is input, it will be n~ before the final count can
be correctly read. Note that in Figure 10.15 the counter does not go
through the transition 1111 --? 0000. Instead the counter passes
through the state transition sequence 1111 --? 1110 --? 1100 --? 1000
--? 0000. These transitions occur in rapid succession but they result
in undesired transient conditions that might cause further problems
I
02-------L-~1~
I
I
I
I
03--------I-~1~-.
I
I
I I
04-------~~1--~~1-.
I I
I I
, I
I I I I
I t + 2f( I f + 4tf
I I
t+ If t +3f(
310 CHAPTER TEN Introduction to Counters, Registers, and RlL
[6] Timing Diagram. The ripple counter of Figure 10.16 exhibits other transient
COUNT----.---------.---------+---------,
CLOCK - - - + 0
CLEAR
. raj
CLOCK
I
I I I I I
01 II I II I I
II II II II
"
O2
::,
II
::1
II
::,
II
::1
II
I:~
II
III
'"
!II
III
'"
III '"
III
III
III
1111
1111
III I
1111 1111
03
III III III III 1111
III Jill III 1111 III I
III 1111 III 1111 1111
04
111
111
1111
1111
III
III
11111
III! lit
III
III 1111 III lUll 1111
III 1111 III 11111 1111
III 1111 III 11111 III I
III 1111 III 11111 1111
{bJ
»
(actual),
1001-') 0000 (ideal), 1001-') 1000-') 1010-') 0000 (actual).
The worst-case transient occurs during the transition 0111 -') 1000.
Since an intermediate count is to be decoded, the clock period must
be longer than the 0111 -') 1000 propagation delay.
Another alternative to the BCD counter design involves feeding
the clock input of a modulo-5 counter with the output of a single T
FF. The combination of a modulo-2 and modulo-5 counter results
in a modulo-l0 counter. Such cascading of one counter with
another should be pursued whenever possible. Some of the counter
designs that we have considered thus far have demonstrated how to
reset a counter once a specific count has been reached. There are
cases where a different approach may be necessary. It is always pos
sible to preset a counter to a specific count by means of a Jam-entry
scheme, as shown in Figure 10.17. The bit that is to replace the old
value at the Qi location is fed directly to the corresponding entry
point, Xi' The new bit is transferred to the FF output when the clock
pulse occurs. The counter will begin counting from the preset count
FF;
CLOCK
input -.._ _- - J
312 CHAPTER TEN Introduction to Counters, Registers, and R1L
10.4 I C Counters In the first three sections of this chapter we have used both classical
and heuristic design techiques to design counters. Similar multi-bit
counters are available in IC form. A typical four-bit binary counter
module with inputs and outputs is shown in Figure 10.18. We are
.already familiar with most of its features. The different inputs are
described as follows:
A, B, C, D: These inputs are used for presetting the counter to an
irutial value. It has been assumed that A is the LSB and D is the
MSB.
QA, QB, Qc, QD: These are the FF outputs of the counter. QA
corresponds to the LSB and QD corresponds to the MSB.
CARRY-OUT (CO): This output becomes a 1 when the count
equals 1111 and the ENABLE control input is a 1. CARRY
OUT is equivalent to QAQsQcQD • ENABLE.
LOAD: This control input is used to load A, B, C, and D values
into the counter. When -the LOAD input is a low (0), the values
are either loaded immediately if loading is asynchronous or
loaded at the next clock pulse in the synchronously operated
counter.
CLEAR (CLR): This control input when set to a 0 causes the
counter to be cleared. The counter is cleared immediately if it
has an asynchronous clear. In a counter with synchronous clear
the output changes coincident with the next clock pulse.
ENABLE (E): This input must be high for the counter to count.
CLOCK (CK): The 1 ~ 0 transitions of this input are counted
by the counter when the ENABLE input is a 1.
CARRY
OUT
-..._+<1 LOAD
--e-aCLR CARRY CARRY
#1
-----iE OUT OUT
Input
EXAMPlJE·l0.4 SOLUTION
Design a counter using the module One of the ways to accomplish this design is to make use of the CARRY
of Figure 10.18 that outputs a 1 OUT output, which is 1 when the count reaches 1111. We can load the
each time six counts have been counter With an ipi~al value that will cause an output to occur five pulses
received. later. The CARRY-OUT is then used to reload the initial value. We begin
from 1010, and when the counter reaches 1111 the:: CARRY-OUT would
give a 1. Note that the first output upon turning the power on may not
even be 1010. The CARRY-OUT either may become 1 before six pulses
have occurred or may require up to 15 pUlses. The number of pulses is
dependent on what value the counter assumes upon power-up. The state
diagram of the required sequence js shown in Figure 10.20.
314 CHAPTER TEN Introduction to Counters, Registers, and RTL
FIGURE 1020
Successive outputs should occur after every six pulses. The circuit con
figuration using an IC counter with a synchronous load is obtained as
shown in Figure 10.21. When the counter reaches 1111 the CARRY-OUT
becomes a 1, causing a low at the LOAD input. This low forces the counter
to begin again from the 1010 state.
FIGURE 1021
CARRY
OUT
Input
'----+IloZ
FIGURE 1022[a]
[a]
to.5 Basic Serial Shift Registers 315
FIGURE 1022[6]
----(1 LOAD
CARRY
OUT
Input
Z--.....-t
[b]
a. Use the CARRY-OUT and load m- n into the preset inputs. The
CARRY-OUT will be 1 every n pulses.
b. Decode a count of n - 1 and use the output of the decode gate to
clear the counter. The decode gate will be active every n clock
pulses.
10.5 Basic Serial Shift The shift register is one of the most extensively used functional
devices in digital systems. A shift register consists of a group of FFs
Registers connected so that each FF transfers its bit of infonnation to the
adjacent FF coincident with with each clock pulse. In other words,
shift registers store bits of infonnation, behaving like temporary
memory, and upon external command shift those infonnation bits
one position to either right or left, depending on the design of the
device.
The action of a right-shift register whose shift-right serial input is
tied to a 1 is illustrated in Figure 10.23. The bits shifting out of the
right-most FF are lost. With each clock input the bits move one
position to the right while a 1 moves in at the MSB. After 11 clock
pulses, the data in the register prior to shiftiIl:g are replaced by a
string of Is. A quite useful application of shift-right registers
requires a connection of the right-most FF output to the input of the
left-most FF. In that case the LSB is not lost b.ut appears at the
MSB. Consequently, after two clock pulses, for example,
00101100101 would be replaced by 01001011001. Such a shift-right
register is known as a circulate-right regiSter. In the event these same
data were stored in a shift-left register and the MSB output was
connected to the LSB input, the data would be 10110010100 after
two clock pulses. This latter type of register is known as a circulate
left register.
316 CHAPTER TEN Introduction to Counters, Registers, and R'IT.
10 11111111110
11 11111111111
Qn +l
10.5 Basic Serial Shift Registers 317
SET
SRI - - - - - - - - 1 0 3 PR 031----1
HOLD
CLOCK----;
CLROo SRO
CLEAR---!
[a]
SET
HOLD
CLOCK----;
L-_-"
CLEAR
SLO ~---------r--~----------+---'---------~--~~--~SLE
su
SET
~--------~---'----------~--~--------~~--'--------CLOCK
CLEAR
SET
SAE
... -.--------+-~~------~~~~------~~
SLE
r + - + - - - - - - - - - - / - - - - t - l - - - - - - - - + - . . - 1 - + - - - - - - - 1 - From (n - 2)th
stage
CLocK'::....:"<...;:.·,-''-~
HOLl)
(n + 1)th stage nth stage (n - 1)th stage
ally exclusive. When the SRE input is high, each of the FFs loads
the respective Qoutput of the FF on its immediate left. When the
SLE input is high, each of the FFs loads the Qoutput of the FF on
its immediate right. When both SLE and SRE are 0, the FFs are all
reset. Note this time how the CLR control has been eliminated.
When HOLD = 0 the register functions in its serial mode, and
when HOLD = 1 the old data bits are restored. We might decide
to eliminate one of the two shift controls. In that event we may
decide to keep SRE only by making sure that SLE has been
replaced with the complement of SRE. The register would function
as a shift-right type when SRE = 1 and as a shift-left type when
SRE = O. But this arrangement causes a problem if we need to
"'; -:
reset the FFs at any time. This problem could be solved, however,
by feeding the complement of a CLR control to each of the FF
resets.
An important application of shift registers is their role in arith
metic operations. A binary number can be multiplied by 2 by shift
ing the number one bit to the left and divided by 2 by shifting the
register content one bit to the right. As we will see later, the bits
shifted in at one end and out at the other end are not unimportant;
they are used in arithmetic operations in many instances.
10.6 Parallel.Load An n-bit, serial-load shift register requires n clock pulses to load an
n-bit word. A parallel-load shift register, in comparison, loads all infor
Shift Registers mation bits simultaneously. Both serial-in and parallel-load shift
registers have specific applications in digital systems. A parallel-in,
serial-out shift register using master-sh~ve SR flip-flops is shown in
Figure 10.28. The parallel data are loaded using the jam-entry
320 CHAPTER TEN Introduction to Counters, Registers, and RlL
SET
Do
~----r-~----~+-----------r-~----~~----------+---~~E
00
CLEAR------1
scheme that was discussed in Section 10.3. When the enable signal
E is high, the data are loaded into the register in parallel. Again, if
E is low, the Qoutput of the FF of every stage is shifted to the right
by means of the combinational gates. In either case the HOLD con
trol must be held low. Parallel-in, serial-out shift registers allow
accepting data n bits at a time on n lines and then sending them one
bit after another on one line. This is a standard mode of communi
cation between digital systems.
At the receiving end of two digital systems communicating over a
single data line, it is necessary to collect n bits and then transfer
them in parallel to the receiving system that is designed to handle n
FIGURE 10.29 Four-Bit, Serial bits simultaneously. Figure 10.29 shows the logic circuit of such a
In, Parallel-Out Shift Register.
SET ~
V
SRI 8 3 PR 0 3 8 2 PR 02 8 1 PR 01 So PR 0 0
- t-
HOLD
CLOC K
-~ ,
D3 D2 D1 Do
CLEAR
~
V
10.7 Universal·Shit~ Registers 321
SRO
0, 00
SET
PR PR
..-------1 So 00
0,
CLR
CLEAR
LOAD'~,~~-r-------------'-r------------~~------------~
•
10.7 Universal· Shift A universal-shift register is a versatile shift register that has capabilities
for parallel loading, parallel outputs, bidirectional shifting, and
Registers bidirectional serial input and output. In other words, it is capable of
operating in all of the register modes described previously. There
could be two different ways to realize a universal-shift register:
either by modifying a parallel-in, parallel-out shift register or by
building one from scratch.
322 CHAPTER TEN Introduction to Counters, Registers, and RTL
SLO
03 O2 0, 00 03 O2 0, 00
SET - SET
HOLD 4-bit, - HOLD 4-bit,
parallel-in, parallel-in,
CLR parallel-out, - CLR parallel-out,
shift-right shift-right
CK register --0 ~CK register
LOAD - LOAD
SRI 13 12 I, 10 SRI 13 12 I, 10
I
)
SLI
[8] [b]
,----10; Oi
CLOCK----~--a
CLEAR
f f
1-of-4 MUX E
-------1/0
10.8 Shift Registers as Shift register ICs are used at times to generate counts or controlled
sequences. As a result registers are used extensively in multiple
Counters address coding, parity bit generators, and random bit generators.
The output of each stage and its complement mtlSt be accessible for
these applications. These register outputs are used to drive combi
national (eedback logic, as shown in Figur~ 10.33. The feedback
logic determines the next state of Qn. In the case of a bidirectional
register, the feedback logic controls shift-left and shift-right signals
and sets up a 1 or 0 to the appropriate SLI and SRI input.
The state diagram of a four-bit shift register with the}3 input of
FIGU~ 10.33 Feedback Shift th~ input FF available is shown in Figure 10.34. If the shift register
Right Register Configuration. is initially in the state-Q3Q2QlQo = 1001, then. there are two possi
Feedback logic
,.
"
.., f:' ..
;,1" .
In On In- 1 On-l Jn~ 0 11-2 ... - JO 00
•
Y r-C >
Kn On
rC t>
Kn 1 On 1
rC >
Kn -i5n 2
r<: >
... - r-- Ko 00
CLOCK
324 CHAPTER TEN Introduction to Counters, Registers, and R TL
ble next states. These are 0100 if the 13 input is a 0, or 1100 if the 13
input is a 1. These values correspond to a shift-right operation. All
possible internal states of the register and all possible transitions
between the states are considered'in this state diagram.
In order to design a counter or sequence generator, the designer
selects the desired sequence of states on the universal state diagram.
Based on the desired sequence the feedback logic is designed so that
the register will cycle through the selected sequence of states. Exam
ple 10.5 illustrates the technique.
Transitions
( ""\
PS .. NS J3
1 - 1 1
0000 1000
1
1000 1100
1
0 0 - -
1100 1110
1
1110 1111
1
- 1 0 0
1111 0111 0
0 - 1 -
0111 1011
1
1011 0101 0
0101 DOlO 0
0010 0001 0
0001 0000 0
I
FIGURE 10.37
rC
r(
~
'-
l(
c
J3 03 J2 O2 J1 01 Jo 00
v~
. ,:
K3 03 K2 O2 K1 01 Ko 00
CLOCK
10.9 Counter and There are hundreds of applications of counters and shift registers.
They are used extensively in computers. In general, digital com
Register Applications puters process numbers by repeated arithmetic and logic opera
tions. Execution of a specific instruction usually involves moving the
instruction and data between registers. The data are operated on by
the ALU as they are transferred between registers. These transfer
sequences are in turn controlled by sequential circuits. In particu
lar, registers provide the means for the storage of bits as they are
being processed. On the other hand, counters keep track of the next
memory location and count the intervals in the sequences that con
trol these complex operations. In this section we shall consider only
a few of their many important applications.
The operations in digital computers are performed in parallel in
most cases since this is a faster mode of operation. In comparison,
serial operations are slower but require less complicated and less
expensive circuits. Consider the add function. In Chapter 5 the
design of parallel addition circuits was examined in detail. The
techniques developed were reasonably fast but they involved very
complex circuitry. Frequently, the designer must make a trade-off
between time and the number of components.
The add operation can also be performed by loading the addend
and augend into two serial shift registers and shifting one bit from
each register into a single-bit FA, as shown in the block diagram of
Figure 10.38. The carry-out of the FA is stored in a D FF and fed
back as the carry-in to the FA to be added to the next pair of signifi
FIGURE 10.38 Serial Adder
Configuration.
SRI
- ADD SRE A SRO
GLOG K ~
Xi Sj ;---
Yi FA
---to Ci - 1 Ci ;---
SRI
SRE B SRO
~
~
PR
~ 0 0
•
Q ,
y
v--
GLR
~
J f-- CLEAR
~'"
10.9 Counter and Register Applications 327
cant bits from the shift registers. The sum bit is shifted into the shift
register containing the augend as the augend bits are continually
being shifted out to the right.
Initially the shift registers A and B hold the augend and addend
and the D FF is cleared. The summation is achieved by connecting
each pair of bits, through shifting, together with the previous carry
out into the FA circuit and by transferring the sum bits serially, into
the register A. The ADD command starts and stops the operation.
When ADD is high the registers perform a shift-right operation at
each clock, and when ADD is low the registers maintain a hold
mode. In the next chapter we shall consider every aspect of how to
design such a serial adder circuit. In the meantime we will develop
other relevant concepts.
Operations in digital systems are controlled by a sequence of tim
ing pulses. The control unit in a serial computer must generate a
signal that remains high for a number of pulses equal to the number
of bits in the shift registers. For example, the serial adder system of
Figure 10.38 requires a control signal, ADD, for its operation. Fig
FIGURE 10.39 Generation of ure 10.39[a] shows a control circuit that generates a signal that
Timing,Sequences: [a] Circuit and remains high for a period of 16 clock periods. The four-bit IC
[6] Timing Diagram. counter and the SR FF are initially CLEARed. The BEGIN signal
BEGIN S PR Q
CLOCK
I I I I
..t>
A B C D HALT
1--< LOAD R CLR Q
CLEAR ~ ,.. CLR
V . E
IC counter CARRY
OUT
-r t>CK
QA 08 Oc OD
[a]
CLOCK
BEGIN -.Ji'-_____________________
HALT---------------------------------------~
Q-----' L
[b]
328 CHAPTER TEN Introduction to Counters, Registers, and R1L
sets the SR FF, which in turn enables the counter. The FF output Q
remains high. for 16 pulses, as shown in the accompanying timing
diagram of Figure 1O.39[ b]. When the counter reaches count 1111,
HALT is activated, which in turn resets the FF. The BEGIN signal
is synchronized with the clock and is made to stay on for one clock
period. It could be made to stay on for a longer period; however, if
it is made to last for more than 15 clock periods, the circuit will not
function as expected. This HALT signal might be used in another
similar circuit to generate a BEGIN pulse.
In a parallel mode of operation, a single pulse is generally used
to specifY the time at which an operation should be executed. Shift
FIGURE 10.40 Four-Bit Ring nected as a ring counter. A shift-right register used as a ring counter is
Counter: [a] Circuit and [6] . shown in Figure 10.40. A feedback path is provided from the serial
Timing Diagram. output to the serial input of the shift register. A shift register con-
CLEAR
HOLD
[a]
CLOCK
0 LrL
03
0
O2
0 L
01
0
00
0
[b1
10.9 Counter and Register Applications 329
I-----IDo PR 0 0
0,
CLOCK
CLEAR
HOLD
[a]
CLOCK
0
03
0 I
O2
0
0,
0
00
0
[b]
j I I I
00 0 1 O2 0 3
10
1-01-4 MUX EO--
11
f 7
START ~ I
I
~ J 1 . . ,. 0 1 J2 O2 ~
CLOCK ~V -C j')
'--
Kl 0, .-- K2 O2
!)
CLEAR -~~
V
' - - - - 11
2-4 decoder EO--
10
00 0, D2 03
I I I I
A
[7J6 5 4[3 211loJ I 0 7 -0 ;
II ... I
B7 17
J~7 ~
r~71
H7
~6 J~61 ~6 r16
C6 E6 G6 C s Es s
r
~s J~s ~sT~s
G C4
r r
£4
~4 ~4 ! ~4 ~4
G4
1-01-8 MUX 1-01-8 MUX 1-01-8 MUX 1-01-8 MUX 1-01-8 MUX
START
~~ E I E E E E
" 12 11 10 f 12 I, 10 f 12 I, 10 f 12 I, 10 f
I I I I
x .1 1 1 1 .
y
z
SELECT -
.
I I
8-line bus
[aJ
[c]
10.10 Bus Concept 333
1O.43[a] shows the necessary connections. When the select lines, x,y,
and z, are all low the least significant input to each of the MUXs is
selected, and consequently the bus is loaded with the contents of
register A. Each combination of the x, y, and z inputs selects the
contents of a particular register and the contents are then attached
to the bus. The simplified block diagram is shown in Figure
1O.43[b]. It is possible to design a bus system without the MUXs if
the registers have tri-state outputs or are connected to the bus using
tri-state buffers. Finally, the contents of the bus are required to
reach a certain destination register. This requirement is accom
plished by the circuit arrangement of Figure 1O.43[c] where the
select lines x' ,y', and z' determine the particular destination register
by means of a 3-8 line decoder. Upon receiving the proper select
inputs, the contents of the bus are loaded into the selected register.
Another example of the use of a bus involves a simple memory
device. Registers often are assembled together to form a larger stor
age array. This arrangement of registers is referred to as a scratch
pad memory~ Figure 10.44[a] shows an arrangement of registers that
can store up to four four-bit words. The device consists of four regis
ters that in tum have four FFs each. When the WRITE ENABLE
(WE) is low, the four data inputs, 10, Ib 12, and 13, are routed to a
particular location of each register as specified by the entries in the
WRITE SELECT (WS) lines. A 00 on the WS lines will store the
input bits in the respective Oth cell of the registers. Similarly, 01, 10,
and 11 applied at the WS lines would respectively select the first,
second, and third bit of each register. Stored data from the scratch
pad memory may be retrieved through the four output lines by
applying a low to the READ ENABLE (RE) and necessary address
bits to the READ SELECT (RS) lines. Figure 10.44[b] shows the
logic diagram of the memory formed using gated D latches.
Scratch-pad memory, although very fast, is not extensively used.
FIGURE 10.44 I6-Bit Scratch
It is not particularly suitable for LSI because too many pin-outs
Pad Memory: [a] Block Diagram
00
l
10
I,
Data Data
12 lOUtputs
13
WRITE
WE
ENABLE
READ ENABLE
~ ~
[a] WRITE SELECT READ SELECT
334 CHAPTER TEN Introduction to Counters, Registers, and RTL
O;o---r---------
RS,
RS o
WE
R
O;,---r--""'"
RS,
RS o
Oi2---r--""'"
AS,
RS o
0 ; 3 - -l ---""
RS, 0---'
RS o
Define a control input, LOAD, to be used for selecting the parallel load
operation, and its complement, LOAD, for selecting the 2's complement
operation. The loading excitation corresponding to a register consisting of
only T FFs is given by
where Ii is the parallel data input to the ith FF. The first term corresponds
to loading the parallel input and the remaining terms correspond to per
forming a complement operation if at least one of the less significant bits is
a 1. The equation is valid as long as the FFs have been CLEARed initially.
Note that in this complementing scheme Qo remains unchanged.
Accordingly, the excitation equation for the least significant FF is given by
The overall excitation equation for the ith FF is now obtained as follows:
+ (0 0 • + (Qo + 0) ...))))
Consequently, if at least one of the bits on the right is a 1, the bit in ques
tion is complemented. The equation may be used to obtain the register cir
FIGURE 10.45
cuit shown in Figure 10.45. The register should be LOADed with the data
CLEAR
01 00
PR CLR
T1
'.~'. f
HOLD
~------------~~------------~~------------~~~-- LOAD
336 CHAPTER TEN Introduction to Counters, Registers, and R 11.,
only after the FFs have been CLEARed. The corresponding 2's comple
ment i~ then obtained by supplying a low LOAD input. Note that a high
HOLD could be used at any time to keep the register content unchanged
indefinitely.
Pl. r 1! =
scale-of-sixty counters,
up-counter that counts 1 through 12,
binary-ta-BCD converters,
decoding circuit to determine the last day of a month,
multiplexers,
TFF,
seven-segment display devices.
Steps 1-3 can be realized using three modulo-60 counters. Two modulo-12
counters could be used to implement Steps 4-7. Steps 5 and 6 can be
implemented, respectively, using a TFF and last-day decoder circuit. BCD
converters and seven-segment displays will be used for the purpose of dis
play, and MUXs will be used for routing the data. •
The IC counter module of Figure 10.18 will be used as the basic unit for
producing the counter modules a and b as shown, respectively, in Figures
10.16 and 10.17.
Internally, module a consists of two four-bit IC counters casca.ded
together. The carry-out of the first is made to enable the second counter
(see Figure 10.19 for a similar circuit). When the count reaches 59.
j
j
10.10 Bus Concept 337
FIGURE 10.46
-b-
,:
r-c LOAD A B C 0 L--a LOAD A' B' C' 0'
?
Outputs
- Za\
...,r-' i---
FIGURE 10.47
A
I B C 0
1
-()
LOAD
"'CLR IC counter Co !---
Inputs { E
~CK
~ OA 08 Oc OD
X/(r Outputs
y ~
V~
lb
SEC pulses, a high will be generated at the minute output, MIN. The out
puts of this module a are then converted to equivalent BCD numbers by
means of three binary-to-BCD converter modules as shown in the circuit.
For an explanation of this multi-bit, binary-to-BCD conversion scheme,
review Example 5.B.
The BCD output is displayed by meatlS of BCD-to-seven-segment
LED display devices. The display will become 00 whenever the MIN
ADJUST input is activated. This allows for the fact that the second display
is cleared automatically whenever the minute display needs to be adjusted.
Note, however, that the DISABLE input must always be activated prior to
MIN ADJUST operation. The resulting low at M </utput would be used
for all of the remaining ADJUST operations.
In Step 3, as shown by the circuit of Figure 10.51, the output of Figure
10.50 is fed into another module a. This configuration is made possible by
means of a 1-of-2 MuX selectable by M. A high M would cause the circuit
to count MIN pulses. In comparison, a low M would allow the adjustments
of MIN counts. The HOUR output becomes a 1 corresponding to every
integral multiple of 60 MIN pulses.
10.10 Bus Concept 339
FIGURE 10.48
---oCLR
------IE d
- - - 0 CK
1
-
A 8 C D A' B' C' D'
J.-{) LOAD L-o LOAD
C CLR
CLR
IC counter IC counter Co '---
E Co E
-a )CK'
,--<: ~CK
OA Os Oc OD OA O's Oc OD
(/)
l' :;
(/) 0
.
7?r
:; ::J
0
C
o
ld
r- Do 1 e.
l- Dl of
D2 4 f f '"' ,l' -- ~
I
II TI
D3 MUX I I tLl
11 12
A
I
Y Y
B
' ..
Y -
FIGURE 10.49
-_+_---o CLR
E a SEC
60Hz
oscillator
340 CHAPTER TEN Introduction to Counters, Registers, and RlL
FIGURE 10.50
M
~
MIN ADJUS T
}-~ CLR
BEGI ~ 0
J
60 Hz .
'=-c > 1- E a Za - MIN
DISA ~ --C >CK
K Q
Os OA OD Oc Os OA
0
SEC
I
8 4 83
I 8I
82 1
04 03 O2 0 1
I l
84 83 82 8 1
04 03 O2 01
I I
84 83 82 8 1
0
04 03 O2 01
I
I I
I-I
II
; ;
II
FIGURE 10.51
1--0 CLR
MIN Do
ADJUST 1-of-2
1- E a Za - HOUR
MUX r "'>CK
v O'S OA OD Oc Os OA
MIN 0 1 Jo
I
I
84 83
I 8I
82 1
M
04 03 O2 0 1
I I
84 83 82 8 1
04 03 02 01
«
I I
84 83 82 8 1
I II
04 03
I I
O2 0 1
1-'
0 I ,
10.10 Bus Concept 341
FIGURE 10.52
HOUR 00
ADJUST b Zb 1f2-DAY
1-of-2
MUX 1 CK
OD Oc 0 8 OA
HOUR 0 1 10
I-I
n U
"
FIGURE 10.53
- Q 04 03 O2 0 1 •
I 84 8j 8 2 8 1
0
I I
04 03 O2 0 1
,,
i
I-I I-I
I ,
342 CHAPTER TEN 1n.troduction to Counters, Registers, and RTL
In the last step, as shown in Figure 10.54, the MONTH output is fed
into a module h. The FF outputs, Qo, Qc. Qs, and ~. and the external
input, LEAP, are decoded to generate A and B. These outputs, A and B,
are fed into modul~ d of Figure 10.53. Note that LEAP is the extra input
required for indicating that the current year is a leap year. This input
needs to be entered prior to February 29. The month decoder circuit of
Figure 10.54 examines the four FF outputs of module h. For the months
January, March, May, July, August, October, and December, both A and
B are set high. For all other months, except February, A = 1 and B = O.
In February A = B = 0 if LEAP = 0, and A = 0 and B = 1 if LEAP =
1. Consequently, the decoder has the following Boolean equations:
A = Qo + Qc + ~
FIGURE 10.54
B = Qo EB ~ + ~Qc' LEAP
1--<: CLR
MONTH - Do
ADJUST 1- E b lb r -
1-of-2
MUX 1 ¢ G>CK
Qo Qc Os OA
MONTH 0,
10 0
I
M
I
84 83 8 2 8,
I 1 I I
Month A t-- To circuit
decoder of Figure
04 03 O2 0, } 10.53
0 0 circuit 8 t-
I r l I
I-I i
'-I
, I LEAP
LI
The design is now complete. After counting the chips involved, let's call
this a table dock. Note that BCD counters instead of binary counters could
have been used in this design, which would have reduced the total chip
count. However, the incentives behind this particular design were to
demonstrate the use of binary counters, to demonstrate the use of binary
to-BCD converter modules, and to demonstrate the thought processes
involved in digital circuit designs.
10.11 Register Transfer The diversity of register types and applications points to the need
for concise language to describe the flow of infdimation (and pro
Language Operations cessing enroute) of bits between registers. The most commonly used
way to attain this goal is by an informal scheme called register trans
fer language, RTL, which was introduced first by 1. S. Reed. A thor
ough investigation would reveal that a complete register transfer
description is made up to two units: data and control. The data unit
consists of registers, data paths, and logic necessary to implement a
10.11 Register Transfer Language Operations 343
set of register transfers. The control unit, on the other hand, generates
necessary signals in a specific sequence to regulate the register
transfers within the data unit. The RTL scheme has the ability to
specify the hardware involved in both units.
The simplest of all RTL operations is represented by P ~ Q,
which indicates that the data in register P are replaced by the data
in register Q. It is also understood that both of these registers have
the same number of bits. Such an operation can be completed dur
ing a single clock period, and thus it corresponds to a single-state
transition of a sequential machine. One elock period, referred to as
the cycle time, may be taken as the basic unit of time at the MSI
complexity leveL For uniformity, the following standardization is
essential:
Table 10.1 lists some of the most important RTL examples that
include arithmetic, bit-by-bit logic, shift, rotate, scale, and condi
tional operations. In order to differentiate between the arithmetic
and the logic operations, the following convention is maintained.
The arithmetic addition is represented by a + symbol, the logical
OR operation by a V symbol, and the logical AND operation by a
1\ symboL The shift, rotate, and scale operations are generally rep
resented by two lowercase letters. For shift and rot~te, the first letter
indicates the type of operation (r for rotate and s for shift) and the
second letter indicates the particular direction (r for right and. I for
left). Furthermore, in the rotate operation the LSB and the MSB
are considered to be adjacent. For all shift operations a 0 will be
assumed to occupy the vacant bit. For the scale operations sel indi
cates scale left and scr indicates scale right.
344 CHAPTER TEN Introduction to Counters, Registers, and RTL
Initial values: A
--
= 10110, B = 11000 and C = 00001.
z
LOAD: R~I;
LOAD: R ~ R + 1 ;
where R is the register receiving the input bits from register 1. These
three RT~ statements describe the action of a significant amount of
hardware. In this and the next chapter we shali be discussing sev
eral of the complex circuits and their correlation with the corre
sponding R TL statements. Such one-to-one correspondence will
make us appreciate the simplification that results from the use of
RTL.
Consider the circuit shown in Figure 10.55. Here we have two
registers, A and B, having four D FFs each. For simplicity the FFs
6 6 ~
-
6
x
V 03 V O2 V 01 V Do
B
03 0 3 O2 O2 0 1 01 00 00
346 CHAPTER TEN Introduction to Counters, Registers, and RTL
Do
A
0,
SRI
Do
P
A
03 0, 0, 00 00
8 SRO
03 03 O2 O2 0, 0, 00 00
[a] [b]
10.11 Register Transfer Language Operations 347
I s
..~~
I VA I V6 6
V
V D3 D2 Dl Do
A
>~h 0 3 O2 O2 01 0 1 00 0 0
I I
.,~, -c
[c) ,.
Do Do
A B
[d)
T:C~AAB;
Note that in all of these valid RTL expressions, the source and des
tination registers have the same number of bits.
348 CHAPTER TEN Introduction to Counters, Registers, and R TL
Design a typical stage for perfonn You might decide to use JK FFs for the design of register A. Register B
ing the following operations: doesn't need to be designed because it is no different than a regular register
with parallel outputs. The JK excitations necessary to turn on the ith FF
Tl:A~O;
for perfonning the required operations are obtained as follows.
T2:A ~A VB;
A+-O is possible when Ki = Tl
T3: A ~A 1\ B;
A +- A V B is possible whenJ; = T2 ' B; and K; =0
T4 : A ~A;
A ~ A 1\ B is possible when J; = 0 and K; = T3 ' B;
where A and B are two multi-bit is possible when Ji = Ki = T4
registers of equal bit size.
The ,corresponding circuit is obtained as shown in Figure lO.57.
CLOCK
~-r----r-----------~
10.12 RTL
The importance ofRTL to describe the internal operations of a dig
ital system is primarily due to the flexibility with which a design
Applications
can be described and the direct way the data and control circuitry
can be realized from RTL statements. Consider, for example, a sys
tem with a four-bit input, I, a four-bit output, 0, and three four-bit
registers, X, Y, and Z, in which the following algorithm is to be
implemented:
A: X ~I;
B: Z ~s12 X;
C:Y~X;
D: Y ~ Y /\ Z;
E: IF (Y3 = 1) 0 ~ 0 ELSE 0 ~ Y;
10.12 RTL Applications 349
o0
~
s/2 X
0, 00
y Z
03 O2 O2 0, 0, 00 0 0
~
YAZ o
[c] [d]
on the output lines, they remain there only during the steps for
which they are valid.
The next step in the design is to regulate this algorithm by gener
ating A, B, CL, C, DL, D, and EL signals in the proper order as
specified by the algorithm. To run the ~ystem, a synchronizing sys
FIGURE 10.59 Complete Data
Unit.
1
-
A B
1 T
03
c
\ O2 V 01 \i Do
(')
V 03 O2
b0
V 1 Do
x Z
03 03 O2 O2 01 0 1 00 Oc 03 0 3 O2 O2 01 01 00 00
L
r-
...
CL OL
1 ---
1 t[
Y
,--v i",--v ",--v I'LL
0
) ()
V 03 V O2 V 01 Do
y -
03 0 3 O2 O2 01 0 1 00 00
EL
- A A
,
351
352 CHAPTER TEN Introduction to Counters, Registers, and R TL
r-ti!
I
AL 1
o _---J. I
l l
~I-,:--:--i-+I-t-I- ' - - - l - - - - -
I I I I I
1 I I I I I
A
o n~~:~~~l-~:~-7_------
I
I I. : :
BL
o-----~r-il~~~:--L:~--+_--------
I : I I
B _
o _______~H I: ! ~~I~I--lro---+-------
I I I
CL
~----------~r-1l~I~l~-~------
1
I I
,I
I
C
o n~~:~--~-----
I I
! !
DL
o------------~~~--~---- I I
I I
o
o--------------~n~--~------ I
I I
1
EL o Il~ _____
10.13 Summary 353
A B C CL o OL EL
, "r r-
L L
l ~ A A A A
- 0 5 PR 05 . D4 PR 0 4 0 3 PR 0 3 O2PR O2 0, PR 0, Do PR 0 0 f
-:.cIo '.
"
,-,t '
~ > ClR Q5 rc I> ClR04 rC :> ClR 03 rC > ClR 02 -<: :> ClR 01 r<: > ClR Oo
~ (
System
clock I
ClEAR-
'"
V~
10.13 Summary
In covering the application of what is known as the traditional
sequential machines, our studies moved through synchronous and
asynchronous counters; serial, parallel, and mixed-mode registers;
and operation sequencers. An understanding of these functional
units was subsequently applied to the development ofRTL (register
354 CHAnER TEN Introduction to Counters, Registers, and RTL
Problems
1. Determine the state diagram of the three-bit programmed
counter whose excitation equations are given as follows:
Dl = Q3Ql + Q2Ql
D2 = Q2(~ + Q3)
D3 = Q3
FIGURE lO.Pl
CLOCK (F) - - - t > i CLOCK (0: 1)
r o
20. Design a two-bit counter that counts up one count at a time
when C = 0 and counts up two counts per clock when C = 1.
356 CHAPTER TEN Introduction to Counters, Registers, and R TL
Q2: A ~A 1\ B P2: A ~A 1\ 13
Q3: A ~A VB P3: A ~A V Ii
Q4: A ~A 1\ B P4 : A ~A 1\ B
Ps: A ~A EB B
26. Describe the function and characteristics of the counter circuit
of Figure 10.P2.
FIGURE lO.P2
J1 01
Kl 01
! 32.
of Example 10.7.
31. Design the complete data and control units for the algorithm
of Problem 25a.
Design the complete data and control units for the algorithm
of Problem 25b. _
Suggested Readings 357
FIGURE lO.P3 +5 V
1kH
,
Die
7
_I
1- ~
... '
• •
1:'.
Hill, F.]., and Peterson, G. R. Digital Logic and Microprocessors. New York:
Wiley, 1984.
Kline, R. Structured Digital Design Including MSI! LSI Components and Micro
processors. Englewood Cliffs, N.J.: Prentice-Hall, 1983.
La, H. Y.; Lu,]. H; and Aoki, Y. "Programmable variable-rate up/down
counter for generating binary logaritluns." lEE Proc. E'J Compo & Dig.
Tech. vol. 131 (1984): 125.
Manning, F. B., and Fenichel, R. R. "Synchronous counters constructed
entirely of J-K flip-flops." IEEE Trans. Compo vol. C-25 (1976): 300.
Rhyne, V. T. "Serial binary-to-decimal and decimal-to-binary conver
sion." IEEE Trans. Compo vol. C-19 (1970): 80B.
Swartzlander, E. E. "Parallel counters." IEEE Trans. Compo vol. C-22
(1973): 1021.
Tien, P. S. "Sequential counter design techniques." Compo Des. vol. 10
(1971): 49.
Vasanthavada, N. S. "Group parity prediction scheme for concurrent test
ing of linear feedback shift registers." Elect. Lett. vol. 21 (1985): 67.
Winkel, n, and Prosser, F. The Art if Digital Design-An Introduction to Top~
Doum Design. Englewood Cliffs, N.J.: Prentice-Hall, 1980.