EE227-Digital Logic Design
Course Instructor: Muhammad Abdullah
( [email protected], [email protected] )
My YouTube Channel Playlists:
1. Digital Logic Design (Lecture Series)
https://www.youtube.com/playlist?list=PLIHFDsuMVV3R7r-1wOWNQenIjhM0Wj2o0
2. Digital System Design (Verilog – FPGA Based Lab Series)
https://www.youtube.com/playlist?list=PLIHFDsuMVV3Q-tMIGve2-4fpnmWulGYRo
3. Hands on HDL Coder: FPGA Prototyping and Hardware in the Loop (HIL) Testing
https://www.youtube.com/playlist?list=PLIHFDsuMVV3TQiJlxupBeL6mL3EUm_cPY
4. Microcontroller and Interfacing (Lecture Series)
https://www.youtube.com/playlist?list=PLIHFDsuMVV3REpdP3HnoAZEQ1K-
nHeu0P
1
Tentative Marks Distribution
Evaluation Weightage
Quizzes (4~5) 10%
Assignments (4~5) 10%
Mid-1 Exam 15%
Mid-2 Exam 15%
Final Exam 50%
Lecture 1: Number Systems
Commonly used number systems are;
Decimal: 0 to 9 Base = 10
Binary: 0 and 1 Base = 2
Octal: 0 to 7 Base = 8
Hexadecimal: 0 to F (0 to 9, A to F) Base = 16
Base of number system is also called as Radix.
Examples:
Let’s see how numbers are represented in different radix systems.
(7392)10 = 7 × 103 + 3 × 102 + 9 × 101 + 2 × 100
(4536.89)10 = 4 × 103 + 5 × 102 + 3 × 101 + 6 × 100 + 8 × 10−1 + 9 × 10−2
(11010.11)2 = 1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 + 1 × 2−1 + 1 × 2−2
(11010.11)2 = (26.75)10
2
(127.4)8 = 1 × 82 + 2 × 81 + 7 × 80 + 4 × 8−1 = (87.5)10
(𝐵65𝐹)16 = 11 × 163 + 6 × 162 + 5 × 161 + 15 × 160 = (46687)10
In general, a number expressed in a base‐𝑟 system has coefficients multiplied by powers
of 𝑟;
𝑎𝑛 × 𝑟 𝑛 + 𝑎𝑛−1 × 𝑟 𝑛−1 + ⋯ … . +𝑎1 × 𝑟 1 + 𝑎0 × 𝑟 0 + 𝑎−1 × 𝑟 −1 + ⋯ . . +𝑎−𝑚 × 𝑟 −𝑚
The coefficients 𝑎𝑖 range in value from 0 to 𝑟 − 1.
Number Base Conversion
Converting a Decimal Number to a Number in Base 𝒓 (without fraction part):
Ex 1: (𝟒𝟏)𝟏𝟎 = ( ? )𝟐
Quotient Remainder
41/2 20 1
20/2 10 0
10/2 5 0
5/2 2 1
2/2 1 0
From above table, we can write; (41)10 = (101001)2
3
Ex 2: (𝟏𝟓𝟑)𝟏𝟎 = ( ? )𝟖
Quotient Remainder
153/8 19 1
19/8 2 3
From above table, we can write; (153)10 = (231)8
Ex 3: (𝟗𝟓𝟔)𝟏𝟎 = ( ? )𝟏𝟔
Quotient Remainder
956/16 59 12 = C
59/16 3 11 = B
From above table, we can write; (956)10 = (3𝐵𝐶)16
Conversion of Decimal Fraction Part to a Number in Base 𝒓:
Ex 4: (𝟎. 𝟔𝟖𝟕𝟓)𝟏𝟎 = ( ? )𝟐
Integer Fraction
0.6875 × 2 1 0.375
0.375 × 2 0 0.75
0.75 × 2 1 0.5
0.5 × 2 1 0
From above table, we can write; (0.6875)10 = (0.1011)2
Using Ex 1 and Ex 4; (41.6875)10 = (1010010.1011)2
4
Ex 5: (𝟎. 𝟓𝟏𝟑)𝟏𝟎 = ( ? )𝟖
Integer Fraction
0.513 × 8 4 0.104
0.104 × 8 0 0.832
0.832 × 8 6 0.656
0.656 × 8 5 0.248
0.248 × 8 1 0.984
0.984 × 8 7 0.872
From above table, we can write; (0.513)10 = (0.406517 … . )8
Using Ex 2 and Ex 5; (153.513)10 = (231.406517 … . )8
Ex 6: (𝟎. 𝟕𝟖𝟔)𝟏𝟎 = ( ? )𝟏𝟔
Integer Fraction
0.786 × 16 12 = C 0.576
0.576 × 16 9 0.216
0.216 × 16 3 0.456
0.456 × 16 7 0.296
0.296 × 16 4 0.736
From above table, we can write; (0.786)10 = (0. 𝐶9374 … . )16
Using Ex 3 and Ex 6; (956.786)10 = (3𝐵𝐶. 𝐶9374 … . )16
5
Octal and Hexadecimal Numbers:
Ex 7: (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟎𝟎𝟎𝟎𝟎𝟏𝟏𝟎)𝟐 = ( ? )𝟖
Partitioning the binary number into groups of three digits each, starting from the binary
point and proceeding to the left and to the right.
Ex 8: (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟎)𝟐 = ( ? )𝟏𝟔
Conversion from binary to hexadecimal is similar, except that the binary number is
divided into groups of four digits;
6
Ex 9: (𝟔𝟕𝟑. 𝟏𝟐𝟒)𝟖 = ( ? )𝟏𝟔
First convert octal number into binary number
Now, convert binary number to hexadecimal number
(110111011.001010100)2 = (1 1011 1011 . 0010 1010 0)2 = (1𝐵𝐵. 2𝐴0)16
So, now we can write;
(673.124)8 = (1𝐵𝐵. 2𝐴0)16
Ex 10: (𝑨𝟔𝑫. 𝟓𝑭)𝟏𝟔 = ( ? )𝟖
First convert hexadecimal number into binary number
(𝐴6𝐷. 5𝐹)16 = (1010 0110 1101 . 0101 1111)2
Now, convert binary number to octal number
(101001101101 . 01011111)2 = (101 001 101 101 . 010 111 110)2
= (5155.276)8
So, now we can write;
(𝐴6𝐷. 5𝐹)16 = (5155.276)8
7
Summary:
Make group of 3 bits
Put value in 3 bits
2 8
Make group of 4 bits
2
Put value in 4 bits
2 8 8
16
16 10
16
Note: 1. Above diagram is not valid if decimal number has non-zero fractional part.
2. For conversion of non-zero fractional decimal number use the following diagram.
2 8
2 8
16 16 10