Lecture D01
Digital Systems: Bits, Bytes and Codes (Part 1)
(Sections 7.1 7.3 in Brockman, Chapters 1 and 2 in ESD 2 text)
Outline
Digital Systems
Analog and Digital
Charles Babbage
Analog Computers
The Dick Smith VZ 200 comes complete with 8K RAM (2K for screen, 6K for user
programs) which can be expanded up to 24K bytes. The 16K RAM has a built-in Basic
Interpreter and operating system. Because no computer system is complete without
some form of data or program storage, also included with the computer is an
interconnection lead for a cassette recorder.
The system can be easily expanded by adding plug-in modules, for instance a 16K
expansion RAM module.
Engineering Systems Design
Figure 7-7
Jay B. Brockman
Introduction to Engineering
Mobile Phone
Speech coding,
error control coding,
modulation
Voice
Microphone
A/D
converter
D/A
converter
Digital
processing
Antenna
10
Transmitted
signal
11
Figure 1-7
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
12
Digital Circuits
Digital circuits are designed to:
Accept input voltages that are within the defined 0 and 1 ranges
Process the input signals in a predictable way
Produce output voltages that fall within the prescribed 0 and 1 ranges
Analog devices and systems process time varying signals that can take
on any value across a continuous range so do digital circuits and
systems; the difference is that we can pretend that they dont!
Wakerly, Chapter 1
This module is an introduction to the analysis design of digital circuits
from the logical perspective.
Engineering Systems Design
13
Figure 7-8
Jay B. Brockman
Introduction to Engineering
14
15
Next Lecture
Digital Systems: Bits, Bytes and Codes (Part 2)
Analog-to-digital conversion
Positional number systems
Decimal and binary numbers
Octal and hexadecimal numbers
Conversion from decimal
Reading:
Lecture D02 overheads
Chapters 1 and 2 in ESD 2 text
16
Outline
Analog-to-digital conversion
Positional number systems
Getting to Binary
Digital systems are built from circuits that process binary digits however binary digits are not usually the things we deal with in the
real world.
How can we represent real world audio, video, numbers, letters and
other things of interest by 0s and 1s?
Analog-to-Digital Conversion
The process of converting an analog waveform into a sequence of 0s
and 1s is called analog-to-digital conversion
The basic operations required are sampling and quantization
First we must sample the analog signal periodically at a rate fast
enough so that we do not lose (much) information (we need to sample
faster than the signal varies)
Analog-to-Digital Conversion
Second we must quantise the sampled values meaning we map the
actual sampled value to the nearest of a finite number of levels.
Each of these levels is then mapped to a unique bit string.
The resultant bit-rate is the product of the sample rate (samples per
second) and the number of bits per sample used in quantisation
(ceiling of base-2 logarithm of the number of quantisation levels)
Example
An audio signal is sampled at a rate of 44,100 samples per second and
quantised to one of 256 quantisation levels. How much memory is
required to store the Metallica song One which is 7 minutes and 26
seconds long? (Assume there is no other processing of the digital data.)
Decimal Numbers
Composed of 10 numerals or symbols (base-10)
Figure 1-2
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Binary Numbers
Only two symbols (0 and 1) (base-2)
Most important for implementing digital systems
Figure 1-4
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Example
(a) Convert the binary number 110101.101 to decimal.
(b) What is the biggest n-bit binary number? Write the number in
binary and in decimal.
10
Octal Numbers
Base-8 system using decimal digits 0 to 7
Convenient system for representing multibit (binary) numbers
Example: Convert the octal number 314.15 to decimal.
11
Hexadecimal Numbers
Base-16 system using decimal digits 0 to 9 plus letters A to F
Another convenient system for representing multibit numbers
Example: Convert the hexadecimal number 2BAD to decimal.
12
13
Next Lecture
Digital Systems: Bits, Bytes and Codes (Part 3)
Binary-Coded-Decimal (BCD)
Alphanumeric codes
Source coding and data compression
Error control coding
Reading:
Lecture D03 overheads
14
Outline
Binary-Coded-Decimal (BCD)
Alphanumeric codes
Binary-Coded-Decimal
A set of bit strings in which each string represents a different
number or letter or other thing is called a code.
In the BCD code for decimal numbers, each digit of the decimal
number is coded in binary.
Example: Show how 94310 is coded using BCD
9
1001
0100
0011 (BCD)
Summary
Decimal
Binary
Octal
Hexadecimal
BCD
0000
0001
10
0010
11
0011
100
0100
101
0101
110
0110
111
0111
1000
10
1000
1001
11
1001
10
1010
12
0001 0000
11
1011
13
0001 0001
12
1100
14
0001 0010
13
1101
15
0001 0011
14
1110
16
0001 0100
15
1111
17
0001 0101
Alphanumeric Codes
Most information processed by computers is nonnumeric.
Text (strings of characters from some character set) is very
common e.g. keyboard.
ASCII (American Standard Code for Information Interchange)
is a 7-bit alphanumeric code for 128 different characters
Table 2-4
Tocci, Widmer and Moss
Digital Systems, Ninth Edition
Example
The Mars Phoenix Lander announced the
end of its five-month mission with a cryptic
message on Twitter, sparking a wave of
heartfelt replies written in computer
language. 01010100 01110010 01101001
01110101 01101101 01110000 01101000
read the final post on the MarsPhoenix
Twitter account.
It is believed Phoenix is now frozen somewhere near the north pole of
Mars without enough sunlight to power itself.
What was the last message sent by the Mars Phoenix Lander?
Example
A source of data produces five different characters which we label a, b,
c, d and e. The relative frequency of occurrence of these characters is
0.5, 0.3, 0.1, 0.05 and 0.05 respectively.
(a) Design a fixed-length code for these characters.
(b) Design a variable-length code for these characters that requires
a lower average number of bits per symbol than the fixed-length
code. Be careful to check that you variable length code can be
decoded.
10
Example
Suppose that we have four information bits to which we add a single
check bit so that the total number of 1s in the codeword is even.
(a) What are the check bits corresponding to the information bits
0110 and 1011?
11
12
Next Lecture
Digital Systems: Truth Tables, Logic Gates and
Boolean Algebra (Part 1)
Truth tables
Logic gates
Simple logic circuits
Reading:
Lecture D04 overheads
Section 7.3 in Brockman
Sections 3.1 3.8 in ESD 2 text
13
Outline
Boolean constants and variables
Truth tables
Logic gates (OR, AND, NOT)
Describing logic circuits
Implementing Boolean expressions
Truth Tables
A truth table describes how the output of a digital
circuit depends on its inputs.
Figure 3-1
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Challenge
Work out how many different 3-input, 1-output Boolean
functions (truth tables) there are.
OR Operation
x = A + B ( A OR B )
Figure 3-2
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Three-Input OR Gate
Figure 3-3
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Exercise
Sketch a circuit to implement a 4-input OR gate using only
2-input OR gates.
Figure 3-4
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
10
AND Operation
x = A B ( A AND B )
Figure 3-7
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
11
Figure 3-8
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
12
NOT Operation
x A
or x A
Figure 3-11
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
13
14
Figure 3-15
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
15
Example
Evaluate the output of circuit (b) on the previous slide
when the inputs are:
A = 1, B = 1, C = 0, D = 1 and E = 0.
16
y AC BC A BC
17
Next Lecture
Digital Systems: Truth Tables, Logic Gates and
Boolean Algebra (Part 2)
Boolean algebra and DeMorgans theorems
NOR gates and NAND gates
Reading:
Lecture D05 overheads
Section 7.3 in Brockman
Section 3.9 3.13 in ESD 2 text
18
Outline
Boolean theorems
DeMorgans theorems
Simplifying logic circuits
NOR gates and NAND gates
Boolean Theorems
Single Variable Theorems
(1) x . 0 = 0
(5) x + 0 = x
(2) x . 1 = x
(6) x + 1 = 1
(3) x . x = x
(7) x + x = x
(4) x . x = 0
(8) x + x = 1
(9) x = x
Boolean Theorems
Multivariable Theorems
(10)
x+y = y+x
commutative
(11)
xy = yx
(12)
x + (y + z) = (x + y)+ z = x + y + z
(13)
x (y z) = (x y) z = x y z
(14)
x (y + z) = x y + x z
(15)
x + (y z) = (x + y)(x + z)
(16)
x+xy = x
(17)
x+xy=x+y
associative
distributive
X+(YZ)=(X+Y)(X+Z)
Example
Simplify
z ( A B) ( A B)
DeMorgans Theorems
(18)
(x y )
(19)
(x y )
x y
x y
Example
Simplify
( )
z A BC A B AC
Principle of Duality
Any theorem or identity in switching (Boolean) algebra
remains true if 0 and 1 are swapped and and + are
swapped throughout.
10
NOR Operation
x A B
( A NOR B )
Figure 3-19
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
11
NAND Operation
x A B
( A NAND B )
Figure 3-22
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
12
inverters
Engineering Systems Design
Figure 3-29
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
13
14
Next Lecture
Digital Systems: Combinational Logic Design (Part 1)
Simplifying Logic Circuits
Designing Combinational Logic Circuits
Karnaugh Map Method
Reading:
Lecture D06 overheads
Sections 4.1 4.5 of ESD 2 text
15
Outline
Simplifying Logic Circuits
Sum-of-Products Form
Algebraic Simplification
Designing Combinational Logic Circuits
Karnaugh Map Method
Figure 4-1
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Sum-of-Products Form
Examples:
ABC A BC
AB A BC C D D
A B CD EF GK HL
Algebraic Simplification
Key Steps:
Obtain the sum-of-products form
Exercise: Simplify ( A B) ( A B D) D
5. Implement circuit
Design Example
Circuits to add binary numbers are at the heart of almost
all digital systems from the processor in the bionic ear to
the communications algorithms in your mobile phone.
A basic component in binary adders is the circuit that
adds three bits A, B and C. The output of the circuit is the
2-bit sum which tells us how many of the input bits are 1.
Design a logic circuit X = F(A, B, C) where the output is
the most significant bit of the two-bit sum of A, B and C.
Design Example
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
X
0
0
0
1
0
1
1
1
Truth Table
ABC
ABC
ABC
ABC
Output Expression
(SOP Form)
Design Example
Algebraic simplification of output expression
Design Example
Implement the circuit for the final expression
Figure 4-7
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
10
Karnaugh Maps
A Karnaugh map (abbreviated K-map) is an alternative,
more compact representation of the truth table of a logic
circuit.
Gives mechanical method for doing algebraic
simplification on complementary product terms such as
ABC ABC AB
In theory, K-map method applies to logic circuits with any
number of input variables, but working by hand (without
computer), limit to 6.
Engineering Systems Design
11
Karnaugh Maps
For design example, there are 3
input variables A,B,C and the K-map
has 8 = 23 cells, with rows and
columns labelled in very specific
order.
AB
AB
AB
AB
12
Karnaugh Maps
The labelling of rows and columns is
quite specific: each cell corresponds to
an input combination that differs from
each of its immediately adjacent
neighbours in exactly one variable
(including wraparound neighbours).
13
AB
AB
AB
AB
Next Lecture
Digital Systems: Combinational Logic Design (Part 2)
Karnaugh maps (continued)
Design example
Reading:
Lecture D07 overheads
Sections 4.5 in ESD 2 text
14
Outline
Karnaugh Maps (continued)
Looping pairs
Looping quads
Looping octets
Dont care conditions
Design Example
2-bit comparator circuit
Karnaugh Maps
A Karnaugh map (abbreviated K-map) is an alternative,
more compact representation of the truth table of a logic
circuit.
Gives mechanical method for doing algebraic
simplification on complementary product terms such as
ABC ABC AB
In theory, K-map method applies to logic circuits with any
number of input variables, but working by hand (without
computer), limit to 6.
Engineering Systems Design
Looping Pairs
C C
AB 0 0
C C
AB 0 0
C C
AB 1 0
AB 1
AB 1
AB 0
AB 1
AB 0
AB 0
AB 0
AB 0
AB 1
x ABC AB C
BC
x ABC ABC
x A BC A BC
BC
AB
C D CD CD C D
AB 0 0 1 1
AB 0
AB 0
AB 1
x ABCD ABC D
ABC D ABC D
ABC AB D
Looping Quads
C C
AB 0 1
C D CD CD C D
AB 0 0 0 0
AB 0
AB 0
AB 0
AB 1
AB 0
AB 0
xC
x AB
C D CD CD C D
AB 0 0 0 0
1
AB 0
AB 0
AB 0
x BD
Looping Quads
C D CD CD C D
AB 0 0 0 0
AB 0
AB 1
AB 1
C D CD CD C D
AB 1 0 0 1
0
AB 0
AB 0
AB 1
x AD
x BD
Figure 4-13 (d), (e)
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Looping Octets
C D CD CD C D
AB 0 0 0 0
AB 1
AB 1
AB 0
C D CD CD C D
AB 1 1 0 0
1
AB 1
AB 1
AB 1
xB
xC
Figure 4-14 (a), (b)
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Examples
Simplify the functions X = F(A,B,C) and Y = G(A,B,C,D)
with K-maps as shown
C C
AB 0 1
C D CD CD C D
AB 0 1 1 0
AB 1
AB 0
AB 0
AB 1
AB 0
AB 1
10
11
C C
C C
AB
AB
AB
AB
AB
AB
AB
AB
zA
12
Design Example
Problem Specification
An important building block in digital systems is a
comparator, something that compares the magnitude
of two binary numbers.
Design a combinational circuit that takes two 2-bit
binary numbers y1 y0 and x1 x0 as inputs and that
outputs 1 if an only if y1 y0 is greater than x1 x0 .
13
Design Example
Truth Table
14
Design Example
Simplify using Karnaugh Map
15
Next Lecture
Digital Systems: Tradeoffs, Modularity and PLDs (Part 1)
Binary Adders
Reading:
Lecture D08 overheads
16
Outline
Binary addition
Ripple-carry adder
Full adder circuit
Carry propagation
Binary Addition
Circuits to add two n-bit binary numbers are central to almost all
digital systems from computers (in the arithmetic-logic unit or ALU),
to MP3 players and to the speech processor in your mobile phone.
We cannot use the design approach from Lectures D06 and D07 to
design a circuit to add two 16-bit numbers. The circuit would have
32 inputs and 17 outputs and the truth table would have more than
4.2 billion rows!
We need to look for structure in the problem and break the design
down into smaller, more manageable chunks.
Binary Addition
Lets start by looking at the way that we add numbers by hand.
Add the following 8-bit binary numbers:
10110011
01011111
(You can check your answer by converting the two binary
numbers and their binary sum to decimal.)
Binary Addition
Figure 6-4
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Ripple-Carry Adder
Figure 6-5
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Figure 6-6
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Exercise
Derive expressions for S in sum-of-products form and
then in terms of XOR operations.
Exercise
Derive an expression for COUT in sum-of-products form.
(See also Lecture D06)
Figure 6-7
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
10
Figure 6-5
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
11
Carry Propagation
In an n-bit adder, the most significant bit will not reach its final value
until after n full-adder propagation delays.
12
Next Lecture
Digital Circuits: Tradeoffs, Modularity and PLDs (Part 2)
Binary Comparators
Reading:
Lecture D09 overheads
13
Outline
Comparators
Design of 4-bit Comparator
Cascading Inputs
Comparators
Another important operation in digital systems is that of comparing
two n-bit binary numbers to see which is bigger.
Comparators are used anytime a system uses thresholds to trigger
events e.g. shut off the central heating if the temperature rises
above the set point or increase the dosage of a drug if a patients
blood sugar level drops below a certain point.
Again the task of designing a circuit to compare two 16-bit binary
numbers must be attacked by looking for structure and breaking the
problem down into byte-sized chunks (pun intended).
Cascading Inputs
With slight modification, the 4-bit comparator we just designed
could be used as a building block for bigger comparators
For example, a 16-bit comparator could be built using four 4-bit
comparators
Cascading Inputs
Cascading Inputs
10
Next Lecture
Digital Circuits: Tradeoffs, Modularity and PLDs (Part 2)
Programmable logic devices
Reading:
Lecture D10 overheads
11
Outline
Programmable Logic Devices
Altera development board
Summary
Example of a PLD
Figure 12-1
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
O1 =
O2 =
O3 =
O4 =
Figure 12-2
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
inputs
hard-wired
OR array
programmable
AND array
outputs
Figure 12-4
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
Figure 12-30
Ronald J. Tocci and Neal S. Widmer
Digital Systems, Eighth Edition
10
11