Chapter 2 (Data Representation and Boolean Algebra)
Chapter 2 (Data Representation and Boolean Algebra)
Number system
Binary 2 0, 1 (1101)2
Octal 8 0, 1, 2, 3, 4, 5, 6, 7 (236)8
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (5876)10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Hexadecimal 16 (A, B, C, D, E, F represents 10, 11, 12, 13, 14, 15 (12AF)16
respectively)
• MSD: The leftmost digit of a number is called Most Significant Digit (MSD).
• LSD: The right most digit of a number is called Least Significant Digit (LSD).
Number Conversions
(30)10 = (11110)2
Decimal fraction to binary
1. Multiply the decimal fraction by 2.
2. Integer part of the answer will be first digit of binary fraction.
3. Repeat step 1 and step 2 to obtain the next significant bit of binary fraction.
0.625 x 2 = 1.25
1 0.25 x 2 = 0.50
0 0.50 x 2 = 1.00
1 .00
(0.625)10 = (0.101)2
Decimal to Octal conversion
Repeated division by 8 and grouping the remainders.(0,1,2,3,4,5,6 or 7)
Example: Convert (120)10 to octal.
8 120 Remainders
8 15 0
8 1 7 (120)10 = (170)8
8 0 1
16 165 Remainders
16 10 5
= 32 + 16 + 0 + 0 + 2 + 0 = (50)10 Bit 1 1 0 0 1 0
Mu
lt
ip
lybinary digit by place value (negative power of 2) and find their sum.
Example: Convert (0.101)2 to decimal. Weight 2-1 2-2 2-3
(0.101)2 = 1×2-1 + 0×2-2 + 1×2-3 Bit 1 0 1
Hexadecimal digit 2 B 5
= 512 + 176 + 5
= (693)10
Octal to binary conversion
Converting each octal digit to its 3 bit binary equivalent.
Octal digit 0 1 2 3 4 5 6 7
Binary equivalent 000 001 010 011 100 101 110 111
Octal digit 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary equivalent 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
A B
(AB)16 = (10101011)2
1010 1011
= (101011111)2
101 011 111
1 5 15(F) = (15F)16
(537)8 = (15F)16
A 3 B
= (101000111011)2
1010 0011 1011
Representation of integers
3 methods : (i) Sign and magnitude representation, (ii) 1’s complement representation &
(iii) 2’s complement representation
= 10111
= 00010111
Sign and magnitude of +23 = 00010111
= 10111
= 00010111
Sign
and magnitude of -23 = 10010111
ii) 1’s complement representation
• If the number is negative, it is represented as 1’s complement of 8-bit form binary.
• 1’s complement of a binary is obtained by changing 0 to 1 and 1 to 0.
• If the number is positive, the 8-bit form binary itself is the 1’s complement.
Example: Represent +23 in 1’s complement form.
Binary of 23 in 8-bit form = (00010111)2
+23 in 1’s complement form = (00010111)2(For +ve numbers, no need to find 1’s
complement)
Example: Represent -23 in 1’s complement form.
Binary of 23 in 8-bit form = (00010111)2
-23 in 1’s complement form = (11101000)2 (by replacing 0 with 1 and 1 with 0)
Representation of characters
Different methods to represent characters in computer memory are: ASCII, Unicode, ISCII,
EBCDIC
A B A+B OR
0 0 0
0 1 1
1 0 1
Gate
1 1 1
Performs logical multiplication and the symbol used for this operation is ● (dot). The expression A ●
B is read as A AND B.
A B A .B AND GATE
0 0 0
0 1 0
1 0 0
1 1 1
The NOT operator and NOT gate(Inverter):
It has only one input and one output. The output is the complement (opposite state) of the input.
1 0
0 1
Principle of Duality
For a Boolean statement, there exists its dual form which can be derived by
1. changing each OR (+) to AND (.)
2. changing each AND(.) to OR(+)
3. replace 0 by 1 and 1 by 0.
eg: Dual of A+A’=1 is A. A’=0
De
Morgan’s Theorems
(i) The complement of sum of Boolean variables is equal to the product of their individual
complements . (X+Y)’ =X’.Y’
(ii) The complement of product of Boolean variables is equal to the sum of their individual
complements . (X.Y)’=X’+Y’
Circuit designs for some Boolean expressions
Expression Logical Circuit
∫ (A,B)= A’+B
∫ (X,Y)= X.Y + Y’
∫ (a,b)= (a+b).(a’+b’)
∫ (a,b)= (a’.b)+(a.b’)
Universal Gates:
NAND and NOR (It can implement any Boolean function without using any other gate type)
Gate Cicuit Logical Truth table
symbol
NAND (inverted AND
gate)
eg: For inputs, A and
B, the result Y=(A.B)’
NOR(inverted OR
gate)
eg: For inputs, A and
B, the result Y=(A+B)’
NAND
NOR