1-- -----------------------------------------------------------------
2--
3-- Copyright 2019 IEEE P1076 WG Authors
4--
5-- See the LICENSE file distributed with this work for copyright and
6-- licensing information and the AUTHORS file.
7--
8-- This file to you under the Apache License, Version 2.0 (the "License").
9-- You may obtain a copy of the License at
10--
11--     http://www.apache.org/licenses/LICENSE-2.0
12--
13-- Unless required by applicable law or agreed to in writing, software
14-- distributed under the License is distributed on an "AS IS" BASIS,
15-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16-- implied.  See the License for the specific language governing
17-- permissions and limitations under the License.
18--
19--   Title     :  Floating-point package (Generic package declaration)
20--             :
21--   Library   :  This package shall be compiled into a library
22--             :  symbolically named IEEE.
23--             :
24--   Developers:  Accellera VHDL-TC and IEEE P1076 Working Group
25--             :
26--   Purpose   :  This packages defines basic binary floating point
27--             :  arithmetic functions
28--             :
29--   Note      :  This package may be modified to include additional data
30--             :  required by tools, but it must in no way change the
31--             :  external interfaces or simulation behavior of the
32--             :  description. It is permissible to add comments and/or
33--             :  attributes to the package declarations, but not to change
34--             :  or delete any original lines of the package declaration.
35--             :  The package body may be changed only in accordance with
36--             :  the terms of Clause 16 of this standard.
37--             :
38-- --------------------------------------------------------------------
39-- $Revision: 1220 $
40-- $Date: 2008-04-10 17:16:09 +0930 (Thu, 10 Apr 2008) $
41-- --------------------------------------------------------------------
42
43use STD.TEXTIO.all;
44library IEEE;
45use IEEE.STD_LOGIC_1164.all;
46use IEEE.NUMERIC_STD.all;
47use IEEE.fixed_float_types.all;
48
49package float_generic_pkg is
50  generic (
51    -- Defaults for sizing routines, when you do a "to_float" this will be
52    -- the default size.  Example float32 would be 8 and 23 (8 downto -23)
53    float_exponent_width : NATURAL    := 8;
54    float_fraction_width : NATURAL    := 23;
55    -- Rounding algorithm, "round_nearest" is default, other valid values
56    -- are "round_zero" (truncation), "round_inf" (round up), and
57    -- "round_neginf" (round down)
58    float_round_style    : round_type := round_nearest;
59    -- Denormal numbers (very small numbers near zero) true or false
60    float_denormalize    : BOOLEAN    := true;
61    -- Turns on NAN processing (invalid numbers and overflow) true of false
62    float_check_error    : BOOLEAN    := true;
63    -- Guard bits are added to the bottom of every operation for rounding.
64    -- any natural number (including 0) are valid.
65    float_guard_bits     : NATURAL    := 3;
66    -- If TRUE, then turn off warnings on "X" propagation
67    no_warning           : BOOLEAN    := false;
68    package fixed_pkg is new IEEE.fixed_generic_pkg
69                           generic map (<>) );
70
71  -- Author David Bishop (dbishop@vhdl.org)
72  constant CopyRightNotice : STRING :=
73    "Copyright IEEE P1076 WG. Licensed Apache 2.0";
74
75  use fixed_pkg.all;
76
77  -- Note that this is "INTEGER range <>", thus if you use a literal, then the
78  -- default range will be (INTEGER'low to INTEGER'low + X)
79  type UNRESOLVED_float is array (INTEGER range <>) of STD_ULOGIC;  -- main type
80  alias U_float is UNRESOLVED_float;
81
82  subtype float is (resolved) UNRESOLVED_float;
83  -----------------------------------------------------------------------------
84  -- Use the float type to define your own floating point numbers.
85  -- There must be a negative index or the packages will error out.
86  -- Minimum supported is "subtype float7 is float (3 downto -3);"
87  -- "subtype float16 is float (6 downto -9);" is probably the smallest
88  -- practical one to use.
89  -----------------------------------------------------------------------------
90
91  -- IEEE 754 single precision
92  subtype UNRESOLVED_float32 is UNRESOLVED_float (8 downto -23);
93  alias U_float32 is UNRESOLVED_float32;
94  subtype float32 is float (8 downto -23);
95  -----------------------------------------------------------------------------
96  -- IEEE-754 single precision floating point.  This is a "float"
97  -- in C, and a FLOAT in Fortran.  The exponent is 8 bits wide, and
98  -- the fraction is 23 bits wide.  This format can hold roughly 7 decimal
99  -- digits.  Infinity is 2**127 = 1.7E38 in this number system.
100  -- The bit representation is as follows:
101  -- 1 09876543 21098765432109876543210
102  -- 8 76543210 12345678901234567890123
103  -- 0 00000000 00000000000000000000000
104  -- 8 7      0 -1                  -23
105  -- +/-   exp.  fraction
106  -----------------------------------------------------------------------------
107
108  -- IEEE 754 double precision
109  subtype UNRESOLVED_float64 is UNRESOLVED_float (11 downto -52);
110  alias U_float64 is UNRESOLVED_float64;
111  subtype float64 is float (11 downto -52);
112  -----------------------------------------------------------------------------
113  -- IEEE-754 double precision floating point.  This is a "double float"
114  -- in C, and a FLOAT*8 in Fortran.  The exponent is 11 bits wide, and
115  -- the fraction is 52 bits wide.  This format can hold roughly 15 decimal
116  -- digits.  Infinity is 2**2047 in this number system.
117  -- The bit representation is as follows:
118  --  3 21098765432 1098765432109876543210987654321098765432109876543210
119  --  1 09876543210 1234567890123456789012345678901234567890123456789012
120  --  S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
121  -- 11 10        0 -1                                               -52
122  -- +/-  exponent    fraction
123  -----------------------------------------------------------------------------
124
125  -- IEEE 854 & C extended precision
126  subtype UNRESOLVED_float128 is UNRESOLVED_float (15 downto -112);
127  alias U_float128 is UNRESOLVED_float128;
128  subtype float128 is float (15 downto -112);
129  -----------------------------------------------------------------------------
130  -- The 128 bit floating point number is "long double" in C (on
131  -- some systems this is a 70 bit floating point number) and FLOAT*32
132  -- in Fortran.  The exponent is 15 bits wide and the fraction is 112
133  -- bits wide. This number can handle approximately 33 decimal digits.
134  -- Infinity is 2**32,767 in this number system.
135  -----------------------------------------------------------------------------
136
137  -- purpose: Checks for a valid floating point number
138  type valid_fpstate is (nan,           -- Signaling NaN (C FP_NAN)
139                         quiet_nan,     -- Quiet NaN (C FP_NAN)
140                         neg_inf,       -- Negative infinity (C FP_INFINITE)
141                         neg_normal,    -- negative normalized nonzero
142                         neg_denormal,  -- negative denormalized (FP_SUBNORMAL)
143                         neg_zero,      -- -0 (C FP_ZERO)
144                         pos_zero,      -- +0 (C FP_ZERO)
145                         pos_denormal,  -- Positive denormalized (FP_SUBNORMAL)
146                         pos_normal,    -- positive normalized nonzero
147                         pos_inf,       -- positive infinity
148                         isx);          -- at least one input is unknown
149
150  -- This deferred constant will tell you if the package body is synthesizable
151  -- or implemented as real numbers.
152  constant fphdlsynth_or_real : BOOLEAN;  -- deferred constant
153
154  -- Returns the class which X falls into
155  function Classfp (
156    x           : UNRESOLVED_float;              -- floating point input
157    check_error : BOOLEAN := float_check_error)  -- check for errors
158    return valid_fpstate;
159
160  -- Arithmetic functions, these operators do not require parameters.
161  function "abs" (arg : UNRESOLVED_float) return UNRESOLVED_float;
162  function "-"   (arg : UNRESOLVED_float) return UNRESOLVED_float;
163
164  -- These allows the base math functions to use the default values
165  -- of their parameters.  Thus they do full IEEE floating point.
166
167  function "+"   (l, r : UNRESOLVED_float) return UNRESOLVED_float;
168  function "-"   (l, r : UNRESOLVED_float) return UNRESOLVED_float;
169  function "*"   (l, r : UNRESOLVED_float) return UNRESOLVED_float;
170  function "/"   (l, r : UNRESOLVED_float) return UNRESOLVED_float;
171  function "rem" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
172  function "mod" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
173
174  -- Basic parameter list
175  -- round_style - Selects the rounding algorithm to use
176  -- guard - extra bits added to the end if the operation to add precision
177  -- check_error - When "false" turns off NAN and overflow checks
178  -- denormalize - When "false" turns off denormal number processing
179
180  function add (
181    l, r                 : UNRESOLVED_float;  -- floating point input
182    constant round_style : round_type := float_round_style;  -- rounding option
183    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
184    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
185    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
186    return UNRESOLVED_float;
187
188  function subtract (
189    l, r                 : UNRESOLVED_float;  -- floating point input
190    constant round_style : round_type := float_round_style;  -- rounding option
191    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
192    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
193    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
194    return UNRESOLVED_float;
195
196  function multiply (
197    l, r                 : UNRESOLVED_float;  -- floating point input
198    constant round_style : round_type := float_round_style;  -- rounding option
199    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
200    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
201    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
202    return UNRESOLVED_float;
203
204  function divide (
205    l, r                 : UNRESOLVED_float;  -- floating point input
206    constant round_style : round_type := float_round_style;  -- rounding option
207    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
208    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
209    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
210    return UNRESOLVED_float;
211
212  function remainder (
213    l, r                 : UNRESOLVED_float;  -- floating point input
214    constant round_style : round_type := float_round_style;  -- rounding option
215    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
216    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
217    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
218    return UNRESOLVED_float;
219
220  function modulo (
221    l, r                 : UNRESOLVED_float;  -- floating point input
222    constant round_style : round_type := float_round_style;  -- rounding option
223    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
224    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
225    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
226    return UNRESOLVED_float;
227
228  -- reciprocal
229  function reciprocal (
230    arg                  : UNRESOLVED_float;  -- floating point input
231    constant round_style : round_type := float_round_style;  -- rounding option
232    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
233    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
234    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
235    return UNRESOLVED_float;
236
237  function dividebyp2 (
238    l, r                 : UNRESOLVED_float;  -- floating point input
239    constant round_style : round_type := float_round_style;  -- rounding option
240    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
241    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
242    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
243    return UNRESOLVED_float;
244
245  -- Multiply accumulate  result = l*r + c
246  function mac (
247    l, r, c              : UNRESOLVED_float;  -- floating point input
248    constant round_style : round_type := float_round_style;  -- rounding option
249    constant guard       : NATURAL    := float_guard_bits;  -- number of guard bits
250    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
251    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
252    return UNRESOLVED_float;
253
254  -- Square root (all 754 based implementations need this)
255  function sqrt (
256    arg                  : UNRESOLVED_float;       -- floating point input
257    constant round_style : round_type := float_round_style;
258    constant guard       : NATURAL    := float_guard_bits;
259    constant check_error : BOOLEAN    := float_check_error;
260    constant denormalize : BOOLEAN    := float_denormalize)
261    return UNRESOLVED_float;
262
263  function Is_Negative (arg : UNRESOLVED_float) return BOOLEAN;
264
265  -----------------------------------------------------------------------------
266  -- compare functions
267  -- =, /=, >=, <=, <, >, maximum, minimum
268
269  function eq (                               -- equal =
270    l, r                 : UNRESOLVED_float;  -- floating point input
271    constant check_error : BOOLEAN := float_check_error;
272    constant denormalize : BOOLEAN := float_denormalize)
273    return BOOLEAN;
274
275  function ne (                               -- not equal /=
276    l, r                 : UNRESOLVED_float;  -- floating point input
277    constant check_error : BOOLEAN := float_check_error;
278    constant denormalize : BOOLEAN := float_denormalize)
279    return BOOLEAN;
280
281  function lt (                               -- less than <
282    l, r                 : UNRESOLVED_float;  -- floating point input
283    constant check_error : BOOLEAN := float_check_error;
284    constant denormalize : BOOLEAN := float_denormalize)
285    return BOOLEAN;
286
287  function gt (                               -- greater than >
288    l, r                 : UNRESOLVED_float;  -- floating point input
289    constant check_error : BOOLEAN := float_check_error;
290    constant denormalize : BOOLEAN := float_denormalize)
291    return BOOLEAN;
292
293  function le (                               -- less than or equal to <=
294    l, r                 : UNRESOLVED_float;  -- floating point input
295    constant check_error : BOOLEAN := float_check_error;
296    constant denormalize : BOOLEAN := float_denormalize)
297    return BOOLEAN;
298
299  function ge (                               -- greater than or equal to >=
300    l, r                 : UNRESOLVED_float;  -- floating point input
301    constant check_error : BOOLEAN := float_check_error;
302    constant denormalize : BOOLEAN := float_denormalize)
303    return BOOLEAN;
304
305  -- Need to overload the default versions of these
306  function "="  (l, r : UNRESOLVED_float) return BOOLEAN;
307  function "/=" (l, r : UNRESOLVED_float) return BOOLEAN;
308  function ">=" (l, r : UNRESOLVED_float) return BOOLEAN;
309  function "<=" (l, r : UNRESOLVED_float) return BOOLEAN;
310  function ">"  (l, r : UNRESOLVED_float) return BOOLEAN;
311  function "<"  (l, r : UNRESOLVED_float) return BOOLEAN;
312
313  function "?="  (l, r : UNRESOLVED_float) return STD_ULOGIC;
314  function "?/=" (l, r : UNRESOLVED_float) return STD_ULOGIC;
315  function "?>"  (l, r : UNRESOLVED_float) return STD_ULOGIC;
316  function "?>=" (l, r : UNRESOLVED_float) return STD_ULOGIC;
317  function "?<"  (l, r : UNRESOLVED_float) return STD_ULOGIC;
318  function "?<=" (l, r : UNRESOLVED_float) return STD_ULOGIC;
319
320  function std_match (l, r : UNRESOLVED_float) return BOOLEAN;
321  function find_rightmost (arg : UNRESOLVED_float; y : STD_ULOGIC)
322    return INTEGER;
323  function find_leftmost (arg : UNRESOLVED_float; y : STD_ULOGIC)
324    return INTEGER;
325  function maximum (l, r : UNRESOLVED_float) return UNRESOLVED_float;
326  function minimum (l, r : UNRESOLVED_float) return UNRESOLVED_float;
327
328  -- conversion functions
329  -- Converts one floating point number into another.
330
331  function resize (
332    arg                     : UNRESOLVED_float;  -- Floating point input
333    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
334    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
335    constant round_style    : round_type := float_round_style;  -- rounding option
336    constant check_error    : BOOLEAN    := float_check_error;
337    constant denormalize_in : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
338    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
339    return UNRESOLVED_float;
340
341  function resize (
342    arg                     : UNRESOLVED_float;  -- Floating point input
343    size_res                : UNRESOLVED_float;
344    constant round_style    : round_type := float_round_style;  -- rounding option
345    constant check_error    : BOOLEAN    := float_check_error;
346    constant denormalize_in : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
347    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
348    return UNRESOLVED_float;
349
350  function to_float32 (
351    arg                     : UNRESOLVED_float;
352    constant round_style    : round_type := float_round_style;  -- rounding option
353    constant check_error    : BOOLEAN    := float_check_error;
354    constant denormalize_in : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
355    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
356    return UNRESOLVED_float32;
357
358  function to_float64 (
359    arg                     : UNRESOLVED_float;
360    constant round_style    : round_type := float_round_style;  -- rounding option
361    constant check_error    : BOOLEAN    := float_check_error;
362    constant denormalize_in : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
363    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
364    return UNRESOLVED_float64;
365
366  function to_float128 (
367    arg                     : UNRESOLVED_float;
368    constant round_style    : round_type := float_round_style;  -- rounding option
369    constant check_error    : BOOLEAN    := float_check_error;
370    constant denormalize_in : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
371    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
372    return UNRESOLVED_float128;
373
374  -- Converts an fp into an SLV (needed for synthesis)
375  function to_slv (arg : UNRESOLVED_float) return STD_LOGIC_VECTOR;
376  alias to_StdLogicVector is to_slv [UNRESOLVED_float return STD_LOGIC_VECTOR];
377  alias to_Std_Logic_Vector is to_slv [UNRESOLVED_float return STD_LOGIC_VECTOR];
378
379  -- Converts an fp into an std_ulogic_vector (sulv)
380  function to_sulv (arg : UNRESOLVED_float) return STD_ULOGIC_VECTOR;
381  alias to_StdULogicVector is to_sulv [UNRESOLVED_float return STD_ULOGIC_VECTOR];
382  alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_float return STD_ULOGIC_VECTOR];
383
384  -- std_ulogic_vector to float
385  function to_float (
386    arg                     : STD_ULOGIC_VECTOR;
387    constant exponent_width : NATURAL := float_exponent_width;  -- length of FP output exponent
388    constant fraction_width : NATURAL := float_fraction_width)  -- length of FP output fraction
389    return UNRESOLVED_float;
390
391  -- Integer to float
392  function to_float (
393    arg                     : INTEGER;
394    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
395    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
396    constant round_style    : round_type := float_round_style)  -- rounding option
397    return UNRESOLVED_float;
398
399  -- real to float
400  function to_float (
401    arg                     : REAL;
402    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
403    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
404    constant round_style    : round_type := float_round_style;  -- rounding option
405    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
406    return UNRESOLVED_float;
407
408  -- unsigned to float
409  function to_float (
410    arg                     : UNRESOLVED_UNSIGNED;
411    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
412    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
413    constant round_style    : round_type := float_round_style)  -- rounding option
414    return UNRESOLVED_float;
415
416  -- signed to float
417  function to_float (
418    arg                     : UNRESOLVED_SIGNED;
419    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
420    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
421    constant round_style    : round_type := float_round_style)  -- rounding option
422    return UNRESOLVED_float;
423
424  -- unsigned fixed point to float
425  function to_float (
426    arg                     : UNRESOLVED_ufixed;  -- unsigned fixed point input
427    constant exponent_width : NATURAL    := float_exponent_width;  -- width of exponent
428    constant fraction_width : NATURAL    := float_fraction_width;  -- width of fraction
429    constant round_style    : round_type := float_round_style;  -- rounding
430    constant denormalize    : BOOLEAN    := float_denormalize)  -- use ieee extensions
431    return UNRESOLVED_float;
432
433  -- signed fixed point to float
434  function to_float (
435    arg                     : UNRESOLVED_sfixed;
436    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
437    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
438    constant round_style    : round_type := float_round_style;  -- rounding
439    constant denormalize    : BOOLEAN    := float_denormalize)  -- rounding option
440    return UNRESOLVED_float;
441
442  -- size_res functions
443  -- Integer to float
444  function to_float (
445    arg                  : INTEGER;
446    size_res             : UNRESOLVED_float;
447    constant round_style : round_type := float_round_style)  -- rounding option
448    return UNRESOLVED_float;
449
450  -- real to float
451  function to_float (
452    arg                  : REAL;
453    size_res             : UNRESOLVED_float;
454    constant round_style : round_type := float_round_style;  -- rounding option
455    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
456    return UNRESOLVED_float;
457
458  -- unsigned to float
459  function to_float (
460    arg                  : UNRESOLVED_UNSIGNED;
461    size_res             : UNRESOLVED_float;
462    constant round_style : round_type := float_round_style)  -- rounding option
463    return UNRESOLVED_float;
464
465  -- signed to float
466  function to_float (
467    arg                  : UNRESOLVED_SIGNED;
468    size_res             : UNRESOLVED_float;
469    constant round_style : round_type := float_round_style)  -- rounding option
470    return UNRESOLVED_float;
471
472  -- sulv to float
473  function to_float (
474    arg      : STD_ULOGIC_VECTOR;
475    size_res : UNRESOLVED_float)
476    return UNRESOLVED_float;
477
478  -- unsigned fixed point to float
479  function to_float (
480    arg                  : UNRESOLVED_ufixed;  -- unsigned fixed point input
481    size_res             : UNRESOLVED_float;
482    constant round_style : round_type := float_round_style;  -- rounding
483    constant denormalize : BOOLEAN    := float_denormalize)  -- use ieee extensions
484    return UNRESOLVED_float;
485
486  -- signed fixed point to float
487  function to_float (
488    arg                  : UNRESOLVED_sfixed;
489    size_res             : UNRESOLVED_float;
490    constant round_style : round_type := float_round_style;  -- rounding
491    constant denormalize : BOOLEAN    := float_denormalize)  -- rounding option
492    return UNRESOLVED_float;
493
494  -- float to unsigned
495  function to_unsigned (
496    arg                  : UNRESOLVED_float;  -- floating point input
497    constant size        : NATURAL;     -- length of output
498    constant round_style : round_type := float_round_style;  -- rounding option
499    constant check_error : BOOLEAN    := float_check_error)  -- check for errors
500    return UNRESOLVED_UNSIGNED;
501
502  -- float to signed
503  function to_signed (
504    arg                  : UNRESOLVED_float;  -- floating point input
505    constant size        : NATURAL;     -- length of output
506    constant round_style : round_type := float_round_style;  -- rounding option
507    constant check_error : BOOLEAN    := float_check_error)  -- check for errors
508    return UNRESOLVED_SIGNED;
509
510  -- purpose: Converts a float to unsigned fixed point
511  function to_ufixed (
512    arg                     : UNRESOLVED_float;  -- fp input
513    constant left_index     : INTEGER;  -- integer part
514    constant right_index    : INTEGER;  -- fraction part
515    constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;  -- saturate
516    constant round_style    : fixed_round_style_type    := fixed_round_style;  -- rounding
517    constant check_error    : BOOLEAN                   := float_check_error;  -- check for errors
518    constant denormalize    : BOOLEAN                   := float_denormalize)
519    return UNRESOLVED_ufixed;
520
521  -- float to signed fixed point
522  function to_sfixed (
523    arg                     : UNRESOLVED_float;  -- fp input
524    constant left_index     : INTEGER;  -- integer part
525    constant right_index    : INTEGER;  -- fraction part
526    constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;  -- saturate
527    constant round_style    : fixed_round_style_type    := fixed_round_style;  -- rounding
528    constant check_error    : BOOLEAN                   := float_check_error;  -- check for errors
529    constant denormalize    : BOOLEAN                   := float_denormalize)
530    return UNRESOLVED_sfixed;
531
532  -- size_res versions
533  -- float to unsigned
534  function to_unsigned (
535    arg                  : UNRESOLVED_float;  -- floating point input
536    size_res             : UNRESOLVED_UNSIGNED;
537    constant round_style : round_type := float_round_style;  -- rounding option
538    constant check_error : BOOLEAN    := float_check_error)  -- check for errors
539    return UNRESOLVED_UNSIGNED;
540
541  -- float to signed
542  function to_signed (
543    arg                  : UNRESOLVED_float;  -- floating point input
544    size_res             : UNRESOLVED_SIGNED;
545    constant round_style : round_type := float_round_style;  -- rounding option
546    constant check_error : BOOLEAN    := float_check_error)  -- check for errors
547    return UNRESOLVED_SIGNED;
548
549  -- purpose: Converts a float to unsigned fixed point
550  function to_ufixed (
551    arg                     : UNRESOLVED_float;  -- fp input
552    size_res                : UNRESOLVED_ufixed;
553    constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;  -- saturate
554    constant round_style    : fixed_round_style_type    := fixed_round_style;  -- rounding
555    constant check_error    : BOOLEAN                   := float_check_error;  -- check for errors
556    constant denormalize    : BOOLEAN                   := float_denormalize)
557    return UNRESOLVED_ufixed;
558
559  -- float to signed fixed point
560  function to_sfixed (
561    arg                     : UNRESOLVED_float;  -- fp input
562    size_res                : UNRESOLVED_sfixed;
563    constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;  -- saturate
564    constant round_style    : fixed_round_style_type    := fixed_round_style;  -- rounding
565    constant check_error    : BOOLEAN                   := float_check_error;  -- check for errors
566    constant denormalize    : BOOLEAN                   := float_denormalize)
567    return UNRESOLVED_sfixed;
568
569  -- float to real
570  function to_real (
571    arg                  : UNRESOLVED_float;  -- floating point input
572    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
573    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
574    return REAL;
575
576  -- float to integer
577  function to_integer (
578    arg                  : UNRESOLVED_float;  -- floating point input
579    constant round_style : round_type := float_round_style;  -- rounding option
580    constant check_error : BOOLEAN    := float_check_error)  -- check for errors
581    return INTEGER;
582
583  -- For Verilog compatability
584  function realtobits (arg : REAL) return STD_ULOGIC_VECTOR;
585  function bitstoreal (arg : STD_ULOGIC_VECTOR) return REAL;
586
587  -- Maps metalogical values
588  function to_01 (
589    arg  : UNRESOLVED_float;            -- floating point input
590    XMAP : STD_LOGIC := '0')
591    return UNRESOLVED_float;
592
593  function Is_X (arg    : UNRESOLVED_float) return BOOLEAN;
594  function to_X01 (arg  : UNRESOLVED_float) return UNRESOLVED_float;
595  function to_X01Z (arg : UNRESOLVED_float) return UNRESOLVED_float;
596  function to_UX01 (arg : UNRESOLVED_float) return UNRESOLVED_float;
597
598  -- These two procedures were copied out of the body because they proved
599  -- very useful for vendor specific algorithm development
600  -- Break_number converts a floating point number into it's parts
601  -- Exponent is biased by -1
602
603  procedure break_number (
604    arg         : in  UNRESOLVED_float;
605    denormalize : in  BOOLEAN := float_denormalize;
606    check_error : in  BOOLEAN := float_check_error;
607    fract       : out UNRESOLVED_UNSIGNED;
608    expon       : out UNRESOLVED_SIGNED;  -- NOTE:  Add 1 to get the real exponent!
609    sign        : out STD_ULOGIC);
610
611  procedure break_number (
612    arg         : in  UNRESOLVED_float;
613    denormalize : in  BOOLEAN := float_denormalize;
614    check_error : in  BOOLEAN := float_check_error;
615    fract       : out UNRESOLVED_ufixed;  -- a number between 1.0 and 2.0
616    expon       : out UNRESOLVED_SIGNED;  -- NOTE:  Add 1 to get the real exponent!
617    sign        : out STD_ULOGIC);
618
619  -- Normalize takes a fraction and and exponent and converts them into
620  -- a floating point number.  Does the shifting and the rounding.
621  -- Exponent is assumed to be biased by -1
622
623  function normalize (
624    fract                   : UNRESOLVED_UNSIGNED;  -- fraction, unnormalized
625    expon                   : UNRESOLVED_SIGNED;   -- exponent - 1, normalized
626    sign                    : STD_ULOGIC;         -- sign bit
627    sticky                  : STD_ULOGIC := '0';  -- Sticky bit (rounding)
628    constant exponent_width : NATURAL    := float_exponent_width;  -- size of output exponent
629    constant fraction_width : NATURAL    := float_fraction_width;  -- size of output fraction
630    constant round_style    : round_type := float_round_style;  -- rounding option
631    constant denormalize    : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
632    constant nguard         : NATURAL    := float_guard_bits)   -- guard bits
633    return UNRESOLVED_float;
634
635  -- Exponent is assumed to be biased by -1
636  function normalize (
637    fract                   : UNRESOLVED_ufixed;   -- unsigned fixed point
638    expon                   : UNRESOLVED_SIGNED;   -- exponent - 1, normalized
639    sign                    : STD_ULOGIC;         -- sign bit
640    sticky                  : STD_ULOGIC := '0';  -- Sticky bit (rounding)
641    constant exponent_width : NATURAL    := float_exponent_width;  -- size of output exponent
642    constant fraction_width : NATURAL    := float_fraction_width;  -- size of output fraction
643    constant round_style    : round_type := float_round_style;  -- rounding option
644    constant denormalize    : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
645    constant nguard         : NATURAL    := float_guard_bits)   -- guard bits
646    return UNRESOLVED_float;
647
648  function normalize (
649    fract                : UNRESOLVED_UNSIGNED;    -- unsigned
650    expon                : UNRESOLVED_SIGNED;      -- exponent - 1, normalized
651    sign                 : STD_ULOGIC;  -- sign bit
652    sticky               : STD_ULOGIC := '0';  -- Sticky bit (rounding)
653    size_res             : UNRESOLVED_float;   -- used for sizing only
654    constant round_style : round_type := float_round_style;  -- rounding option
655    constant denormalize : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
656    constant nguard      : NATURAL    := float_guard_bits)   -- guard bits
657    return UNRESOLVED_float;
658
659  -- Exponent is assumed to be biased by -1
660  function normalize (
661    fract                : UNRESOLVED_ufixed;      -- unsigned fixed point
662    expon                : UNRESOLVED_SIGNED;      -- exponent - 1, normalized
663    sign                 : STD_ULOGIC;  -- sign bit
664    sticky               : STD_ULOGIC := '0';  -- Sticky bit (rounding)
665    size_res             : UNRESOLVED_float;   -- used for sizing only
666    constant round_style : round_type := float_round_style;  -- rounding option
667    constant denormalize : BOOLEAN    := float_denormalize;  -- Use IEEE extended FP
668    constant nguard      : NATURAL    := float_guard_bits)   -- guard bits
669    return UNRESOLVED_float;
670
671  -- overloaded versions
672  function "+"   (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
673  function "+"   (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
674  function "+"   (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
675  function "+"   (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
676  function "-"   (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
677  function "-"   (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
678  function "-"   (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
679  function "-"   (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
680  function "*"   (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
681  function "*"   (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
682  function "*"   (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
683  function "*"   (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
684  function "/"   (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
685  function "/"   (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
686  function "/"   (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
687  function "/"   (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
688  function "rem" (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
689  function "rem" (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
690  function "rem" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
691  function "rem" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
692  function "mod" (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
693  function "mod" (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
694  function "mod" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
695  function "mod" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
696
697  -- overloaded compare functions
698  function "="   (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
699  function "/="  (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
700  function ">="  (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
701  function "<="  (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
702  function ">"   (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
703  function "<"   (l : UNRESOLVED_float; r : REAL)    return BOOLEAN;
704  function "="   (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
705  function "/="  (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
706  function ">="  (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
707  function "<="  (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
708  function ">"   (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
709  function "<"   (l : REAL; r : UNRESOLVED_float)    return BOOLEAN;
710  function "="   (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
711  function "/="  (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
712  function ">="  (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
713  function "<="  (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
714  function ">"   (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
715  function "<"   (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
716  function "="   (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
717  function "/="  (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
718  function ">="  (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
719  function "<="  (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
720  function ">"   (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
721  function "<"   (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
722  function "?="  (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
723  function "?/=" (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
724  function "?>"  (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
725  function "?>=" (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
726  function "?<"  (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
727  function "?<=" (l : UNRESOLVED_float; r : REAL)    return STD_ULOGIC;
728  function "?="  (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
729  function "?/=" (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
730  function "?>"  (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
731  function "?>=" (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
732  function "?<"  (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
733  function "?<=" (l : REAL; r : UNRESOLVED_float)    return STD_ULOGIC;
734  function "?="  (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
735  function "?/=" (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
736  function "?>"  (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
737  function "?>=" (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
738  function "?<"  (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
739  function "?<=" (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
740  function "?="  (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
741  function "?/=" (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
742  function "?>"  (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
743  function "?>=" (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
744  function "?<"  (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
745  function "?<=" (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
746  -- minimum and maximum overloads
747  function maximum (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
748  function minimum (l : UNRESOLVED_float; r : REAL)    return UNRESOLVED_float;
749  function maximum (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
750  function minimum (l : REAL; r : UNRESOLVED_float)    return UNRESOLVED_float;
751  function maximum (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
752  function minimum (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
753  function maximum (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
754  function minimum (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
755----------------------------------------------------------------------------
756  -- logical functions
757  ----------------------------------------------------------------------------
758
759  function "not"  (l    : UNRESOLVED_float) return UNRESOLVED_float;
760  function "and"  (l, r : UNRESOLVED_float) return UNRESOLVED_float;
761  function "or"   (l, r : UNRESOLVED_float) return UNRESOLVED_float;
762  function "nand" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
763  function "nor"  (l, r : UNRESOLVED_float) return UNRESOLVED_float;
764  function "xor"  (l, r : UNRESOLVED_float) return UNRESOLVED_float;
765  function "xnor" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
766  -- Vector and std_ulogic functions, same as functions in numeric_std
767  function "and" (l : STD_ULOGIC; r : UNRESOLVED_float)
768    return UNRESOLVED_float;
769  function "and" (l : UNRESOLVED_float; r : STD_ULOGIC)
770    return UNRESOLVED_float;
771  function "or" (l : STD_ULOGIC; r : UNRESOLVED_float)
772    return UNRESOLVED_float;
773  function "or" (l : UNRESOLVED_float; r : STD_ULOGIC)
774    return UNRESOLVED_float;
775  function "nand" (l : STD_ULOGIC; r : UNRESOLVED_float)
776    return UNRESOLVED_float;
777  function "nand" (l : UNRESOLVED_float; r : STD_ULOGIC)
778    return UNRESOLVED_float;
779  function "nor" (l : STD_ULOGIC; r : UNRESOLVED_float)
780    return UNRESOLVED_float;
781  function "nor" (l : UNRESOLVED_float; r : STD_ULOGIC)
782    return UNRESOLVED_float;
783  function "xor" (l : STD_ULOGIC; r : UNRESOLVED_float)
784    return UNRESOLVED_float;
785  function "xor" (l : UNRESOLVED_float; r : STD_ULOGIC)
786    return UNRESOLVED_float;
787  function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_float)
788    return UNRESOLVED_float;
789  function "xnor" (l : UNRESOLVED_float; r : STD_ULOGIC)
790    return UNRESOLVED_float;
791  -- Reduction operators, same as numeric_std functions
792  function "and"  (l : UNRESOLVED_float) return STD_ULOGIC;
793  function "nand" (l : UNRESOLVED_float) return STD_ULOGIC;
794  function "or"   (l : UNRESOLVED_float) return STD_ULOGIC;
795  function "nor"  (l : UNRESOLVED_float) return STD_ULOGIC;
796  function "xor"  (l : UNRESOLVED_float) return STD_ULOGIC;
797  function "xnor" (l : UNRESOLVED_float) return STD_ULOGIC;
798
799  -- Note: "sla", "sra", "sll", "slr", "rol" and "ror" not implemented.
800
801  -----------------------------------------------------------------------------
802  -- Recommended Functions from the IEEE 754 Appendix
803  -----------------------------------------------------------------------------
804
805  -- returns x with the sign of y.
806  function Copysign (x, y : UNRESOLVED_float) return UNRESOLVED_float;
807
808  -- Returns y * 2**n for integral values of N without computing 2**n
809  function Scalb (
810    y                    : UNRESOLVED_float;  -- floating point input
811    N                    : INTEGER;     -- exponent to add
812    constant round_style : round_type := float_round_style;  -- rounding option
813    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
814    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
815    return UNRESOLVED_float;
816
817  -- Returns y * 2**n for integral values of N without computing 2**n
818  function Scalb (
819    y                    : UNRESOLVED_float;  -- floating point input
820    N                    : UNRESOLVED_SIGNED;      -- exponent to add
821    constant round_style : round_type := float_round_style;  -- rounding option
822    constant check_error : BOOLEAN    := float_check_error;  -- check for errors
823    constant denormalize : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
824    return UNRESOLVED_float;
825
826  -- returns the unbiased exponent of x
827  function Logb (x : UNRESOLVED_float) return INTEGER;
828  function Logb (x : UNRESOLVED_float) return UNRESOLVED_SIGNED;
829
830  -- returns the next representable neighbor of x in the direction toward y
831  function Nextafter (
832    x, y                 : UNRESOLVED_float;  -- floating point input
833    constant check_error : BOOLEAN := float_check_error;  -- check for errors
834    constant denormalize : BOOLEAN := float_denormalize)
835    return UNRESOLVED_float;
836
837  -- Returns TRUE if X is unordered with Y.
838  function Unordered (x, y : UNRESOLVED_float) return BOOLEAN;
839  function Finite (x       : UNRESOLVED_float) return BOOLEAN;
840  function Isnan (x        : UNRESOLVED_float) return BOOLEAN;
841
842  -- Function to return constants.
843  function zerofp (
844    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
845    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
846    return UNRESOLVED_float;
847  function nanfp (
848    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
849    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
850    return UNRESOLVED_float;
851  function qnanfp (
852    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
853    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
854    return UNRESOLVED_float;
855  function pos_inffp (
856    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
857    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
858    return UNRESOLVED_float;
859  function neg_inffp (
860    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
861    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
862    return UNRESOLVED_float;
863  function neg_zerofp (
864    constant exponent_width : NATURAL := float_exponent_width;  -- exponent
865    constant fraction_width : NATURAL := float_fraction_width)  -- fraction
866    return UNRESOLVED_float;
867  -- size_res versions
868  function zerofp (
869    size_res : UNRESOLVED_float)        -- variable is only use for sizing
870    return UNRESOLVED_float;
871  function nanfp (
872    size_res : UNRESOLVED_float)        -- variable is only use for sizing
873    return UNRESOLVED_float;
874  function qnanfp (
875    size_res : UNRESOLVED_float)        -- variable is only use for sizing
876    return UNRESOLVED_float;
877  function pos_inffp (
878    size_res : UNRESOLVED_float)        -- variable is only use for sizing
879    return UNRESOLVED_float;
880  function neg_inffp (
881    size_res : UNRESOLVED_float)        -- variable is only use for sizing
882    return UNRESOLVED_float;
883  function neg_zerofp (
884    size_res : UNRESOLVED_float)        -- variable is only use for sizing
885    return UNRESOLVED_float;
886
887  --===========================================================================
888  -- string and textio Functions
889  --===========================================================================
890
891  -- writes S:EEEE:FFFFFFFF
892  procedure WRITE (
893    L         : inout LINE;              -- access type (pointer)
894    VALUE     : in    UNRESOLVED_float;  -- value to write
895    JUSTIFIED : in    SIDE  := right;    -- which side to justify text
896    FIELD     : in    WIDTH := 0);       -- width of field
897
898  -- Reads SEEEEFFFFFFFF, "." and ":" are ignored
899  procedure READ (L    : inout LINE; VALUE : out UNRESOLVED_float);
900  procedure READ (L    : inout LINE; VALUE : out UNRESOLVED_float;
901                  GOOD : out   BOOLEAN);
902
903  alias BREAD is READ [LINE, UNRESOLVED_float, BOOLEAN];
904  alias BREAD is READ [LINE, UNRESOLVED_float];
905  alias BWRITE is WRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
906  alias BINARY_READ is READ [LINE, UNRESOLVED_float, BOOLEAN];
907  alias BINARY_READ is READ [LINE, UNRESOLVED_float];
908  alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
909
910  procedure OWRITE (
911    L         : inout LINE;              -- access type (pointer)
912    VALUE     : in    UNRESOLVED_float;  -- value to write
913    JUSTIFIED : in    SIDE  := right;    -- which side to justify text
914    FIELD     : in    WIDTH := 0);       -- width of field
915
916  -- Octal read with padding, no separators used
917  procedure OREAD (L    : inout LINE; VALUE : out UNRESOLVED_float);
918  procedure OREAD (L    : inout LINE; VALUE : out UNRESOLVED_float;
919                   GOOD : out   BOOLEAN);
920  alias OCTAL_READ is OREAD [LINE, UNRESOLVED_float, BOOLEAN];
921  alias OCTAL_READ is OREAD [LINE, UNRESOLVED_float];
922  alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
923
924  -- Hex write with padding, no separators
925  procedure HWRITE (
926    L         : inout LINE;              -- access type (pointer)
927    VALUE     : in    UNRESOLVED_float;  -- value to write
928    JUSTIFIED : in    SIDE  := right;    -- which side to justify text
929    FIELD     : in    WIDTH := 0);       -- width of field
930
931  -- Hex read with padding, no separators used
932  procedure HREAD (L : inout LINE; VALUE : out UNRESOLVED_float);
933  procedure HREAD (L    : inout LINE; VALUE : out UNRESOLVED_float;
934                   GOOD : out   BOOLEAN);
935  alias HEX_READ is HREAD [LINE, UNRESOLVED_float, BOOLEAN];
936  alias HEX_READ is HREAD [LINE, UNRESOLVED_float];
937  alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
938
939  -- returns "S:EEEE:FFFFFFFF"
940  function to_string (value : UNRESOLVED_float) return STRING;
941  alias TO_BSTRING is TO_STRING [UNRESOLVED_float return STRING];
942  alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_float return STRING];
943
944  -- Returns a HEX string, with padding
945  function to_hstring (value : UNRESOLVED_float) return STRING;
946  alias TO_HEX_STRING is to_hstring [UNRESOLVED_float return STRING];
947
948  -- Returns and octal string, with padding
949  function to_ostring (value : UNRESOLVED_float) return STRING;
950  alias TO_OCTAL_STRING is to_ostring [UNRESOLVED_float return STRING];
951
952  function from_string (
953    bstring                 : STRING;   -- binary string
954    constant exponent_width : NATURAL := float_exponent_width;
955    constant fraction_width : NATURAL := float_fraction_width)
956    return UNRESOLVED_float;
957  alias from_bstring is from_string [STRING, NATURAL, NATURAL
958                                     return UNRESOLVED_float];
959  alias from_binary_string is from_string [STRING, NATURAL, NATURAL
960                                           return UNRESOLVED_float];
961  function from_ostring (
962    ostring                 : STRING;   -- Octal string
963    constant exponent_width : NATURAL := float_exponent_width;
964    constant fraction_width : NATURAL := float_fraction_width)
965    return UNRESOLVED_float;
966  alias from_octal_string is from_ostring [STRING, NATURAL, NATURAL
967                                           return UNRESOLVED_float];
968
969  function from_hstring (
970    hstring                 : STRING;   -- hex string
971    constant exponent_width : NATURAL := float_exponent_width;
972    constant fraction_width : NATURAL := float_fraction_width)
973    return UNRESOLVED_float;
974  alias from_hex_string is from_hstring [STRING, NATURAL, NATURAL
975                                         return UNRESOLVED_float];
976
977  function from_string (
978    bstring  : STRING;                  -- binary string
979    size_res : UNRESOLVED_float)        -- used for sizing only
980    return UNRESOLVED_float;
981  alias from_bstring is from_string [STRING, UNRESOLVED_float
982                                     return UNRESOLVED_float];
983  alias from_binary_string is from_string [STRING, UNRESOLVED_float
984                                           return UNRESOLVED_float];
985
986  function from_ostring (
987    ostring  : STRING;                  -- Octal string
988    size_res : UNRESOLVED_float)        -- used for sizing only
989    return UNRESOLVED_float;
990  alias from_octal_string is from_ostring [STRING, UNRESOLVED_float
991                                           return UNRESOLVED_float];
992
993  function from_hstring (
994    hstring  : STRING;                  -- hex string
995    size_res : UNRESOLVED_float)        -- used for sizing only
996    return UNRESOLVED_float;
997  alias from_hex_string is from_hstring [STRING, UNRESOLVED_float
998                                         return UNRESOLVED_float];
999
1000end package float_generic_pkg;
1001