Asked in Math and Arithmetic
Who performs arithmetic operation on numerical data stored in registers?
Arithmetic operations are performed by using Boolean Gates in a register.
A register consists of 32 or 64 bits usually.
For eg we want to add two single bits A and B.
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Sum = A (xor) B; and
Carry = A (and) B
If you are adding more than one bit (8 bit, say).
Then you need 8 such operations.
Carry from one bit will be forwarded to another bit and would be taken into consideration.
Sum = A (xor) B (xor) Cprev
Carry(new) = A (and) B + B (and) Cprev + A (and) Cprev
+ = (or)
. = (and)