Digital Circuits
Design
Dr. Omar A. M. Aly
Omar.aly@aun.edu.eg
Introduction
Dr. Omar A. M. Aly
Omar.aly@aun.edu.eg
M. M. Mano, “Digital Design With an Introduction to the Verilog HDL,” 5th Edition,
Pearson Education, 2013.
Outline
Topics to be covered in the course
Grading
Schedule & Instructors
Digital Circuits Design Slide 3
Topics to be covered in the course
Digital Systems and Binary Numbers Chapter 1
Boolean Algebra and Logic Gates Chapter 2
Gate‐Level Minimization Chapter 3
Combinational Logic Chapter 4
Synchronous Sequential Logic Chapter 5
Registers and Counters Chapter 6
Digital Circuits Design Slide 4
Grading
Midterm exam : 25 (50%)
Homework: 5 (10%)
Quiz: 10 (10%)
Attendance: 5 (10%)
Activities: 5 (10%)
Total 50
Digital Circuits Design Slide 5
Chapter 1:
Digital Systems and
Binary Numbers
Dr. Omar A. M. Aly
Omar.aly@aun.edu.eg
M. M. Mano, “Digital Design With an Introduction to the Verilog HDL,” 5th Edition,
Pearson Education, 2013.
Outline
Digital Systems and Computer Systems
Information Representation
Number Systems [binary, octal and hexadecimal]
Arithmetic Operations
Base Conversion
Decimal Codes [BCD (binary coded decimal), parity]
Gray Codes
Alphanumeric Codes
Digital Circuits Design Slide 7
Digital Systems
We live in the digital age. Why?
Digital systems take a set of discrete
information inputs and discrete internal
information (system state) and
generates a set of discrete information
outputs.
The discrete elements are called the
digits
Digital Circuits Design Slide 8
Types of Digital Systems
No state present
Combinational Logic System
Output = Function(Input)
State present
State updated at discrete times
=> Synchronous Sequential System
State updated at any time
=>Asynchronous Sequential System
Digital Circuits Design Slide 9
Examples of Digital Systems
Digital Counter
Digital Circuits Design Slide 10
Examples of Digital Systems
Digital Computer
Digital Circuits Design Slide 11
Signal
An information variable represented by physical quantity.
For digital systems, the variable takes on discrete values.
Two level, or binary values are the most prevalent values in digital systems.
Binary values are represented abstractly by:
o digits 0 and 1
o words (symbols) False (F) and True (T)
o words (symbols) Low (L) and High (H)
o and words On and Off.
Digital Circuits Design Slide 12
Signal
Analog Vs Digital signal (signal over time)
Digital Circuits Design Slide 13
Signal
Binary values are represented by values
or ranges of values of physical quantities
Example for Physical Quantity: Voltage
The HIGH range typically corresponds
to binary 1 and LOW range to binary 0.
The threshold region is a range of
voltages for which the input voltage
value cannot be interpreted reliably as
either a 0 or a 1.
Digital Circuits Design Slide 14
Signal
Digital systems have better immunity to noise than analog systems. Why?
Noise added
Sender Receiver
Signal Signal
Digital Circuits Design Slide 15
Signal
What are other physical quantities represent 0 and 1?
CPU and Logic Gates: Voltage
Disk: Magnetic Field Direction
CD: Surface Pits/Light
Dynamic RAM: Electrical Charge
Digital Circuits Design Slide 16
Number Systems – Representation
Positive radix, positional number systems
A number with radix r is represented by a string of digits:
MSD radix point LSD
An-1An-2 … A1A0 . A-1 A-2 … A-m+1A-m
in which 0 ≤ Ai < r and . is the radix point
The string of digits represents the power series:
Digital Circuits Design Slide 17
Number Systems – Examples
Digital Circuits Design Slide 18
Number Systems
Powers of 2
Digital Circuits Design Slide 19
Converting Binary to Decimal
To convert to decimal, use decimal arithmetic to form
Σ (digit × respective power of 2)
Example: Convert (11010)2 to N10:
Answer: Powers of 2: 43210
(1 1 0 1 0)2
=16 +8 +0 +1 +0=
Digital Circuits Design Slide 20
Other Number Systems
Digital Circuits Design Slide 21
Other Number Systems
Numbers in Different Bases
Digital Circuits Design Slide 22
Conversion Between Bases
Method 2: To convert from one base to another:
1) Convert the integer part
2) Convert the fractional part
3) Join the two results with a radix point
Digital Circuits Design Slide 23
Conversion Between Bases
To Convert the Integer Part:
Repeatedly divide the number by the new radix and save the remainders. The
digits for the new radix are the remainders in reverse order of their
computation. If the new radix is > 10, then convert all remainders > 10 to
digits A, B, …
To Convert the Fractional Part:
Repeatedly multiply the fraction by the new radix and save the integer digits
that result. The digits for the new radix are the integer digits in order of their
computation. If the new radix is > 10, then convert all integers > 10 to digits A,
B, …
Digital Circuits Design Slide 24
Conversion Between Bases
Example1: Convert the integer (46)10 To Base 2
Digital Circuits Design Slide 25
Conversion Between Bases
Example2: Convert the fraction (0.6875)10 To Base 2
Digital Circuits Design Slide 26
Conversion Between Bases
Example 3: Convert (46.6875)10 To Base 2
Digital Circuits Design Slide 27
Conversion Between Bases
Checking the conversion: To convert back, sum the digits times their respective
powers of r.
From the prior conversion of (46.6875)10
(101110)2 = 1*𝟐𝟐𝟓𝟓 + 0 *𝟐𝟐𝟒𝟒 +1 *𝟐𝟐𝟑𝟑 +1 *𝟐𝟐𝟐𝟐 + 1 *𝟐𝟐𝟏𝟏 +0 *𝟐𝟐𝟎𝟎
=1*32 + 0*16 +1*8 +1*4 + 1*2 +0*1
= 32 + 8 + 4 + 2
= 46
(0.1011)2 = 1*𝟐𝟐−𝟏𝟏 + 0 *𝟐𝟐−𝟐𝟐 +1 *𝟐𝟐−𝟑𝟑 +1 *𝟐𝟐−𝟒𝟒
= 1/2 +0 + 1/8 + 1/16
= 0.5000 + 0.1250 + 0.0625
= 0.6875
Digital Circuits Design
Octal And Hexadecimal Numbers
The conversion from and to binary, octal, and hexadecimal plays an
important role in digital computers
Shorter patterns of hex characters are easier to recognize than long
patterns of 1’s and 0’s
Since 23 = 8 and 24 = 16, each octal digit corresponds to three binary digits
and each hexadecimal digit corresponds to four binary digits
Digital Circuits Design Slide 29
Octal & Hexadecimal to Binary and Back
Octal to Binary: Restate the octal as three binary digits starting at the radix
point and going both ways
Hexadecimal to Binary: Restate the Hexadecimal as four binary digits starting
at the radix point and going both ways
Binary to Octal:
o Group the binary digits into three-bit groups starting at the radix point and going both
ways, padding with zeros as needed in the fractional part.
o Convert each group of three bits to an octal digit.
Binary to Hexadecimal:
o Group the binary digits into four-bit groups starting at the radix point and going both
ways, padding with zeros as needed in the fractional part.
o Convert each group of four bits to a Hexadecimal digit.
Digital Circuits Design Slide 30
Octal & Hexadecimal to Binary and Back
Examples
Digital Circuits Design Slide 31
Binary Numbers and Binary Coding
Given n binary digits (called bits), a binary code is a mapping from a set of
represented elements to a subset of the 2n binary numbers.
Example: binary code for the seven
colors of the rainbow
Digital Circuits Design Slide 32
Binary Numbers and Binary Coding
Given M elements to be represented by a binary code, the minimum
number of bits, n, needed, satisfies :
Example: How many bits are required to represent decimal digits with a
binary code?
Digital Circuits Design Slide 33
Binary Codes for Decimal Digits
Digital Circuits Design Slide 34
Binary Numbers and Binary Coding
Binary Coded Decimal (BCD)
The BCD code is the 8,4,2,1 code.
This code is the simplest, most intuitive binary code for decimal digits and
uses the same powers of 2 as a binary number, but only encodes the first
ten values from 0 to 9.
Example: 1001 (9) = 1000 (8) + 0001 (1)
How many “invalid” code words are there?
What are the “invalid” code words?
Digital Circuits Design Slide 35
Binary Numbers and Binary Coding
What is interesting in Excess 3 and 8,4, -1, -2 codes?
Answer: Both codes have the property that the codes for 0 and 9, 1 and 8, etc.
can be obtained from each other by replacing the 0’s with the 1’s and vice-
versa in the code words. Such a code is sometimes called a complement code.
What is interesting in Gray code?
Answer: As we “counts” up or down in decimal, the code word for the Gray
code changes in only one bit position as we go from decimal digit to digit
including from 9 to 0.
Digital Circuits Design Slide 36
Warning: Conversion or Coding?
Do NOT mix up conversion of a decimal number to a binary number with
coding a decimal number with a BINARY CODE.
o1310 = 11012 (This is conversion)
o13 ⇔ 0001 0011 (This is coding)
Digital Circuits Design Slide 37
Binary Arithmetic
Single Bit Addition with Carry
Multiple Bit Addition
BCD Addition
Digital Circuits Design Slide 38
Single Bit Binary Addition with Carry
Given two binary digits (X,Y), a carry in (Z) we get the following sum (S) and
carry (C):
Carry in (Z) of 0: Z 0 0 0 0
X 0 0 1 1
+Y +0 +1 +0 +1
CS 00 01 01 10
Carry in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
+Y +0 +1 +0 +1
CS 01 10 10 11
Digital Circuits Design Slide 39
Multiple Bit Binary Addition
Extending this to two multiple bit examples:
Note: The 0 is the default Carry-In to the least significant bit.
Carries 0 0
01100 10110
+ 10001 +10111
Sum
Digital Circuits Design Slide 40
BCD Addition
Given a BCD code, we use
binary arithmetic to add the
digits.
Note that the result is MORE
THAN 9, so must be
represented by two digits!
To correct the digit, subtract
10 by adding 6 modulo 16.
Digital Circuits Design Slide 41
BCD Addition
Example:
The addition of two n‐digit
unsigned BCD numbers follows
the same procedure
Digital Circuits Design Slide 42
Complements Of Numbers
r complement
r-1 complement
Binary subtraction using complement
Unsigned binary system
Singed binary system
Digital Circuits Design Slide 43
Complements
Two types of complement:
Diminished Radix Complement of N
• (r − 1)’s complement for radix r
• 1’s complement for radix 2
• Defined as (rn − 1) − Ν
Radix Complement
• r’s complement for radix r
• 2’s complement in binary
• Defined as rn − N
Subtraction is done by adding the complement of the subtrahend
If the result is negative, takes its 2’s complement
Digital Circuits Design Slide 44
Binary 1's Complement
For r = 2, N = 011100112, n = 8 (8 digits):
(rn – 1) = 256 -1 = 25510 or 111111112
The 1's complement of 011100112 is then:
11111111
– 01110011
10001100
Since the 2n – 1 factor consists of all 1's and since 1 – 0 = 1 and 1 – 1 = 0, the
one's complement is obtained by complementing each individual bit
(bitwise NOT).
Digital Circuits Design Slide 45
Binary 2's Complement
For r = 2, N = 011100112, n = 8 (8 digits), we have:
(rn ) = (256)10 or (100000000)2
The 2's complement of 01110011 is the
Note the result is the 1's complement plus 1
Digital Circuits Design Slide 46
Subtraction with 2’s Complement
For n-digit, unsigned numbers M and N, find M − N in base 2:
1) Add the 2's complement of the subtrahend N to the minuend M:
M + (2n − N) = M − N + 2n
2) If M > N, the sum produces end carry rn which is discarded; from above, M − N
remains.
3) If M < N, the sum does not produce an end carry and, from above, is equal to
2n − ( N − M ), the 2's complement of ( N − M ). To obtain the result − (N – M) ,
take the 2's complement of the sum and place a − to its left.
Digital Circuits Design Slide 47
Unsigned 2’s Complement Subtraction
Example 1: Find Example 2: Find
010101002 – 010000112 010000112 – 010101002
The carry of 1 indicates that no The carry of 0 indicates that a
correction of the result is required. correction of the result is required.
Result = – (00010001)
Digital Circuits Design Slide 48
Subtraction with Diminished Radix Complement
For n-digit, unsigned numbers M and N, find M − N in base 2:
1) Add the 1's complement of the subtrahend N to the minuend M:
M + (2n − 1 − N) = M − N + 2n − 1
2) If M > N, the result is excess by 2n − 1. The end carry 2n when discarded removes 2n,
leaving a result short by 1. To fix this shortage, whenever and end carry occurs, add
1 in the LSB position. This is called the end-around carry.
3) If M < N, the sum does not produce an end carry and, from above, is equal to
2n−1−(N−M), the 1's complement of ( N − M ). To obtain the result − (N – M) , take the
1's complement of the sum and place a − to its left.
Digital Circuits Design Slide 49
Unsigned 1’s Complement Subtraction
Example 1: Find Example 2: Find
010101002 – 010000112 010000112 – 010101002
The carry of 0 indicates that a
correction of the result is required.
The end-around carry occurs
Result = – (00010001)
Digital Circuits Design Slide 50
Signed Integers
Positive numbers and zero can be represented by unsigned n-digit, radix r
numbers. We need a representation for negative numbers.
To represent a sign (+ or –) we need one more bit of information (1 binary
digit gives 21 = 2 elements which is exactly what is needed).
Since computers use binary numbers, by convention, the most significant
bit is interpreted as a sign bit:
s an–2a2a1a0
where:
s = 0 for Positive numbers
s = 1 for Negative numbers
and ai = 0 or 1 represent the magnitude in some form
Digital Circuits Design Slide 51
Signed Integer Representations
Signed-Magnitude: the n – 1 digits are interpreted as a positive magnitude.
Signed-Complement: the digits are interpreted as the rest of the
complement of the number. There are two possibilities:
Signed 1's Complement
• Uses 1's Complement Arithmetic
Signed 2's Complement
• Uses 2's Complement Arithmetic
Digital Circuits Design Slide 52
Signed Binary Numbers
Example: the number 9, represented in binary with eight bits.
+9 is represented with a sign bit of 0 in the leftmost position, followed by
the binary equivalent of 9, which gives:
(+9)10 = (00001001)2
There are three different ways to represent -9 with eight bits:
1) signed‐magnitude representation: 10001001
2) signed‐1’s‐complement representation: 11110110
3) signed‐2’s‐complement representation: 11110111
Digital Circuits Design Slide 53
What is the maximum number that can be represented in
an n digits binary system?
Digital Circuits Design Slide 54
Signed Binary Numbers: Arithmetic Addition
The addition of two signed binary numbers is performed as follows:
1) negative numbers are represented in signed 2’s‐complement form
2) addition of the two numbers, including their sign bits
3) A carry out of the sign‐bit position is discarded
Digital Circuits Design Slide 55
Signed Binary Numbers: Arithmetic Addition
Examples:
Digital Circuits Design Slide 56
Signed Binary Numbers: Arithmetic Subtraction
Subtraction of two signed binary numbers is performed as follows:
1) Take the 2’s complement of the subtrahend (including the sign bit) and
add it to the minuend (including the sign bit).
2) A carry out of the sign‐bit position is discarded
Digital Circuits Design Slide 57
Signed Binary Numbers: Arithmetic Subtraction
Subtraction operation can be changed to an addition operation if the sign of
the subtrahend is changed
Digital Circuits Design Slide 58
Signed Binary Numbers: Arithmetic Subtraction
Example:
oThe subtraction is changed to addition by taking the 2’s complement of the
subtrahend (-13), giving (+13)
oRemoving the end carry, we obtain the correct answer:
Digital Circuits Design Slide 59
Binary Codes: ASCII Character Code
An alphanumeric character set is a set of elements that includes the 10
decimal digits, the 26 letters of the alphabet, and a number of special
characters. Such a set contains between 36 and 64 elements if only capital
letters are included, or between 64 and 128 elements if both uppercase and
lowercase letters are included. In the first case, we need a binary code of six
bits, and in the second, we need a binary code of seven bits.
The standard binary code for the alphanumeric characters is the American
Standard Code for Information Interchange (ASCII), which uses seven bits to
code 128 characters.
Digital Circuits Design Slide 60
Thanks and Feedback
Digital Circuits Design