0% found this document useful (0 votes)
54 views

Float Point Multiplier

The document describes a floating-point multiplier that performs multiplication of two IEEE single-precision floating-point numbers in four steps: multiplying the mantissas, normalizing the result, adding the exponents, and calculating the sign. An example multiplication of -18.0 x 9.5 is shown step-by-step to illustrate the algorithm. The author also proposes designing an FP multiplier in VHDL and testing it on an Altera board with sample multiplications.

Uploaded by

Dang Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Float Point Multiplier

The document describes a floating-point multiplier that performs multiplication of two IEEE single-precision floating-point numbers in four steps: multiplying the mantissas, normalizing the result, adding the exponents, and calculating the sign. An example multiplication of -18.0 x 9.5 is shown step-by-step to illustrate the algorithm. The author also proposes designing an FP multiplier in VHDL and testing it on an Altera board with sample multiplications.

Uploaded by

Dang Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

A Floating-Point Multiplier

Eduardo Sanchez
EPFL HEIG-VD

An overview of the IEEE FP format


-9.5 = -1.0011x23

sign

mantissa

exponent
23

1 10000010 00110000000000000000000




The number, in binary, must be normalized: the integer part must


always be equal to 1
The exponent, an integer value, is not represented in 2complement, but in a biased representation: a bias of 127 is
added to the exponent
Eduardo Sanchez




As the value 0 can not be normalized, a special representation is


reserved for: all bits to zero
In general, the values 00000000 and 11111111 from the exponent
field are reserved for special cases and are not biased values:
 00000000 is used for non-normalized values
 11111111 is used for infinity and NaN (not a number)

Eduardo Sanchez

Multiplication algorithm

A multiplication of two floating-point numbers is done in four steps:


 non-signed multiplication of mantissas: it must take account of the integer





part, implicit in normalization. The number of bits of the result is twice the
size of the operands (48 bits)
normalization of the result: the exponent can be modified accordingly
addition of the exponents, taking into account the bias
calculation of the sign

Eduardo Sanchez

Example





Let's suppose a multiplication of 2 floating-point numbers A and


B, where A=-18.0 and B=9.5
Binary representation of the operands:
A = -10010.0
B = +1001.1
Normalized representation of the operands:
A = -1.001x24
B = +1.0011x23
IEEE representation of the operands:
A = 1 10000011 00100000000000000000000
B = 0 10000010 00110000000000000000000

Eduardo Sanchez

Multiplication of the mantissas:


 we must extract the mantissas, adding an1 as most significant bit, for





normalization
100100000000000000000000
100110000000000000000000
the 48-bit result of the multiplication is:
0x558000000000
only the most significant bits are useful: after normalization (elimination of
the most significant 1), we get the 23-bit mantissa of the result. This
normalization can lead to a correction of the result's exponent
in our case, we get:
01 01010110000000000000000 0000000000000000000000

Eduardo Sanchez

Addition of the exponents:


 exponent of the result is equal to the sum of the operands exponents. A 1

can be added if needed by the normalization of the mantissas


multiplication (this is not the case in our example)
as the exponent fields (Ea and Eb) are biased, the bias must be removed in
order to do the addition. And then, we must to add again the bias, to get
the value to be entered into the exponent field of the result (Er):
Er = (Ea-127) + (Eb-127) + 127
= Ea + Eb 127
in our example, we have:
Ea
Eb
-127
Er

10000011
10000010
10000001
10000110

what is actually 7, the exponent of the result

Eduardo Sanchez

Calculation of the sign of the result:


 the sign of the result (Sr) is given by the exclusive-or of the operands signs

(Sa and Sb):


Sr = Sa  Sb
in our example, we get:
Sr = 1  0 = 1
i.e. a negative sign

Composition of the result:


the setting of the 3 intermediate results (sign, exponent and
mantissa) gives us the final result of our multiplication:
1 10000110 01010110000000000000000

AxB = -18.0x9.5 = -1.0101011x2134-127 = -10101011.0 = -171.010


Eduardo Sanchez

Laboratory



Design, writing in VHDL, a hardware multiplier of 2 floating-point


numbers A and B, represented using the simple precision IEEE
format (32 bits)
Synthesize your program for the Altera board and verify its
behavior. Try for example with:
 A=134.0625 and B=-2.25
 A=-14.5 and B=-0.375
 A=7.5 and B=15.5

Eduardo Sanchez

Solutions


A = 134.0625 = 1.00001100001x27
A = 0 10000110 00001100001000000000000 = 0x43061000
B = -2.25 = -1.001x21
B = 1 10000000 00100000000000000000000 = 0xC0100000
AxB = -301.640625 = -1.00101101101001x28
AxB = 1 10000111 00101101101001000000000 = 0xC396D200
A = -14.5 = -1.1101x23
A = 1 10000010 11010000000000000000000 = 0xC1680000
B = -0.375 = -1.1x2-2
B = 1 01111101 10000000000000000000000 = 0xBEC00000
AxB = 5.4375 = 1.010111x22
AxB = 0 10000001 01011100000000000000000 = 0x40AE0000
Eduardo Sanchez

10

A = 7.5 = 1.111x22
A = 0 10000001 11100000000000000000000 = 0x40F00000
B = 15.5 = 1.1111x23
B = 0 10000010 11110000000000000000000 = 0x41780000
AxB = 116.25 = 1.11010001x26
AxB = 0 10000101 11010001000000000000000 = 0x42E88000

Eduardo Sanchez

11

0
1

0
1

0
4

0
1

0
4

+
5

AxB

Eduardo Sanchez

12

You might also like