Tutorial 1
Tutorial 1
x 0 1 1 0 0
y 0 0 1 1 0
AND: x ? y 0 0 1 0 0
OR: x 1 y 0 1 1 1 0
NOT: x9 1 0 0 1 1
FIGURE 1.5
Input–output signals for gates
A
A F 5 ABC B G5A1B1C1D
B
C C
D
(a) Three-input AND gate (b) Four-input OR gate
FIGURE 1.6
Gates with multiple inputs
instantaneously. The low level represents logic 0 and the high level logic 1. The AND
gate responds with a logic 1 output signal when both input signals are logic 1. The OR
gate responds with a logic 1 output signal if any input signal is logic 1. The NOT gate
is commonly referred to as an inverter. The reason for this name is apparent from the
signal response in the timing diagram, which shows that the output signal inverts the
logic sense of the input signal.
AND and OR gates may have more than two inputs. An AND gate with three inputs
and an OR gate with four inputs are shown in Fig. 1.6. The three-input AND gate
responds with logic 1 output if all three inputs are logic 1. The output produces logic 0
if any input is logic 0. The four-input OR gate responds with logic 1 if any input is logic
1; its output becomes logic 0 only when all inputs are logic 0.
PROBLEMS
(Answers to problems marked with * appear at the end of the text.)
1.1 List the octal and hexadecimal numbers from 5010 to 6410. Using A, B,C, and D for the last
four digits, list the numbers from 1110 to 3010 in base 14.
1.2* What is the exact number of bytes in a system that contains (a) 16K bytes, (b) 32M bytes,
and (c) 2G bytes?
1.3 Convert the following numbers with the indicated bases to decimal:
(a)* (1203)4 (b)* (5243)6
(c) (9922)14 (d) (248)9
54 Chapter 1 Digital Systems and Binary Numbers
1.4 What is the largest binary number that can be expressed with 12 bits? What are the equiva-
lent decimal, octal, and hexadecimal numbers?
1.5* Determine the base of the numbers in each case for the following operations to be correct:
(a) 67/5 = 11 (b) 15 * 3 = 51 (c) 123 + 120 = 303.
1.6* The solutions to the quadratic equation x 2 - 13x + 22 = 0 are x = 7 and x = 2. What is
the base of the numbers?
1.7* Convert the hexadecimal number CA5E to binary, and then convert it from binary to octal.
1.8 Convert the decimal number 253 to binary in two ways: (a) convert directly to binary;
(b) convert first to hexadecimal and then from hexadecimal to binary. Which method is
faster?
1.9 Express the following numbers in decimal:
(a)* (10101.101)2 (b)* (64.8)16
(c)* (261.44)8 (d) (51DE.C)16
(e) (110011.001)2
1.10 Convert the following binary numbers to hexadecimal and to decimal: (a) 1.00011,
(b) 1000.11. Explain why the decimal answer in (b) is eight times that in (a).
1.11 Perform the following division in binary: 101010 , 100.
1.12* Add and multiply the following numbers without converting them to decimal:
(a) Binary numbers 1101 and 110.
(b) Hexadecimal numbers D0 and 1F.
1.13 Perform the following conversion problems:
(a) Convert decimal 45.125 to binary.
(b) Calculate the binary equivalent of 3.33 out to four places. Then convert from binary
to decimal. Find the error percentage.
(c) Convert the binary result in (b) into hexadecimal. Then convert the result to decimal.
Is the answer the same?
1.14 Obtain the 1’s and 2’s complements of the following binary numbers:
(a) 11100010 (b) 00011000
(c) 10111101 (d) 10100101
(e) 11000011 (f) 01011000
1.15 Find the 9’s and the 10’s complement of the following decimal numbers:
(a) 65,234,035 (b) 56,783,223
(c) 87,000,367 (d) 99,999,000
1.16 (a) Find the 8’s complement of (2360)8.
(b) Convert (2360)8 to binary.
(c) Find the 2’s complement of the result in (b).
(d) Convert the answer in (c) to octal and compare with the answer in (a).
1.17 Perform subtraction on the given unsigned numbers using the 10’s complement of the
subtrahend. Where the result should be negative, find its 10’s complement and affix a minus
sign. Verify your answers.
(a) 7,523 - 4.567 (b) 230 - 1,204
(c) 224 - 712 (d) 2,390 - 945
Problems 55
1.18 Perform subtraction on the given unsigned binary numbers using the 2’s complement of
the subtrahend. Where the result should be negative, find its 2’s complement and affix a
minus sign.
(a) 11001 - 10010 (b) 1100 - 111100
(c) 10101 - 11011 (d) 1100011 - 10001
1.19* The following decimal numbers are shown in signed-magnitude form: + 9,286 and +801.
Convert them to signed-10’s-complement form and perform the following operations
(note that the sum is + 10,627 and requires five digits and a sign).
(a) ( + 9,286) + ( +801) (b) ( + 9,286) + ( - 801)
(c) ( - 9,286) + ( +801) (d) ( -9,286) + ( -801)
1.20 Convert decimal + 49 and +29 to binary, using the signed-2’s-complement representation
and enough digits to accommodate the numbers. Then perform the binary equivalent of
( + 29) + ( - 49), ( - 29) + ( + 49), and ( -29) + ( - 49). Convert the answers back to deci-
mal and verify that they are correct.
1.21 If the numbers ( +9,742)10 and ( +641)10 are in signed-magnitude format, their sum
is ( + 10,383)10 and requires five digits and a sign. Convert the numbers to signed-10’s-
complement form and find the following sums:
(a) ( + 9,742) + ( + 641) (b) ( +9,742) + ( - 641)
(c) ( -9,742) + ( +641) (d) ( -9,742) + ( - 641)
1.22 Convert decimal 9,045 and 337 to both BCD and ASCII codes. For ASCII, an even parity
bit is to be appended at the left.
1.23 Represent the unsigned decimal numbers 609 and 516 in BCD, and then show the steps
necessary to form their sum.
1.24 Formulate a weighted binary code for the decimal digits, using the following weights:
(a)* 5, 2, 1, 1 (b) 6, 3, 2, 1
1.25 Represent the decimal number 6,428 in (a) BCD, (b) excess-3 code, (c) 2421 code, and
(d) 6311 code.
1.26 Find the 9’s complement of the decimal number 6,248 and express it in 2421 code. Show
that the result is the 1’s complement of the answer to (c) in Problem 1.25. This demon-
strates that the 2421 code is self-complementing.
1.27 Assign a binary code in some orderly manner to the 52 playing cards. Use the minimum
number of bits.
1.28 The message “Pass 0.12” is to be sent via communication line. For this, each character of
the message should be encoded into a seven-bit ASCII code including the period and the
space. Each ASCII encoded character should be then encrypted by adding binary 101 to
it. Write the expression for the message sent.
1.29* Decode the following ASCII code:
1000011 0101110 1000010 1000001 1000010 1000010 1000010 1000111 1000101.
1.30 The following is a string of ASCII characters whose bit patterns have been converted into
hexadecimal for compactness: 47 2E 5C 42 CF CF CC C5. Of the eight bits in each pair of
digits, the leftmost is a parity bit. The remaining bits are the ASCII code.
(a) Convert the string to bit form and decode the ASCII.
(b) Determine the parity used: odd or even?
56 Chapter 1 Digital Systems and Binary Numbers
1.31* How many printing characters are there in ASCII? How many of them are special char-
acters (not letters or numerals)?
1.32* What bit must be complemented to change an ASCII letter from capital to lowercase and
vice versa?
1.33* The state of a 16-bit register is 1000011101011001. What is its content if it represents
(a) Four decimal digits in BCD?
(b) Four decimal digits in the excess-3 code?
(c) Four hexadecimal digits in the Gray code?
(d) Two ASCII characters with even parity bit as the left-most bit in each byte?
1.34 (a) List the ASCII code for the 10 decimal digits with an even parity bit in the leftmost
position.
(b) Repeat (a) with odd parity.
REFERENCES
1. Cavanagh, J. J. 1984. Digital Computer Arithmetic. New York: McGraw-Hill.
2. Mano, M. M. 1988. Computer Engineering: Hardware Design. Englewood Cliffs, NJ: Pren-
tice-Hall.
3. Nelson, V. P., H. T. Nagle, J. D. Irwin, and B. D. Carroll. 1997. Digital Logic Circuit
Analysis and Design. Upper Saddle River, NJ: Prentice Hall.
4. Schmid, H. 1974. Decimal Computation. New York: John Wiley.
5. Katz, R. H. and Borriello, G. 2004. Contemporary Logic Design, 2nd ed., Upper Saddle
River, NJ: Prentice-Hall.
Some CAD systems include an editing program for creating and modifying schematic
diagrams on a computer screen. This process is called schematic capture or schematic
entry. With the aid of menus, keyboard commands, and a mouse, a schematic editor can
draw circuit diagrams of digital circuits on the computer screen. Components can be
placed on the screen from a list in an internal library and can then be connected with
lines that represent wires. The schematic entry software creates and manages a database
containing the information produced with the schematic. Primitive gates and functional
blocks have associated models that allow the functionality (i.e., logical behavior) and
timing of the circuit to be verified. Verification is performed by applying inputs to the
circuit and using a logic simulator to determine and display the outputs in text or wave-
form format.
An important development in the design of digital systems is the use of a hardware
description language (HDL). Such a language resembles a computer programming
language, but is specifically oriented to describing digital hardware. It represents logic
diagrams and other digital information in textual form to describe the functionality
and structure of a circuit. Moreover, the HDL description of a circuit’s functionality
can be abstract, without reference to specific hardware, thereby freeing a designer to
devote attention to higher level functional detail (e.g., under certain conditions the cir-
cuit must detect a particular pattern of 1’s and 0’s in a serial bit stream of data) rather
than transistor-level detail. HDL-based models of a circuit or system are simulated to
check and verify its functionality before it is submitted to fabrication, thereby reducing
the risk and waste of manufacturing a circuit that fails to operate correctly. In tandem
with the emergence of HDL-based design languages, tools have been developed to
automatically and optimally synthesize the logic described by an HDL model of a cir-
cuit. These two advances in technology have led industry to an almost total reliance on
HDL-based synthesis tools and methodologies for the design of the circuits of complex
digital systems. Two HDLs—Verilog and VHDL—are widely used by design teams
throughout the world, and are standards of the Institute of Electrical and Electronics
Engineers (IEEE). Verilog and VHDL are introduced in Section 3.9, and because of
their importance, we include several exercises and design problems based on them
throughout the book. Additionally, we introduce selected features of System Verilog,
an important and more recent language, in Chapter 8. Since Verilog is embedded in
System Verilog we delay our presentation of System Verilog until a foundation has
been laid in Verilog.
PROBLEMS
Answers to problems marked with * appear at the end of the text.
2.1 Demonstrate the validity of the following identities by means of truth tables:
(a) DeMorgan’s theorem for three variables: (x + y + z)′ = x′y′z′ and (xyz)′ = x′ +
y′ + z′
(b) The distributive law: x + yz = (x + y)(x + z)
(c) The distributive law: x(y + z) = xy + xz
Problems 93
F = x′y + xy′ + xz
A B C T1 T2
0 0 0 0 1
0 0 1 1 0
0 1 0 1 1
0 1 1 1 0
1 0 0 0 0
1 0 1 1 1
1 1 0 0 0
1 1 1 1 1
(a) Obtain the truth table of F and represent it as the sum of minterms.
(b) Draw the logic diagram, using the original Boolean expression.
(c)*Use Boolean algebra to simplify the function to a minimum number of literals.
(d) Obtain the function F as the sum of minterms from the simplified expression and
show that it is the same as the one in part (a).
(e) Draw the logic diagram from the simplified expression, and compare the total number
of gates with the diagram of part (b).
2.19* Express the following function as a sum of minterms and as a product of maxterms:
Table P2.27
f1 f2 a b c
1 1 0 0 0
0 1 0 0 1
1 0 0 1 0
1 1 0 1 1
1 0 1 0 0
0 1 1 0 1
1 0 1 1 1
2.28 Write Boolean expressions and construct the truth tables describing the outputs of the
circuits described by the logic diagrams in Fig. P2.28.
a
y1
a
b
b
c
c y
d y2
d
e
e
f
(a) (b)
FIGURE P2.28
96 Chapter 2 Boolean Algebra and Logic Gates
a b c
FIGURE P2.32
2.33 By means of a timing diagram similar to Fig. 1.5, show the signals of the outputs f and g in
Fig. P2.33 as functions of the two inputs a and b. Use all four possible combinations of a
and b.
a b
FIGURE P2.33
REFERENCES
1. Boole, G. 1854. An Investigation of the Laws of Thought. New York: Dover.
2. Dietmeyer, D. L. 1988. Logic Design of Digital Systems, 3rd ed., Boston: Allyn and Bacon.
3. Huntington, E. V. Sets of independent postulates for the algebra of logic. Trans. Am. Math.
Soc., 5 (1904): 288–309.