floating point addition
floating point addition in computer architecture
floating point alu
floating point addition
- For real floating point numbers addition we require full algorithm to be performed.The addition and subtraction happens on Mantissa.
Ex:
Addition of 4.0 and 2.0 floating point number
4 0 1 0 0
+ 2 0 0 1 0
= 6 0 1 1 0
floating point alu
Let two floating point number both will have mantissa and Exponent.
X=Xm.2XE
Y=Ym.2YE
M is mantissa,E is exponent.
- Alu has two different units for the addition and subtraction operation on floating point.
- Addition and subtraction i.e core arithmetic will only happen on mantissa.
1)Exponent unit
2)Mantissa unit.
- Here the first block is an exponential unit having E1 and E2 as two input exponents and E is the result of E1 – E2 .
- Second block is the mantissa unit where AC stores the mantissa value of one input and DR stores mantissa value of another input.
- Adder here is the adder/subtractor circuit.
- MQ is the multiplication circuit(will be explained in later discussion)
Algorithm:
1)First exponents are compared.
- Two exponents are given to the adder/subtractor circuit.
- E1-E2 if the result is 0 both exponents are equal.
- E result of E1-E2,If result is 0 only then have permission to add mantissa.
2)Perform arithmetic in the mantissa unit.
3)If not equal then perform a shift of mantissa until exponents are equal.
(always get the lower one higher because we can get ready normalized form)
4)after adding check error cases.
floating point addition in computer architecture
Steps to perform addition of floating point in computer architecture is as follows:
Inputs: AC ← Xm, E1 ←XE ; Ac – overflow ← 0
DR ← Ym, E2 ←YE ; Error ← 0
Compare: E ← E1-E2
Equalise: If (E<0) then
{
AC ← Right Shift(AC)
E←E+1
Go to equalise
}
If (E>0) then
{
DR ← Right Shift(DR)
E←E-1
Go to equalise
ADD: AC←AC+DR
E←max(E1,E2)
Until add step addition operation is completed,after that the computer even checks for the error cases,they are performed as follows
Overflow: If(AC Overflow=1) then
{
If (E=Emax)then go to error
AC←right shift(AC)
E←E+1
Go to end
}
Normalise: if(AC normalise) then
Go to end
Zero: if(AC=0) then
E←0
Underflow: if(E>Emin)then
{
AC←leftshift(AC)
}
Go to normalise
Error: Error←1
End: end of process