BCD Addition & Subtraction
BCD Addition & Subtraction
DECIMAL(BCD)
ADDITION & SUBTRACTION
1
Human perception
2
Binary Codes
For the 10 digits need a 4 bit code. One code is called Binary Coded
Decimal (BCD)
3
Decimal and BCD
4
BCD ADDITION
5
Another Example
A second example
3 0011
+3 0011
Getting 6 or 0 1 1 0
And in range and a BCD digit representation
6
And now
Consider 5 + 5
5 0101
+5 0101
giving 1 0 1 0 which is binary 10 but not a BCD digit!
What to do?
Try adding 6??
Why only 6?
7
Adding 6
8
Another carry example
Add 7 + 6
have 7 0111
plus 6 0 1 1 0
Giving 1 1 0 1 and again out of range
Adding 6 0110
Giving 1 0 0 1 1 so a 1 carries out to the next BCD digit
FINAL BCD answer 0001 0011 or 1310
9
Multibit BCD ADDITION
10
Continuing…..
11
Still Continuing ….
12
BCD SUBTRACTION
RECAP…..
we will use 8-4-2-1 bcd
Decimal numbers > 9 may be obtained when adding two decimal digits
(range: 0-19) i.e. 0 to 9 + 9+1. only 09 have the correct bcd code. • we
need to correct the others
0 to 9 only legal codes e.g. 19 = 1 9 = 0001 1001 = 11001 thus, for sums
between 10 to 18 must subtract 10 and produce a carry subtract 10 = 1010 2
>> add 2’s complement = 0110
13
BCD SUBTRACTION
14
BCD SUBTRACTION
9’s complement
The 9’s complement of a decimal number is found by subtracting each
digit in the number from 9
16
BCD SUBTRACTION
EXAMPLES: (a) +8 +8
-3 +6 (9’s Complement of 3)
(1) 4
+1 END AROUND CARRY
= 5
17
BCD SUBTRACTION
18
BCD SUBTRACTION
19
ASSIGNMENT
20
THANK YOU
21