Uploaded by Gamingt

Digital Systems Design I: Binary Numbers

advertisement
Digital Systems Design I
Lecture 1 – Part A:
Digital Systems and Binary Numbers
Fadi El-Hassan, Ph.D., P.Eng.
ECE – Concordia University
References & Copyrights
• Digital Design: With an Introduction to the Verilog HDL, VHDL, and
SystemVerilog, by M. Morris Mano and Michael D. Ciletti, 6th
Edition, Pearson, 2018.
• Digital Logic Circuit Analysis and Design, by V. P. Nelson, H. T. Nagle, B.
D. Carroll, & J. D. Irwin (1995). 2002.
• Digital Fundamentals, by T. L. Floyd, 11th edition, Pearson, 2014.
• Dr. Soleimani's lecture notes
• Dr. Gomar’s lecture notes
Digital versus Analog
• A digital system is a system or device that works based on discrete
values.
• An analog system is a system that works based on continuous values
Analog to Digital (A/D) Conversion, and
Digital to Analog (D/A) Conversion
CD drive
A/D
10110011101
Digital data
Digital-to-analog
converter
D/A
Linear amplifier
Analog
reproduction
of music audio
signal
Speaker
Sound
waves
Binary Digits and Logic Levels
• Digital electronics use circuits that have two states, which are
represented by two different voltage levels called HIGH and LOW.
• The voltages represent numbers in the binary system.
• HIGH voltage: bit 1
• LOW voltage: bit 0
• In binary, a single number is called a bit (for binary digit). A bit can
have the value of either 0 or 1, depending on if the voltage is HIGH or
LOW.
Logic Gates
• All modern digital electronic devices, even those as complex as
computers and smartphones are designed by a few basic blocks called
logic gates
Logic Gates
• We will even show that technically speaking only one type of gate,
namely a NAND gate is enough to build all the Digital Empire.
Two-input NAND gate:
• We will see as well that we can also exclusively use another type of
gate called a NOR gate.
Two-input NOR gate:
Number Systems
• A number system is made of an ordered set of symbols, called digits,
with relations defined for addition, subtraction, multiplication, and
division.
• The radix (r), or the base of the number system is the total number of
digits allowed in the number system.
• Examples of Common number systems:
โ–ช Decimal (r=10) → allowed digits: 0,1,2,3,4,5,6,7,8,9
โ–ช Binary (r=2)
→ allowed digits: 0,1
โ–ช Octal (r=8)
→ allowed digits: 0,1,2,3,4,5,6,7
โ–ช Hexadecimal (r=16)
→ allowed digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Numbers with a Different Base (Radix)
Positional & Polynomial Notations
• A positive number can be represented in positional notation as:
๐‘ = ๐‘Ž๐‘›−1 ๐‘Ž๐‘›−2 … ๐‘Ž1 ๐‘Ž0 . ๐‘−1 ๐‘−2 … ๐‘−๐‘š ๐’“
• A positive number can be represented in polynomial notation as:
๐‘›−1
−1
๐‘ = เท ๐‘Ž๐‘– ๐‘Ÿ ๐‘– + เท ๐‘๐‘— ๐‘Ÿ ๐‘—
๐‘–=0
๐‘—=−๐‘š
(๐‘–๐‘›๐‘ก๐‘’๐‘”๐‘’๐‘Ÿ ๐‘๐‘Ž๐‘Ÿ๐‘ก + ๐‘“๐‘Ÿ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘›๐‘Ž๐‘™ ๐‘๐‘Ž๐‘Ÿ๐‘ก)
. = radix point
r = radix or base of the number system
n = number of integer digits in the left side of the radix point
m = the number of fractional digits in the right side of the radix point
ai = integer digit i when 0 <= i <= n-1
bj = fraction digit j when –m <= j <= -1
Positional & Polynomial Notations
Positional:
๐‘ = ๐‘Ž๐‘›−1 ๐‘Ž๐‘›−2 … ๐‘Ž1 ๐‘Ž0 . ๐‘−1 ๐‘−2 … ๐‘−๐‘š ๐’“
Polynomial:
๐‘›−1
−1
๐‘ = เท ๐‘Ž๐‘– ๐‘Ÿ ๐‘– + เท ๐‘๐‘— ๐‘Ÿ ๐‘—
๐‘–=0
๐‘—=−๐‘š
(๐‘–๐‘›๐‘ก๐‘’๐‘”๐‘’๐‘Ÿ ๐‘๐‘Ž๐‘Ÿ๐‘ก + ๐‘“๐‘Ÿ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘›๐‘Ž๐‘™ ๐‘๐‘Ž๐‘Ÿ๐‘ก)
• ๐‘Ž๐‘›−1 = Most Significant Digit (MSD)
• ๐‘−๐‘š = Least Significant Digit (LSD)
• Examples in positional notation:
โžข(123.4)10
(1011.101)2
(123.4)8
• Results of polynomial summations will be in Decimal (r=10)
(123.4)16
Conversion to Decimal
โžข(123.4)10
(1011.101)2
(123.4)8
• Results of polynomial summations will be in Decimal (r=10)
(123.4)16
(123.4)10 → (1*100 + 2*10 + 3*1 + 4*0.1) = (123.4)10
102
101
100
10−1
Binary to Decimal: (1011.101)2 →
๐‘Š๐‘’๐‘–๐‘”โ„Ž๐‘ก๐‘ : 23 , 22 , 21 , 20 , 2−1 , 2−2 , 2−3
(1* 23 + 0* 22 + 1* 21 + 1* 20 + 1*½ + 0*14 + 1* 18 = (11.625)10
Octal to Decimal: (123.4)8 → (1*64 + 2*8 + 3*1 + 4*18) = (83.5)10
82
81
80
Hexadecimal to Decimal: (123.4)16 →
1
(1*256 + 2*16 + 3*1 + 4*16
) = (291.25)10
162
161
160
16−1
8−1
Binary Addition
Find the addition of (101111)2, and (110111)2
โ–ช Note that in binary, 0+0=0, (0 with no carry)
0+1=1, (1 with no carry)
1+0=1, (1 with no carry)
1+1=10, (0 and carry=1)
1+1+1=11 (1 and carry=1)
โ–ช Result = (1100110)2
Later, we will see how to design a binary adder in hardware
Binary Subtraction
Find the subtraction of (011001)2 from (100111)2
โ–ช Note that in binary, 0-0=0, (0 with no borrow)
1-0=1, (1 with no borrow)
1-1=0, (0 with no borrow)
0-1=? (1 if borrow is possible)
โ–ช If borrow is not possible, result must be negative: we will see it
later in signed binary
โ–ช Result = (001110)2
Later, we will see how to design a binary subtractor in hardware using
the concept of 2’s complement
Binary Multiplication
Find the multiplication of (10101)2, and (1110)2
โ–ช Result = (100100110)2
Binary Division
Find the division of (1110111)2 by (1001)2
โ–ช Result = (1101)2 and Remainder (10)2
Download