2.number Systems
2.number Systems
2.number Systems
Number Systems
1
Number Systems
• A number system defines a set of values used to
represent quantity.
• It can be categorized in two broad categories:
1. Non – Positional Number Systems
Stones or sticks were used to indicate values
Difficult to perform arithmetic because it has no
symbol for zero.
Example: Roman number systems – Few
characters are used such as I, V, X, L (fifty), C
(hundred)
2
Number System
2. Positional Number Systems
The value of each digit in number is defined not
only by the symbol but also by symbol’s position.
Positional number systems have base or radix.
3
Common Number Systems
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F
4
Quantities/Counting (1 of 3)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
5
Quantities/Counting (2 of 3)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
6
Quantities/Counting (3 of 3)
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
Etc. 7
Conversion Among Bases
• The possibilities:
Decimal Octal
Binary Hexadecimal
8
Quick Example
Base
9
Decimal to Decimal (just for fun)
Decimal Octal
Binary Hexadecimal
10
Weight
Base
11
Decimal to Binary
Decimal Octal
Binary Hexadecimal
12
Decimal to Binary
• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-significant
bit)
– Second remainder is bit 1
– Etc.
13
Conversion of Decimal to Binary
1. Determine the Binary equivalent of (125)10
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1
Most Significant Bit ( MSB)
12510 = 11111012
14
Conversion of Decimal to Binary
2. Determine the Binary equivalent of (36)10
2 18 0
2 9 0
2 4 1
2 2 0
2 1 0
0 1
Most Significant Bit ( MSB)
3610 = 1001002
15
Conversion of Decimal to Binary
3. Determine the Binary equivalent of (671)10
2 335 1
2 167 1
2 83 1
2 41 1
2 20 1
2 10 0
2 5 0
2 2 1
2 1 0
0 1 Most Significant Bit ( MSB)
67110 = 10100111112 16
Conversion of Decimal Fraction to Binary
Fraction
1. Determine the Binary equivalent of (0.375)10
0.375 X 2 = 0.750 0
0.750 X 2 = 1.500 1
0.500 X 2 = 1.000 1
0.37510 = 0112
17
Conversion of Decimal Fraction to Binary
Fraction
2. Determine the Binary equivalent of (0.29)10
0.29 X 2 = 0.58 0
0.58 X 2 = 1.16 1
0.16 X 2 = 0.32 0
0.32 X 2 = 0.64 0
0.64 X 2 = 1.28 1
0.28 X 2 = 0.56 0
.
.
.
∞
0.2910 = (0.010010)2
18
Binary to Decimal
Decimal Octal
Binary Hexadecimal
19
Binary to Decimal
• Technique
– Multiply each bit by 2n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
20
Binary to Decimal
1. Determine the Decimal equivalent of (101011)2
Binary 1 0 1 0 1 1
Number
Weight of 25 24 23 22 21 20
Each Bit
Weighted 1 X 25 0X 1X 0 X 22 1 X 21 1 X 20
Value 24 23
Solved 32 0 8 0 2 1
Multiplicati
on
Binary 1 1 0 1 0
Number
Weight of 24 23 22 21 20
Each Bit
Weighted 1 X 24 1 X 23 0 X 22 1 X 21 0 X 20
Value
Solved 16 8 0 2 0
Multiplication
Binary 1 0 1 1 0 0 1 1
Number
Weight of 27 26 25 24 23 22 21 20
Each Bit
Weighted 1 X 0X 1 X 25 1 X 24 0 X 23 0 X 22 1 X 21 1 X 20
Value 27 26
Solved 128 0 32 16 0 0 2 1
Multiplica
tion
Binary 0 1 1 0 1
Number
Weight of 2-1 2-2 2-3 2-4 2-5
Each Bit
Weighted 0X 1 X 2-2 1 X 2-3 0 X 2-4 1 X 2-5
Value 2-1
Solved 0 1/4 1/8 0 1/32
Multiplicati
on
Decimal Octal
Binary Hexadecimal
27
Decimal to Octal
• Technique
– Divide by 8
– Keep track of the remainder
28
Conversion of Decimal to Octal
1. Determine the Octal equivalent of (1234)10
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
29
Conversion of Decimal to Octal
2. Determine the Octal equivalent of (359)10
8 44 7
8 5 4
0 5
35910 = 5478
30
Conversion of Decimal to Octal
3. Determine the Octal equivalent of (432267)10
43226710 = 15142138 31
Conversion of Decimal Fraction to Octal
Fraction
1. Determine the Octal equivalent of (0.3125)10
0.3125 X 8 = 2.5 2
0.50 X 8 = 4.0 4
0.37510 = 0.248
32
Conversion of Decimal Fraction to Octal
Fraction
2. Determine the Octal equivalent of (0.1325)10
0.1325 X 8 = 1.0600 1
0.0600 X 8 = 0.4800 0
0.4800 X 8 = 3.8400 3
0.8400 X 8 = 6.7200 6
6.7200 X 8 = 5.7600 5
.
.
.
∞
0.132510 = 0.103658 33
Octal to Decimal
Decimal Octal
Binary Hexadecimal
34
Octal to Decimal
• Technique
– Multiply each bit by 8n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
35
Conversion of Octal to Decimal
Octal Number 7 2 4
Weight of Each 82 81 80
Bit
Weighted Value 7 X 82 2 X 81 4 X 80
Solved 448 16 4
Multiplication
Octal Number 4 5 6
Weighted Value 4 X 82 5 X 81 6 X 80
Octal 1 2 7 6 6 2
Number
Weight of 85 84 83 82 81 80
Each Bit
Weighted 1 X 85 2 X 84 7 X 83 6 X 82 6 X 81 2 X 80
Value
Solved 32768 8192 3584 384 48 2
Multiplicatio
n
Octal 2 3 7 0 4
Number
Weight of 82 81 80 8-1 8-2
Each Bit
Weighted 2 X 82 3 X 81 7 X 80 0 X 8-1 4 X 8-2
Value
Solved 128 24 7 0 0.0625
Multiplicatio
n
Octal 6 7 3 2 0 3 2
Number
Weight 83 82 81 80 8-1 8-2 8-3
of Each
Bit
Weighte 6X 7X 3X 2X 0X 3X 2X
d Value 83 82 81 80 8-1 8-2 8-3
Solved 307 448 24 2 0 0.046 0.003
Multiplic 2 87 90
ation
Decimal Octal
Binary Hexadecimal
41
Binary to Octal
• Technique
– Break the binary number into 3 sections
starting from LSB to MSB (starting on right)
– Convert to octal digits
42
Conversion of Binary to Octal
10110101112 = (1327)8
43
Conversion of Binary to Octal
0101112 = (27)8
44
Conversion of Binary to Octal
10101111101100102 = (127662)8
45
Conversion of Binary Fractions to Octal Fractions
0.1101012 = (0.65)8
46
Conversion of Binary Fraction to Octal Fraction
1100010.11101102 = (142.730)8
47
Octal to Binary
Decimal Octal
Binary Hexadecimal
48
Octal to Binary
• Technique
– Convert each octal digit to a 3-bit equivalent
binary representation
49
Conversion of Octal to Binary
Octal Number 7 0 5
7058 = (111000101)2
50
Conversion of Octal to Binary
Octal Number 2 3 1
2318 = (010011001)2
51
Conversion of Octal to Binary
Octal 4 5 3 2 6 7
Number
Binary 100 101 011 010 110 111
Coded
Value
4532678 = (100101011010110111)2
52
Conversion of Octal Fractions to Binary Fractions
Octal 2 3 3 5
Number
Binary 010 011 011 101
Coded
Value
2.3358 = (010.011011101)2
53
Conversion of Octal Fractions to Binary Fractions
Octal 5 6 6 7 2 4 1 1
Number
Binary 101 110 110 111 010 100 001 001
Coded
Value
5667.24118 = (101110110111.010100001001)2
54
Decimal to Hexadecimal
Decimal Octal
Binary Hexadecimal
55
Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder
56
Conversion of Decimal to Hexadecimal
1. Determine the Hexadecimal equivalent of (1234)10
16 77 2
16 4 13
0 4
123410 = 4D216
57
Conversion of Decimal to Hexadecimal
2. Determine the Hexadecimal equivalent of (5112)10
511210 = 13F816
58
Conversion of Decimal to Hexadecimal
3. Determine the Hexadecimal equivalent of (584666)10
Least Significant Bit ( LSB)
16 584666 Remainder
16 36541 10=A
16 2283 13 = D
16 142 11=B
16 8 14=E
0 8
58466610 = 8EBDA16
59
Conversion of Decimal Fraction to Hexadecimal
Fraction
1. Determine the Hexadecimal equivalent of (0.625)10
0.625 X 16 = 10.000 10 = A
0.000 X 16 = 0.000 0
0.132510 = 0.A016
60
Conversion of Decimal Fraction to Hexadecimal
Fraction
2. Determine the Hexadecimal equivalent of (0.2715)10
0.2715 X 16 = 4.3440 4
0.3440 X 16 = 5.5040 5
0.5040 X 16 = 8.0640 8
0.0640 X 16 = 1.0240 1
0.0240 X 16 = 0.3840 0
.
.
∞
0.271510 = 0.4581016
61
Hexadecimal to Decimal
Decimal Octal
Binary Hexadecimal
62
Hexadecimal to Decimal
• Technique
– Multiply each bit by 16n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
63
Conversion of Hexadecimal to Decimal
Hexadecimal B=11 1 4
Number
Weight of Each Bit 162 161 160
Hexadecimal A B C
Number
Weight of Each Bit 162 161 160
Hexadecim 8 A F E 2 B
al Number
Weight of 165 164 163 162 161 160
Each Bit
Weighted 8 X 165 10 X164 15 X 163 14 X 162 2X 11 X 160
Value 161
Solved 8388608 655360 61440 3584 32 11
Multiplicatio
n
Octal Number A 2 3
Weighted 4X 5 X 16 12 X 1 8 X 16-1 11 X 14 X 3 X
Value 256 16-2 16-3 16-4
Decimal Octal
Binary Hexadecimal
69
Hexadecimal to Binary
• Technique
– Convert each hexadecimal digit to a 4-bit
equivalent binary representation
70
Conversion of Hexadecimal to Binary
10AF16 = (0001000010101111)2
71
Conversion of Hexadecimal to Binary
5AF16 = (010110101111)2
72
Conversion of Hexadecimal to Binary
86DB45C16 = (1000011011011011010001011100)2
73
Conversion of Hexadecimal Fractions to Binary
Fractions
1. Determine the Binary equivalent of (2B.6C)16
2B.6C16 = (00101011.01101100)2
74
Conversion of Hexadecimal Fractions to Binary
Fractions
2. Determine the Binary equivalent of (576E.34DF)16
576E.34DF16 =
(0101011101101110.0011010011011111)2
75
Binary to Hexadecimal
Decimal Octal
Binary Hexadecimal
76
Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
77
Conversion of Binary to Hexadecimal
10101110112 = (2BB)16
78
Conversion of Binary to Hexadecimal
110010112 = (CB)16
79
Conversion of Binary to Hexadecimal
110010112 = (2BCD9)16
80
Conversion of Binary Fraction to Hexadecimal Fraction
0.111010002 = (0.E8)16
81
Conversion of Binary Fraction to Hexadecimal Fraction
1100001.1010111100112 = (61.AF3)16
82
Octal to Hexadecimal
Decimal Octal
Binary Hexadecimal
83
Octal to Hexadecimal
• Technique
– Use binary as an intermediary
84
Conversion of Octal to Hexadecimal
Octal 2 3 2 7
Number
Binary Coded 010 011 010 111
Value
4 13 7
23278 = (4D7)16
85
Conversion of Octal to Hexadecimal
Octal 1 0 7 6
Number
Binary Coded 001 000 111 110
Value
2 3 14
10768 = (23E)16 86
Conversion of Octal Fraction to Hexadecimal Fraction
Octal 3 1 5 7
Number
Binary Coded 011 001 101 111
Value
31.578 = (011001.101111)2
= (0001 1001.1011 1100)
1 9 . 11 12
31.578 = (19.BC)16 87
Conversion of Octal Fraction to Hexadecimal Fraction
Octal 7 6 6 6 5
Number
Binary 111 110 110 110 101
Coded
Value
76.6658 = (111110.110110101)2
= (0011 1110 . 1101 1010 1000)
3 14 . 13 10 8
76.6658 = (3E.DA8)16 88
Hexadecimal to Octal
Decimal Octal
Binary Hexadecimal
89
Hexadecimal to Octal
• Technique
– Use binary as an intermediary
90
Conversion of Hexadecimal to Octal
Hexa 2 B=11 6
decimal
Number
Binary Coded 0010 1011 0110
Value
2B616 = (001010110110)2
= (001 010 110 110)
1 2 6 6
2B616 = (1266)8 91
Conversion of Hexadecimal to Octal
1F0C16 = (0001111100001100)2
= (000 001 111 100 001 100)
0 1 7 4 1 4
1F0C16 = (017414)8 92
Conversion of Hexadecimal to Octal
5DE24716 = (010111011110001001000111)2
= (010 111 011 110 001 001 000 111)
2 7 3 6 1 1 0 7
5DE24716 = (27361107)8 93
Conversion of Hexadecimal Fractions to Octal Fractions
Hexa 4 3 C=12
decimal
Number
Binary 0100 0011 1100
Coded
Value
4.3C16 = (0100.00111100)2
= (000 100 . 001 111 000)
0 4 . 1 7 0
4.3C16 = (04.170)8 94
Conversion of Hexadecimal Fractions to Octal Fractions
7B.64D16 = (01111011.011001001101)2
= (001 111 011.011 001 001 101)
1 7 3 . 3 1 1 5
7B.64D16 = (173.3115)8 95
Exercise – Convert ...
Hexa-
Decimal Binary Octal decimal
33
1110101
703
1AF
96
Exercise – Convert …
Answer
Hexa-
Decimal Binary Octal decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
97
Exercise – Convert ...
Hexa-
Decimal Binary Octal decimal
29.8
101.1101
3.07
C.82
Don’t use a calculator!
98
Exercise – Convert …
Answer
Hexa-
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
99
Arithmetic System
100
Binary Addition
• Addition of Binary Numbers
INPUT OUTPUT
X Y SUM(S) CARRY(C)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
pp. 36-
38
101
Binary Addition
• Add binary numbers 1111 and 1010
Binary Decimal
11 1
1 1 1 1 1 5
+ 1 0 1 0 +1 0
11 0 01 2 5
pp. 36-
38
102
Binary Addition
• Add binary numbers 110011, 10010, 1100
and 101
Binary Decimal
111111 1
110011 51
10010 18
1100 12
+ 101 + 5
1010110 8 6
103
Binary Addition
• Add binary numbers 11.10, 10.10
Binary
11 1 1
11.10 3.5
+ 10.10 2.5
11 0 .00 6.0
104
Binary Addition
• Add binary numbers 11010.0100,
1001.01 ,001.11 and 10.1010
Binary
11 1 11 1
110 10 .010 0
10 01. 01
0 01. 11
+ 10. 101 0
1 0 0 1 1 1. 1 1 1 0 105
Binary Subtraction
• Subtraction of Binary Numbers
INPUT OUTPUT
X Y Difference(D) Borrow(B)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
106
Example
1
10 10 0 10
1 0 0 1 0 1
0 0 1 0 1 1
0 1 1 0 1 0
107
Example
10
1 1 0 1
1 0 1 1
0 0 1 0
108
Example
pp. 36-
38
109
Octal Addition
1. First, add the two digits of the unit column
of the octal number in decimal.
2. During the process of addition, if the sum
is less than or equal to 7, then it can be
directly written as octal digit.
3. If the sum is greater than 7, then subtract
8 from that particular digit and carry 1 to
the next digit position.
110
Octal Addition
• Add the octal numbers 26 and 17.
1
2 6
+ 1 7
4 13
- 8
4 5
111
Octal Addition
• Add the octal numbers 5647 and 1425
1 1
5 6 4 7
+1 4 2 5
7 10 7 12
-8 -8
7 2 7 4
112
Octal Subtraction
Subtract the octal numbers 677 from 770
8+6=14
6 6 8
7 7 0
6 7 7
0 7 1
113
Octal Subtraction
Subtract the octal numbers 2761 from 6357
5 8+2=10 8+5=13
6 3 5 7
2 7 6 1
3 3 7 6
114
Hexadecimal Addition
1. First, add the two digits of the unit column
of the octal number in decimal.
2. During the process of addition, if the sum
is less than or equal to 15, then it can be
directly written as a hexadecimal digit.
3. If the sum is greater than 15, then
subtract 16 from that particular digit and
carry 1 to the next digit position.
115
Hexadecimal Addition
• Add the hexadecimal numbers 76 and 45.
7 6
+ 4 5
11 11
- -
B B
116
Hexadecimal Addition
• Add the hexadecimal numbers
A27E9 and 6FB43
1 1 1
A 2 7 E 9
+ 6 F B 4 3
1 17 18 19 18 12
-16 -16 -16 -16
1 1 2 3 2 12
1 1 2 3 2 C
117
Hexadecimal Subtraction
Subtract the hexadecimal numbers 75 from 527
4 16+2=18
5 2 7
7 5
4 11 2
4 B 2
118
Hexadecimal Subtraction
Subtract the hexadecimal numbers 1F65 from
7E2CA
13 16+2=18
7 E 2 C A
1 F 6 5
7 12 3 6 5
7 C 3 6 5
119
Binary Addition: Example
• 10001 + 11101 = ?
• 101101 + 11001 =?
• 1011001 + 111010 = ?
• 0011010 + 0001100 = ?
120
Binary Addition: Example
• 10001 + 11101 = 101110
• 101101 + 11001 = 1000110
• 1011001 + 111010 = 10010011
• 0011010 + 0001100 = 0100110
121
Binary Subtraction: Example
• 1011011 – 10010 = ?
• 1010110 – 101010 =?
• 100010110 – 1111010 = ?
• 1110110 – 1010111 = ?
122
Binary Subtraction: Example
• 1011011 – 10010 = 1001001
• 1010110 – 101010 = 0101100
• 100010110 – 1111010 = 010011100
• 1110110 – 1010111 = 0011111
123
Octal Addition: Example
• 45667 + 2341 = ?
• 77542 + 16423 = ?
• 211345 + 456771 = ?
124
Octal Addition: Example
• 45667 + 2341 = 50230
• 77542 + 16423 = 116165
• 211345 + 456771 = 670336
125
Octal Subtraction: Example
• 76542 – 44367 = ?
• 123457 − 44663 = ?
• 456771 − 211345 = ?
126
Octal Subtraction: Example
• 76542 – 44367 = 32153
• 123457 − 44663 = 56574
• 456771 − 211345 = 245424
127
Hexadecimal Addition: Example
• A89EF + 347C = ?
• 2467 + 895A = ?
• 1B59A + 2E3FD = ?
128
Hexadecimal Addition: Example
• A89EF + 347C = ABE6B
• 2467 + 895A = ADC1
• 1B59A + 2E3FD = 49997
129
Hexadecimal Subtraction:
Example
• E89B5 − 1FA27 = ?
• 6B432 − 59876 = ?
• 1B59A − 2E3D = ?
• ABCDEF − FEDCB = ?
130
Hexadecimal Subtraction:
Example
• E89B5 − 1FA27 = C8F8E
• 6B432 − 59876 = 11BBC
• 1B59A − 2E3D = 1875D
• ABCDEF − FEDCB = 9BE024
131
Signed And Unsigned Numbers
UnSigned Number
MSB LSB
Magnitude
Signed Number
MSB LSB
Signed bit
Example
- Decimal r= 10, 9's complement and 10’s complement
-Binary r=2, 1’s and 2’s complement
-Octal r=8, 7’s and 8’s complement
133
SIGNED NUMBERS
- Following 3 representations
134
2’s complement
135
- (14) in 2’s complement form
Binary Number 1 1 1 0
1’s Complement 0 0 0 1
2’s Complement 0 0 1 0
With Sign Bit 1 0 0 1 0
136
+(12) in 2’s complement form
Binary Number 1 1 0 0
1’s Complement 0 0 1 1
2’s Complement 0 1 0 0
With Sign Bit 0 0 1 0 0
137
Addition-Subtraction of signed number using 2’s complement
138
Addition-Subtraction of signed number
using 2’s complement
1. Add (27)10 and (-11)10 using complementary representation
for the negative value.
27 = 011011 and 11 = 001011
2’s complement of (001011) = 1’s complement of (001011) + 1
= 110100 + 1
= 110101
Add (011011) and (110101)
1 1 1 1 1
0 1 1 0 1 1
+ 1 1 0 1 0 1
11 0 1 0 0 0 0
139
Carry Hence, result is (010000)2 or (16)10
Addition-Subtraction of signed number
using 2’s complement
2. Subtract (25)10 from (42)10
25 = 011001 and 42 = 101010
2’s complement of (011001) = 1’s complement of (011001) + 1
= 100110 + 1
= 100111
Add (101010) and (100111)
1 1 1
1 0 1 0 1 0
+ 1 0 0 1 1 1
1 0 1 0 0 0 1
143
Overflow
• Example: If we add two positive number 7 + 6 using 4-bit
binary number, result should be +13
0111 (7)
+ 0110 (6)
1101
In signed notation, this is a result of -3, not +13
(because in 4 bit binary system, 4th bit represent sign bit and
only 3 bits represent magnitude of the number.
Therefore, an overflow has occurred, where result would have
more bits than the original numbers.
144
Underflow
• Example: If we add two negative numbers -29 and -13
using 8-bit binary number, result should be -42
29 = 00011101 13 = 00001101
1’s of 29 = 11100010 1’s of 13 = 11110010
2’s of 29 =11100011 2’s of 13 = 11110011
now, add 1 1 1 0 0 0 1 1
+1 1 1 1 0 0 1 1
11 1 0 1 0 1 1 0
Result is 11010110
In signed notation, this is a result of +214 and not of -42.
Therefore, an underflow has occurred.
145
Cont…
• Overflow in two's complement occurs, not
when a bit is carried out of the left column,
but when there is a carry into the sign.
• A negative and positive added together
cannot overflow, because the sum is
between the addends.
146
147
Examples
148
Basic Logic Gates
149
• Logic gate is an elementary building block
of a digital circuit.
– Which when combined with each other are
able to perform complex logical and arithmetic
operations.
• Two possible input
0 = 0v = False
1 = +5v = True
150
AND Function
Output Y is TRUE if inputs A AND B are TRUE,
Text Description else it is FALSE.
A
Logic Symbol AND Y
B
INPUTS OUTPUT
A B Y
Truth Table 0 0 0
0 1 0
1 0 0
1 1 1
AND Gate Truth Table
AND Symbol
Boolean Expression Y = A x B = A • B = AB
151
OR Function
Output Y is TRUE if input A OR B is TRUE, else it
Text Description
is FALSE.
Logic Symbol A
OR Y
B
INPUTS OUTPUT
A B Y
0 0 0
Truth Table 0 1 1
1 0 1
1 1 1
OR Gate Truth Table
OR Symbol
INPUT OUTPUT
A Y
0 1
Truth Table
1 0
NOT Gate Truth Table
153
Combination of Logic Gates
154
NAND Function
The term NAND is formed by the combination of NOT-AND
155
NAND Function
Output Y is FALSE if inputs A AND B are TRUE,
Text Description
else it is TRUE.
A bubble is an inverter
Logic Symbol A This is an AND Gate with an inverted output
NAND Y
B
INPUTS OUTPUT
A B Y
0 0 1
Truth Table
0 1 1
1 0 1
1 1 0
NAND Gate Truth Table
Boolean Expression Y = A x B = AB
156
NOR Function
The term NOR is formed by the combination of NOT-OR
157
NOR Function
Output Y is FALSE if input A OR B is TRUE, else it
Text Description
is TRUE.
A bubble is an inverter.
Logic Symbol A This is an OR Gate with its output inverted.
NOR Y
B
INPUTS OUTPUT
A B Y
0 0 1
Truth Table
0 1 0
1 0 0
1 1 0
NOR Gate Truth Table
159
Exclusive-OR Gate
XOR X Y Z
X
Z 0 0 0
Y
0 1 1
1 0 1
1 1 0
A + B = A • B’ + A’ • B
160
Exclusive-NOR Gate
A • B =A• B+ A’ • B’
161
Boolean Algebra
Boolean algebra is the mathematics of digital systems.
162
Boolean Operations
•The complement is denoted by a bar. It is defined by
• 0 = 1 and 1 = 0.
163
Laws of Boolean Algebra
A + AB =A
164
Laws of Boolean Algebra
• Commutative Law
the order of literals does not matter
A+B=B+A
AB=BA
165
Laws of Boolean Algebra
• Associative Law
the grouping of literals does not matter
A + (B + C) = (A + B) + C (=A+B+C)
166
Rules of Boolean Algebra
Rule Boolean Expression
Num
ber
1 A+ 0 =A
2 A+ 1 = 1
3 A• 0 = 0
4 A• 1 =A
5 A+A=A
6 A + A’ = 1
7 A• A=A
8 A • A’ = 0
9 A + AB = A
10 A + A’B = A + B
167
Why codes are used?
168
Coding Systems
169
Decimal and BCD
• The BCD is simply the 4 bit
representation of the
decimal digit.
• E.X.
5 3 1 9
0101 0011 0001 1001
170
• BCD is fastest way to convert numbers
from decimal to binary.
• However, it can represent only 16,(2^4)
symbols.
• The later version of BCD used a 6-bit
code, which allows representing a max. of
64 that is 2^6 symbols.
• However, it is also not sufficient for
modern computers.
171
ASCII
It stands for American Standard Code for Information
Interchange
172
ASCII
173
• Determine the binary code of ‘word’ in the
ASCII form.
• w o r d
119 111 114 100
01110111 01101111 01110010 01100110
174
EBCDIC
• Extended Binary Coded Decimal
Interchange Code uses 8 bits for each
character.
– Provides 256 different unique code
Character Zone bits
A–I 1100
J–R 1101
S–Z 1110
0-9 1111
a–i 1000
j–r 1001
s–z 1010
175
EBCDIC
176
EBCDIC vs. ASCII
Character D P 3
EBCDIC 1100 0100 1101 0111 1111 0011
ASCII 0100 0100 0101 0000 0011 0011
177