-
Notifications
You must be signed in to change notification settings - Fork 1
/
SOMMATORE_IEEE754.vhd
213 lines (173 loc) · 4.32 KB
/
SOMMATORE_IEEE754.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity SOMMATORE_IEEE754 is
port(
X : in std_logic_vector(31 downto 0);
Y : in std_logic_vector(31 downto 0);
SUB : in std_logic;
Z : out std_logic_vector(31 downto 0);
CLK : in std_logic;
RST : in std_logic
);
end SOMMATORE_IEEE754;
architecture Behavioral of SOMMATORE_IEEE754 is
signal rIN_X : std_logic_vector(31 downto 0);
signal rIN_Y : std_logic_vector(31 downto 0);
signal rIN_SUB : std_logic;
component DENORMALIZE is
port(
X : in std_logic_vector(31 downto 0);
Y : in std_logic_vector(31 downto 0);
SUB : in std_logic;
DNORMX : out std_logic_vector(24 downto 0);
DNORMY : out std_logic_vector(24 downto 0);
EXP : out std_logic_vector(7 downto 0)
);
end component;
signal DNORMX : std_logic_vector(24 downto 0);
signal DNORMY : std_logic_vector(24 downto 0);
signal EXP : std_logic_vector(7 downto 0);
signal r1_DNORMX : std_logic_vector(24 downto 0);
signal r1_DNORMY : std_logic_vector(24 downto 0);
signal r1_EXP : std_logic_vector(7 downto 0);
signal r2_EXP : std_logic_vector(7 downto 0);
component CLU is
port(
X : in std_logic_vector(31 downto 0);
Y : in std_logic_vector(31 downto 0);
SUB : in std_logic;
PINF : out std_logic;
NINF : out std_logic;
NAN : out std_logic
);
end component;
signal PINF : std_logic;
signal NINF : std_logic;
signal NAN : std_logic;
signal r1_PINF : std_logic;
signal r1_NINF : std_logic;
signal r1_NAN : std_logic;
signal r2_PINF : std_logic;
signal r2_NINF : std_logic;
signal r2_NAN : std_logic;
component DENORMALIZED_SUM is
port(
X : in std_logic_vector(24 downto 0);
Y : in std_logic_vector(24 downto 0);
M : out std_logic_vector(23 downto 0);
SIGN : out std_logic;
INCR : out std_logic
);
end component;
signal M : std_logic_vector(23 downto 0);
signal SIGN : std_logic;
signal INCR : std_logic;
signal r2_M : std_logic_vector(23 downto 0);
signal r2_SIGN : std_logic;
signal r2_INCR : std_logic;
component NORMALIZE is
port(
SIGN : in std_logic;
EXP : in std_logic_vector(7 downto 0);
MAN : in std_logic_vector(23 downto 0);
INCR : in std_logic;
PINF : in std_logic;
NINF : in std_logic;
NAN : in std_logic;
Z : out std_logic_vector(31 downto 0)
);
end component;
signal OUTPUT : std_logic_vector(31 downto 0);
signal rOUT_Z : std_logic_vector(31 downto 0);
begin
U1: DENORMALIZE
port map(
X => rIN_X,
Y => rIN_Y,
SUB => rIN_SUB,
DNORMX => DNORMX,
DNORMY => DNORMY,
EXP => EXP
);
U2: CLU
port map(
X => rIN_X,
Y => rIN_Y,
SUB => rIN_SUB,
PINF => PINF,
NINF => NINF,
NAN => NAN
);
U3: DENORMALIZED_SUM
port map(
X => r1_DNORMX,
Y => r1_DNORMY,
M => M,
SIGN => SIGN,
INCR => INCR
);
U4: NORMALIZE
port map(
SIGN => r2_SIGN,
EXP => r2_EXP,
MAN => r2_M,
INCR => r2_INCR,
PINF => r2_PINF,
NINF => r2_NINF,
NAN => r2_NAN,
Z => OUTPUT
);
Z <= rOUT_Z;
CLOCK: process(CLK, RST)
begin
if (RST = '1') then
-- INPUT registers
rIN_X <= (others => '0');
rIN_Y <= (others => '0');
rIN_SUB <= '0';
-- DENORMALIZE registers
r1_DNORMX <= (others => '0');
r1_DNORMY <= (others => '0');
r1_EXP <= (others => '0');
r2_EXP <= (others => '0');
-- CLU registers
r1_PINF <= '0';
r1_NINF <= '0';
r1_NAN <= '0';
r2_PINF <= '0';
r2_NINF <= '0';
r2_NAN <= '0';
-- SUM registers
r2_M <= (others => '0');
r2_SIGN <= '0';
r2_INCR <= '0';
-- NORMALIZE registers (output)
rOUT_Z <= (others => '0');
else
if (CLK'EVENT and CLK = '1') then
-- INPUT registers
rIN_X <= X;
rIN_Y <= Y;
rIN_SUB <= SUB;
-- DENORMALIZE registers
r1_DNORMX <= DNORMX;
r1_DNORMY <= DNORMY;
r1_EXP <= EXP;
r2_EXP <= r1_EXP;
-- CLU registers
r1_PINF <= PINF;
r1_NINF <= NINF;
r1_NAN <= NAN;
r2_PINF <= r1_PINF;
r2_NINF <= r1_NINF;
r2_NAN <= r1_NAN;
-- SUM registers
r2_M <= M;
r2_SIGN <= SIGN;
r2_INCR <= INCR;
-- NORMALIZE registers (output)
rOUT_Z <= OUTPUT;
end if;
end if;
end process;
end Behavioral;