Fall 2002
ECE 221 Introduction to Digital System Design
[Link]
Prof. F. S. Hill, hill@[Link], KEB 309B 5-0767
Prof. W. Gong, gong@[Link], KEB 211E 5-0384
[Link] 1
ECE 221 Fall 2002
Course Description:
Covers the theory of digital circuits and computer systems stressing
general techniques for the analysis and synthesis of combinational
and sequential logic systems. Limited to EE and CSE majors.
Course Meetings:
Lectures: M,W,F 8:00 – 8:50 MARCUS AUDITORIUM (McLaughlin)
Discussion: W 5:00 – 5:50 PM GSMN 64 (Gong)
Textbook:
Ronald J. Tocci and Neal S. Widmer, Digital Systems - Principles and
Applications, 8th edition, Prentice Hall, 2001
[Link] 2
ECE 221 Fall 2002
Exams: There will be 2 midterm quizzes given during the semester in
addition to a comprehensive final exam at the end of the term. Each quiz
will constitute 20% of the course grade, and the final exam will constitute
30% of the grade. Dates and formats for these tests will be provided once
the term is underway.
Homework: Homework will be assigned weekly. Problem sets will
be due in class one week after they are assigned. Late homework will be
accepted, with penalty, until the time the solutions are posted to this
website. No homeworks will be accepted once the solutions are posted.
Homeworks will constitute 10% of the course grade.
Project: A design project will be assigned that will constitute 20% of
the course grade. Details will be provided once the term is underway.
[Link] 3
ECE 221 Fall 2002
Text Coverage
• Ch1 Introductory Concept
• Ch2 Number Systems and Codes
• Ch3 Logic Gates and Boolean Algebra
• Ch4 Combinatorial Logic
• Ch5 Sequential Logic
• Ch6 Digital Arithmetic
• Ch7 Counters and Registers
• Ch9 MSI Logic Circuits
• Ch10 Interfacing with the Analog World (Time
Permitting)
• Ch11 Memory Devices
[Link] 4
ECE 221 Fall 2002
Announcements
• Check the web site.
• No discussion session tonight (9/5/01).
• Read chapters 1 & 2.
• Homework #1 is posted. Due Friday
9/13/01.
[Link] 5
ECE 221 Fall 2002
Ch2 Number systems and codes
Octal(base 8)
Decimal(base 10) Binary(base 2)
Hexadecimal
(base16)
[Link] 6
ECE 221 Fall 2002
Examples
• Decimal numbers(base 10)
36.210 9810
• Hexadecimal number(base 16)
3F216
• Binary number(base 2)
10112
[Link] 7
ECE 221 Fall 2002
Positional system
• Each digit carries a certain weight based on its
position.
346.17463.71 Position matters
Weight vs Position
[Link] 8
ECE 221 Fall 2002
Decimal Positional System
(Base 10 or radix 10)
decimal point
… 104 103 102 101 100 . 10-1 10-2 …
tenths position
ones position
tens position
hundreds position hundredth position
[Link] 9
ECE 221 Fall 2002
Binary Positional System
(Base 2 or radix 2)
binary point
… 24 23 22 21 20 . 2-1 2-2 …
halves position
ones position
twos position quarters position
fours position
[Link] 10
ECE 221 Fall 2002
Example
Decimal Example
346.1710 (3 102 ) (4 101 ) (6 100 ) (1 101 ) (7 102 )
300 40 6 0.1 0.07
Binary Example
1101 .012 1 23 1 2 2 0 21 1 20 0 2 1 1 2 2
8 4 0 1 0 .25
13.2510
[Link] 11
ECE 221 Fall 2002
Binary to Decimal Conversion
• What is 1101012 in decimal?
1101012 1 25 1 2 4 0 23 1 2 2 0 21 1 20
32 16 0 4 0 1
5310
[Link] 12
ECE 221 Fall 2002
n 2n n 2n
0 20=1 8 28=256
1 21=1 9 29=512
2 22=4 10 210=1024
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M
6 26=64 30 230=1G
7 27=128
[Link] 13
ECE 221 Fall 2002
Decimal-To-Binary
Conversions(method 1)
• The decimal number is simply expressed as a sum of
powers of 2, and then 1s and 0s are written in the
appropriate bit positions.
5010 32 18 34610 256 90
256 64 26
32 16 2 256 64 16 10
256 64 16 8 2
1 25 1 2 4 1 21
1 28 1 26 1 2 4 1 23 1 21
5010 110010 2 34610 1010110102
[Link] 14
ECE 221 Fall 2002
(Method 2)Flowchart for Repeated Division
[Link] 15
ECE 221 Fall 2002
Example for Repeated Division
quotient remainder
50/2 = 25 0 LSB
25/2 = 12 1
12/2 = 6 0
6/2 = 3 0
3/2 = 1 1
1/2 = 0 1 MSB
5010=1100102
[Link] 16
ECE 221 Fall 2002
Example for Repeated Division
quotient remainder
346/2 173 0
173/2 86 1
86/2 43 0
43/2 21 1
21/2 10 1
10/2 5 0
5/2 2 1
2/2 1 0
1/2 0 1
[Link] 17
34610=1010110102 ECE 221 Fall 2002
How many different values can we represent with N
binary digits? Decimal digits? Octal digits? Radix Z
digits?
•Decimal: 1 digit 0-9 10 different values
2 digits 10X10=100 different values
.. 6 digits 106=1,000,000 different values
•Binary: 1 digit 0,1 2 different values=21
2 digits 00,01,10,11 4 different values=22
n digits 2n different values
•Radix Z digits: n digits Zn different values(0 thru. Zn-1)
[Link] 18
ECE 221 Fall 2002
Octal-to-Decimal Conversion
• Octal-to-Decimal Conversion
372 3 (82 ) 7 (81) 2 (80 )
8
3 64 7 8 2 1
250
10
24.6 2 (81) 4 (80 ) 6 (8 1)
8
20.75
10
[Link] 19
ECE 221 Fall 2002
Decimal-to-Octal Conversion
• Convert 26610 to Octal
quotient remainder
266/8 = 33 2 LSB
33/8 = 4 1
4/8 = 0 4 MSB
26610=4128
[Link] 20
ECE 221 Fall 2002
Octal-to-Binary Conversion
• Convert 4728 to binary
4 7 2
100 111 010
• Convert 54318 to binary
5 4 3 1
101 100 011 001
[Link] 21
ECE 221 Fall 2002
Binary-to-Octal Conversion
• Convert 1001110102 to octal
1 0 0 1 1 1 0 1 0
4 7 28
• Convert 110101102 to octal
0 1 1 0 1 0 1 1 0
3 2 68
[Link] 22
ECE 221 Fall 2002
Octal-to-hex Conversion
• Convert B2F16 to octal
B2F16=1011 0010 1111 {convert to binary}
=101 100 101 111 {group into three-bit groupings}
= 5 4 5 78 {Convert to octal}
[Link] 23
ECE 221 Fall 2002
2-5 BCD Code
• If each digit of a decimal number is represented by
its binary equivalent, the result is a code called
binary-code-decimal(BCD).
8 7 4 (decimal)
1000 0111 0100 (BCD)
9 4 3 (decimal)
1001 0100 0011 (BCD)
[Link] 24
ECE 221 Fall 2002
Example
• Convert 0110100000111001(BCD) to its decimal
equivalent.
• Convert the BCD number 011111000001 to its decimal
equivalent.
[Link] 25
ECE 221 Fall 2002
Comparison of BCD and Binary
• A straight binary code takes the complete decimal
number and represents it in binary.
• A BCD code converts each decimal digit to binary
individually.
13710=100010012 (binary)
13710=0001 0011 0111 (BCD)
• BCD uses more bits, easier to convert to and from
decimal.
[Link] 26
ECE 221 Fall 2002
Review Questions
• Represent the decimal value 178 by its straight
binary equivalent. Then encode the same decimal
number using BCD.
• How many bits are required to represent an eight-
digit decimal number in BCD?
• What is an advantage of encoding a decimal number in
BCD as compared with straight binary? What is a
disadvantage?
[Link] 27
ECE 221 Fall 2002
2-6 Putting it ALL
together(TBA)
[Link] 28
ECE 221 Fall 2002
2-7 The byte
• A string of 8 bits is called a byte.
• How many bytes are in a 32-bit string?
• What is the largest decimal value that can be
represented in binary using two bytes?
• How many bytes are needed to represent the decimal
value 846,569 in BCD?
[Link] 29
ECE 221 Fall 2002
Review Questions
• How many bytes are needed to represent 23510 in
binary?
• What is the largest decimal value that can be
represented in BCD using two bytes?
[Link] 30
ECE 221 Fall 2002
2-8 Alphanumeric Codes
• Codes representing letters of the alphabet,
punctuation marks, and other special characters as
well as numbers are called alphanumeric codes.
• The most widely used alphanumeric code is the
American Standard Code for Information
Interchange(ASCII). The ASCII(pronounced “askee”)
code is a seven-bit code.
[Link] 31
ECE 221 Fall 2002
Partial listing of ASCII code
[Link] 32
ECE 221 Fall 2002
Example
• The following is a message encoded in ASCII code.
What is the message?
1001000 1000101 1001100 1010000
• An operator is typing in a JAVA program at the
keyboard of a certain microcomputer. The computer
converts each keystroke into its ASCII code and
stores the code as a byte in memory. Determine the
binary strings that will be entered into memory when
the operator types in the following JAVA statement.
import [Link].*
[Link] 33
ECE 221 Fall 2002
Review Questions
• Encode the following message in ASCII code using the
hex representation: “COST=$72.”
• The following padded ASCII-coded message is stored
in successive memory location in a computer:
01010011 01010100 01001111 01010000
What is the message?
[Link] 34
ECE 221 Fall 2002
2-9 Parity method for error
detection
Whenever information is transmitted from one device to another device, there is
a possibility that errors can occur such that the receiver does not receive the
identical information that was sent by the transmitter.
[Link] 35
ECE 221 Fall 2002
Parity Bit
• A parity bit is an extra bit that is attached to a code
group that is being transferred from one location to
another.
• Even-parity
– The value of the parity bit is chosen so that the total
number of 1s in the code group(including the parity bit)
is an even number.
1 1 0 0 0 0 1 1
Added parity bit
• Odd-parity
– The parity bit is chosen so that the total number of
1s(including the parity bit) is an odd number.
• The parity bit is issued to detect any single-bit errors
during the transmission of a code from one location to
another.
[Link] 36
ECE 221 Fall 2002
Example
• Computers often communicate with other remote
computers over the telephone lines. For example,
this is how some communication over the internet
takes place. When one computer is transmitting a
message to another, the information is usually
encoded in [Link] actual bit strings would a
computer transmit to send the message HELLO, using
ASCII with even parity?
[Link] 37
ECE 221 Fall 2002
Review Questions
• Attach an odd-parity bit to the ASCII code for the $
symbol, and express the result in hexadecimal.
• Attach an even-parity bit to the BCD code for
decimal 69.
• Why can’t the parity method detect a double error in
transmitted data?
[Link] 38
ECE 221 Fall 2002
2-10 Applications
• A typical CD-ROM can store 650 megabytes of digital
data. Since mega=220, how many bits of data can a CD-
ROM hold?
• An automotive parts shop uses a computer to store
all of its parts numbers in 7-bit ASCII code with an
odd parity bit. The codes for each part are stored
in successive memory locations. List the binary
contents of memory that stores the part number JR2-
5.
• A small process-control computer uses octal codes to
represent its 12-bit memory addresses.
– How many octal digits are required?
– What is the range of addresses in octal?
– How many memory locations are there?
[Link] 39
ECE 221 Fall 2002
Applications(cont.)
• A typical PC uses a 20-bit address code for its
memory locations.
– How many hex digits are needed to represent a
memory address?
– What is the range of addresses?
– What is the total number of memory locations?
• Most calculators use BCD to store the decimal values
as they are entered into the keyboard and to drive
the digit displays.
– If a calculator is designed to handle 8-digit
decimal numbers, how many bits does this require?
– What bits are stored when the number 375 is
entered into the calculator?
[Link] 40
ECE 221 Fall 2002
Summary
• The octal and hexadecimal number systems are used in
digital systems and computers as efficient ways of
representing binary quantities.
• In conversion between octal and binary, one octal
digit corresponds to three bits. In conversions
between hex and binary, each hex digit corresponds
to four bits.
• The repeated-division method is used to convert
decimal numbers to binary, octal or hexadecimal.
• Using an N-bit binary number, we can represent
decimal values from 0 to 2N-1.
• The BCD code for a decimal number is formed by
converting each digit of the decimal number to its
four-bit binary equivalent.
[Link] 41
ECE 221 Fall 2002
Summary(cont.)
• A byte is a string of eight bits.
• An alphanumeric code is one that uses groups of bits
to represent all of the various characters and
functions that are part of a typical computer’s
keyboard. The ASCII code is the most widely used
alphanumeric code.
• The parity method for error detection attaches a
special parity bit to each transmitted group of
bits.
[Link] 42
ECE 221 Fall 2002