Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

CSE 221: Digital Logic Design

Lecture 1: Number Systems

Shahadat Hussain Parvez


Analog Vs. Digital Electronics

July 2 2020 SHP 2


Analog Electronics Vs Digital Electronics
• Analog Electronics are electronic systems with a
continuously variable signal.

• Digital Electronics on the other hand are electronics that


handle digital signals (discrete bands of analog levels) rather
than by continuous ranges as used in analog electronics.

July 2 2020 SHP 3


Analog Electronics Vs Digital Electronics

July 2 2020 SHP 4


Number System

July 2 2020 SHP 5


Common Number Systems
• Binary system (Base 2)
• Octal System (Base 8)
• Decimal System (Base 10)
• Hexadecimal System (Base 16)

July 2 2020 SHP 6


Radix of a number
• The radix or base is the number of unique digits, including zero, used
to represent numbers in a positional numeral system.
• In decimal number system radix is 10 (0-9)
• In any standard positional numeral system, a number is
conventionally written as (x)y with x as the string of digits and y as its
base
• Same string can represent different numbers in different number
system
• (100)2
• (100)10
July 2 2020 SHP 7
Radix of a number (Cont’d)
• In the system with radix 13, for example, a string of digits such as 398
denotes the number
3 × 132 + 9 × 131 + 8 × 130

• More generally, in a system with radix b (b > 1), a string of digits d1 …


dn denotes the number
d1bn−1 + d2bn−2 + … + dnb0, where 0 ≤ di < b.

July 2 2020 SHP 8


Example of number conversion in Digital
Computer Processor

July 2 2020 SHP 9


Binary Numbers
• Radix: 2
• Symbols: 0, 1

Number Binary
Zero 0
One 1
Two 10
Three 11
Four 100
July 2 2020 SHP 10
Binary Numbers (Cont’d)
101012 = 10101B = 1×24+0×23+1×22+0×21+1×20 = 16+4+1= 21

101112 = 10111B = 1×24+0×23+1×22+1×21+1×20 = 16+4+2+1= 23

1000112 = 100011B = 1×25+0×24+0×23+0×22+1×21+1×20 =32+2+1= 35

July 2 2020 SHP 11


Octal Numbers
• Radix: 8
• Symbols: 0, 1, 2, 3, 4, 5, 6, 7

• Examples of value of octal strings:


278 = 2×81+7×80 = 16+7 = 23

43078 = 4×83+3×82+0×81+7×80= 2247

July 2 2020 SHP 12


Octal Numbers (Cont’d)
Number (in Decimal) Octal
Zero 0
One 1
Two 2
Three 3
Four 4
Five 5
Six 6
Seven 7
Eight 10
Nine 11
Ten 12
July 2 2020 SHP 13
Decimal Numbers
• Radix: 10
• Symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

• Examples of value of Decimal strings:

253810 = 2×103+5×102+3×101+8×100= 2538

July 2 2020 SHP 14


Decimal Numbers (Cont’d)
Number Decimal
Zero 0
One 1
Two 2
Three 3
Four 4
Five 5
Six 6
Seven 7
Eight 8
Nine 9
Ten 10
Eleven 11
July 2 2020 SHP 15
Hexadecimal Numbers
• Radix: 16
• Symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Symbol Value
A 10
B 11
C 12
D 13
E 14
F 15
July 2 2020 SHP 16
First 21 Hexadecimal Numbers
Number Hexadecimal
Zero 0 Number Hexadecimal
One 1 Eleven B
Two 2 Twelve C
Three 3 Thirteen D
Four 4 Fourteen E
Five 5 Fifteen F
Six 6 Sixteen 10
Seven 7 Seventeen 11
Eight 8 Eighteen 12
Nine 9 Nineteen 13
Ten A Twenty 14
July 2 2020 SHP 17
Hexadecimal Numbers (Cont’d)
Example of value of hexadecimal strings:
2816 = 28H = 2×161+8×160 = 40

2F16 = 2FH = 2×161+15×160 = 47

BC1216 = BC12H = 11×163+12×162+1×161+2×160= 48146

July 2 2020 SHP 18


