Digital Design: Thursday, Mar. 13 Dr. Asmaa Farouk Assiut University
Digital Design: Thursday, Mar. 13 Dr. Asmaa Farouk Assiut University
Digital Design: Thursday, Mar. 13 Dr. Asmaa Farouk Assiut University
Thursday, Mar. 13
Dr. Asmaa Farouk
Assiut University
Instructors
• Dr. Asmaa Farouk, Assiut University
(asmaaf@au.edu.eg).
• Textbook:
M. Morris Mano & Michael
D. Ciletti:
Digital Design
Course Overview
• Topics will be covered in this course
– Digital Systems and Binary Numbers.
– Boolean Algebra and Logic Gates.
– Gate-Level Minimization.
– Combinational Logic.
– Synchronous Sequential Logic.
– Registers and Counters.
Lecture # 1, 2
• Reading:
Mano:
Chapter 1.
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Digital Systems
• Why digital systems?
– They are everywhere and generic.
• Digital computers, smart phones, data communication,
digital recording, digital TV, many others…
Digital Systems
• What is a digital system?
– Characteristic:
• Has a special‐purpose digital computer (processor)
embedded within it, follow a sequence of instructions,
called a program, that operates on given data.
• Ability of manipulating discrete elements of information
(data).
– Examples for discrete sets:
• Decimal digits {0, 1, …, 9}.
• Alphabet {A, B, …, Y, Z}.
• Binary digits {0, 1}.
Digital Systems
• How to represent data?
– In electronic circuits, we have electrical signals:
• Voltage.
• Current.
– In digital circuits (systems), we have just two
discrete values (binary):
• Just two signal levels: 0 V and 5 V (on & off).
• Two elements {0, 1}.
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Binary Numbers
• Humans use decimal arithmetic (base 10) while
computers use the binary (base 2) system.
• Numbering systems.
– Decimal.
– Binary.
– Hexadecimal.
– Octal.
• To distinguish between different bases, we
enclose the number in parentheses and write a
subscript equal to the base used.
Binary Numbers
• Digits:
– In base 10 (decimal) there are 10 distinct digits:
• 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9.
– In base 2 (binary) there are only two digits:
• 0 & 1.
• Commonly referred to as bits.
• The binary system is used in computers because the two
digits represent the two voltage levels off & on.
– In base 16 (hexadecimal) there are 10 digits and 6
letters:
• 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9, A, B, C, D, E & F.
Binary Numbers
• The Radix:
– The radix of any numbering system is its base:
• Decimal => radix = 10.
• Binary => radix = 2.
• Hexadecimal => radix = 16.
• Octal => radix = 8.
Binary Numbers
• Significant Digits:
Binary Numbers
• Decimal (base 10):
– Uses positional representation.
– Each digit corresponds to a power of 10 based on its
position in the number.
– The powers of 10 increment from 0, 1, 2, etc. as you
move right to left.
– Example:
Binary Numbers
• Binary (base 2):
– Two digits: 0, 1.
– To make the binary numbers more readable, the
digits are often put in groups of 4.
– The powers of 2 increment from 0, 1, 2, etc. as you
move right to left (to convert to decimal).
– Example:
Binary Numbers
• Binary (base 2):
Binary Numbers
• Hexadecimal (base 16):
– 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
– Shorter & easier to read than binary.
– The “H” letter is often follow hexadecimal numbers.
– The powers of 16 increment from 0, 1, 2, etc. as you
move right to left (to convert to decimal).
– Example:
Binary Numbers
• Octal (base 8):
– 8 digits: 0, 1, 2, 3, 4, 5, 6, 7.
– Shorter & easier to read than binary.
– The powers of 8 increment from 0, 1, 2, etc. as you
move right to left (to convert to decimal).
– Example:
Binary Numbers
• Fractional Numbers:
– Point:
• Decimal point, binary Point, hexadecimal point.
– Decimal:
– Binary:
– Hexadecimal:
Binary Numbers
• Arithmetic with Binary Numbers:
10101 21 augend 10101 21 minuend
+ 10011 19 addend - 10011 19 subtrahend
1 01000 40 sum 0 00010 2 difference
0 0 1 0 multiplicand (2)
1 0 1 1 multiplier (11)
0 0 1 0
0 0 1 0
0 0 0 0
+ 0 0 1 0
0 0 1 0 1 1 0 product (22)
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Number-Base Conversions
• Converting to and from Decimal:
Number-Base Conversions
• Decimal Binary (or any numbering system):
– To convert from decimal (whole number) to any
numbering system:
1. Divide the decimal number by the radix of the system
you want to convert to.
2. Save the remainder (first remainder is the least
significant digit).
3. Repeat steps 1 and 2 until the quotient is zero.
4. Remainders are written in reverse order to obtain the
converted number.
Number-Base Conversions
• Decimal Binary (or any numbering system):
– Example (1): convert the decimal number 10 to
binary.
• Example (2):
Octal and Hexadecimal Numbers
Octal and Hexadecimal Numbers
• Each octal digit is converted to its three‐digit
binary equivalent. Similarly, each hexadecimal
digit is converted to its four‐digit binary
equivalent.
• Example (3):
• Example (4):
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Complements of Numbers
• Complementing is an operation to simplify
subtraction operation.
– Turn the subtraction operation into an addition
operation.
• Two types:
1. Diminished complement ((r-1)’s complement).
2. Radix complement (r’s complement).
• When r = 2 (binary), they are called:
1. One’s (1’s) complement.
2. Two’s (1’s) complement.
Complements of Numbers
• Diminished Complement (r -1)’s Complement:
– Each digit of the number is subtracted from the
radix -1 to represent a negative number.
– In binary system it is called one’s (1’s) complement
(since radix – 1 = 2 -1 = 1).
Complements of Numbers
• Diminished Complement (r -1)’s Complement:
– Example (1): compute the radix – 1 (one’s)
complement of the binary number 0100 1100.
There is no end
carry. Therefore, 17
the answer Y - X = -
(2’s complement of
sum) = - 0010001 =
(-17)10.
-17
Complements of Numbers
• Subtraction with Complements:
– Example (1.8): Repeat the previous example but
using 1’s complement.
– Solution:
There is no end
carry. Therefore, 17
the answer Y - X = -
(1’s complement of
sum) = - 0010001 =
(-17)10.
-17
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Signed Binary Numbers
• Computers represent the sign with a bit placed
in the leftmost position of the number.
• The sign bit 0 for positive and 1 for negative.
• Two Conventions:
1. Signed-magnitude.
2. Signed-complement.
Signed Binary Numbers
• Signed-magnitude:
– The number consists of a magnitude bits and a bit (0
or 1) indicating the sign.
• In signed representation, bits to the right of sign bit is the
number.
• In unsigned representation, the leftmost bit (LSB) is a part
of the number (i.e. the most significant bit (MSB)).
– Example: the number +/- 9 in 8 bits:
• 00001001 = +9.
• 10001001 = -9.
Signed Binary Numbers
• Signed-complement:
– A negative number is indicated by its complement.
– Can use either the 1’s or the 2’s complement, but
the 2’s complement is the most common.
– Example: the number +/- 9 in 8 bits:
• 00001001 = +9.
• 11110110 = -9, using 1’s complement.
• 11110111 = -9, using 2’s complement.
Signed Binary Numbers
• Arithmetic Addition:
– Binary addition:
• One bit:
100000111
Discard last bit
Signed Binary Numbers
• Arithmetic Addition:
– Examples:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• Gray Code:
– Binary to gray code:
– Example: convert the number 910 = 10012 to gray
code.
XOR
• Solution:
Binary 1 0 0 1
Gray code 1 1 0 1
Binary Codes
• ASCII Code:
– Besides numbers, we have to represent other types
of information:
• Letters of alphabet, mathematical symbols.
– For English, alphanumeric character set includes:
• 10 decimal digits.
• 26 letters of alphabet (both lowercase and uppercase).
• Several special characters.
– We need an alphanumeric code:
• ASCII (American Standard Code for Information
Exchange), uses 7 bits to encode 128 characters.
– (b6 b5 b4 b3 b2 b1 b0)2.
Binary Codes
• ASCII Code:
– Examples:
• A 65 = (1000001),…, Z 90 = (1011010).
• a 97 = (1100001), …, z 122 = (1111010).
• 0 48 = (0110000), …,9 57 = (0111001).
– 128 different characters:
• 26 + 26 + 10 = 62 (letters and decimal digits).
• 32 special printable characters %, *, $.....
• 34 special control characters (non-printable): BS, CR, etc.
Binary Codes
• ASCII Code:
Binary Codes
• Error-Detecting Code:
– Most computers manipulate 8-bit quantity as a
single unit (byte) ASCII code.
• One ASCII character is stored using a byte.
• One un-used bit can be used for other purposes such as
representing Greek alphabet, italic type font, etc.
– The 8th bit can be used for error-detection.
• It is called the parity bit.
Binary Codes
• Error-Detecting Code:
– A parity bit is an extra bit included with a message
(the binary number) to make the total number of 1’s
either even or odd.
– Parity of the 7 bits of the ASCII code:
– A (0 1000001) even parity.
– A (1 1000001) odd parity.
– Detects one, three, and any odd number of bit errors.
Binary Codes
• Error-Detecting Code:
– A parity bit is an extra bit included with a message
(the binary number) to make the total number of 1’s
either even or odd.
– Parity of the 7 bits of the ASCII code:
– A (0 1000001) even parity.
– A (1 1000001) odd parity.
– Detects one, three, and any odd number of bit errors.
– Even parity is more common.
Topics of Today
• Digital Systems.
• Binary Numbers.
• Number-Base Conversions.
• Octal and Hexadecimal Numbers.
• Complements of Numbers.
• Signed Binary Numbers.
• Binary Codes.
• Binary Logic.
Binary Logic
• Definition of Binary Logic:
– Binary logic is equivalent to what is called “two-
valued Boolean algebra”.
• It is an implementation of Boolean algebra.
– Deals with variables that take “two discrete values”
and operations that assume “logical meaning”.
• Two discrete values:
– {true, false}.
– {yes, no}.
– {1, 0}.
• Binary logic should not be confused with binary
arithmetic.
Binary Logic
• Definition of Binary Logic:
– We use A, B, C, x, y, z, etc. to denote binary
variables.
• Each can take {0, 1}.
– Logical operations:
1. AND x · y = z or xy = z.
2. OR x + y = z.
3. NOT x = z or x’ = z.
– For each combination of the values of x and y, there is a value
specified by the definition of the logical operation.
– This definition may be listed in a compact form called truth
table.
Binary Logic
• Definition of Binary Logic:
Binary Logic
• Logic Gates:
– Binary values are represented as electrical signals
• Voltage, current.
Binary Logic
• Logic Gates:
– Binary values are represented as electrical signals
• Voltage, current.
– Logic gates are electronic circuits that operate on
one or more input signals to produce output signals
• AND gate, OR gate, NOT gate.
– Symbols:
OR AND NOT
Binary Logic
• Logic Gates:
– Binary values are represented as electrical signals
• Voltage, current.
– Logic gates are electronic circuits that operate on
one or more input signals to produce output signals
• AND gate, OR gate, NOT gate.
– Symbols:
Questions?