Microsoft Word - Digital Logic Design v_4_6a

(lily) #1

1.8. Binary Arithmetic


All of today’s computer systems use RC numbers (2’s complement) for binary arithmetic operations. The
reset of this section provides description of Binary Arithmetic using RC numbers.


 Addition of Signed Binary Numbers
When adding RC numbers, simply add then ignore the left-most carry.


+7  0 1 1 1
+(-2)  1 1 1 0
----------
0 1 0 1 “Ignore the left-most carry, and the result is +5”

Notes:


  • The left-most bit is a sign bit and there are three magnitude bits.

  • As long as we know results fits within the 1 sign-bit and n magnitude bits, this process
    works. Otherwise we need to consider the overflow.


 Addition of Unsigned Binary Numbers
Unsigned addition Signed works exactly the same way as singed addition, allowing us to use the
same circuitry.


+7  0 1 1 1
+3  0 0 1 1
----------
1 0 1 0 “Result is +10. If there is a carry beyond the available bits, then an
an overflow has occurred.

 Overflow
 An overflow occurs when the addition of two numbers results in a number larger than can be
expressed with the available number of bits.


 Example – performing the operation, 8+9=17; in a 4-bit word system, results in an overflow
since 4 bits can only store 0 to 15. The result will show as a 1, which is 16 less than the
correct result.

 Detecting overflow
 Unsigned number addition
If the addition has a carry beyond the available bits then an overflow has occurred.

 Signed (RC, 2’s complement) number addition


  • If the operands have different signs, then overflow cannot occur, since one number is
    being subtracted from the other.

  • If the operands have the same sign and the result has a different sign, then an overflow
    has occurred.
    A quick way to identify an overflow situation is when the carry into the sign-bit position
    and the carry out of sign-bit position are different. Example

Free download pdf