Number Binary Octal Decimal Hexadecimal
Zero 0 0 0 0
One 1 1 1 1
Two 10 2 2 2
Three 11 3 3 3
Four 100 4 4 4
Five 101 5 5 5
Six 110 6 6 6
Seven 111 7 7 7
Eight 1000 10 8 8
Nine 1001 11 9 9
Ten 1010 12 10 A
Eleven 1011 13 11 B
July 2 2020 SHP 19
Number Binary Octal Decimal Hexadecimal
Twelve 1100 14 12 C
Thirteen 1101 15 13 D
Fourteen 1110 16 14 E
Fifteen 1111 17 15 F
Sixteen 10000 20 16 10
Seventeen 10001 21 17 11
Eighteen 10010 22 18 12
Nineteen 10011 23 19 13
Twenty 10100 24 20 14

July 2 2020 SHP 20


Conversion Between Radix

July 2 2020 SHP 21


Conversion to Decimal
• To convert number from any other base to decimal
use the following steps
• Step 1 − Determine the column (positional) value of each
digit (this depends on the position of the digit and the
base of the number system).
• Step 2 − Multiply the obtained column values (in Step 1)
by the digits in the corresponding columns.
• Step 3 − Sum the products calculated in Step 2. The total
is the equivalent value in decimal.
July 2 2020 SHP 22
Binary Number − 111012 Calculating Decimal Equivalent

Step Binary Number Decimal Number


Step 1 111012 ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10
Step 2 111012 (16 + 8 + 4 + 0 + 1)10
Step 3 111012 2910

Binary Number − 111012 = Decimal Number − 2910

July 2 2020 SHP 23


Octal Number – 74658 Calculating Decimal Equivalent

Step Octal Decimal Number


Step 1 74658 ( (7 × 83) + (4 × 82) + (6 × 81) + (5 × 80))10
Step 2 74658 (3584 + 256 + 48 + 5)10
Step 3 74658 389310

Binary Number − 74658 = Decimal Number − 389310

July 2 2020 SHP 24


Hexadecimal number − F2B16 Calculating
Decimal Equivalent

F 2 B
= FX162 + 2X161 + BX160
=15X256 + 2X16 + 11X1
= 3840 + 32 + 11
=388310

July 2 2020 SHP 25


Binary number − 0.1112 Calculating Decimal Equivalent

July 2 2020 SHP 26


Octal number − 32.48 Calculating Decimal Equivalent

July 2 2020 SHP 27


Conversion of numbers from Decimals
To convert numbers from decimal to any other bases use the following steps.
• Step 1 − Divide the decimal number to be converted by the value of the
new base.
• Step 2 − Get the remainder from Step 1 as the rightmost digit (least
significant digit) of new base number.
• Step 3 − Divide the quotient of the previous divide by the new base.
• Step 4 − Record the remainder from Step 3 as the next digit (to the left) of
the new base number.

• Repeat Steps 3 and 4, getting remainders from right to left, until the
quotient becomes zero in Step 3.
• The last remainder thus obtained will be the Most Significant Digit (MSD)
of the new base number.
July 2 2020 SHP 28
Decimal Number: 2910 Calculating Binary Equivalent

Step Operation Result Remainder


Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7/2 3 1
Step 4 3/2 1 1
Step 5 1/2 0 1

Decimal Number − 2910 = Binary Number − 111012.


July 2 2020 SHP 29
Decimal Number: 266 Calculating Octal Equivalent

July 2 2020 SHP 30


Decimal Number: 423 Calculating Hexadecimal
Equivalent

July 2 2020 SHP 31


Decimal Number: 0.375 Calculating Binary Equivalent

 Binary Equivalent is 0.0112

July 2 2020 SHP 32


Decimal Number: 12.525 Calculating Octal Equivalent

July 2 2020 SHP 33


Conversion Between Any 2 bases
• To convert number between any two bases use the following steps
• Step 1 − Convert the original number to a decimal number (base 10).
• Step 2 − Convert the decimal number so obtained to the new base
number.
• Example Octal Number − 258 Calculating Binary Equivalent

July 2 2020 SHP 34


Step 1 − Convert to Decimal

Step Octal Number Decimal Number


Step 1 258 ((2 × 81) + (5 × 80))10
Step 2 258 (16 + 5 )10
Step 3 258 2110

