Professional Documents
Culture Documents
Chapter 1a
Chapter 1a
Resources
Lecture Slides will be available on MS Teams and LMS
Text Book:
Digital Design by Morris Mano. Any Edition ,Preferably Latest one
available in the market.
Reference:
Will be introduced as course proceeds
2
Grading Policy
Assignments/PPTs10%
Quizzes 10%
Mid Term or 1OHT&2OHT 30%
End-term 50%
3
Assignment Policies
4
Policies – Attendance
Deficiency in attendance may lead to termination or
relegation or default F
5
Chapter 1 – Digital Systems and
Binary Numbers
6
Contents
Analog versus Digital Systems
Digitization of Analog Signals
Binary Numbers and Number Systems
Number System Conversions
Representing Fractions
7
Digital Systems
• Digital Systems exist everywhere
• Communication, banks, hospitals, Internet etc.
• Computers are digital systems
8
Analog vs Digital Systems
Analog means continuous
Analog parameters have continuous range of values
◦ Example: temperature is an analog parameter
◦ Temperature increases/decreases continuously
100oC
temperature
time
9
Analog vs Digital Systems
Digital signals are non-continuous i.e. discrete
◦ Consist of fixed set of digits. E.g. number of
months in a year = 12; digits = {1,2,3,
….,10,11,12} note that 11.3 or 4.9 are invalid
here
◦ Abrupt transition (jumping) from one digit to
another 8 9 10 11 12
6 7
4 5
3
1 2
Value
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
10
Analog vs Digital Systems
Q: Digital or Analog?
◦ English letters
◦ Internet IP addresses
◦ Human voice
◦ Week days
11
Analog vs Digital Systems
Analog
Digital
12
Digitization
Process of conversion from analog to digital is called
digitization
13
Computers
Computers are digital systems
Deal with a vocabulary of two elements namely 0 and 1 – also
known as the binary system of numbers
Binary digits i.e. 0 and 1 are called bits
1 1
0
14
bit
binary digit 15
Next…
Analog versus Digital Systems
Digitization of Analog Signals
Binary Numbers and Number Systems
Number System Conversions
Representing Fractions
16
Binary Number System
Decimal-to-Binary
Conversion
01 01 00100
1001 11
0 01 0 1
10001 01
011 01
01 0 1101 01 01 01
10 01
0 0 1 1 1
001
0
00100 11
010 01
0 0
110
010
110
1 101 0 1
Binary-to-Decimal 1 1 1101
011 110 001011 00100 1
Conversion 011 0
11
010101 1 0101011
110 010
10 01 0
0 1 011 10
0 1 01 011 001011
1 011 00
01
100
0 17
17
Decimal (base 10) number system consists of
10 symbols or digits
0 1 2 3 4
5 6 7 8 9
18
We count in Base 10 (Decimal)
101
100
19
18
17
16
15
99
98
97
96
95
14
13
12
11
10
24
23
22
21
20
9
8
7
6
5
4
3
2
1
0
Ran out of symbols (0-9), so increment the digit on the left by one unit.
19
Binary (base 2) number system consists of just two
01
20
Computers count in Base 2 (Binary)
Counting in Binary is the same, but with
only two symbols
◦ On (1)
◦ Off (0)
10000
1111
1110
1101
1100
1011
1010
1001
1000
111
101
100
110
11
10
1
0
21
Binary Numbers (Bits)
Bits can be represented as:
◦ 1 or 0
◦ On or Off
◦ Up or Down
◦ Open or Closed
◦ Yes or No
◦ Black or White
◦ Thick or Thin
◦ Long or Short
22
Decimal (base 10) numbers are expressed in the
positional notation
23
Decimal (base 10) numbers are expressed in the
positional notation
1
4202 = 2x100 + 0x101 + 2x102 + 4x103
1’s multiplier
24
Decimal (base 10) numbers are expressed in the
positional notation
10
4202 = 2x100 + 0x101 + 2x102 + 4x103
10’s multiplier
25
Decimal (base 10) numbers are expressed in the
positional notation
100
4202 = 2x100 + 0x101 + 2x102 + 4x103
100’s multiplier
26
Decimal (base 10) numbers are expressed in the
positional notation
1000
4202 = 2x100 + 0x101 + 2x102 + 4x103
1000’s multiplier
27
Decimal Numbers
7,392= 7x103 + 3x102 + 9x101 + 2x100
Generally a decimal number is represented by a
series of coefficients
aa6 aa5 aa4 aa3 aa2 aa1 aa0. .aa-1 aa-2 aa-3 aa-4
6 5 4 3 2 1 0 -1 -2 -3 -4
28
Binary (base 2) numbers are also expressed in the
positional notation
29
Binary (base 2) numbers are also expressed in the
positional notation
1
10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24
1’s multiplier
30
Binary (base 2) numbers are also expressed in the
positional notation
2
10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24
2’s multiplier
31
Binary (base 2) numbers are also expressed in the
positional notation
4
10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24
4’s multiplier
32
Binary (base 2) numbers are also expressed in the
positional notation
8
10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24
8’s multiplier
33
Binary (base 2) numbers are also expressed in the
positional notation
16
10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24
16’s multiplier
34
Counting in Counting
Decimal in Binary
0 10 20 30 0 1010 10100 11110
1 11 21 31 1 1011 10101 11111
2 12 22 32 10 1100 10110 100000
3
13 23 33 11 1101 10111 100001
4
14 24 34 100 1110 11000 100010
5
6 15 25 35 101 1111 11001 100011
7 16 26 36 110 10000 11010 100100
8 17 27 . 111 10001 11011 .
9 18 28 . 1000 10010 11100 .
19 29 . 1001 10011 11101 .
35
Next…
Analog versus Digital Systems
Digitization of Analog Signals
Binary Numbers and Number Systems
Number System Conversions
Representing Fractions
36
Binary Decimal
conversion
37
Binary Numbers
Each binary digit (called a bit) is either 1 or 0
Bits have no inherent meaning, they can represent …
◦ Unsigned and signed integers
Most Least
◦ Fractions
Significant Bit Significant Bit
◦ Characters
7 6 5 4 3 2 1 0
Bit Numbering
◦ Least significant bit (LSB) is rightmost (bit 0)
◦ Most significant bit (MSB) is leftmost (bit 7 in an 8-bit number)
38
Binary Numbers
Coefficient have two possible values 0 and 1
Strings of binary digits (“bits”)
◦ n bits can store numbers from 0 to 2n -1
◦ n bits can store 2n distinct combinations of 1’s and 0’s
Each coefficient a is multiplied by 2j
j
So 101 binary is
1 x 22 + 0 x 21 + 1 x 20
or
1x4 + 0x2 + 1x1=5
39
Converting Binary to Decimal
Each bit represents a power of 2
Every binary number is a sum of powers of 2
Decimal Value = (dn-1 2n-1) + ... + (d1 21) +
(d0 20)
Binary (10011101)2 = 27 + 24 + 23 + 22 + 1 = 157
7 6 5 4 3 2 1 0
1 0 0 1 1 1 0 1
27 26 25 24 23 22 21 20
40
Converting Binary to Decimal
1 0 1 0 1 1 0 0
128 64 32 16 8 4 2 1
128 + 0 + 32 + 0 + 8 + 4 + 0 + 0
128 + 32 + 8 + 4 = 172
41
Converting Binary to Decimal
0 1 0 1 0 0 0 1
128 64 32 16 8 4 2 1
0 + 64 + 0 + 16 + 0 + 0 + 0 + 1
64 + 16 + 1 = 81
42
Converting Binary to Decimal
- - - -
128 64 32 16 8 4 2 1
0 + 0 + 0 + 16 + 0 + 4 + 2 + 1
16 + 4 + 2 + 1 = 23
43
Converting Binary to Decimal
128 64 32 16 8 4 2 1
128 + 0 + 32 + 16 + 0 + 4 + 2 + 1
128 + 32 + 16 + 4 + 2 + 1 = 183
44
Binary → Dec : More Examples
a) 0110 2 = ?
b) 11010 2 = ?
c) 0110101 2 = ?
d) 11010011 2 = ?
45
45
Binary → Dec : More Examples
a) 0110 2 = ? 6 10
b) 11010 2 = ? 26 10
c) 0110101 2 = ? 53 10
d) 11010011 2 = ? 211 10
46
46
Decimal Binary
conversion
47
Convert 75 to Binary
2 75 remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
1 0
1001011
48
Check
1001011
1001011 == 1x2 1x200++1x2
1x211++0x2
0x222++1x2
1x233++
0x2
0x244++0x2
0x255++1x2
1x266
== 11 ++ 22 ++ 00 ++ 88 ++ 00 ++ 00 ++ 64
64
== 75
75
49
Convert 100 to Binary
2 100 remainder
2 50 0
2 25 0
2 12 1
2 6 0
2 3 0
1 1
1100100 50
Dec → Binary : More Examples
a) 1310 = ?
b) 2210 = ?
c) 4310 = ?
d) 15810 = ?
51
51
Dec → Binary : More Examples
a) 1310 = ? 11012
b) 2210 = ? 101102
c) 4310 = ? 1010112
d) 15810 = ? 100111102
52
52
Summary
Base10 Successive
Division
Base2
DECIMAL BINARY
a) Divide the Decimal Number by 2; the remainder is the LSB of Binary Number .
b) If the Quotient Zero, the conversion is complete; else repeat step (a) using the
Quotient as the Decimal Number. The new remainder is the next most significant
bit of the Binary Number.
Base2 Weighted
Multiplication
Base10
BINARY DECIMAL
a) Multiply each bit of the Binary Number by it corresponding bit-weighting factor
(i.e. Bit-0→20=1; Bit-1→21=2; Bit-2→22=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.
53
53
Bytes
Eight bits form a single byte
◦ “00110011” is One Byte of Information
Byte Values:
◦ 00000000 = 0
◦ 11111111 = 255
54
Special Powers of 2
55
Popular Number Systems
Binary Number System: Radix = 2
◦ Only two digit values: 0 and 1
◦ Numbers are represented as 0s and 1s
Octal Number System: Radix = 8
◦ Eight digit values: 0, 1, 2, …, 7
Decimal Number System: Radix = 10
◦ Ten digit values: 0, 1, 2, …, 9
Hexadecimal Number Systems: Radix = 16
◦ Sixteen digit values: 0, 1, 2, …, 9, A, B, …, F
◦ A = 10, B = 11, …, F = 15
Octal and Hexadecimal numbers can be converted easily to Binary and vice
versa
56
Octal and Hexadecimal Numbers
Octal Decimal Binary Octal Hex
= Radix 8 Radix 10 Radix 2 Radix 8 Radix 16
Only 0 0000 0 0
eight digits: 0 to 7
1 0001 1 1
Digits 2 0010 2 2
8 and 9 not used 3 0011 3 3
Hexadecimal 4 0100 4 4
= Radix 16 5 0101 5 5
16 6 0110 6 6
digits: 0 to 9, A to F 7 0111 7 7
A=10, 8 1000 10 8
B=11, …, F=15 9 1001 11 9
First 10 1010 12 A
16 decimal values (0 11 1011 13 B
to15) and their values in 12 1100 14 C
binary, octal and hex. 13 1101 15 D
14 1110 16 E
Memorize table 15 1111 17 F
57
Converting Octal & Hex to Decimal
58
Converting Decimal to Octal & Hex
Base-2 Base-2
Base-3 Base-3
Base-4 Decimal Base-4
… ….
Base-R Base-R
3 5 3 0 5 5 2 3 6 2 4 Octal
1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 0 32-bit binary
E B 1 6 A 7 9 4 Hexadecimal
61
Binary to Octal
Partition Binary number into group of three digits
each
The corresponding octal digit is then assigned to each
group
(10110001101011)
(10110001101011)2 2
== (10
(10110
110001
001101
101011)
011)2 2
== (26153)
(26153)88
62
Octal to Binary
Each Octal digit is converted to its three digit binary
equivalent
(26153)
(26153)88 == (010
(010 110
110 001
001 101
101 011)
011)22
63
Bin Hex
0x2AC 0111 7
1000 8
1001 9
1010 A
0010 1010 1100 1011 B
1100 C
0x2ac = 001010101100 1101 D
1110 E
1111 F
64
Binary to Hex Bin
0000
Hex
0
0001 1
Just convert groups of 4 bits 0010 2
0011 3
101001101111011 0100 4
0101 5
65
Important Properties
How many possible digits can we have in Radix r ?
r digits: 0 to r – 1
What is the result of adding 1 to the largest digit in Radix r?
2n values: 0 to 2n – 1
Using n binary digits?
8n values: 0 to 8n – 1
Using n octal digits
10n values: 0 to 10n – 1
Using n decimal digits?
16n values: 0 to 16n – 1
Using n hexadecimal digits
rn values: 0 to rn – 1
Using n digits in Radix r ?
67
Next…
Analog versus Digital Systems
Digitization of Analog Signals
Binary Numbers and Number Systems
Number System Conversions
Representing Fractions
68
Representing Fractions
A number Nr in radix r can also have a fraction part:
Nr = dn-1dn-2 … d1d0 . d-1 d-2 … d-m+1 d-m
0 ≤ di < r
69
Examples of Numbers with Fractions
(2409.87)10 = 2×103 + 4×102 + 9 + 8×10-1 + 7×10-2
(263.5)6
70
Converting Decimal Fraction to Binary
Stopwhen new fraction = 0.0, or when enough fraction bits are obtained
Therefore, N = 0.6875 = (0.1011)2
Check (0.1011)2 = 2-1 + 2-3 + 2-4 = 0.6875
71
More Conversion Examples
Convert N = 139.6875 to Octal (Radix 8)
Solution: N = 139 + 0.6875 (split integer from fraction)
The integer and fraction parts are converted separately
N = 139.6875 = (213.54)8
72
Conversion Procedure to Radix r
To convert decimal number N (with fraction) to radix r
Convert the Integer Part
◦ Repeatedly divide the integer part of number N by the radix r and save the
remainders. The integer digits in radix r are the remainders in reverse order of their
computation. If radix r > 10, then convert all remainders > 10 to digits A, B, … etc.
Convert the Fractional Part
◦ Repeatedly multiply the fraction of N by the radix r and save the integer digits that
result. The fraction digits in radix r are the integer digits in order of their
computation. If the radix r > 10, then convert all digits > 10 to A, B, … etc.
Join the result together with the radix point
73
Simplified Conversions
Converting fractions between Binary, Octal, and Hexadecimal can be simplified
Starting at the radix pointing, the integer part is converted from right to left and the
fractional part is converted from left to right
Group 4 bits into a hex digit or 3 bits into an octal digit
74
Windows Calculator for Binary
1. Type your number.
2. Choose notation.
Windows Calculator for Hex
1. Type your number.
2. Choose notation.
There
There are
are 10
10 types
types of
of people
people in
in
the
the world...
world... Those
Those who
who
understand
understand binary,
binary, and
and those
those who
who
don’t.
don’t.
Arithmetic -- addition
Binary similar to decimal arithmetic
No carries
No carries 1 0 1 1 0 0 Carries
0 1 1 0 0 1 0 1 1 0
+ 1 0 0 0 1 + 1 0 1 1 1
1 1 1 0 1 1 0 1 1 0 1
No borrows 0 0 1 1 0 Borrows
1 0 1 1 0 1 1 1 1 0
- 1 0 0 1 0 - 1 0 0 1 1
0 0 1 0 0 0 1 0 1 1
0 - 1 results in a borrow
Borrow makes it (10)2 =(2) 10
Arithmetic -- multiplication
1 0 1 1
X 1 0 1
1 0 1 1
0 0 0 0
1 0 1 1
1 1 0 1 1 1