Module 5
Module 5
V
I
T Module 5 - Digital Systems
DIGITAL/ANALOG SIGNALS
V
Analog Circuits
I The continuously changing input voltage produces a continuously changing
T output voltage.
Analog device
The one in which data is represented by physical variables.
Digital circuits
Designed for two-state operation
The output voltage has only two states (values), either LOW or HIGH.
Digital operation is with a square-wave input
Digital device
The one in which data is represented by numerical quantities.
DIGITAL/ANALOG SIGNALS
V
ADVANTAGES OF DIGITAL CIRCUITS.
I Changes in component values have very little effect on digital signals.
T The voltage anywhere in a digital circuit will always be in one state or the other, so that there is
Noise and other interfering signals have very little effect on digital signals.
V
I
T Number Systems
WHY BINARY ?
Quantities/Counting
V
I
Dec Bin Oct Hex Dec Bin Oct Hex Dec Bin Oct Hex
T
0 0 0 0 8 1000 10 8 16 10000 20 10
1 1 1 1 9 1001 11 9 17 10001 21 11
2 10 2 2 10 1010 12 A 18 10010 22 12
3 11 3 3 11 1011 13 B 19 10011 23 13
4 100 4 4 12 1100 14 C 20 10100 24 14
5 101 5 5 13 1101 15 D 21 10101 25 15
6 110 6 6 14 1110 16 E 22 10110 26 16
7 111 7 7 15 1111 17 F 23 10111 27 17
Decimal Octal
Binary Hexadecimal
Quick Example
V
I
T
Base
V Decimal Numbers
I
T Weight
Base
V Decimal to Binary
I • Technique 12510 = ?2
T • Divide by two, keep track
of the remainder 2 125
62 1
• First remainder is bit 0 2
(LSB, least-significant bit) 2 31 0
12510 = 11111012
V Binary to Decimal
I
Bit “0”
T • Technique
• Multiply each bit by 2n,
where n is the “weight” of
the bit 1010112 => 1 x 20 = 1
1 x 21 = 2
• The weight is the position of
the bit, starting from 0 on 0 x 22 = 0
the right 1 x 23 = 8
• Add the results 0 x 24 = 0
1 x 25 = 32
4310
Decimal to Octal
V
I
T • Technique 123410 = ?8
• Divide by 8
• Keep track of the remainder 8 1234
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
V Octal to Decimal
I
T • Technique n 7248 => 4 x 80 = 4
• Multiply each bit by 8 , where n is
2 x 81 = 16
the “weight” of the bit 7 x 82 = 448
• The weight is the position of the 46810
bit, starting from 0 on the right
• Add the results
V Decimal to Hexadecimal
I
T • Technique 123410 = ?16
• Divide by 16
• Keep track of the 16 1234
remainder 77 2
16
16 4 13 = D
0 4
123410 = 4D216
Hexadecimal to Decimal
V
I
T • Technique
• Multiply each bit by 16n,
where n is the “weight” of the
ABC16 => C x 160 = 12 x 1 = 12
bit B x 161 = 11 x 16 = 176
• The weight is the position of A x 162 = 10 x 256 = 2560
the bit, starting from 0 on the 274810
right
• Add the results
V Octal to Binary
I
T • Technique 7058 = ?2
7058 = 1110001012
V Binary to Octal
I
10110101112 = ?8
T • Technique
• Group bits in threes,
1 011 010 111
starting on right
• Convert to octal digits
1 3 2 7
10110101112 = 13278
V Hexadecimal to Binary
I
T • Technique 10AF 16 = ?2
10AF16 = 00010000101011112
V Binary to Hexadecimal
I
T• Technique
10101110112 = ?16
2 B B
10101110112 = 2BB16
V Octal to Hexadecimal
I
T • Technique 1076 8 = ?16
• Use binary as an
intermediary 1 0 7 6
2 3 E
10768 = 23E16
V Hexadecimal to Octal
I 1F0C16 = ?8
T • Technique
• Use binary as an intermediary 1 F 0 C
1 7 4 1 4
1F0C16 = 174148
V Answer
I Hexa-
T Decimal Binary Octal decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
V Fractions
I
T • Decimal to decimal (just for logic)
V Fractions
I
T • Binary to decimal
10.1011 => 1 x 2-4 = 0.0625
1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875
V Fractions
I • Decimal to binary .14579
T 3.14579
x
0.29158
2
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001...
etc.
V Answer
I Hexa-
T Decimal Binary Octal decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82
V
Binary-Coded Decimal (BCD), Excess 3 Code
I Digit Bit pattern Excess 3
T • Four bits per digit 8421 Code
0 0000 0011
Note: the following Note: the following 1 0001 0100
bit patterns are not bit patterns are not
used for BCD: used for Excess 3: 2 0010 0101
1010 0000 3 0011 0110
1011 0001 4 0100 0111
1100 0010
1101 1101 5 0101 1000
1110 1110 6 0110 1001
1111 1111
7 0111 1010
8 1000 1011
9 1001 1100
06-10-2023 Module - 5- Number Systems 29
BEEE102L
T 0 0000 0000
1 0001 0111
2 0010 0110
3 0011 0101
4 0100 0100
5 0101 1011
6 0110 1010
7 0111 1001
8 1110 1000
9 1111 1111
Gray Code
V
I Digit Gray Code Digit Gray Code
T 0 0000 8 1100
1 0001 9 1101
2 0011 10 1111
3 0010 11 1110
4 0110 12 1010
5 0111 13 1011
6 0101 14 1001
7 0100 15 1000
V Example
I
T • 709310 = ? (in BCD)
7 0 9 3
V Signed Integers
I • Previous examples were for “unsigned integers” (positive values
T only!)
• Must also have a mechanism to represent “signed integers” (positive
and negative values!)
• E.g., -510 = ?2
• Two common schemes: sign-magnitude and twos complement
V Sign-Magnitude
I
T • Extra bit on left to represent sign
• 0 = positive value
• 1 = negative value
• E.g., 6-bit sign-magnitude representation of +5 and –5:
+5: 0 0 0 1 0 1 -5: 1 0 0 1 0 1
+ve 5 -ve 5
V
Ranges
I Binary
Unsigned Sign-magnitude
T No. of bits Min Max Min Max
1 0 1
2 0 3 -1 1
3 0 7 -3 3
4 0 15 -7 7
5 0 31 -15 15
6 0 63 -31 31
n n-1 n-1
In General, n bits 0 2 -1 -(2 - 1) 2 -1
Complement of Numbers
V
I • Complements are used in digital computers to simplify the subtraction operation.
Note : 1’s complement of a binary number is formed by changing 1’s to 0’s and 0’s to 1’s
06-10-2023 Module - 5- Number Systems 37
BEEE102L
000101
Sign Bit
V
I • In 2’s complement notation, the MSB is the sign bit (as with sign-
magnitude notation)
T • 0 = positive value
• 1 = negative value
+5: 0 0 0 1 0 1 -5: 1 1 1 0 1 1
+ve 5 -ve
V “Complementary” Notation
I
T • Conversions between positive and negative numbers are easy
• For binary (base 2)…
2’s C
-ve
+ve
2’s C
V Example
+5 0 0 0 1 0 1
I
T 2’s C
1 1 1 0 1 0
+ 1
-5 1 1 1 0 1 1
0 0 0 1 0 0
2’s C
+ 1
+5 0 0 0 1 0 1
V Answer
I
T • Represent -20 as an 8-bit binary number in 2’s complement notation?
• Answer: 11101100
Ranges
V
I Binary
No. of bits 2’s complement
T Unsigned Sign-magnitude
Min Max Min Max Min Max
1 0 1
2 0 3 -1 1 -2 1
3 0 7 -3 3 -4 3
4 0 15 -7 7 -8 7
5 0 31 -15 15 -16 15
6 0 63 -31 31 -32 31
+3: 000011
001010
1s C: 111100
+1: 1 +111101
-3: 111101
000111
+10: 001010
000011
1s C: 110101
+1: 1 +110110
-10: 110110
111001
1s C : 000110
+1 : 1
2s C : 000111
carry 1
000111
1s C: 110101 +110101
111000
1s C : 000111
V Answer
I
T • What is the 3-digit 10’s complement of 247?
• Answer: 753
V
I
Logic Gates
T
Logic 0 Logic 1
False True
Off On
Low High
No Yes
Open switch Closed switch
Truth Tables
A truth table is a means for describing how a logic circuit’s output depends
V on the logic levels present at the circuit’s inputs.
I
T
Inputs Output
A B X
A
1 1 1
? x
0 1 0
B
1 0 0
0 0 0
OR Operation
V Boolean expression for the OR operation:
I x =A + B
T The above expression is read as “x equals A OR B”
AND Operation
V
Boolean expression for the AND operation:
I x =A B
T The above expression is read as “x equals A AND B”
NOT Operation
V • The NOT operation is an unary operation, taking only one input variable.
I • Boolean expression for the NOT operation:
x= 𝐴
T • The above expression is read as “x equals the inverse of A”
• Also known as inversion or complementation.
• Can also be expressed as: A’
NAND Gate
V Boolean expression for the NAND operation:
I
T x=𝐴𝐵
XOR Gate
V An XOR gate accepts two input signals
I If both are the same, the output is 0; otherwise, the output is 1
T
De-Morgan’s Theorems
V
I• (x + y)’= x’y’
• Implications and alternative symbol for NOR function
T• (xy)’= x’+ y’
• Implications and alternative symbol for NAND function
• Process of Demorgan:
(i) Complement entire function
(ii) Change all AND to OR and all OR to AND
(iii) Complement each of the individual variables
VAND XY
X ZX
I
X
Y
ZXYXY X Z
T X Y Z 0
1
1
0
Equivalent to Inverter
NAND Gate Inverter 0 0 0
0 1 0
Equivalent to AND Gate
1 0 0
1 1 1
OR X
X Y Z
X Y
0 0 0
Z XY XY XY 0 1 1
Y Equivalent to OR Gate
1 0 1
1 1 1
Inverters NAND Gate
VAND X X ZX X Z
XI
Y 0 1
Equivalent
1 0
Z XYXY XY to Inverter
YT X Y Z
0 0 0
“Inverters” NOR Gate 0 1 0
Equivalent to AND Gate
1 0 0
1 1 1
OR
XY
X X Y Z
Z XY XY
Y 0 0 0
0 1 1
NOR Gate “Inverter” Equivalent to OR Gate
1 0 1
1 1 1