246094lecture 12 - Decimal Arithmetic Operations and BCD-1693891828368
246094lecture 12 - Decimal Arithmetic Operations and BCD-1693891828368
Organization &
Architecture
Lecture 12
Decimal Arithmetic
Operations and BCD
Session Objectives
By the end of the session, we will be
able to:
Floating-point hardware
Decimal Arithmetic Unit
BCD Addition
BCD Adder
Arithmetic Operations
▪ Example
Decimal 8 4 2 1 Explanation
Digits
0 0 0 0 0 All 0’s
1 0 0 0 1 LSB is 1
2 0 0 1 0 Self-explanatory
3 0 0 1 1 2+1 = 3
4 0 1 0 0 Self-explanatory
5 0 1 0 1 4+1 = 5
6 0 1 1 0 4+2 = 6
7 0 1 1 1 4+2+1 = 7
8 1 0 0 0 Self-explanatory
9 1 0 0 1 8+1 = 9
Decimal Arithmetic Unit
BCD Addition
BCD Adder
BCD Code
▪ Example Analysis
▪ The mentioned codes are valid BCD codes.
▪ Now, we’ll look at the invalid BCD codes:
▪ Since we are using 4-bits to represent the
decimal digits, the total possibilities will be
24 = 16 and we are only representing (0-9),
i.e. 10 out of 16 possibilities. So, what about
the other ones?
▪ 10 - 15 are considered invalid since they are
not decimal digits rather decimal numbers.
Terms(X) are used to represent invalid cases.
BCD Code
▪ Examples
▪ (2)2 + (6)2
▪ (3)10 + (7)10
BCD Addition
▪ As discussed above by adding 6 we can
obtain the correct result. Now the question
may arise why 6 only?
▪ We know that we use the 4-bit binary number
to represent the decimal digits which are from
(0-9).
▪ Also, we know that with 4-bit there can be 16
(0-15) possibilities.
▪ But the valid cases are only from (0-9), by
this, we can calculate the invalid cases, i.e, 15
- 9 = 6.
BCD Addition
BCD Addition
BCD Adder
BCD Adder
▪ The digital system handles the decimal
number in the form of binary-coded decimal
numbers (BCD).
▪ A BCD Adder Circuit adds two BCD digits and
returns a BCD sum digit. BCD numbers use
digits, ranging from 0 to 9, which are
represented in binary as 0000 to 1001, i.e.
each BCD digit is a 4-bit binary number.
▪ The maximum value of output will be 19 (i.e.
9(1001)+9(1001)+1(carry =1) = 19).
▪ Here, we will only be obtaining the binary
Fig. BCD Adder
addition of the two numbers. To convert them
into the BCD form by using the BCD adder.
BCD Adder
▪ As a result, in order to build a BCD Adder
Circuit, we'll need:
○ 4-bit binary adder for initial addition
○ Logic circuit to detect sum greater than 9
○ One more 4-bit adder to add 0110(6) in the
sum if the sum is greater than 9 or carry is 1.
BCD Addition
BCD Adder
Lecture 12 Activity
1 activity.
Time for an
Lecture 12 Activity
2 activity.
Time for an