Octal Number − 258 = Decimal Number − 2110


July 2 2020 SHP 35
Step 2 − Convert Decimal to Binary
Step Operation Result Remainder
Step 1 21 / 2 10 1
Step 2 10 / 2 5 0
Step 3 5/2 2 1
Step 4 2/2 1 0
Step 5 1/2 0 1
Decimal Number − 2110 = Binary Number − 101012

Octal Number − 258 = Binary Number −SHP


July 2 2020
101012 36
Shortcut method - Binary to Octal
• The following table is used for inter-conversion between binary and
Octal

July 2 2020 SHP 37


Shortcut method - Binary to Octal
• Step 1 − Divide the binary digits into groups of three (starting from
the right).
• Step 2 − Convert each group of three binary digits to one octal digit.
• Example Binary Number − 101012 Calculating Octal Equivalent

Step Binary Number Octal Number


Step 1 101012 010 101
Step 2 101012 28 58
Step 3 101012 258
Binary Number − 101012 = Octal Number − 258
July 2 2020 SHP 38
Shortcut method - Octal to Binary
• Step 1 − Convert each octal digit to a 3 digit binary number (the octal
digits may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 3 digits each) into
a single binary number.
• Example Octal Number − 258 Calculating Binary Equivalent
Step Octal Number Binary Number
Step 1 258 210 510
Step 2 258 0102 1012
Step 3 258 0101012
Octal Number − 258 = Binary Number − 101012
July 2 2020 SHP 39
Shortcut method - Binary to Hexadecimal
• Step 1 − Divide the binary digits into groups of four
• Step 2 − Convert each group of four binary digits to one hexadecimal
symbol.
• Example Binary Number − 101012 Calculating hexadecimal Equivalent
Hexadecimal
Step Binary Number
Number
Step 1 101012 0001 0101
Step 2 101012 110 510
Step 3 101012 1516
Binary Number − 101012 = Hexadecimal Number − 1516
July 2 2020 SHP 40
Shortcut method - Hexadecimal to Binary
• Step 1 − Convert each hexadecimal digit to a 4 digit binary number
• Step 2 − Combine all the resulting binary groups into a single binary
number.
• Example Hexadecimal Number − 1516 Calculating Binary Equivalent
Hexadecimal
Step Binary Number
Number
Step 1 1516 110 510
Step 2 1516 00012 01012
Step 3 1516 000101012
Hexadecimal Number − 1516 = Binary Number − 101012
July 2 2020 SHP 41
Recommended Text for this lecture
• Digital Design by M. Morris Mano and Michael D. Ciletti, 5th
Edition
• Digital Logic and Computer Design by M. Morris Mano
• Digital Systems : Principles and Applications by Ronald J.
Tocci, Neal S. Widmer, Gregory L. Moss, 10th Edition.
• Logic and Computer Design Fundamentals by M. Morris
Mano and Charles Kime, 4th Edition

July 2 2020 SHP 42


Homework Based on Lecture 1
1. Look at some of the electronic devices around you and list some of
the devices that you think is analog electronic devices and digital
electronic device.
2. What is the difference between analog and digital signal?
3. Use internet research to list some advantage of digital signal over
analog signal.
4. Convert the following decimal numbers to Binary, Octal and
Hexadecimals
a. 24
b. 53
c. 59
d. 254
July 2 2020 SHP 43
Homework Based on Lecture 1
5. Convert the following binary numbers to Decimal, Octal and
Hexadecimals
a. 110110
b. 1001
c. 101010
d. 1001110
6. Convert these following Hexadecimal Numbers to Decimal and
Binary
a. ABE
b. CAB
c. C1B4
d. ACE
July 2 2020 SHP 44
Homework Based on Lecture 1
7. Convert the following Octal numbers to Decimal and Binary
a. 7623
b. 3436
c. 3411
d. 11010
8. Explain why conversion between radix is important in digital
electronics?
9. What is radix?
10. Write down the numbers from 21 to 35 in Binary, Octal and
Hexadecimal.
11. Digital Design by M. Morris Mano and Michael D. Ciletti, 5th Edition,
Examples 1.1 – 1.4
July 2 2020 SHP 45
END

July 2 2020 SHP 46

You might also like