Chapter 04 Computer Arithmetic
Chapter 04 Computer Arithmetic
Computer Architecture
and Organization
0 = 00000000
Bitwise not =11111111
Add 1 to LSB +1
Result 1 00000000
Bit 1 at most significant bit is Overflow, so it will be ignored, so:
- 0 = 0 , as a result 0 is represented in single binary using twos
complement
-128 = 10000000
bitwise not= 01111111
Add 1 to LSB +1
Result =10000000, So:
-(-128) = -128 , here we expected the twos complement of
negative number is positive but the result is similar which is un
avoidable for this number only
On any addition, the result may be larger than can be held in the
word size being used, this condition is called overflow
When overflow occurs, the ALU must signal this fact so that no
attempt is made to use the result
To detect overflow, the following rule is observed:
OVERFLOW RULE: If two numbers are added, and they are
both positive or both negative, then overflow occurs if and only if
the result has the opposite sign.
When the event occurs, a 1 is placed in the quotient and the divisor is
subtracted from the partial dividend
The result is referred to as a partial remainder
At each cycle, additional bits from the dividend are appended to the
partial remainder until the result is greater than or equal to the
divisor
The divisor is subtracted from this number to produce a new partial
remainder
The process continues until all the bits of the dividend are exhausted
Computer Architecture
and Organization