Project Report Vlsi
Project Report Vlsi
HBTU, KANPUR
PROJECT REPORT
SESSION-2020-21
1
ABSTRACT
2
ACKNOWLEDGEMENT
3
4
INDEX
1. Abstract 3
2. Introduction 6-8
4. Algorithms 10-14
9. Future Scope 31
10. References 32
5
INTRODUCTION
6
Moreover, these efforts demonstrate that such customized
formats enable significant speedups for certain chosen
applications. The earliest work on IEEE floating-point [7]
focused on single precision although found to be feasible but
it was extremely slow. Eventually, it was demonstrated [8]
that while FPGAs were uncompetitive with CPUs in terms of
peak FLOPs, they could provide competitive sustained
floating-point performance. Since then, a variety of work [2,
5, 9, 10] has demonstrated the growing feasibility of IEEE
compliant, single precision floating point arithmetic and
other floating-point formats of approximately same
complexity. In [2, 5], the details of the floating-point format
are varied to optimize performance. The specific issues of
implementing floating-point division in FPGAs have been
studied [10]. Early implementations either involved multiple
FPGAs for implementing IEEE 754 single precision floating-
point arithmetic, or they adopted custom data formats to
enable a single-FPGA solution. To overcome device size
restriction, subsequent single-FPGA implementations of IEEE
754 standard employed serial arithmetic or avoided features,
such as supporting gradual underflow, which are expensive
to implement. In this paper, a high-speed IEEE754-compliant
32-bit floating point arithmetic unit designed using VHDL
code has been presented and all operations of addition,
subtraction, multiplication and division got tested on Xilinx
and verified successfully. Thereafter, the new feature of
creating Simulink model using MAT lab for verification of
VHDL code of that 32-bit Floating Point Arithmetic Unit in
Modelsim has been explained. The simu lation results of
7
addition, subtraction, multiplication and division in Modelsim
wave window have been demonstrated.
8
FLOATING POINT ARCHITECTURE
S EEEEEEEE MMMMMMMMMMMMMMMMMMMMMM
S: Sign – 1 bit
E: Exponent – 8 bits
M: Mantissa – 23 bits Fraction
9
An extra bit is added to the mantissa to form what is called
the significand. If the exponent is greater than 0 and smaller
than 255, and there is 1 in the MSB of the significand then
the number is said to be a normalized number; in this case
the real number is represented by
Where M = m22 2-1 + m21 2-2 + m20 2-3 +…+ m1 2- 22+m0 2-23;
Bias = 127.
10
ALGORITHMS FOR FLOATING POINT
ARITHMETIC UNIT
11
12
A description of the proposed implementation algorithm is as
follows :-
13
9. Using the results from the leading one detector, the result
is then shifted left to be normalized. In some cases, 1-bit right
shift is needed.
11. If the carry out from the rounding adder is 1, the result is
left shifted by one.
12. Using the results from the leading one detector, the
exponent is adjusted. The sign is computed and after
overflow and underflow check, the result is registered.
14
BLOCK DIAGRAM OF STANDARD FLOATING
POINT ADDER
15
• To identify if e1 is smaller than e2.
2) Right shift shifter: The right shifter is used to shift right the
significand of the smaller operand by the absolute exponent
difference. This is done so that the two numbers have the
same exponent and normal integer addition can be
implemented. Right shifter is one of the most important
modules when designing for latency.
5) Left shift shifter: Using the results from the LOD, the result
from the adder is shifted left to normalize the result. That
means now the first bit is 1. This shifter can be implemented
using “shl” operator in VHDL or by describing it behaviorally
using „case‟ statements.
16
added to the result if r and s bit are 1 or r and either of the
last two bits of the normalized result is 1. This step is really
important to assure precision and omit loss of accuracy.
17
VHDL CODE
end component
component fpa_seq is
port(
n1,n2:in std_logic_vector(32 downto 0)
clk:in std_logic
sum:out std_logic_vector(32 downto 0)
)
end component
component fpm is port(in1,in2:in std_logic_vector(31 downto 0)
18
out1:out std_logic_vector(31 downto 0)
)
end component
signal out_fpa: std_logic_vector(32 downto 0)
signal out_fpm,out_div: std_logic_vector(31 downto 0)
signal in1_fpa,in2_fpa: std_logic_vector(32 downto 0)
begin in1_fpa<=in1&'0'
in2_fpa<=in2&'0'
fpa1:fpa_seq port map(in1_fpa,in2_fpa,clk,out_fpa)
fpm1:fpm port map(in1,in2,out_fpm)
fpd1:divider port map(clk,'0','1',in1,in2,out_div)
process(sel,clk) begin if(sel="01")then output1<=out_fpa(32 downto 1)
elsif(sel="10")then output1<=out_fpm
elsif(sel="11")then output1<=out_div
end if
end process
end fp_alu_struct
FPA BEHAVIOUR
entity fpa_seq is port(n1,n2:in std_logic_vector(32 downto 0)
clk:in std_logic
sum:out std_logic_vector(32 downto 0))
end fpa_seq
architecture Behavioral of fpa_seq is
--signal f1,f2:std_logic_vector(23 downto 0):="000000000000000000000000"
signal sub_e:std_logic_vector(7 downto 0):="00000000"
19
signal s33:std_logic_vector(23 downto 0):="000000000000000000000000"
signal s2_temp :std_logic_vector(23 downto 0):="000000000000000000000000"
signal diff:std_logic_vector(7 downto 0):="00000000"
----------sub calling---------------------------------------------
-------------------- sub(e1,e2,d)
if(d>="00011100")then sum<=num1
elsif(d<"00011100")then shift_count:=conv_integer(d)
shift_count1<=shift_count
num2_temp2<=num2
--s2_temp<=s2
--------------shifter calling-------------------------------------
-------------------- shift(s2,shift_count,s3)
--s33<=s3
end if
end if
else s3:=s3
-- end if
20
---------------------same sign start ---------------adder 8 calling---------------
adder8(e2,d,e3)
sub_e<=e3
num1_temp:=n1(32)& e1 & s1
num2_temp:=n2(32)& e3 & s3
else
sum<=n1(32)& e3 & s4
end if
end if
end if
end if
----same sign end end if
21
FPM BEHAVIOUR
entity fpm is port(in1,in2:in std_logic_vector(31 downto 0)
out1:out std_logic_vector(31 downto 0))
end fpm
architecture Behavioral of fpm is procedure adder( a,b:in std_logic_vector(7 downto 0)
-------------------------------------------multiplier-------------
------------------
procedure multiplier ( a,b : in STD_LOGIC_VECTOR
(23 downto 0)
y : out STD_LOGIC_VECTOR (47 downto 0))is variable temp,prod:std_logic_vector(47
downto 0)
begin temp:="000000000000000000000000"&a
prod:="000000000000000000000000000000000000000
000000000"
prod:=prod+temp
22
end if
temp:=temp(46 downto 0)&'0'
end loop
y:=prod
end multiplier
--------------------------end multipier--------------------------
--------------------- begin process(in1,in2) variable sign_f,sign_in1,sign_in2: std_logic:='0'
variable e1,e2: std_logic_vector(7 downto
0):="00000000"
0):="000000000"
0):="00000000000000000000000000000000000000000
0000000"
0):="00000000000000000000000000000000000000000
0000000"
variable bias:std_logic_vector(8 downto 0):="001111111"
0):="00000000"
0):="000000000"
0):="000000000"
begin sign calculation sign_in1:=in1(31)
23
sign_in2:=in2(31)
sign_f:=sign_in1 xor sign_in2
FPD BEHAVIOUR
end divider
architecture design of divider is signal x_reg : std_logic_vector(31 downto 0)
signal y_reg : std_logic_vector(31 downto 0)
signal x_mantissa : std_logic_vector(23 downto 0)
signal y_mantissa :
std_logic_vector(23 downto 0)
signal z_mantissa : std_logic_vector(23 downto 0)
signal x_exponent : std_logic_vector(7 downto 0)
signal y_exponent : std_logic_vector(7 downto 0)
signal z_exponent : std_logic_vector(7 downto 0)
signal x_sign : std_logic
signal y_sign : std_logic
signal z_sign : std_logic
signal sign : std_logic
signal SC : integer range 0 to 26
signal exp : std_logic_vector(9 downto 0)
signal EA : std_logic_vector(24 downto 0)
24
signal B : std_logic_vector(23 downto 0)
signal Q : std_logic_vector(24 downto 0)
type states is (reset, idle, s0, s1, s2, s3, s4)
signal state : states
begin x_mantissa <= '1' & x_reg(22 downto 0)
x_exponent <= x_reg(30 downto 23)
x_sign <= x_reg(31)
y_mantissa <= '1' & y_reg(22 downto 0)
y_exponent <= y_reg(30 downto 23)
y_sign <= y_reg(31)
process(clk) begin if clk'event and clk = '1' then if res = '1' then state <= reset
exp <= (others => '0')
sign <= '0'
x_reg <= (others => '0')
y_reg <= (others => '0')
z_sign <= '0'
25
overflow <= '0'
SC <= 25
done <= '0'
sign <= x_sign xor y_sign
B <= y_mantissa
exp <= ("00" & x_exponent) + not ("00" & y_exponent) + 1 + "0001111111"
when s1 => if (y_mantissa = x"800000" and y_exponent = x"00") then
overflow <= '1'
z_sign <= sign
z_mantissa <= (others => '0')
z_exponent <= (others => '1')
then Q <= Q (23 downto 0) & '0'
exp <= exp - 1
end if
state <= s4
else
EA <= EA(23 downto 0) & Q(24)
Q <= Q(23 downto 0) & '0'
state <= s1
end if
end design;
26
RESULT OF VHDL CODE
27
Simulation result of decimal inputs 2.5 & 4.75 for „adder‟ in
Modelsim wave window
28
ADVANTAGES AND APPLICATIONS
ADVANTAGES:
APPLICATIONS:
29
The floating point adder is used in such as :
1. CPU
2. Calculators
30
CONCLUSIONS & FUTURE SCOPE
31
REFERENCES
32
33