Docsity

Binary-Coded Decimal (BCD) Number Representation and Addition, Study notes of Computer Architecture and Organization

Toggle sidebar
bg1
ECS 154A Discussion Section 10/17
BCD (Binary-Coded Decimal)
• 4-bit binary
• total: 10 decimal digits (0 to 9) in binary number
• includes 0000 – 1001, excludes 1010 – 1111
Number Representation
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Addition
• Example 1:
2 = 0010
3 = 0011
0101 = 5
• Example 2:
7 = 0111
2 = 0010
1001 = 9
• Example 3:
6 = 0110
2 = 0010
1000 = 8
• Example 4:
8 = 1000
9 = 1001
1 0001
Error: 1 0001 in BCD is 11 in decimal, result should be 0001 0111 in BCD
Therefore,
If the digit sum > 9, add 6 (0110)
pf2

Partial preview of the text

Download Binary-Coded Decimal (BCD) Number Representation and Addition and more Study notes Computer Architecture and Organization in PDF only on Docsity!

ECS 154A Discussion Section 10/

BCD (Binary-Coded Decimal)

  • 4-bit binary
  • total: 10 decimal digits (0 to 9) in binary number
  • includes 0000 – 1001, excludes 1010 – 1111

Number Representation Decimal BCD 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001

Addition

  • Example 1: 2 = 0010 3 = 0011 0101 = 5
  • Example 2: 7 = 0111 2 = 0010 1001 = 9
  • Example 3: 6 = 0110 2 = 0010 1000 = 8
  • Example 4: 8 = 1000 9 = 1001 1 0001 Error: 1 0001 in BCD is 11 in decimal, result should be 0001 0111 in BCD Therefore, If the digit sum > 9, add 6 (0110)

1 0001 digit sum > 9 0110 add 6 1 0111 in BCD (17 in decimal)

  • Example 5: 70 = 0111 0000 45 = 0100 0101 1011 0101 (1011 > 9) 0110 (add 6) 0001 0001 0101 in BCD (115 in decimal)
  • Example 6: 79 = 0111 1001 43 = 0100 0011 1011 1100 (1011 > 9, 1100 > 9) 0110 1 0110 (add 6) 0001 0010 0010 in BCD (122 in decimal)

BCD Adder

Top row: Full adder A1, A2: the digital sum > 9 1010, 1011 -> 1x1x 1100, 1101, 1110, 1111 -> 11xx