Chapter - 10: Computer Arithmetic
Chapter - 10: Computer Arithmetic
Chapter - 10: Computer Arithmetic
Computer Arithmetic
Flowchart for add and subtract operations
The flowchart for the hardware algorithm is presented in
fig.
The two signs Ai and Bi are compared by an exclusive-OR
gate.
If the output of the gate is 0, the signs are identical; if it is
1, the signs are different.
For an add operation, identical signs dictate that the
magnitudes be added.
For an subtract operation, different signs dictate that the
magnitudes be added.
The magnitudes are added with a microoperation
EA A+B
Where EA is a register that combines E and A.
Flowchart for add and subtract operations
The carry in E after the addition constitutes an overflow if it
is equal to 1.
The value of E is transferred into the add-overflow flip-flop
AVF.
The two magnitudes are subtracted if the signs are
different for an add operation or identical for a subtract
operation.
The magnitudes are subtracted by adding A to the 2’
complement of B.
No overflow can occur if the numbers are subtracted so
AVF is cleared to 0.
If E = 1, then the condition is A>=B and the number in A is
the correct result.
If E=0, then the condition A < B , for this is 2’complement of
the value is A.
Flowchart for add and subtract operations
The operation can be done one microoperation,