Floating Point ALU Design PDF
Floating Point ALU Design PDF
ABSTRACT For double precision IEEE 754 standard, the difference in the
The 32-bit and 64-bit Floating point Arithmetic Logic Unit is Fig 1 is Exponent is 11 bit wide and mantissa is 52 bit wide.
a main part in the design of computers. The Aim of this paper
is high performance through the pipelining concept compared The format for the single precision is written below.
to non-pipelining. This ALU includes all the arithmetic and
logical operations. The Pipelined modules are independent of (1)
each other. The novelty is to design pipelined modules like
left shift, right shift, increment, decrement and logical Where 0<e<255 and .
modules. The Arithmetic pipelined modules are also
modified. These modules use single and double precision For double precision, the difference is in the exponent. It is
IEEE 754 standard to carry out the required operation. All 1023 instead of 127 and the range of e is 0<e<2047.
modules in the ALU design are realized using Verilog HDL.
Test vectors are given to the inputs of the floating point ALU ALU is a digital module that performs all the arithmetic and
to testify its functionality. The simulation is carried out with logical operations. It is an important block in CPU.
ModelSim 6.5b simulator and RTL synthesis is done with Depending on the selection bits ALU executes the appropriate
RTL Compiler tool in Cadence. Physical design of this operation and gives the result. Along with ALU output there
architecture is done with SoC Encounter cadence tool in are also status bits which represent exception in the arithmetic
180nm technology. operations. They are result zero, overflow, and underflow,
divide by zero and normal operation. Pipelining is a special
General Terms technique to give the faster output and reduce the delay in the
Algorithm, Floating point number. design. It allows many operations to occur in parallel.
Pipelining reduces the critical path in the circuit hence
Keywords increases the speed.
, ALU, ASIC, IEEE 754, LSB, MSB, Verilog HDL.
Generally in Pipelining, each operation of the stage is
1. INTRODUCTION performed at each clock pulse and concurrently the output of
Floating Point numbers are used when there is necessity the previous stage is given to the next stage so there is no
numbers to be very large or to be very small [1]. Floating waste of clock pulse in the pipelining [3].Implementing
point representation has its advantages of its resolution and pipelined architecture of floating point ALU gives faster
accuracy compared to fixed point number representation. results. The proposed 32 and 64 bit proposed floating point
Numbers in the floating point are represented in the form of ALU carry out 16 different arithmetic and logical operations
bit string. This bit string is combination of sign bit, mantissa with pipelining [4]. The modified addition, multiplication and
and exponent power. This representation is called IEEE 754 division algorithms of the floating point numbers are designed
standard [2].The single precision of floating Point is shown in using Verilog HDL. The proposed Left shift, Right shift,
Fig 1[2]. Increment, Decrement and all logical modules are also
implemented for Single precision and double precision.
31 30 22
In Proposed Pipelined modules, there are maximum 6 stages
as shown in the Fig 2 .So, after 6 clock pulse, the first output
Sign Exponent Mantissa comes and at 7th clock pulse second output comes. It reduces
the number of clock pulses.
27
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
ADD 2:1
MUX
NOT
a
DEMUX s
16 bit Selection
bits[4:0]
{
16 bit
MUX
OUT
SUB
Fig 4: Modified top level view of 32 bit Floating Point
b DEMUX
ALU
16 bit
28
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
Table 2. Status bits and status For 64 bit add/sub, The procedure is same but the mantissa
and exponent bits are 52 bits and 11 bits wide. For 32 and 64
Status bits[2:0] Status bit subtraction, the change is in the operation of the mantissa
No. i.e. addition becomes subtraction and vice versa.
1 000 Result zero
2 001 Overflow 3.3.2 Modified Pipelined Addition/Subtraction
3 010 Underflow architecture
4 011 Normal Operation For this addition/subtraction algorithm, new 32 bit pipelined
5 100 Divide by Zero addition/subtraction module has been implemented. D-FF is
used for the pipelining. It is shown in Fig 6.
m1d shifter
m1 mc1 mc1d
D- D- st std
view of 64 bit floating point is constructed as in the Fig 4. But FF FF D-
FF
the inputs and output is 64 bit instead of 32 bit. m2 D- m2d mc2 D- mc2d
FF FF
29
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
The modified 64-bit pipelined floating point add/sub module The working of the Fig. 8 is explained below.
is implemented by changing the mantissa and exponent bits in
the operands. 3.4.2.1 Sign Calculation module
This module calculates the output sign of the resultant
3.4 Modified 32-bit and 64-bit Pipelined mantissa by doing the XOR operation of the two sign bits of
the operands .If the resultant sign is 0 ,then the result is
floating point Multiplication module positive and vice versa.
The algorithm and architecture for the 32 and 64 bit pipelined
floating point multiplication has been implemented. 3.4.2.2 Exception adder with bias subtraction
It computes the result exponent by adding the exponents of
3.4.1 Modified Multiplication Algorithm two operands with bias subtraction of (01111111) b
It is shown in Fig 7.
3.4.2.3 Mantissa Multiplier module
Start This module will calculate the multiplication of the two
mantissas. Here the multiplication should be done for 24x24
Take two floating point in single precision and 53x53 in double precision .But to
numbers in IEEE 754 reduce the area 12x12 multiplication has been done in the
standard implementation of mantissa multiplier module .For the
Separate mantissa, exponent
multiplication carry save multiplier has been used because of
and sign bits and add the its less use number of half adder and full adder.
implied bit in the mantissa
The 64 bit pipelined floating point multiplication module is
Calculate the sign Add the exponents
Multiply Mantissas of implemented by changing the mantissa and exponent bits in
of the result by and subtract the
two operands the operands.
XOR operation bias
Start
Check the exception
and raise the status Take two floating point
bits numbers in IEEE 754
standard
For 64 bit multiplication, the procedure is same but the Divide m1 by m2 and
compute the result
mantissa and exponent bits are 52 bits and 11 bits wide mantissa
instead of 23 bit in mantissa and 8 bit in exponent in 32 bit
multiplication.
Left shift mantissa
Normalization Is the MSB of until MSB becomes 1
Yes
3.4.2 Modified Pipelined Multiplication is not needed the result No
and decrement the
mantissa 1? exponent by 1
architecture
sr
s1 D-
FF
s1d Sign Calculation sc D- scd e5 sn mfD- snd
sed
FF FF se D-
s2 D- s2d module FF
32 bit FF ec ecd
Operand a D- out[31:0]
e1d
FF
Check the exception
Unpack
e1 D-
FF
Exponent adder Normalize en Exception mc mcd and raise the status
Operand b with bias e3 D- e3d D- ed
D-
FF Packer status[2:0] bits
32 bit module e2 D-
FF
e2d FF
module FF
Checker st
m1
subtraction D-
FF
std
D- m1d
FF
Mantissa Compute the final mantissa & drop
m2 m2d m3 D- m3d mn D- mnd implied bit ,then combine resultant
D-
FF Multiplier FF FF
mantissa ,exponent and sign bit to
Clock module form the IEEE 754 format
Terminate
Fig 8: 32-bit pipelined multiplication architecture
Fig 9: Flowchart for modified division algorithm
30
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
32 bit
module FF
s2 s2d
Operand a D-
FF
ec D- ecd out[31:0]
FF
e1d e3
Unpack e1 D-
FF Exponent Normalize Exception mc D- mcd
Operand b e4
e D- e3d en D- ed FF Packer status[2:0]
32 bit module e2 D- e2d subtractor FF
module FF
Checker st
D- std
FF
Division FF
m1 m1d m3
D-
FF Aligner Divider m5 D-
FF
m5d mn D-
FF
mnd
m2 m4
m2d fn
D-
FF flag module fg D-
FF
fgd D-
FF
fnd
Clock
sr
MUX
FF Unpack e1 D-
Exponent e Normalize en Exception mc D- mcd
FF
e4
D- e3d D- ed FF Packer status[2:0] Fig 12: 32-bit proposed pipelined Left Shift architecture
module Recipro subtractor module Checker st
FF FF
Operand b D- std
FF
32 bit
m1 D- m1d -cal m3 mn As Shown in Fig 12, the unpack module, Exception checker
m5 D- m5d D- mnd
Aligner m4 Divider
FF
FF FF
fn
and Packer module are same as described in the section 3.3.2.
flag module fg D- fgd D- fnd
Selection
FF FF
The new block is left shifter. It is explained below.
bit
Clock
3.7.1 Left Shifter
Fig 11: 32- bit proposed pipelined Reciprocal architecture This module will shift the mantissa part of the floating point
i.e. the exponent will be incremented by 1.
3.6.1 2:1 Multiplexer
This multiplexer will select one operand out of two operands
which is to be reciprocal.
31
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
Selection
bit
Clock
For Right shift architecture, the difference is in the Right 3.9.3 AND Gate
shifter instead of Left shifter in the Fig. 12.In Right shifter, This gate is used to perform the Logical AND operation of the
the exponent will be decremented by 1 to get the operand mantissas of two operands.
right shifted.
The Logical modules like OR, NOR, NOT, XOR & XNOR
3.8 The Proposed 32 and 64-bitFloating are implemented by changing the gate in the Fig 14 instead of
Point Increment and Decrement AND gate. The new 64 bit pipelined floating point Logical
modules for the above operations are implemented by
architecture changing the operand bit size 64 instead of 32bit.
The working of Fig.13 is explained below.
4. RESULTS AND DISCUSSION
3.8.1 Comparator and shifter The Simulations has been done in ModelSim 6.5 by giving the
different test vectors to the 32 and 64 bit Floating point ALU
This module will compare the exponent of the operand to the
with pipelined modules. The Simulation results are shown by
011111111 in single precision and 01111111111 in double
merging the two operations of the ALU. The Synthesis results
precision, because to increment the number by 1, add the
in 180 nm of both ALU are shown in the TABLE 3.
mantissa to 1. So, the single precision IEEE 754 standard
format of 1 is 3F800000 and double precision is For 32-bit and 64-bit operations of ALU, the inputs and
3FF0000000000000.Comparator will compare this exponent outputs are in the form of IEEE 754 standard. For example,
and shifter will shift the mantissa of 1 by the difference of the the addition & subtraction are performed as under.
exponent of the operand and exponent of 1.
Operand 1= (21.43) d = (41ab70a4) h= (40356e147ae147ae) h.
3.8.2 Mantissa Increment by 1 Operand 2 = (7.23) d = (40e75c29) h= (401ceb851eb851ec) h.
This module will add or subtract the mantissa with the Output = (28.67) d= (41E55C29) h= (403cae147ae147ae) h.
mantissa of 1 depending upon the sign of the first operand. For Subtraction,
Operand 1= (15.25) d = (41740000) h= (402e800000000000) h.
For Decrement architecture, the difference is in the Mantissa Operand 2 = (-5.5) d = (c0b00000) h= (C016000000000000) h.
decrement by 1 instead of Mantissa increment by 1 in the Fig Output = (20.75) d= (41a60000) h= (4034c00000000000) h.
13.Decrement architecture, the mantissa will be subtracted
with 1 instead of addition.
4.1 Simulation Results for 32-bit and 64-bit
3.9 The proposed 32-bit and 64-bit Floating Point ALU
Pipelined Logical modules
sc1
s1 D-
FF
s1d D-
FF
sc1d XOR
32 bit
s2 D- s2d sc2 D- sc1d Gate sr srd sr1 sr1d sr2 sr2d
Operand a
FF
Comparator FF D-
FF
D-
FF
D-
FF out[31:0]
e1d
Unpack
e1 D-
FF and e3 D-
FF
e3d Exponent e5 D-
e5d
Normalize en D- ed Exception ec D-
ecd
Operand b FF FF FF
Packer
32 bit module
e2 D-
FF
e2d Barrel e4 D-
FF
e4d Passer mf D-
mfd module
mn D- mnd Checker mc D- mcd status[2:0]
FF FF FF
32
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
33
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
Table 4 Parameters for 64 bit Floating Point ALU with 4.3 Backend Results
and without Pipelining
34
International Journal of Computer Applications (0975 – 8887)
Volume 94 – No.17, May 2014
[4] Mamu Bin Ibne Reaz, MEEE, Md. Shabiul Islam, [15] Surendra Singh Rajpoot, Nidhi Maheshwari, D.S. Yadav,
MEEE, Mohd. S. Sulaiman, MEEE,” Pipeline Floating ”Design and Implementation of efficient 32-bit floating
Point ALU Design using VHDL” ICSE2002 Proc. Point multiplier using verilog”, International Journal of
2002 , Penang, Malaysia. Engineering and Computer Science,Vol-2 ,Issue 6,June
2013,Page no.2098-2101.
[5] Shao Jie, Ye Ning, Zhang Xiao-Yan,” An IEEE
compliant Floating-point Adder with the Deeply [16] A book on “Verilog HDL: A Guide to Digital Design and
Pipelining paradigm on FPGAs”, 2008 International Synthesis” by. Samir Palnitkar , second edition.
Conference on Computer Science and Software [17] A User Manual on “GUI Guide for Encounter® RTL
Engineering. Compiler” by cadence®, Product Version 6.1, June,
[6] Prashant Gurjar, Rashmi Sola Pooja Kansliwal, 2006.
Mahendra Vucha, “VLSI Implementation of Adders for [18] A User Manual on “Using Encounter® RTL Compiler”
High Speed ALU. by cadence®, Product Version 9.1, September 14, 2009.
[7] A. Anand Kumar Book,” Fundamentals of Digital [19] Website:http://babbage.cs.qc.cuny.edu/IEEE-
Circuits”. 754.old/32bit.html.
[8] V.Narasimha rao, V.Swathi,” Normalization on floating [20] Website:http://www.academic.marist.edu/~jzbv/architect
point multiplication using Verilog HDL”, International ure/MultiplicationDivisionFP.htm.
Journal of VLSI and Embedded Systems-IJVES,
ISSN: 2249 – 6556.
IJCATM : www.ijcaonline.org 35