Binary Arithmetic Operations: Prof. R.Ezhilarasie Assistant Professor School of Computing SASTRA Deemed To Be University
Binary Arithmetic Operations: Prof. R.Ezhilarasie Assistant Professor School of Computing SASTRA Deemed To Be University
Prof. R.EZHILARASIE
Assistant Professor
School of Computing
SASTRA Deemed to be University
0 1 1 0 0 1 1 0 1
1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 1 1 1
A B Sub Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
A B Mul
(A * B)
0 0 0
0 1 0
1 0 0
1 1 1
– 1’ Complement
– 2’s Complement
– Addition of positive number and a smaller negative number yields a positive number
Ex: 10 - 3
• Representation of SBN
3 0011 0110 – Obtained from the corresponding binary value plus three
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100
19
Binary to Gray Code
Decimal Binary Gray Code
0 0000 0000 • One bit changes when going from one number to next
1 0001 0001 • Binary To Gray Code Conversion
2 0010 0011 – MSB of Gray code is same as Binary number
3 0011 0010 – Perform EX-OR operation between the adjacent pair of binary codes bits from left
to right
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
ASCII Chart 23
Error Detection and Correction Codes
• Error Detection : Parity Generator and Checker
• Error Correction: Hamming Code
Error Detection: Parity Generator and Checker
• Error in any bit can cause a problem
• Parity: System that checks for errors in a multi-bit binary number by counting the number
of 1’s
• Parity bit: Bit appended to a binary number to make the number of 1’s even or odd
– Even parity: requires binary number to have an even number of ones
– Odd parity: requires binary number to have an odd number of ones
Odd Parity Generator
Parity Bit Data Total Number of 1’s
0 0001110 3
1 0011000 3
1 0010100 3
0 1011101 5
24
Summary
• Binary Arithmetic Operations
• Representation of SBN
• Binary Codes