1 |
2 |
davidklun |
---------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- FPU ----
|
4 |
|
|
---- Floating Point Unit (Double precision) ----
|
5 |
|
|
---- ----
|
6 |
|
|
---- Author: David Lundgren ----
|
7 |
|
|
---- davidklun@gmail.com ----
|
8 |
|
|
---- ----
|
9 |
|
|
---------------------------------------------------------------------
|
10 |
|
|
---- ----
|
11 |
|
|
---- Copyright (C) 2009 David Lundgren ----
|
12 |
|
|
---- davidklun@gmail.com ----
|
13 |
|
|
---- ----
|
14 |
|
|
---- This source file may be used and distributed without ----
|
15 |
|
|
---- restriction provided that this copyright statement is not ----
|
16 |
|
|
---- removed from the file and that any derivative work contains ----
|
17 |
|
|
---- the original copyright notice and the associated disclaimer.----
|
18 |
|
|
---- ----
|
19 |
|
|
---- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ----
|
20 |
|
|
---- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ----
|
21 |
|
|
---- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ----
|
22 |
|
|
---- FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ----
|
23 |
|
|
---- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ----
|
24 |
|
|
---- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ----
|
25 |
|
|
---- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ----
|
26 |
|
|
---- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ----
|
27 |
|
|
---- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ----
|
28 |
|
|
---- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ----
|
29 |
|
|
---- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ----
|
30 |
|
|
---- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ----
|
31 |
|
|
---- POSSIBILITY OF SUCH DAMAGE. ----
|
32 |
|
|
---- ----
|
33 |
|
|
---------------------------------------------------------------------
|
34 |
|
|
|
35 |
|
|
library ieee;
|
36 |
|
|
use work.fpupack.all;
|
37 |
|
|
use work.comppack.all;
|
38 |
|
|
use ieee.std_logic_misc.all;
|
39 |
|
|
use ieee.std_logic_unsigned.all;
|
40 |
|
|
use ieee.std_logic_arith.all;
|
41 |
|
|
use ieee.std_logic_1164.all;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
entity fpu_double_tb is
|
45 |
|
|
end fpu_double_tb;
|
46 |
|
|
|
47 |
|
|
architecture TB_ARCHITECTURE of fpu_double_tb is
|
48 |
|
|
|
49 |
|
|
component fpu_double
|
50 |
|
|
port(
|
51 |
|
|
clk : in std_logic;
|
52 |
|
|
rst : in std_logic;
|
53 |
|
|
enable : in std_logic;
|
54 |
|
|
rmode : in std_logic_vector(1 downto 0);
|
55 |
|
|
fpu_op : in std_logic_vector(2 downto 0);
|
56 |
|
|
opa : in std_logic_vector(63 downto 0);
|
57 |
|
|
opb : in std_logic_vector(63 downto 0);
|
58 |
|
|
out_fp : out std_logic_vector(63 downto 0);
|
59 |
|
|
ready : out std_logic;
|
60 |
|
|
underflow : out std_logic;
|
61 |
|
|
overflow : out std_logic;
|
62 |
|
|
inexact : out std_logic;
|
63 |
|
|
exception : out std_logic;
|
64 |
|
|
invalid : out std_logic );
|
65 |
|
|
end component;
|
66 |
|
|
|
67 |
|
|
signal clk : std_logic;
|
68 |
|
|
signal rst : std_logic;
|
69 |
|
|
signal enable : std_logic;
|
70 |
|
|
signal rmode : std_logic_vector(1 downto 0);
|
71 |
|
|
signal fpu_op : std_logic_vector(2 downto 0);
|
72 |
|
|
signal opa : std_logic_vector(63 downto 0);
|
73 |
|
|
signal opb : std_logic_vector(63 downto 0);
|
74 |
|
|
signal out_fp : std_logic_vector(63 downto 0);
|
75 |
|
|
|
76 |
|
|
signal ready : std_logic;
|
77 |
|
|
signal underflow : std_logic;
|
78 |
|
|
signal overflow : std_logic;
|
79 |
|
|
signal inexact : std_logic;
|
80 |
|
|
signal exception : std_logic;
|
81 |
|
|
signal invalid : std_logic;
|
82 |
|
|
|
83 |
|
|
signal END_SIM: BOOLEAN:=FALSE;
|
84 |
|
|
signal out_fp1 : std_logic_vector(63 downto 0);
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
begin
|
88 |
|
|
out_fp1 <= out_fp;
|
89 |
|
|
UUT : fpu_double
|
90 |
|
|
port map (
|
91 |
|
|
clk => clk,
|
92 |
|
|
rst => rst,
|
93 |
|
|
enable => enable,
|
94 |
|
|
rmode => rmode,
|
95 |
|
|
fpu_op => fpu_op,
|
96 |
|
|
opa => opa,
|
97 |
|
|
opb => opb,
|
98 |
|
|
out_fp => out_fp,
|
99 |
|
|
ready => ready,
|
100 |
|
|
underflow => underflow,
|
101 |
|
|
overflow => overflow,
|
102 |
|
|
inexact => inexact,
|
103 |
|
|
exception => exception,
|
104 |
|
|
invalid => invalid
|
105 |
|
|
);
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
STIMULUS: process
|
109 |
|
|
begin
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
rst <= '1';
|
114 |
|
|
wait for 20 ns;
|
115 |
|
|
rst <= '0';
|
116 |
|
|
--inputA:4.0000000000e+000
|
117 |
|
|
--inputB:-4.0000000000e+000
|
118 |
|
|
enable <= '1';
|
119 |
|
|
opa <= "0100000000010000000000000000000000000000000000000000000000000000";
|
120 |
|
|
opb <= "1100000000010000000000000000000000000000000000000000000000000000";
|
121 |
|
|
fpu_op <= "000";
|
122 |
|
|
rmode <= "10";
|
123 |
|
|
wait for 20ns;
|
124 |
|
|
enable <= '0';
|
125 |
|
|
wait for 800 ns;
|
126 |
|
|
--Output:0.000000000000000e+000
|
127 |
|
|
-- out_fp = 0000000000000000
|
128 |
|
|
--inputA:3.0000000000e-312
|
129 |
|
|
--inputB:1.0000000000e-025
|
130 |
|
|
enable <= '1';
|
131 |
|
|
opa <= "0000000000000000000000001000110101100000010101111101110111110010";
|
132 |
|
|
opb <= "0011101010111110111100101101000011110101110110100111110111011001";
|
133 |
|
|
fpu_op <= "011";
|
134 |
|
|
rmode <= "10";
|
135 |
|
|
wait for 20ns;
|
136 |
|
|
enable <= '0';
|
137 |
|
|
wait for 800 ns;
|
138 |
|
|
--Output:3.000000000000337e-287
|
139 |
|
|
-- out_fp = 047245C02F8B68C5
|
140 |
|
|
--inputA:4.0000000000e-304
|
141 |
|
|
--inputB:2.0000000000e-007
|
142 |
|
|
enable <= '1';
|
143 |
|
|
opa <= "0000000011110001100011100011101110011011001101110100000101101001";
|
144 |
|
|
opb <= "0011111010001010110101111111001010011010101111001010111101001000";
|
145 |
|
|
fpu_op <= "010";
|
146 |
|
|
rmode <= "00";
|
147 |
|
|
wait for 20ns;
|
148 |
|
|
enable <= '0';
|
149 |
|
|
wait for 800 ns;
|
150 |
|
|
--Output:8.000000000000074e-311
|
151 |
|
|
-- out_fp = 00000EBA09271E89
|
152 |
|
|
--inputA:3.4445600000e+002
|
153 |
|
|
--inputB:3.4445599000e+002
|
154 |
|
|
enable <= '1';
|
155 |
|
|
opa <= "0100000001110101100001110100101111000110101001111110111110011110";
|
156 |
|
|
opb <= "0100000001110101100001110100101110111100001010111001010011011001";
|
157 |
|
|
fpu_op <= "001";
|
158 |
|
|
rmode <= "00";
|
159 |
|
|
wait for 20ns;
|
160 |
|
|
enable <= '0';
|
161 |
|
|
wait for 800 ns;
|
162 |
|
|
--Output:1.000000003159585e-005
|
163 |
|
|
-- out_fp = 3EE4F8B58A000000
|
164 |
|
|
--inputA:-8.8899000000e+002
|
165 |
|
|
--inputB:7.8898020000e+002
|
166 |
|
|
enable <= '1';
|
167 |
|
|
opa <= "1100000010001011110001111110101110000101000111101011100001010010";
|
168 |
|
|
opb <= "0100000010001000101001111101011101110011000110001111110001010000";
|
169 |
|
|
fpu_op <= "000";
|
170 |
|
|
rmode <= "11";
|
171 |
|
|
wait for 20ns;
|
172 |
|
|
enable <= '0';
|
173 |
|
|
wait for 800 ns;
|
174 |
|
|
--Output:-1.000098000000000e+002
|
175 |
|
|
-- out_fp = C05900A0902DE010
|
176 |
|
|
--inputA:4.5600000000e+002
|
177 |
|
|
--inputB:2.3700000000e+001
|
178 |
|
|
enable <= '1';
|
179 |
|
|
opa <= "0100000001111100100000000000000000000000000000000000000000000000";
|
180 |
|
|
opb <= "0100000000110111101100110011001100110011001100110011001100110011";
|
181 |
|
|
fpu_op <= "011";
|
182 |
|
|
rmode <= "00";
|
183 |
|
|
wait for 20ns;
|
184 |
|
|
enable <= '0';
|
185 |
|
|
wait for 800 ns;
|
186 |
|
|
--Output:1.924050632911392e+001
|
187 |
|
|
-- out_fp = 40333D91D2A2067B
|
188 |
|
|
--inputA:4.9990000000e+003
|
189 |
|
|
--inputB:0.0000000000e+000
|
190 |
|
|
enable <= '1';
|
191 |
|
|
opa <= "0100000010110011100001110000000000000000000000000000000000000000";
|
192 |
|
|
opb <= "0000000000000000000000000000000000000000000000000000000000000000";
|
193 |
|
|
fpu_op <= "010";
|
194 |
|
|
rmode <= "10";
|
195 |
|
|
wait for 20ns;
|
196 |
|
|
enable <= '0';
|
197 |
|
|
wait for 800 ns;
|
198 |
|
|
--Output:0.000000000000000e+000
|
199 |
|
|
-- out_fp = 0000000000000000
|
200 |
|
|
--inputA:-9.8883300000e+005
|
201 |
|
|
--inputB:4.4444440000e+006
|
202 |
|
|
enable <= '1';
|
203 |
|
|
opa <= "1100000100101110001011010100001000000000000000000000000000000000";
|
204 |
|
|
opb <= "0100000101010000111101000100011100000000000000000000000000000000";
|
205 |
|
|
fpu_op <= "001";
|
206 |
|
|
rmode <= "10";
|
207 |
|
|
wait for 20ns;
|
208 |
|
|
enable <= '0';
|
209 |
|
|
wait for 800 ns;
|
210 |
|
|
--Output:-5.433277000000000e+006
|
211 |
|
|
-- out_fp = C154B9EF40000000
|
212 |
|
|
--inputA:-4.8000000000e-311
|
213 |
|
|
--inputB:4.0000000000e-050
|
214 |
|
|
enable <= '1';
|
215 |
|
|
opa <= "1000000000000000000010001101011000000101011111011101111100011111";
|
216 |
|
|
opb <= "0011010110101101111011100111101001001010110101001011100000011111";
|
217 |
|
|
fpu_op <= "011";
|
218 |
|
|
rmode <= "00";
|
219 |
|
|
wait for 20ns;
|
220 |
|
|
enable <= '0';
|
221 |
|
|
wait for 800 ns;
|
222 |
|
|
--Output:-1.200000000000011e-261
|
223 |
|
|
-- out_fp = 89C2E4AE4EAE705E
|
224 |
|
|
--inputA:1.9500000000e-308
|
225 |
|
|
--inputB:1.8800000000e-308
|
226 |
|
|
enable <= '1';
|
227 |
|
|
opa <= "0000000000001110000001011010001000110110111111110101001011001101";
|
228 |
|
|
opb <= "0000000000001101100001001100011001100110111010010000011110011111";
|
229 |
|
|
fpu_op <= "000";
|
230 |
|
|
rmode <= "10";
|
231 |
|
|
wait for 20ns;
|
232 |
|
|
enable <= '0';
|
233 |
|
|
wait for 800 ns;
|
234 |
|
|
--Output:3.830000000000000e-308
|
235 |
|
|
-- out_fp = 001B8A689DE85A6C
|
236 |
|
|
--inputA:-3.0000000000e-309
|
237 |
|
|
--inputB:9.0000000000e+100
|
238 |
|
|
enable <= '1';
|
239 |
|
|
opa <= "1000000000000010001010000100000001010111001110101111100100001100";
|
240 |
|
|
opb <= "0101010011100100100100101110001011001010010001110101101111101101";
|
241 |
|
|
fpu_op <= "010";
|
242 |
|
|
rmode <= "11";
|
243 |
|
|
wait for 20ns;
|
244 |
|
|
enable <= '0';
|
245 |
|
|
wait for 800 ns;
|
246 |
|
|
--Output:-2.700000000000001e-208
|
247 |
|
|
-- out_fp = 94D630F25FC26702
|
248 |
|
|
--inputA:3.0000000000e-308
|
249 |
|
|
--inputB:2.9900000000e-308
|
250 |
|
|
enable <= '1';
|
251 |
|
|
opa <= "0000000000010101100100101000001101101000010011011011101001110111";
|
252 |
|
|
opb <= "0000000000010101100000000001101011011100110111001101010001001011";
|
253 |
|
|
fpu_op <= "001";
|
254 |
|
|
rmode <= "10";
|
255 |
|
|
wait for 20ns;
|
256 |
|
|
enable <= '0';
|
257 |
|
|
wait for 800 ns;
|
258 |
|
|
--Output:1.000000000000046e-310
|
259 |
|
|
-- out_fp = 000012688B70E62C
|
260 |
|
|
--inputA:-9.0000000000e-300
|
261 |
|
|
--inputB:5.0000000000e+100
|
262 |
|
|
enable <= '1';
|
263 |
|
|
opa <= "1000000111011000000110111110001110111011010110000001000111000100";
|
264 |
|
|
opb <= "0101010011010110110111000001100001101110111110011111010001011100";
|
265 |
|
|
fpu_op <= "011";
|
266 |
|
|
rmode <= "11";
|
267 |
|
|
wait for 20ns;
|
268 |
|
|
enable <= '0';
|
269 |
|
|
wait for 800 ns;
|
270 |
|
|
--Output:-4.940656458412465e-324
|
271 |
|
|
-- out_fp = 8000000000000001
|
272 |
|
|
--inputA:4.0000000000e+100
|
273 |
|
|
--inputB:3.0000000000e-090
|
274 |
|
|
enable <= '1';
|
275 |
|
|
opa <= "0101010011010010010010011010110100100101100101001100001101111101";
|
276 |
|
|
opb <= "0010110101011000011100011100011001000110111001011001010110100111";
|
277 |
|
|
fpu_op <= "010";
|
278 |
|
|
rmode <= "10";
|
279 |
|
|
wait for 20ns;
|
280 |
|
|
enable <= '0';
|
281 |
|
|
wait for 800 ns;
|
282 |
|
|
--Output:1.200000000000000e+011
|
283 |
|
|
-- out_fp = 423BF08EB0000001
|
284 |
|
|
--inputA:-9.9000000000e-002
|
285 |
|
|
--inputB:4.0220000000e+001
|
286 |
|
|
enable <= '1';
|
287 |
|
|
opa <= "1011111110111001010110000001000001100010010011011101001011110010";
|
288 |
|
|
opb <= "0100000001000100000111000010100011110101110000101000111101011100";
|
289 |
|
|
fpu_op <= "000";
|
290 |
|
|
rmode <= "11";
|
291 |
|
|
wait for 20ns;
|
292 |
|
|
enable <= '0';
|
293 |
|
|
wait for 800 ns;
|
294 |
|
|
--Output:4.012100000000000e+001
|
295 |
|
|
-- out_fp = 40440F7CED916872
|
296 |
|
|
--inputA:9.0770000000e+001
|
297 |
|
|
--inputB:-2.0330000000e+001
|
298 |
|
|
enable <= '1';
|
299 |
|
|
opa <= "0100000001010110101100010100011110101110000101000111101011100001";
|
300 |
|
|
opb <= "1100000000110100010101000111101011100001010001111010111000010100";
|
301 |
|
|
fpu_op <= "000";
|
302 |
|
|
rmode <= "00";
|
303 |
|
|
wait for 20ns;
|
304 |
|
|
enable <= '0';
|
305 |
|
|
wait for 800 ns;
|
306 |
|
|
--Output:7.044000000000000e+001
|
307 |
|
|
-- out_fp = 40519C28F5C28F5C
|
308 |
|
|
--inputA:4.9077000000e+002
|
309 |
|
|
--inputB:-3.4434000000e+002
|
310 |
|
|
enable <= '1';
|
311 |
|
|
opa <= "0100000001111110101011000101000111101011100001010001111010111000";
|
312 |
|
|
opb <= "1100000001110101100001010111000010100011110101110000101000111101";
|
313 |
|
|
fpu_op <= "001";
|
314 |
|
|
rmode <= "00";
|
315 |
|
|
wait for 20ns;
|
316 |
|
|
enable <= '0';
|
317 |
|
|
wait for 800 ns;
|
318 |
|
|
--Output:8.351100000000000e+002
|
319 |
|
|
-- out_fp = 408A18E147AE147B
|
320 |
|
|
--inputA:9.0000000000e+034
|
321 |
|
|
--inputB:2.7700000000e+000
|
322 |
|
|
enable <= '1';
|
323 |
|
|
opa <= "0100011100110001010101010101011110110100000110011100010111000010";
|
324 |
|
|
opb <= "0100000000000110001010001111010111000010100011110101110000101001";
|
325 |
|
|
fpu_op <= "011";
|
326 |
|
|
rmode <= "00";
|
327 |
|
|
wait for 20ns;
|
328 |
|
|
enable <= '0';
|
329 |
|
|
wait for 800 ns;
|
330 |
|
|
--Output:3.249097472924188e+034
|
331 |
|
|
-- out_fp = 471907B705EBEABE
|
332 |
|
|
--inputA:3.9999999989e-315
|
333 |
|
|
--inputB:1.0000000000e-002
|
334 |
|
|
enable <= '1';
|
335 |
|
|
opa <= "0000000000000000000000000000000000110000010000011010011100110101";
|
336 |
|
|
opb <= "0011111110000100011110101110000101000111101011100001010001111011";
|
337 |
|
|
fpu_op <= "010";
|
338 |
|
|
rmode <= "10";
|
339 |
|
|
wait for 20ns;
|
340 |
|
|
enable <= '0';
|
341 |
|
|
wait for 800 ns;
|
342 |
|
|
--Output:4.000000428704504e-317
|
343 |
|
|
-- out_fp = 00000000007B895B
|
344 |
|
|
--inputA:-9.0000000000e+003
|
345 |
|
|
--inputB:8.0000000000e+003
|
346 |
|
|
enable <= '1';
|
347 |
|
|
opa <= "1100000011000001100101000000000000000000000000000000000000000000";
|
348 |
|
|
opb <= "0100000010111111010000000000000000000000000000000000000000000000";
|
349 |
|
|
fpu_op <= "011";
|
350 |
|
|
rmode <= "00";
|
351 |
|
|
wait for 20ns;
|
352 |
|
|
enable <= '0';
|
353 |
|
|
wait for 800 ns;
|
354 |
|
|
--Output:-1.125000000000000e+000
|
355 |
|
|
-- out_fp = BFF2000000000000
|
356 |
|
|
--inputA:9.8440000000e+003
|
357 |
|
|
--inputB:0.0000000000e+000
|
358 |
|
|
enable <= '1';
|
359 |
|
|
opa <= "0100000011000011001110100000000000000000000000000000000000000000";
|
360 |
|
|
opb <= "0000000000000000000000000000000000000000000000000000000000000000";
|
361 |
|
|
fpu_op <= "011";
|
362 |
|
|
rmode <= "10";
|
363 |
|
|
wait for 20ns;
|
364 |
|
|
enable <= '0';
|
365 |
|
|
wait for 800 ns;
|
366 |
|
|
--Output:1.#INF00000000000e+000
|
367 |
|
|
-- out_fp = 7FF0000000000000
|
368 |
|
|
--inputA:4.4440000000e+002
|
369 |
|
|
--inputB:-8.8800000000e+002
|
370 |
|
|
enable <= '1';
|
371 |
|
|
opa <= "0100000001111011110001100110011001100110011001100110011001100110";
|
372 |
|
|
opb <= "1100000010001011110000000000000000000000000000000000000000000000";
|
373 |
|
|
fpu_op <= "001";
|
374 |
|
|
rmode <= "10";
|
375 |
|
|
wait for 20ns;
|
376 |
|
|
enable <= '0';
|
377 |
|
|
wait for 800 ns;
|
378 |
|
|
--Output:1.332400000000000e+003
|
379 |
|
|
-- out_fp = 4094D1999999999A
|
380 |
|
|
--inputA:3.0000000000e-309
|
381 |
|
|
--inputB:3.0000000000e+080
|
382 |
|
|
enable <= '1';
|
383 |
|
|
opa <= "0000000000000010001010000100000001010111001110101111100100001100";
|
384 |
|
|
opb <= "0101000010100100001111011011001101111101011101001011110010000111";
|
385 |
|
|
fpu_op <= "011";
|
386 |
|
|
rmode <= "00";
|
387 |
|
|
wait for 20ns;
|
388 |
|
|
enable <= '0';
|
389 |
|
|
wait for 800 ns;
|
390 |
|
|
--Output:0.000000000000000e+000
|
391 |
|
|
-- out_fp = 0000000000000000
|
392 |
|
|
--inputA:4.9900000000e+002
|
393 |
|
|
--inputB:-3.3000000000e-003
|
394 |
|
|
enable <= '1';
|
395 |
|
|
opa <= "0100000001111111001100000000000000000000000000000000000000000000";
|
396 |
|
|
opb <= "1011111101101011000010001001101000000010011101010010010101000110";
|
397 |
|
|
fpu_op <= "010";
|
398 |
|
|
rmode <= "11";
|
399 |
|
|
wait for 20ns;
|
400 |
|
|
enable <= '0';
|
401 |
|
|
wait for 800 ns;
|
402 |
|
|
--Output:-1.646700000000000e+000
|
403 |
|
|
-- out_fp = BFFA58E219652BD4
|
404 |
|
|
--inputA:9.0000000000e+034
|
405 |
|
|
--inputB:4.0000000000e+023
|
406 |
|
|
enable <= '1';
|
407 |
|
|
opa <= "0100011100110001010101010101011110110100000110011100010111000010";
|
408 |
|
|
opb <= "0100010011010101001011010000001011000111111000010100101011110110";
|
409 |
|
|
fpu_op <= "000";
|
410 |
|
|
rmode <= "10";
|
411 |
|
|
wait for 20ns;
|
412 |
|
|
enable <= '0';
|
413 |
|
|
wait for 800 ns;
|
414 |
|
|
--Output:9.000000000040000e+034
|
415 |
|
|
-- out_fp = 47315557B41A1A76
|
416 |
|
|
--inputA:4.0000000000e+080
|
417 |
|
|
--inputB:3.0000000000e-002
|
418 |
|
|
enable <= '1';
|
419 |
|
|
opa <= "0101000010101010111111001110111101010001111100001111101101011111";
|
420 |
|
|
opb <= "0011111110011110101110000101000111101011100001010001111010111000";
|
421 |
|
|
fpu_op <= "000";
|
422 |
|
|
rmode <= "10";
|
423 |
|
|
wait for 20ns;
|
424 |
|
|
enable <= '0';
|
425 |
|
|
wait for 800 ns;
|
426 |
|
|
--Output:4.000000000000001e+080
|
427 |
|
|
-- out_fp = 50AAFCEF51F0FB60
|
428 |
|
|
--inputA:-5.4770000000e+000
|
429 |
|
|
--inputB:-8.9990000000e+000
|
430 |
|
|
enable <= '1';
|
431 |
|
|
opa <= "1100000000010101111010000111001010110000001000001100010010011100";
|
432 |
|
|
opb <= "1100000000100001111111110111110011101101100100010110100001110011";
|
433 |
|
|
fpu_op <= "011";
|
434 |
|
|
rmode <= "10";
|
435 |
|
|
wait for 20ns;
|
436 |
|
|
enable <= '0';
|
437 |
|
|
wait for 800 ns;
|
438 |
|
|
--Output:6.086231803533726e-001
|
439 |
|
|
-- out_fp = 3FE379D751E6915E
|
440 |
|
|
--inputA:-7.7000000000e+001
|
441 |
|
|
--inputB:-8.8400000000e+001
|
442 |
|
|
enable <= '1';
|
443 |
|
|
opa <= "1100000001010011010000000000000000000000000000000000000000000000";
|
444 |
|
|
opb <= "1100000001010110000110011001100110011001100110011001100110011010";
|
445 |
|
|
fpu_op <= "010";
|
446 |
|
|
rmode <= "10";
|
447 |
|
|
wait for 20ns;
|
448 |
|
|
enable <= '0';
|
449 |
|
|
wait for 800 ns;
|
450 |
|
|
--Output:6.806800000000001e+003
|
451 |
|
|
-- out_fp = 40BA96CCCCCCCCCE
|
452 |
|
|
--inputA:4.0000000000e+009
|
453 |
|
|
--inputB:3.0000000000e+008
|
454 |
|
|
enable <= '1';
|
455 |
|
|
opa <= "0100000111101101110011010110010100000000000000000000000000000000";
|
456 |
|
|
opb <= "0100000110110001111000011010001100000000000000000000000000000000";
|
457 |
|
|
fpu_op <= "011";
|
458 |
|
|
rmode <= "00";
|
459 |
|
|
wait for 20ns;
|
460 |
|
|
enable <= '0';
|
461 |
|
|
wait for 800 ns;
|
462 |
|
|
--Output:1.333333333333333e+001
|
463 |
|
|
-- out_fp = 402AAAAAAAAAAAAB
|
464 |
|
|
--inputA:9.0000000000e-311
|
465 |
|
|
--inputB:8.0000000000e-311
|
466 |
|
|
enable <= '1';
|
467 |
|
|
opa <= "0000000000000000000100001001000101001010010011000000001001011010";
|
468 |
|
|
opb <= "0000000000000000000011101011101000001001001001110001111010001001";
|
469 |
|
|
fpu_op <= "000";
|
470 |
|
|
rmode <= "00";
|
471 |
|
|
wait for 20ns;
|
472 |
|
|
enable <= '0';
|
473 |
|
|
wait for 800 ns;
|
474 |
|
|
--Output:1.700000000000010e-310
|
475 |
|
|
-- out_fp = 00001F4B537320E3
|
476 |
|
|
--inputA:1.9999777344e-320
|
477 |
|
|
--inputB:5.0000000000e+099
|
478 |
|
|
enable <= '1';
|
479 |
|
|
opa <= "0000000000000000000000000000000000000000000000000000111111010000";
|
480 |
|
|
opb <= "0101010010100010010010011010110100100101100101001100001101111101";
|
481 |
|
|
fpu_op <= "010";
|
482 |
|
|
rmode <= "10";
|
483 |
|
|
wait for 20ns;
|
484 |
|
|
enable <= '0';
|
485 |
|
|
wait for 800 ns;
|
486 |
|
|
--Output:9.999888671826831e-221
|
487 |
|
|
-- out_fp = 124212D01E240533
|
488 |
|
|
--inputA:4.4444000000e+004
|
489 |
|
|
--inputB:3.3000000000e+001
|
490 |
|
|
enable <= '1';
|
491 |
|
|
opa <= "0100000011100101101100111000000000000000000000000000000000000000";
|
492 |
|
|
opb <= "0100000001000000100000000000000000000000000000000000000000000000";
|
493 |
|
|
fpu_op <= "011";
|
494 |
|
|
rmode <= "00";
|
495 |
|
|
wait for 20ns;
|
496 |
|
|
enable <= '0';
|
497 |
|
|
wait for 800 ns;
|
498 |
|
|
--Output:1.346787878787879e+003
|
499 |
|
|
-- out_fp = 40950B26C9B26C9B
|
500 |
|
|
--inputA:9.7730000000e+000
|
501 |
|
|
--inputB:9.7720000000e+000
|
502 |
|
|
enable <= '1';
|
503 |
|
|
opa <= "0100000000100011100010111100011010100111111011111001110110110010";
|
504 |
|
|
opb <= "0100000000100011100010110100001110010101100000010000011000100101";
|
505 |
|
|
fpu_op <= "011";
|
506 |
|
|
rmode <= "00";
|
507 |
|
|
wait for 20ns;
|
508 |
|
|
enable <= '0';
|
509 |
|
|
wait for 800 ns;
|
510 |
|
|
--Output:1.000102333196889e+000
|
511 |
|
|
-- out_fp = 3FF0006B4DDBBE31
|
512 |
|
|
--inputA:8.3345700000e+003
|
513 |
|
|
--inputB:1.0000000000e+000
|
514 |
|
|
enable <= '1';
|
515 |
|
|
opa <= "0100000011000000010001110100100011110101110000101000111101011100";
|
516 |
|
|
opb <= "0011111111110000000000000000000000000000000000000000000000000000";
|
517 |
|
|
fpu_op <= "010";
|
518 |
|
|
rmode <= "00";
|
519 |
|
|
wait for 20ns;
|
520 |
|
|
enable <= '0';
|
521 |
|
|
wait for 800 ns;
|
522 |
|
|
--Output:8.334570000000000e+003
|
523 |
|
|
-- out_fp = 40C04748F5C28F5C
|
524 |
|
|
--inputA:-1.0000000000e+000
|
525 |
|
|
--inputB:5.8990000000e+003
|
526 |
|
|
enable <= '1';
|
527 |
|
|
opa <= "1011111111110000000000000000000000000000000000000000000000000000";
|
528 |
|
|
opb <= "0100000010110111000010110000000000000000000000000000000000000000";
|
529 |
|
|
fpu_op <= "010";
|
530 |
|
|
rmode <= "11";
|
531 |
|
|
wait for 20ns;
|
532 |
|
|
enable <= '0';
|
533 |
|
|
wait for 800 ns;
|
534 |
|
|
--Output:-5.899000000000000e+003
|
535 |
|
|
-- out_fp = C0B70B0000000000
|
536 |
|
|
--inputA:6.1000000000e+000
|
537 |
|
|
--inputB:-6.0990000000e+000
|
538 |
|
|
enable <= '1';
|
539 |
|
|
opa <= "0100000000011000011001100110011001100110011001100110011001100110";
|
540 |
|
|
opb <= "1100000000011000011001010110000001000001100010010011011101001100";
|
541 |
|
|
fpu_op <= "000";
|
542 |
|
|
rmode <= "10";
|
543 |
|
|
wait for 20ns;
|
544 |
|
|
enable <= '0';
|
545 |
|
|
wait for 800 ns;
|
546 |
|
|
--Output:9.999999999994458e-004
|
547 |
|
|
-- out_fp = 3F50624DD2F1A000
|
548 |
|
|
--inputA:3.0000000000e-300
|
549 |
|
|
--inputB:3.0000000000e-015
|
550 |
|
|
enable <= '1';
|
551 |
|
|
opa <= "0000000111000000000100101001011111010010001110101011011010000011";
|
552 |
|
|
opb <= "0011110011101011000001011000011101101110010110110000000100100000";
|
553 |
|
|
fpu_op <= "010";
|
554 |
|
|
rmode <= "00";
|
555 |
|
|
wait for 20ns;
|
556 |
|
|
enable <= '0';
|
557 |
|
|
wait for 800 ns;
|
558 |
|
|
--Output:9.000000001157124e-315
|
559 |
|
|
-- out_fp = 000000006C93B838
|
560 |
|
|
--inputA:-9.0000000000e+088
|
561 |
|
|
--inputB:4.0000000000e+084
|
562 |
|
|
enable <= '1';
|
563 |
|
|
opa <= "1101001001100110100111110000000010010101111101001101000000000000";
|
564 |
|
|
opb <= "0101000110000000011110001110000100010001110000110101010101101101";
|
565 |
|
|
fpu_op <= "000";
|
566 |
|
|
rmode <= "00";
|
567 |
|
|
wait for 20ns;
|
568 |
|
|
enable <= '0';
|
569 |
|
|
wait for 800 ns;
|
570 |
|
|
--Output:-8.999600000000000e+088
|
571 |
|
|
-- out_fp = D2669EBEB27088F3
|
572 |
|
|
--inputA:6.6210000000e+001
|
573 |
|
|
--inputB:6.9892000000e+001
|
574 |
|
|
enable <= '1';
|
575 |
|
|
opa <= "0100000001010000100011010111000010100011110101110000101000111101";
|
576 |
|
|
opb <= "0100000001010001011110010001011010000111001010110000001000001100";
|
577 |
|
|
fpu_op <= "011";
|
578 |
|
|
rmode <= "00";
|
579 |
|
|
wait for 20ns;
|
580 |
|
|
enable <= '0';
|
581 |
|
|
wait for 800 ns;
|
582 |
|
|
--Output:9.473187203113375e-001
|
583 |
|
|
-- out_fp = 3FEE506F59540645
|
584 |
|
|
--inputA:-5.0000000000e-309
|
585 |
|
|
--inputB:4.0000000000e-310
|
586 |
|
|
enable <= '1';
|
587 |
|
|
opa <= "1000000000000011100110000110101100111100000011001111010001101001";
|
588 |
|
|
opb <= "0000000000000000010010011010001000101101110000111001100010101100";
|
589 |
|
|
fpu_op <= "000";
|
590 |
|
|
rmode <= "11";
|
591 |
|
|
wait for 20ns;
|
592 |
|
|
enable <= '0';
|
593 |
|
|
wait for 800 ns;
|
594 |
|
|
--Output:-4.600000000000001e-309
|
595 |
|
|
-- out_fp = 80034EC90E495BBD
|
596 |
|
|
--inputA:8.8000000000e+001
|
597 |
|
|
--inputB:0.0000000000e+000
|
598 |
|
|
enable <= '1';
|
599 |
|
|
opa <= "0100000001010110000000000000000000000000000000000000000000000000";
|
600 |
|
|
opb <= "0000000000000000000000000000000000000000000000000000000000000000";
|
601 |
|
|
fpu_op <= "011";
|
602 |
|
|
rmode <= "01";
|
603 |
|
|
wait for 20ns;
|
604 |
|
|
enable <= '0';
|
605 |
|
|
wait for 800 ns;
|
606 |
|
|
--Output:1.#INF00000000000e+000
|
607 |
|
|
-- out_fp = 7FEFFFFFFFFFFFFF
|
608 |
|
|
--inputA:4.5570000000e+002
|
609 |
|
|
--inputB:3.4229100000e+003
|
610 |
|
|
enable <= '1';
|
611 |
|
|
opa <= "0100000001111100011110110011001100110011001100110011001100110011";
|
612 |
|
|
opb <= "0100000010101010101111011101000111101011100001010001111010111000";
|
613 |
|
|
fpu_op <= "000";
|
614 |
|
|
rmode <= "01";
|
615 |
|
|
wait for 20ns;
|
616 |
|
|
enable <= '0';
|
617 |
|
|
wait for 800 ns;
|
618 |
|
|
--Output:3.878610000000000e+003
|
619 |
|
|
-- out_fp = 40AE4D3851EB851E
|
620 |
|
|
--inputA:9.9440000000e+003
|
621 |
|
|
--inputB:2.3000000000e+001
|
622 |
|
|
enable <= '1';
|
623 |
|
|
opa <= "0100000011000011011011000000000000000000000000000000000000000000";
|
624 |
|
|
opb <= "0100000000110111000000000000000000000000000000000000000000000000";
|
625 |
|
|
fpu_op <= "011";
|
626 |
|
|
rmode <= "01";
|
627 |
|
|
wait for 20ns;
|
628 |
|
|
enable <= '0';
|
629 |
|
|
wait for 800 ns;
|
630 |
|
|
--Output:4.323478260869565e+002
|
631 |
|
|
-- out_fp = 407B0590B21642C8
|
632 |
|
|
--inputA:-9.0054400000e+005
|
633 |
|
|
--inputB:-3.4445500000e+005
|
634 |
|
|
enable <= '1';
|
635 |
|
|
opa <= "1100000100101011011110111000000000000000000000000000000000000000";
|
636 |
|
|
opb <= "1100000100010101000001100001110000000000000000000000000000000000";
|
637 |
|
|
fpu_op <= "001";
|
638 |
|
|
rmode <= "01";
|
639 |
|
|
wait for 20ns;
|
640 |
|
|
enable <= '0';
|
641 |
|
|
wait for 800 ns;
|
642 |
|
|
--Output:-5.560890000000000e+005
|
643 |
|
|
-- out_fp = C120F87200000000
|
644 |
|
|
--inputA:5.5500000000e-002
|
645 |
|
|
--inputB:3.2444400000e+005
|
646 |
|
|
enable <= '1';
|
647 |
|
|
opa <= "0011111110101100011010100111111011111001110110110010001011010001";
|
648 |
|
|
opb <= "0100000100010011110011010111000000000000000000000000000000000000";
|
649 |
|
|
fpu_op <= "011";
|
650 |
|
|
rmode <= "00";
|
651 |
|
|
wait for 20ns;
|
652 |
|
|
enable <= '0';
|
653 |
|
|
wait for 800 ns;
|
654 |
|
|
--Output:1.710618781669564e-007
|
655 |
|
|
-- out_fp = 3E86F5A431628F6D
|
656 |
|
|
--inputA:1.2330000000e+000
|
657 |
|
|
--inputB:1.5666600000e+000
|
658 |
|
|
enable <= '1';
|
659 |
|
|
opa <= "0011111111110011101110100101111000110101001111110111110011101110";
|
660 |
|
|
opb <= "0011111111111001000100010000101000010011011111110011100011000101";
|
661 |
|
|
fpu_op <= "010";
|
662 |
|
|
rmode <= "10";
|
663 |
|
|
wait for 20ns;
|
664 |
|
|
enable <= '0';
|
665 |
|
|
wait for 800 ns;
|
666 |
|
|
--Output:1.931691780000000e+000
|
667 |
|
|
-- out_fp = 3FFEE835A3D0D51B
|
668 |
|
|
--inputA:9.7770000000e-001
|
669 |
|
|
--inputB:3.0000000000e+099
|
670 |
|
|
enable <= '1';
|
671 |
|
|
opa <= "0011111111101111010010010101000110000010101010011001001100001100";
|
672 |
|
|
opb <= "0101010010010101111100100000001011111001111001011011011101100011";
|
673 |
|
|
fpu_op <= "011";
|
674 |
|
|
rmode <= "00";
|
675 |
|
|
wait for 20ns;
|
676 |
|
|
enable <= '0';
|
677 |
|
|
wait for 800 ns;
|
678 |
|
|
--Output:3.259000000000000e-100
|
679 |
|
|
-- out_fp = 2B46CF7665DCED50
|
680 |
|
|
--inputA:4.4000000000e+007
|
681 |
|
|
--inputB:6.0000000000e+002
|
682 |
|
|
enable <= '1';
|
683 |
|
|
opa <= "0100000110000100111110110001100000000000000000000000000000000000";
|
684 |
|
|
opb <= "0100000010000010110000000000000000000000000000000000000000000000";
|
685 |
|
|
fpu_op <= "010";
|
686 |
|
|
rmode <= "00";
|
687 |
|
|
wait for 20ns;
|
688 |
|
|
enable <= '0';
|
689 |
|
|
wait for 800 ns;
|
690 |
|
|
--Output:2.640000000000000e+010
|
691 |
|
|
-- out_fp = 4218964020000000
|
692 |
|
|
--inputA:3.9800000000e+000
|
693 |
|
|
--inputB:3.7700000000e+000
|
694 |
|
|
enable <= '1';
|
695 |
|
|
opa <= "0100000000001111110101110000101000111101011100001010001111010111";
|
696 |
|
|
opb <= "0100000000001110001010001111010111000010100011110101110000101001";
|
697 |
|
|
fpu_op <= "000";
|
698 |
|
|
rmode <= "01";
|
699 |
|
|
wait for 20ns;
|
700 |
|
|
enable <= '0';
|
701 |
|
|
wait for 800 ns;
|
702 |
|
|
--Output:7.750000000000000e+000
|
703 |
|
|
-- out_fp = 401F000000000000
|
704 |
|
|
--inputA:8.0400000000e+000
|
705 |
|
|
--inputB:8.0395700000e+000
|
706 |
|
|
enable <= '1';
|
707 |
|
|
opa <= "0100000000100000000101000111101011100001010001111010111000010100";
|
708 |
|
|
opb <= "0100000000100000000101000100001010000100110111111100111000110001";
|
709 |
|
|
fpu_op <= "001";
|
710 |
|
|
rmode <= "01";
|
711 |
|
|
wait for 20ns;
|
712 |
|
|
enable <= '0';
|
713 |
|
|
wait for 800 ns;
|
714 |
|
|
--Output:4.299999999997084e-004
|
715 |
|
|
-- out_fp = 3F3C2E33EFF18000
|
716 |
|
|
|
717 |
|
|
|
718 |
|
|
END_SIM <= TRUE;
|
719 |
|
|
|
720 |
|
|
wait;
|
721 |
|
|
end process;
|
722 |
|
|
|
723 |
|
|
CLOCK_clk : process
|
724 |
|
|
begin
|
725 |
|
|
|
726 |
|
|
if END_SIM = FALSE then
|
727 |
|
|
clk <= '0';
|
728 |
|
|
wait for 5 ns;
|
729 |
|
|
else
|
730 |
|
|
wait;
|
731 |
|
|
end if;
|
732 |
|
|
if END_SIM = FALSE then
|
733 |
|
|
clk <= '1';
|
734 |
|
|
wait for 5 ns;
|
735 |
|
|
else
|
736 |
|
|
wait;
|
737 |
|
|
end if;
|
738 |
|
|
end process;
|
739 |
|
|
|
740 |
|
|
|
741 |
|
|
|
742 |
|
|
end TB_ARCHITECTURE;
|
743 |
|
|
|
744 |
|
|
configuration TESTBENCH_FOR_fpu_double of fpu_double_tb is
|
745 |
|
|
for TB_ARCHITECTURE
|
746 |
|
|
for UUT : fpu_double
|
747 |
|
|
use entity work.fpu_double(rtl);
|
748 |
|
|
end for;
|
749 |
|
|
end for;
|
750 |
|
|
end TESTBENCH_FOR_fpu_double;
|
751 |
|
|
|