Module 5_Digital Logic and Number Systems-P1
Module 5_Digital Logic and Number Systems-P1
2
I. Positive and negative logic
II. Basic and derived logic gates, symbols and their
truth tables
AND, OR, NOT, NAND, NOR, XOR, and XNOR
III. Boolean algebra
IV. Basic laws of Boolean algebra
V. De-Morgan’s theorems
VI. Reducing Boolean expressions using Boolean laws
3
Day 1:
I. Introduction to decimal, binary, octal, hexadecimal
number systems
II. Interconversions
Day 2:
III. BCD code, Excess - 3 code, Gray code
Day 3:
IV. One’s and two’s complements
V. Simple binary arithmetic operations
Addition, subtraction, multiplication and division
Day 4: Review and Problem solving
4
5
P1 - I. Introduction to number systems
6
P1 - I. Introduction to number systems
The Decimal System
To convert a number from any base (let's call it base (b)) to a decimal
number (base-10), you can use the following general formula:
8
P1 - I. Introduction to number systems
The Binary System
• Only two digits, 1 and 0
• Represented to the base 2
• The digits 1 and 0 in binary notation have the same meaning as in decimal notation:
02 = 010
12 = 110
• To represent larger numbers each digit in a binary number has a value depending on its
position:
102 = (1 * 21) + (0 * 20) = 210
112 = (1 * 21) + (1 * 20) = 310
1002 = (1 * 22) + (0 * 21) + (0 * 20) = 410
and so on. Again, fractional values are represented with negative powers of the radix:
1001.101 = 23 + 20 + 2-1 + 2-3 = 9.62510
9
P1 - I. Introduction to number systems
The Octal System
10
= 0 1
2
P1 - II. Interconversion
1011 = 11 2 10
(a) 1110
Converting Decimal to Binary (Integers)
Quotient Remainder
21 = 10 1
2
10 = 5 0
2
5 = 2 1
2
2 = 1 0
2
1 = 0 1
2
101012 = 2110
(b) 2110
P1 - II. Interconversion
0.96 2 = 1.92 1
0.5 2 = 1.0 1
0.48 2 = 0.96 0
0.92 2 = 1.84 1
13
P1 - II. Interconversion
Converting Binary to Hexadecimal
• Binary digits are grouped into sets of four bits, called a nibble
• Each possible combination of four binary digits is given a symbol, as follows:
0000 = 0 0100 = 4 1000 = 8 1100 = C
0001 = 1 0101 = 5 1001 = 9 1101 = D
0010 = 2 0110 = 6 1010 = A 1110 = E
0011 = 3 0111 = 7 1011 = B 1111 = F
• Because 16 symbols are used, the notation is called hexadecimal and the 16 symbols
are the hexadecimal digits
• Thus
2C16 = (216 * 161) + (C16 * 160)
= (210 * 161) + (1210 * 160) = 44
• Octal → Hexadecimal
• STEP 1: Octal → Binary (nibble: 3 bits)
• STEP 2: Binary → Hexadecimal (nibble: 4 bits)
• Example: 52.448 = 2A.9116
15
P1 - III. BCD code, Excess – 3 code, Gray code
BCD Code (Binary-Coded Decimal)
• BCD is a binary encoding of decimal numbers where each
digit is represented by its own binary sequence.
• Example:
• Binary number: 1010
• One's complement: 0101
• Add 1: 0101 + 1 = 0110
• Two's complement: 0110
21
P1 - V. Simple binary arithmetic operations
Addition, Subtraction, Multiplication, Division
0-1
22
P1 - V. Simple binary arithmetic operations
Addition (Unsigned binary number)
10001 + 11101 = ?
10111 + 110001 = ?
23
P1 - V. Simple binary arithmetic operations
Subtraction (unsigned binary numbers)
1010 - 101 = ?
0011010 – 001100 = ?
24
P1 - V. Simple binary arithmetic operations
Multiplication (unsigned binary numbers)
1010 × 101 = ?
1011.01 × 110.1 = ?
25
P1 - V. Simple binary arithmetic operations
Division (unsigned binary number)
26
P1 - V. Simple binary arithmetic operations
Thumb rules for performing arithmetic operations
on signed binary numbers:
➢ Convert the negative number using two’s complements
➢ Perform the operation (as they were unsigned)
➢ Adjust the sign of the resultant (if negative, convert to its two's
complement form)
* For fractional numbers:
✓ Align the Binary Points, perform integer and fraction part separately
* For multiplication:
✓ Consider sign-bit extension [1 for negative numbers]
✓ Consider number of bit required
27
P1 – Review and Problem Solving
Interconversion:
1- Convert 13.25 to binary, octal and hexadecimal (direct and indirect)
2- Convert 2FA.516 to octal
Coding:
1- Find BCD of 123 and -45 using 4-bit system
2- Convert 375 to Excess-3 Code
3- Find gray code of binary 110.01 and find binary code of the gray 101.10
Arithmetic operation:
1- Perform 4 binary arithmetic operations for the unsigned numbers 5 and 3
2- Perform 4 binary arithmetic operations for the signed numbers -5 and +3
28
29