Binary fixed-point arithmetic over the ufixed and sfixed types.
- Use clause
-
library IEEE;
use IEEE.FIXED_GENERIC_PKG.all; - Source
-
ieee/fixed_generic_pkg.vhdlin the IEEE 1076 OSR, tag1076-2019
Apache License 2.0, © 2019 IEEE P1076 WG Authors - Length
- 1439 lines
- VHDL revisions
- Added in 1076-2008; updated through 1076-2019
- Body
- View package body ›
Overview
FIXED_GENERIC_PKG defines binary fixed-point arithmetic on the
unresolved types UNRESOLVED_ufixed (unsigned) and
UNRESOLVED_sfixed (signed two’s complement), plus the
resolved subtypes ufixed and sfixed built on
STD_LOGIC. The position of the binary point is encoded directly
in each value’s index range, so a 4.4 unsigned number sits in
UNRESOLVED_ufixed(3 downto -4).
The package is generic over four configuration constants
(fixed_round_style, fixed_overflow_style,
fixed_guard_bits, no_warning); the instantiated
FIXED_PKG wires those to the
common defaults (round-nearest, saturate, 3 guard bits). For the rules that
govern the body of this package, see §16.10 of IEEE Std 1076-2019.
What's defined here
- Types
-
UNRESOLVED_ufixed,UNRESOLVED_sfixed(unconstrained arrays ofSTD_ULOGIC) and the resolved subtypesu_ufixed/u_sfixed/ufixed/sfixed. - Operator groups
- Arithmetic · Comparison · Shift & rotate · Logical · Resize · Conversion · Translation · String & textio
- Key named functions
-
resize,to_ufixed,to_sfixed,to_real,to_integer,to_slv,scalb,divide,reciprocal,remainder,modulo,maximum,minimum,find_msb,find_lsb,read,write,to_string,to_hstring,to_ostring
VHDL source listing
docFile header
lines 1–42
-- -----------------------------------------------------------------
--
-- Copyright 2019 IEEE P1076 WG Authors
--
-- See the LICENSE file distributed with this work for copyright and
-- licensing information and the AUTHORS file.
--
-- This file to you under the Apache License, Version 2.0 (the "License").
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-- implied. See the License for the specific language governing
-- permissions and limitations under the License.
--
-- Title : Fixed-point package (Generic package declaration)
-- :
-- Library : This package shall be compiled into a library
-- : symbolically named IEEE.
-- :
-- Developers: Accellera VHDL-TC and IEEE P1076 Working Group
-- :
-- Purpose : This packages defines basic binary fixed point
-- : arithmetic functions
-- :
-- Note : This package may be modified to include additional data
-- : required by tools, but it must in no way change the
-- : external interfaces or simulation behavior of the
-- : description. It is permissible to add comments and/or
-- : attributes to the package declarations, but not to change
-- : or delete any original lines of the package declaration.
-- : The package body may be changed only in accordance with
-- : the terms of Clause 16 of this standard.
-- :
-- --------------------------------------------------------------------
-- $Revision: 1220 $
-- $Date: 2008-04-10 17:16:09 +0930 (Thu, 10 Apr 2008) $
-- --------------------------------------------------------------------
use STD.TEXTIO.all;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
use IEEE.fixed_float_types.all;
package fixed_generic_pkg is
generic (
-- Rounding routine to use in fixed point, fixed_round or fixed_truncate
fixed_round_style : fixed_round_style_type := fixed_round;
-- Overflow routine to use in fixed point, fixed_saturate or fixed_wrap
fixed_overflow_style : fixed_overflow_style_type := fixed_saturate;
-- Extra bits used in divide routines
fixed_guard_bits : NATURAL := 3;
-- If TRUE, then turn off warnings on "X" propagation
no_warning : BOOLEAN := false
);
coCopyRightNotice
lines 61–64
CopyRightNotice -- Author David Bishop (dbishop@vhdl.org)
constant CopyRightNotice : STRING :=
"Copyright IEEE P1076 WG. Licensed Apache 2.0";
tyUNRESOLVED_ufixed
lines 65–66
UNRESOLVED_ufixed -- base Unsigned fixed point type, downto direction assumed
type UNRESOLVED_ufixed is array (INTEGER range <>) of STD_ULOGIC;tyUNRESOLVED_sfixed
lines 67–69
UNRESOLVED_sfixed -- base Signed fixed point type, downto direction assumed
type UNRESOLVED_sfixed is array (INTEGER range <>) of STD_ULOGIC;
alU_ufixed, U_sfixed
lines 70–72
U_ufixed, U_sfixed alias U_ufixed is UNRESOLVED_ufixed;
alias U_sfixed is UNRESOLVED_sfixed;
stufixed, sfixed
lines 73–75
ufixed, sfixed subtype ufixed is (resolved) UNRESOLVED_ufixed;
subtype sfixed is (resolved) UNRESOLVED_sfixed;
Arithmetic operators
--===========================================================================
-- Arithmetic Operators:
--===========================================================================
fn"abs"
lines 80–85
"abs" -- Absolute value, 2's complement
-- abs sfixed(a downto b) = sfixed(a+1 downto b)
function "abs" (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Negation, 2's complement
-- - sfixed(a downto b) = sfixed(a+1 downto b)fn"-"
lines 86–90
"-" function "-" (arg : UNRESOLVED_sfixed)return UNRESOLVED_sfixed;
-- Addition
-- ufixed(a downto b) + ufixed(c downto d)
-- = ufixed(maximum(a,c)+1 downto minimum(b,d))fn"+"
lines 91–99
"+" function "+" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed(a downto b) + sfixed(c downto d)
-- = sfixed(maximum(a,c)+1 downto minimum(b,d))
function "+" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Subtraction
-- ufixed(a downto b) - ufixed(c downto d)
-- = ufixed(maximum(a,c)+1 downto minimum(b,d))fn"-"
lines 100–107
"-" function "-" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed(a downto b) - sfixed(c downto d)
-- = sfixed(maximum(a,c)+1 downto minimum(b,d))
function "-" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Multiplication
-- ufixed(a downto b) * ufixed(c downto d) = ufixed(a+c+1 downto b+d)fn"*"
lines 108–114
"*" function "*" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed(a downto b) * sfixed(c downto d) = sfixed(a+c+1 downto b+d)
function "*" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Division
-- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1)fn"/"
lines 115–122
"/" function "/" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c)
function "/" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Remainder
-- ufixed (a downto b) rem ufixed (c downto d)
-- = ufixed (minimum(a,c) downto minimum(b,d))fn"rem"
lines 123–131
"rem" function "rem" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed (a downto b) rem sfixed (c downto d)
-- = sfixed (minimum(a,c) downto minimum(b,d))
function "rem" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Modulo
-- ufixed (a downto b) mod ufixed (c downto d)
-- = ufixed (minimum(a,c) downto minimum(b, d))fn"mod"
lines 132–146
"mod" function "mod" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed (a downto b) mod sfixed (c downto d)
-- = sfixed (c downto minimum(b, d))
function "mod" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
----------------------------------------------------------------------------
-- In these routines the "real" or "natural" (integer)
-- are converted into a fixed point number and then the operation is
-- performed. It is assumed that the array will be large enough.
-- If the input is "real" then the real number is converted into a fixed of
-- the same size as the fixed point input. If the number is an "integer"
-- then it is converted into fixed with the range (l'high downto 0).
----------------------------------------------------------------------------
fn"+"
lines 147–159
"+" -- ufixed(a downto b) + ufixed(a downto b) = ufixed(a+1 downto b)
function "+" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed(c downto d) + ufixed(c downto d) = ufixed(c+1 downto d)
function "+" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) + ufixed(a downto 0) = ufixed(a+1 downto minimum(0,b))
function "+" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed(a downto 0) + ufixed(c downto d) = ufixed(c+1 downto minimum(0,d))
function "+" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) - ufixed(a downto b) = ufixed(a+1 downto b)fn"-"
lines 160–171
"-" function "-" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed(c downto d) - ufixed(c downto d) = ufixed(c+1 downto d)
function "-" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) - ufixed(a downto 0) = ufixed(a+1 downto minimum(0,b))
function "-" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed(a downto 0) + ufixed(c downto d) = ufixed(c+1 downto minimum(0,d))
function "-" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) * ufixed(a downto b) = ufixed(2a+1 downto 2b)fn"*"
lines 172–183
"*" function "*" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed(c downto d) * ufixed(c downto d) = ufixed(2c+1 downto 2d)
function "*" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed (a downto b) * ufixed (a downto 0) = ufixed (2a+1 downto b)
function "*" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed (a downto b) * ufixed (a downto 0) = ufixed (2a+1 downto b)
function "*" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) / ufixed(a downto b) = ufixed(a-b downto b-a-1)fn"/"
lines 184–195
"/" function "/" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed(a downto b) / ufixed(a downto b) = ufixed(a-b downto b-a-1)
function "/" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed(a downto b) / ufixed(a downto 0) = ufixed(a downto b-a-1)
function "/" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed(c downto 0) / ufixed(c downto d) = ufixed(c-d downto -c-1)
function "/" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed (a downto b) rem ufixed (a downto b) = ufixed (a downto b)fn"rem"
lines 196–207
"rem" function "rem" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed (c downto d) rem ufixed (c downto d) = ufixed (c downto d)
function "rem" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed (a downto b) rem ufixed (a downto 0) = ufixed (a downto minimum(b,0))
function "rem" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed (c downto 0) rem ufixed (c downto d) = ufixed (c downto minimum(d,0))
function "rem" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed (a downto b) mod ufixed (a downto b) = ufixed (a downto b)fn"mod"
lines 208–219
"mod" function "mod" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-- ufixed (c downto d) mod ufixed (c downto d) = ufixed (c downto d)
function "mod" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- ufixed (a downto b) mod ufixed (a downto 0) = ufixed (a downto minimum(b,0))
function "mod" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-- ufixed (c downto 0) mod ufixed (c downto d) = ufixed (c downto minimum(d,0))
function "mod" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-- sfixed(a downto b) + sfixed(a downto b) = sfixed(a+1 downto b)fn"+"
lines 220–231
"+" function "+" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed(c downto d) + sfixed(c downto d) = sfixed(c+1 downto d)
function "+" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) + sfixed(a downto 0) = sfixed(a+1 downto minimum(0,b))
function "+" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed(c downto 0) + sfixed(c downto d) = sfixed(c+1 downto minimum(0,d))
function "+" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) - sfixed(a downto b) = sfixed(a+1 downto b)fn"-"
lines 232–243
"-" function "-" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed(c downto d) - sfixed(c downto d) = sfixed(c+1 downto d)
function "-" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) - sfixed(a downto 0) = sfixed(a+1 downto minimum(0,b))
function "-" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed(c downto 0) - sfixed(c downto d) = sfixed(c+1 downto minimum(0,d))
function "-" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) * sfixed(a downto b) = sfixed(2a+1 downto 2b)fn"*"
lines 244–255
"*" function "*" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed(c downto d) * sfixed(c downto d) = sfixed(2c+1 downto 2d)
function "*" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) * sfixed(a downto 0) = sfixed(2a+1 downto b)
function "*" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed(c downto 0) * sfixed(c downto d) = sfixed(2c+1 downto d)
function "*" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) / sfixed(a downto b) = sfixed(a-b+1 downto b-a)fn"/"
lines 256–267
"/" function "/" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed(c downto d) / sfixed(c downto d) = sfixed(c-d+1 downto d-c)
function "/" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed(a downto b) / sfixed(a downto 0) = sfixed(a+1 downto b-a)
function "/" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed(c downto 0) / sfixed(c downto d) = sfixed(c-d+1 downto -c)
function "/" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed (a downto b) rem sfixed (a downto b) = sfixed (a downto b)fn"rem"
lines 268–279
"rem" function "rem" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed (c downto d) rem sfixed (c downto d) = sfixed (c downto d)
function "rem" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed (a downto b) rem sfixed (a downto 0) = sfixed (a downto minimum(b,0))
function "rem" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed (c downto 0) rem sfixed (c downto d) = sfixed (c downto minimum(d,0))
function "rem" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed (a downto b) mod sfixed (a downto b) = sfixed (a downto b)fn"mod"
lines 280–292
"mod" function "mod" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-- sfixed (c downto d) mod sfixed (c downto d) = sfixed (c downto d)
function "mod" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- sfixed (a downto b) mod sfixed (a downto 0) = sfixed (a downto minimum(b,0))
function "mod" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-- sfixed (c downto 0) mod sfixed (c downto d) = sfixed (c downto minimum(d,0))
function "mod" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- This version of divide gives the user more control
-- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1)fndivide
lines 293–308
divide function divide (
l, r : UNRESOLVED_ufixed;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
-- This version of divide gives the user more control
-- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c)
function divide (
l, r : UNRESOLVED_sfixed;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
-- These functions return 1/X
-- 1 / ufixed(a downto b) = ufixed(-b downto -a-1)fnreciprocal
lines 309–324
reciprocal function reciprocal (
arg : UNRESOLVED_ufixed; -- fixed point input
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
-- 1 / sfixed(a downto b) = sfixed(-b+1 downto -a)
function reciprocal (
arg : UNRESOLVED_sfixed; -- fixed point input
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
-- REM function
-- ufixed (a downto b) rem ufixed (c downto d)
-- = ufixed (minimum(a,c) downto minimum(b,d))fnremainder
lines 325–341
remainder function remainder (
l, r : UNRESOLVED_ufixed;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
-- sfixed (a downto b) rem sfixed (c downto d)
-- = sfixed (minimum(a,c) downto minimum(b,d))
function remainder (
l, r : UNRESOLVED_sfixed;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
-- mod function
-- ufixed (a downto b) mod ufixed (c downto d)
-- = ufixed (minimum(a,c) downto minimum(b, d))fnmodulo
lines 342–359
modulo function modulo (
l, r : UNRESOLVED_ufixed;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
-- sfixed (a downto b) mod sfixed (c downto d)
-- = sfixed (c downto minimum(b, d))
function modulo (
l, r : UNRESOLVED_sfixed;
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
-- Procedure for those who need an "accumulator" function.
-- add_carry (ufixed(a downto b), ufixed (c downto d))
-- = ufixed (maximum(a,c) downto minimum(b,d))pradd_carry
lines 360–375
add_carry procedure add_carry (
L, R : in UNRESOLVED_ufixed;
c_in : in STD_ULOGIC;
result : out UNRESOLVED_ufixed;
c_out : out STD_ULOGIC);
-- add_carry (sfixed(a downto b), sfixed (c downto d))
-- = sfixed (maximum(a,c) downto minimum(b,d))
procedure add_carry (
L, R : in UNRESOLVED_sfixed;
c_in : in STD_ULOGIC;
result : out UNRESOLVED_sfixed;
c_out : out STD_ULOGIC);
-- Scales the result by a power of 2. Width of input = width of output with
-- the binary point moved.fnscalb
lines 376–380
scalb function scalb (y : UNRESOLVED_ufixed; N : INTEGER) return UNRESOLVED_ufixed;
function scalb (y : UNRESOLVED_ufixed; N : UNRESOLVED_SIGNED) return UNRESOLVED_ufixed;
function scalb (y : UNRESOLVED_sfixed; N : INTEGER) return UNRESOLVED_sfixed;
function scalb (y : UNRESOLVED_sfixed; N : UNRESOLVED_SIGNED) return UNRESOLVED_sfixed;
fnIs_Negative
lines 381–382
Is_Negative function Is_Negative (arg : UNRESOLVED_sfixed) return BOOLEAN;
Comparison operators
--===========================================================================
-- Comparison Operators
--===========================================================================
fn">"
lines 387–388
">" function ">" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function ">" (l, r : UNRESOLVED_sfixed) return BOOLEAN;fn"<"
lines 389–390
"<" function "<" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function "<" (l, r : UNRESOLVED_sfixed) return BOOLEAN;fn"<="
lines 391–392
"<=" function "<=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function "<=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;fn">="
lines 393–394
">=" function ">=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function ">=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;fn"="
lines 395–396
"=" function "=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function "=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;fn"/="
lines 397–399
"/=" function "/=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function "/=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
fn"?="
lines 400–400
"?=" function "?=" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?/="
lines 401–401
"?/=" function "?/=" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>"
lines 402–402
"?>" function "?>" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>="
lines 403–403
"?>=" function "?>=" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<"
lines 404–404
"?<" function "?<" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<="
lines 405–405
"?<=" function "?<=" (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?="
lines 406–406
"?=" function "?=" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?/="
lines 407–407
"?/=" function "?/=" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>"
lines 408–408
"?>" function "?>" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>="
lines 409–409
"?>=" function "?>=" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<"
lines 410–410
"?<" function "?<" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<="
lines 411–412
"?<=" function "?<=" (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
fnstd_match
lines 413–417
std_match function std_match (l, r : UNRESOLVED_ufixed) return BOOLEAN;
function std_match (l, r : UNRESOLVED_sfixed) return BOOLEAN;
-- Overloads the default "maximum" and "minimum" function
fnmaximum
lines 418–418
maximum function maximum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fnminimum
lines 419–419
minimum function minimum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fnmaximum
lines 420–420
maximum function maximum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fnminimum
lines 421–422
minimum function minimum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
----------------------------------------------------------------------------
-- In these compare functions a natural is converted into a
-- fixed point number of the bounds "maximum(l'high,0) downto 0"
----------------------------------------------------------------------------
fn"="
lines 428–428
"=" function "=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;fn"/="
lines 429–429
"/=" function "/=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;fn">="
lines 430–430
">=" function ">=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;fn"<="
lines 431–431
"<=" function "<=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;fn">"
lines 432–432
">" function ">" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;fn"<"
lines 433–434
"<" function "<" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
fn"="
lines 435–435
"=" function "=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"/="
lines 436–436
"/=" function "/=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn">="
lines 437–437
">=" function ">=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"<="
lines 438–438
"<=" function "<=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn">"
lines 439–439
">" function ">" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"<"
lines 440–441
"<" function "<" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
fn"?="
lines 442–442
"?=" function "?=" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;fn"?/="
lines 443–443
"?/=" function "?/=" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;fn"?>="
lines 444–444
"?>=" function "?>=" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;fn"?<="
lines 445–445
"?<=" function "?<=" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;fn"?>"
lines 446–446
"?>" function "?>" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;fn"?<"
lines 447–448
"?<" function "?<" (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
fn"?="
lines 449–449
"?=" function "?=" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?/="
lines 450–450
"?/=" function "?/=" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>="
lines 451–451
"?>=" function "?>=" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<="
lines 452–452
"?<=" function "?<=" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>"
lines 453–453
"?>" function "?>" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<"
lines 454–455
"?<" function "?<" (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
fnmaximum
lines 456–457
maximum function maximum (l : UNRESOLVED_ufixed; r : NATURAL)
return UNRESOLVED_ufixed;fnminimum
lines 458–459
minimum function minimum (l : UNRESOLVED_ufixed; r : NATURAL)
return UNRESOLVED_ufixed;fnmaximum
lines 460–461
maximum function maximum (l : NATURAL; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;fnminimum
lines 462–463
minimum function minimum (l : NATURAL; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed; ----------------------------------------------------------------------------
-- In these compare functions a real is converted into a
-- fixed point number of the bounds "l'high+1 downto l'low"
----------------------------------------------------------------------------
fn"="
lines 469–469
"=" function "=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;fn"/="
lines 470–470
"/=" function "/=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;fn">="
lines 471–471
">=" function ">=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;fn"<="
lines 472–472
"<=" function "<=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;fn">"
lines 473–473
">" function ">" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;fn"<"
lines 474–475
"<" function "<" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
fn"="
lines 476–476
"=" function "=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"/="
lines 477–477
"/=" function "/=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn">="
lines 478–478
">=" function ">=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"<="
lines 479–479
"<=" function "<=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn">"
lines 480–480
">" function ">" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;fn"<"
lines 481–482
"<" function "<" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
fn"?="
lines 483–483
"?=" function "?=" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;fn"?/="
lines 484–484
"?/=" function "?/=" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;fn"?>="
lines 485–485
"?>=" function "?>=" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;fn"?<="
lines 486–486
"?<=" function "?<=" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;fn"?>"
lines 487–487
"?>" function "?>" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;fn"?<"
lines 488–489
"?<" function "?<" (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
fn"?="
lines 490–490
"?=" function "?=" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?/="
lines 491–491
"?/=" function "?/=" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>="
lines 492–492
"?>=" function "?>=" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<="
lines 493–493
"?<=" function "?<=" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?>"
lines 494–494
"?>" function "?>" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;fn"?<"
lines 495–496
"?<" function "?<" (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
fnmaximum
lines 497–498
maximum function maximum (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
function maximum (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fnminimum
lines 499–500
minimum function minimum (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
function minimum (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed; ----------------------------------------------------------------------------
-- In these compare functions an integer is converted into a
-- fixed point number of the bounds "maximum(l'high,1) downto 0"
----------------------------------------------------------------------------
fn"="
lines 506–506
"=" function "=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;fn"/="
lines 507–507
"/=" function "/=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;fn">="
lines 508–508
">=" function ">=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;fn"<="
lines 509–509
"<=" function "<=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;fn">"
lines 510–510
">" function ">" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;fn"<"
lines 511–512
"<" function "<" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
fn"="
lines 513–513
"=" function "=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;fn"/="
lines 514–514
"/=" function "/=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;fn">="
lines 515–515
">=" function ">=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;fn"<="
lines 516–516
"<=" function "<=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;fn">"
lines 517–517
">" function ">" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;fn"<"
lines 518–519
"<" function "<" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
fn"?="
lines 520–520
"?=" function "?=" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;fn"?/="
lines 521–521
"?/=" function "?/=" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;fn"?>="
lines 522–522
"?>=" function "?>=" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;fn"?<="
lines 523–523
"?<=" function "?<=" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;fn"?>"
lines 524–524
"?>" function "?>" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;fn"?<"
lines 525–526
"?<" function "?<" (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
fn"?="
lines 527–527
"?=" function "?=" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?/="
lines 528–528
"?/=" function "?/=" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>="
lines 529–529
"?>=" function "?>=" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<="
lines 530–530
"?<=" function "?<=" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>"
lines 531–531
"?>" function "?>" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<"
lines 532–533
"?<" function "?<" (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
fnmaximum
lines 534–537
maximum function maximum (l : UNRESOLVED_sfixed; r : INTEGER)
return UNRESOLVED_sfixed;
function maximum (l : INTEGER; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;fnminimum
lines 538–541
minimum function minimum (l : UNRESOLVED_sfixed; r : INTEGER)
return UNRESOLVED_sfixed;
function minimum (l : INTEGER; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed; ----------------------------------------------------------------------------
-- In these compare functions a real is converted into a
-- fixed point number of the bounds "l'high+1 downto l'low"
----------------------------------------------------------------------------
fn"="
lines 547–547
"=" function "=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;fn"/="
lines 548–548
"/=" function "/=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;fn">="
lines 549–549
">=" function ">=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;fn"<="
lines 550–550
"<=" function "<=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;fn">"
lines 551–551
">" function ">" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;fn"<"
lines 552–553
"<" function "<" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
fn"="
lines 554–554
"=" function "=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;fn"/="
lines 555–555
"/=" function "/=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;fn">="
lines 556–556
">=" function ">=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;fn"<="
lines 557–557
"<=" function "<=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;fn">"
lines 558–558
">" function ">" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;fn"<"
lines 559–560
"<" function "<" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
fn"?="
lines 561–561
"?=" function "?=" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;fn"?/="
lines 562–562
"?/=" function "?/=" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;fn"?>="
lines 563–563
"?>=" function "?>=" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;fn"?<="
lines 564–564
"?<=" function "?<=" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;fn"?>"
lines 565–565
"?>" function "?>" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;fn"?<"
lines 566–567
"?<" function "?<" (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
fn"?="
lines 568–568
"?=" function "?=" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?/="
lines 569–569
"?/=" function "?/=" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>="
lines 570–570
"?>=" function "?>=" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<="
lines 571–571
"?<=" function "?<=" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?>"
lines 572–572
"?>" function "?>" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;fn"?<"
lines 573–574
"?<" function "?<" (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
fnmaximum
lines 575–576
maximum function maximum (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
function maximum (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fnminimum
lines 577–578
minimum function minimum (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
function minimum (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;Shift and rotate functions.
--===========================================================================
-- Shift and Rotate Functions.
-- Note that sra and sla are not the same as the BIT_VECTOR version
--===========================================================================
fn"sll"
lines 584–585
"sll" function "sll" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"srl"
lines 586–587
"srl" function "srl" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"rol"
lines 588–589
"rol" function "rol" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"ror"
lines 590–591
"ror" function "ror" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"sla"
lines 592–593
"sla" function "sla" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"sra"
lines 594–595
"sra" function "sra" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
return UNRESOLVED_ufixed;fn"sll"
lines 596–597
"sll" function "sll" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fn"srl"
lines 598–599
"srl" function "srl" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fn"rol"
lines 600–601
"rol" function "rol" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fn"ror"
lines 602–603
"ror" function "ror" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fn"sla"
lines 604–605
"sla" function "sla" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fn"sra"
lines 606–607
"sra" function "sra" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
return UNRESOLVED_sfixed;fnSHIFT_LEFT, SHIFT_RIGHT
lines 608–616
SHIFT_LEFT, SHIFT_RIGHT function SHIFT_LEFT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
return UNRESOLVED_ufixed;
function SHIFT_RIGHT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
return UNRESOLVED_ufixed;
function SHIFT_LEFT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
return UNRESOLVED_sfixed;
function SHIFT_RIGHT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
return UNRESOLVED_sfixed;
Logical functions
----------------------------------------------------------------------------
-- logical functions
----------------------------------------------------------------------------
fn"not"
lines 621–621
"not" function "not" (l : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"and"
lines 622–622
"and" function "and" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"or"
lines 623–623
"or" function "or" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"nand"
lines 624–624
"nand" function "nand" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"nor"
lines 625–625
"nor" function "nor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"xor"
lines 626–626
"xor" function "xor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"xnor"
lines 627–627
"xnor" function "xnor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;fn"not"
lines 628–628
"not" function "not" (l : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"and"
lines 629–629
"and" function "and" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"or"
lines 630–630
"or" function "or" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"nand"
lines 631–631
"nand" function "nand" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"nor"
lines 632–632
"nor" function "nor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"xor"
lines 633–633
"xor" function "xor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fn"xnor"
lines 634–636
"xnor" function "xnor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- Vector and std_ulogic functions, same as functions in numeric_stdfn"and"
lines 637–640
"and" function "and" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "and" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"or"
lines 641–644
"or" function "or" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "or" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"nand"
lines 645–648
"nand" function "nand" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "nand" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"nor"
lines 649–652
"nor" function "nor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "nor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"xor"
lines 653–656
"xor" function "xor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "xor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"xnor"
lines 657–660
"xnor" function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed;
function "xnor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
return UNRESOLVED_ufixed;fn"and"
lines 661–664
"and" function "and" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "and" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;fn"or"
lines 665–668
"or" function "or" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "or" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;fn"nand"
lines 669–672
"nand" function "nand" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "nand" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;fn"nor"
lines 673–676
"nor" function "nor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "nor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;fn"xor"
lines 677–680
"xor" function "xor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "xor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;fn"xnor"
lines 681–686
"xnor" function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed;
function "xnor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
return UNRESOLVED_sfixed;
-- Reduction operators, same as numeric_std functionsfn"and"
lines 687–687
"and" function "and" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"nand"
lines 688–688
"nand" function "nand" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"or"
lines 689–689
"or" function "or" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"nor"
lines 690–690
"nor" function "nor" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"xor"
lines 691–691
"xor" function "xor" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"xnor"
lines 692–692
"xnor" function "xnor" (l : UNRESOLVED_ufixed) return STD_ULOGIC;fn"and"
lines 693–693
"and" function "and" (l : UNRESOLVED_sfixed) return STD_ULOGIC;fn"nand"
lines 694–694
"nand" function "nand" (l : UNRESOLVED_sfixed) return STD_ULOGIC;fn"or"
lines 695–695
"or" function "or" (l : UNRESOLVED_sfixed) return STD_ULOGIC;fn"nor"
lines 696–696
"nor" function "nor" (l : UNRESOLVED_sfixed) return STD_ULOGIC;fn"xor"
lines 697–697
"xor" function "xor" (l : UNRESOLVED_sfixed) return STD_ULOGIC;fn"xnor"
lines 698–700
"xnor" function "xnor" (l : UNRESOLVED_sfixed) return STD_ULOGIC;
-- returns arg'low-1 if not foundfnfind_leftmost
lines 701–706
find_leftmost function find_leftmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
return INTEGER;
function find_leftmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
return INTEGER;
-- returns arg'high+1 if not foundfnfind_rightmost
lines 707–711
find_rightmost function find_rightmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
return INTEGER;
function find_rightmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
return INTEGER;
RESIZE functions
--===========================================================================
-- RESIZE Functions
--===========================================================================fnresize
lines 715–759
resize -- resizes the number (larger or smaller)
-- The returned result will be ufixed (left_index downto right_index)
-- If "round_style" is fixed_round, then the result will be rounded.
-- If the MSB of the remainder is a "1" AND the LSB of the unrounded result
-- is a '1' or the lower bits of the remainder include a '1' then the result
-- will be increased by the smallest representable number for that type.
-- "overflow_style" can be fixed_saturate or fixed_wrap.
-- In saturate mode, if the number overflows then the largest possible
-- representable number is returned. If wrap mode, then the upper bits
-- of the number are truncated.
function resize (
arg : UNRESOLVED_ufixed; -- input
constant left_index : INTEGER; -- integer portion
constant right_index : INTEGER; -- size of fraction
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
-- "size_res" functions create the size of the output from the indices
-- of the "size_res" input. The actual value of "size_res" is not used.
function resize (
arg : UNRESOLVED_ufixed; -- input
size_res : UNRESOLVED_ufixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
-- Note that in "wrap" mode the sign bit is not replicated. Thus the
-- resize of a negative number can have a positive result in wrap mode.
function resize (
arg : UNRESOLVED_sfixed; -- input
constant left_index : INTEGER; -- integer portion
constant right_index : INTEGER; -- size of fraction
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
function resize (
arg : UNRESOLVED_sfixed; -- input
size_res : UNRESOLVED_sfixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
Conversion functions
--===========================================================================
-- Conversion Functions
--===========================================================================
fnto_ufixed
lines 764–821
to_ufixed -- integer (natural) to unsigned fixed point.
-- arguments are the upper and lower bounds of the number, thus
-- ufixed (7 downto -3) <= to_ufixed (int, 7, -3);
function to_ufixed (
arg : NATURAL; -- integer
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER := 0; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
function to_ufixed (
arg : NATURAL; -- integer
size_res : UNRESOLVED_ufixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
-- real to unsigned fixed point
function to_ufixed (
arg : REAL; -- real
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
function to_ufixed (
arg : REAL; -- real
size_res : UNRESOLVED_ufixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_ufixed;
-- unsigned to unsigned fixed point
function to_ufixed (
arg : UNRESOLVED_UNSIGNED; -- unsigned
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER := 0; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
function to_ufixed (
arg : UNRESOLVED_UNSIGNED; -- unsigned
size_res : UNRESOLVED_ufixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_ufixed;
-- Performs a conversion. ufixed (arg'range) is returned
function to_ufixed (
arg : UNRESOLVED_UNSIGNED) -- unsigned
return UNRESOLVED_ufixed;
-- unsigned fixed point to unsignedfnto_unsigned
lines 822–837
to_unsigned function to_unsigned (
arg : UNRESOLVED_ufixed; -- fixed point input
constant size : NATURAL; -- length of output
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_UNSIGNED;
-- unsigned fixed point to unsigned
function to_unsigned (
arg : UNRESOLVED_ufixed; -- fixed point input
size_res : UNRESOLVED_UNSIGNED; -- used for length of output
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_UNSIGNED;
-- unsigned fixed point to realfnto_real
lines 838–842
to_real function to_real (
arg : UNRESOLVED_ufixed) -- fixed point input
return REAL;
-- unsigned fixed point to integerfnto_integer
lines 843–849
to_integer function to_integer (
arg : UNRESOLVED_ufixed; -- fixed point input
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return NATURAL;
-- Integer to UNRESOLVED_sfixedfnto_sfixed
lines 850–909
to_sfixed function to_sfixed (
arg : INTEGER; -- integer
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER := 0; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
function to_sfixed (
arg : INTEGER; -- integer
size_res : UNRESOLVED_sfixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
-- Real to sfixed
function to_sfixed (
arg : REAL; -- real
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
function to_sfixed (
arg : REAL; -- real
size_res : UNRESOLVED_sfixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style;
constant guard_bits : NATURAL := fixed_guard_bits)
return UNRESOLVED_sfixed;
-- signed to sfixed
function to_sfixed (
arg : UNRESOLVED_SIGNED; -- signed
constant left_index : INTEGER; -- left index (high index)
constant right_index : INTEGER := 0; -- right index
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
function to_sfixed (
arg : UNRESOLVED_SIGNED; -- signed
size_res : UNRESOLVED_sfixed; -- for size only
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_sfixed;
-- signed to sfixed (output assumed to be size of signed input)
function to_sfixed (
arg : UNRESOLVED_SIGNED) -- signed
return UNRESOLVED_sfixed;
-- Conversion from ufixed to sfixed
function to_sfixed (
arg : UNRESOLVED_ufixed)
return UNRESOLVED_sfixed;
-- signed fixed point to signedfnto_signed
lines 910–925
to_signed function to_signed (
arg : UNRESOLVED_sfixed; -- fixed point input
constant size : NATURAL; -- length of output
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_SIGNED;
-- signed fixed point to signed
function to_signed (
arg : UNRESOLVED_sfixed; -- fixed point input
size_res : UNRESOLVED_SIGNED; -- used for length of output
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return UNRESOLVED_SIGNED;
-- signed fixed point to realfnto_real
lines 926–930
to_real function to_real (
arg : UNRESOLVED_sfixed) -- fixed point input
return REAL;
-- signed fixed point to integerfnto_integer
lines 931–946
to_integer function to_integer (
arg : UNRESOLVED_sfixed; -- fixed point input
constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
constant round_style : fixed_round_style_type := fixed_round_style)
return INTEGER;
-- Because of the fairly complicated sizing rules in the fixed point
-- packages these functions are provided to compute the result ranges
-- Example:
-- signal uf1 : ufixed (3 downto -3);
-- signal uf2 : ufixed (4 downto -2);
-- signal uf1multuf2 : ufixed (ufixed_high (3, -3, '*', 4, -2) downto
-- ufixed_low (3, -3, '*', 4, -2));
-- uf1multuf2 <= uf1 * uf2;
-- Valid characters: '+', '-', '*', '/', 'r' or 'R' (rem), 'm' or 'M' (mod),
-- '1' (reciprocal), 'a' or 'A' (abs), 'n' or 'N' (unary -)fnufixed_high
lines 947–951
ufixed_high function ufixed_high (left_index, right_index : INTEGER;
operation : CHARACTER := 'X';
left_index2, right_index2 : INTEGER := 0)
return INTEGER;
fnufixed_low
lines 952–956
ufixed_low function ufixed_low (left_index, right_index : INTEGER;
operation : CHARACTER := 'X';
left_index2, right_index2 : INTEGER := 0)
return INTEGER;
fnsfixed_high
lines 957–961
sfixed_high function sfixed_high (left_index, right_index : INTEGER;
operation : CHARACTER := 'X';
left_index2, right_index2 : INTEGER := 0)
return INTEGER;
fnsfixed_low
lines 962–971
sfixed_low function sfixed_low (left_index, right_index : INTEGER;
operation : CHARACTER := 'X';
left_index2, right_index2 : INTEGER := 0)
return INTEGER;
-- Same as above, but using the "size_res" input only for their ranges:
-- signal uf1multuf2 : ufixed (ufixed_high (uf1, '*', uf2) downto
-- ufixed_low (uf1, '*', uf2));
-- uf1multuf2 <= uf1 * uf2;
--fnufixed_high
lines 972–976
ufixed_high function ufixed_high (size_res : UNRESOLVED_ufixed;
operation : CHARACTER := 'X';
size_res2 : UNRESOLVED_ufixed)
return INTEGER;
fnufixed_low
lines 977–981
ufixed_low function ufixed_low (size_res : UNRESOLVED_ufixed;
operation : CHARACTER := 'X';
size_res2 : UNRESOLVED_ufixed)
return INTEGER;
fnsfixed_high
lines 982–986
sfixed_high function sfixed_high (size_res : UNRESOLVED_sfixed;
operation : CHARACTER := 'X';
size_res2 : UNRESOLVED_sfixed)
return INTEGER;
fnsfixed_low
lines 987–992
sfixed_low function sfixed_low (size_res : UNRESOLVED_sfixed;
operation : CHARACTER := 'X';
size_res2 : UNRESOLVED_sfixed)
return INTEGER;
-- purpose: returns a saturated numberfnsaturate
lines 993–1011
saturate function saturate (
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_ufixed;
-- purpose: returns a saturated number
function saturate (
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_sfixed;
function saturate (
size_res : UNRESOLVED_ufixed) -- only the size of this is used
return UNRESOLVED_ufixed;
function saturate (
size_res : UNRESOLVED_sfixed) -- only the size of this is used
return UNRESOLVED_sfixed;
Translation functions
--===========================================================================
-- Translation Functions
--===========================================================================
fnto_01
lines 1016–1027
to_01 -- maps meta-logical values
function to_01 (
s : UNRESOLVED_ufixed; -- fixed point input
constant XMAP : STD_ULOGIC := '0') -- Map x to
return UNRESOLVED_ufixed;
-- maps meta-logical values
function to_01 (
s : UNRESOLVED_sfixed; -- fixed point input
constant XMAP : STD_ULOGIC := '0') -- Map x to
return UNRESOLVED_sfixed;
fnIs_X
lines 1028–1029
Is_X function Is_X (arg : UNRESOLVED_ufixed) return BOOLEAN;
function Is_X (arg : UNRESOLVED_sfixed) return BOOLEAN;fnto_X01
lines 1030–1031
to_X01 function to_X01 (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
function to_X01 (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fnto_X01Z
lines 1032–1033
to_X01Z function to_X01Z (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
function to_X01Z (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;fnto_UX01
lines 1034–1041
to_UX01 function to_UX01 (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
function to_UX01 (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-- straight vector conversion routines, needed for synthesis.
-- These functions are here so that a std_logic_vector can be
-- converted to and from sfixed and ufixed. Note that you can
-- not convert these vectors because of their negative index.
fnto_slv
lines 1042–1044
to_slv function to_slv (
arg : UNRESOLVED_ufixed) -- fixed point vector
return STD_LOGIC_VECTOR; alias to_StdLogicVector is to_slv [UNRESOLVED_ufixed
return STD_LOGIC_VECTOR];
alias to_Std_Logic_Vector is to_slv [UNRESOLVED_ufixed
return STD_LOGIC_VECTOR];
fnto_slv
lines 1050–1052
to_slv function to_slv (
arg : UNRESOLVED_sfixed) -- fixed point vector
return STD_LOGIC_VECTOR; alias to_StdLogicVector is to_slv [UNRESOLVED_sfixed
return STD_LOGIC_VECTOR];
alias to_Std_Logic_Vector is to_slv [UNRESOLVED_sfixed
return STD_LOGIC_VECTOR];
fnto_sulv
lines 1058–1060
to_sulv function to_sulv (
arg : UNRESOLVED_ufixed) -- fixed point vector
return STD_ULOGIC_VECTOR; alias to_StdULogicVector is to_sulv [UNRESOLVED_ufixed
return STD_ULOGIC_VECTOR];
alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_ufixed
return STD_ULOGIC_VECTOR];
fnto_sulv
lines 1066–1068
to_sulv function to_sulv (
arg : UNRESOLVED_sfixed) -- fixed point vector
return STD_ULOGIC_VECTOR; alias to_StdULogicVector is to_sulv [UNRESOLVED_sfixed
return STD_ULOGIC_VECTOR];
alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_sfixed
return STD_ULOGIC_VECTOR];
fnto_ufixed
lines 1074–1084
to_ufixed function to_ufixed (
arg : STD_ULOGIC_VECTOR; -- shifted vector
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_ufixed;
function to_ufixed (
arg : STD_ULOGIC_VECTOR; -- shifted vector
size_res : UNRESOLVED_ufixed) -- for size only
return UNRESOLVED_ufixed;
fnto_sfixed
lines 1085–1102
to_sfixed function to_sfixed (
arg : STD_ULOGIC_VECTOR; -- shifted vector
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_sfixed;
function to_sfixed (
arg : STD_ULOGIC_VECTOR; -- shifted vector
size_res : UNRESOLVED_sfixed) -- for size only
return UNRESOLVED_sfixed;
-- As a concession to those who use a graphical DSP environment,
-- these functions take parameters in those tools format and create
-- fixed point numbers. These functions are designed to convert from
-- a std_logic_vector to the VHDL fixed point format using the conventions
-- of these packages. In a pure VHDL environment you should use the
-- "to_ufixed" and "to_sfixed" routines.
fnto_UFix
lines 1103–1110
to_UFix -- unsigned fixed point
function to_UFix (
arg : STD_ULOGIC_VECTOR;
width : NATURAL; -- width of vector
fraction : NATURAL) -- width of fraction
return UNRESOLVED_ufixed;
-- signed fixed pointfnto_SFix
lines 1111–1125
to_SFix function to_SFix (
arg : STD_ULOGIC_VECTOR;
width : NATURAL; -- width of vector
fraction : NATURAL) -- width of fraction
return UNRESOLVED_sfixed;
-- finding the bounds of a number. These functions can be used like this:
-- signal xxx : ufixed (7 downto -3);
-- -- Which is the same as "ufixed (UFix_high (11,3) downto UFix_low(11,3))"
-- signal yyy : ufixed (UFix_high (11, 3, "+", 11, 3)
-- downto UFix_low(11, 3, "+", 11, 3));
-- Where "11" is the width of xxx (xxx'length),
-- and 3 is the lower bound (abs (xxx'low))
-- In a pure VHDL environment use "ufixed_high" and "ufixed_low"
fnUFix_high
lines 1126–1130
UFix_high function UFix_high (width, fraction : NATURAL;
operation : CHARACTER := 'X';
width2, fraction2 : NATURAL := 0)
return INTEGER;
fnUFix_low
lines 1131–1139
UFix_low function UFix_low (width, fraction : NATURAL;
operation : CHARACTER := 'X';
width2, fraction2 : NATURAL := 0)
return INTEGER;
-- Same as above but for signed fixed point. Note that the width
-- of a signed fixed point number ignores the sign bit, thus
-- width = sxxx'length-1
fnSFix_high
lines 1140–1144
SFix_high function SFix_high (width, fraction : NATURAL;
operation : CHARACTER := 'X';
width2, fraction2 : NATURAL := 0)
return INTEGER;
fnSFix_low
lines 1145–1149
SFix_low function SFix_low (width, fraction : NATURAL;
operation : CHARACTER := 'X';
width2, fraction2 : NATURAL := 0)
return INTEGER;
String and textio functions
--===========================================================================
-- string and textio Functions
--===========================================================================
prWRITE
lines 1154–1167
WRITE -- purpose: writes fixed point into a line
procedure WRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_ufixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
-- purpose: writes fixed point into a line
procedure WRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_sfixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
prREAD
lines 1168–1181
READ procedure READ(L : inout LINE;
VALUE : out UNRESOLVED_ufixed);
procedure READ(L : inout LINE;
VALUE : out UNRESOLVED_ufixed;
GOOD : out BOOLEAN);
procedure READ(L : inout LINE;
VALUE : out UNRESOLVED_sfixed);
procedure READ(L : inout LINE;
VALUE : out UNRESOLVED_sfixed;
GOOD : out BOOLEAN);
albwrite
lines 1182–1183
bwrite alias bwrite is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width];
alias bwrite is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width];albread
lines 1184–1187
bread alias bread is READ [LINE, UNRESOLVED_ufixed];
alias bread is READ [LINE, UNRESOLVED_ufixed, BOOLEAN];
alias bread is READ [LINE, UNRESOLVED_sfixed];
alias bread is READ [LINE, UNRESOLVED_sfixed, BOOLEAN];alBINARY_WRITE
lines 1188–1189
BINARY_WRITE alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width];
alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width];alBINARY_READ
lines 1190–1195
BINARY_READ alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed, BOOLEAN];
alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed];
alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed, BOOLEAN];
alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed];
-- octal read and writeprOWRITE
lines 1196–1207
OWRITE procedure OWRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_ufixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
procedure OWRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_sfixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
prOREAD
lines 1208–1220
OREAD procedure OREAD(L : inout LINE;
VALUE : out UNRESOLVED_ufixed);
procedure OREAD(L : inout LINE;
VALUE : out UNRESOLVED_ufixed;
GOOD : out BOOLEAN);
procedure OREAD(L : inout LINE;
VALUE : out UNRESOLVED_sfixed);
procedure OREAD(L : inout LINE;
VALUE : out UNRESOLVED_sfixed;
GOOD : out BOOLEAN);alOCTAL_READ
lines 1221–1224
OCTAL_READ alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed, BOOLEAN];
alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed];
alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed, BOOLEAN];
alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed];alOCTAL_WRITE
lines 1225–1228
OCTAL_WRITE alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH];
alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH];
-- hex read and writeprHWRITE
lines 1229–1241
HWRITE procedure HWRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_ufixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
-- purpose: writes fixed point into a line
procedure HWRITE (
L : inout LINE; -- input line
VALUE : in UNRESOLVED_sfixed; -- fixed point input
JUSTIFIED : in SIDE := right;
FIELD : in WIDTH := 0);
prHREAD
lines 1242–1254
HREAD procedure HREAD(L : inout LINE;
VALUE : out UNRESOLVED_ufixed);
procedure HREAD(L : inout LINE;
VALUE : out UNRESOLVED_ufixed;
GOOD : out BOOLEAN);
procedure HREAD(L : inout LINE;
VALUE : out UNRESOLVED_sfixed);
procedure HREAD(L : inout LINE;
VALUE : out UNRESOLVED_sfixed;
GOOD : out BOOLEAN);alHEX_READ
lines 1255–1258
HEX_READ alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed, BOOLEAN];
alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed, BOOLEAN];
alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed];
alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed];alHEX_WRITE
lines 1259–1263
HEX_WRITE alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH];
alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH];
-- returns a string, useful for:
-- assert (x = y) report "error found " & TO_STRING(x) severity error;fnTO_STRING
lines 1264–1265
TO_STRING function TO_STRING (value : UNRESOLVED_ufixed) return STRING;
alias TO_BSTRING is TO_STRING [UNRESOLVED_ufixed return STRING];
alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_ufixed return STRING];
fnTO_OSTRING
lines 1269–1269
TO_OSTRING function TO_OSTRING (value : UNRESOLVED_ufixed) return STRING; alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_ufixed return STRING];
fnTO_HSTRING
lines 1272–1272
TO_HSTRING function TO_HSTRING (value : UNRESOLVED_ufixed) return STRING; alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_ufixed return STRING];
fnTO_STRING
lines 1275–1275
TO_STRING function TO_STRING (value : UNRESOLVED_sfixed) return STRING; alias TO_BSTRING is TO_STRING [UNRESOLVED_sfixed return STRING];
alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_sfixed return STRING];
fnTO_OSTRING
lines 1279–1279
TO_OSTRING function TO_OSTRING (value : UNRESOLVED_sfixed) return STRING; alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_sfixed return STRING];
fnTO_HSTRING
lines 1282–1282
TO_HSTRING function TO_HSTRING (value : UNRESOLVED_sfixed) return STRING; alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_sfixed return STRING];
fnfrom_string
lines 1285–1297
from_string -- From string functions allow you to convert a string into a fixed
-- point number. Example:
-- signal uf1 : ufixed (3 downto -3);
-- uf1 <= from_string ("0110.100", uf1'high, uf1'low); -- 6.5
-- The "." is optional in this syntax, however it exist and is
-- in the wrong location an error is produced. Overflow will
-- result in saturation.
function from_string (
bstring : STRING; -- binary string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING, INTEGER, INTEGER
return UNRESOLVED_ufixed];
alias from_binary_string is from_string [STRING, INTEGER, INTEGER
return UNRESOLVED_ufixed];
fnfrom_ostring
lines 1303–1311
from_ostring -- Octal and hex conversions work as follows:
-- uf1 <= from_hstring ("6.8", 3, -3); -- 6.5 (bottom zeros dropped)
-- uf1 <= from_ostring ("06.4", 3, -3); -- 6.5 (top zeros dropped)
function from_ostring (
ostring : STRING; -- Octal string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER
return UNRESOLVED_ufixed];
fnfrom_hstring
lines 1315–1319
from_hstring function from_hstring (
hstring : STRING; -- hex string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER
return UNRESOLVED_ufixed];
fnfrom_string
lines 1323–1327
from_string function from_string (
bstring : STRING; -- binary string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING, INTEGER, INTEGER
return UNRESOLVED_sfixed];
alias from_binary_string is from_string [STRING, INTEGER, INTEGER
return UNRESOLVED_sfixed];
fnfrom_ostring
lines 1333–1337
from_ostring function from_ostring (
ostring : STRING; -- Octal string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_sfixed; alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER
return UNRESOLVED_sfixed];
fnfrom_hstring
lines 1341–1345
from_hstring function from_hstring (
hstring : STRING; -- hex string
constant left_index : INTEGER;
constant right_index : INTEGER)
return UNRESOLVED_sfixed; alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER
return UNRESOLVED_sfixed];
fnfrom_string
lines 1349–1353
from_string -- Same as above, "size_res" is used for it's range only.
function from_string (
bstring : STRING; -- binary string
size_res : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING, UNRESOLVED_ufixed
return UNRESOLVED_ufixed];
alias from_binary_string is from_string [STRING, UNRESOLVED_ufixed
return UNRESOLVED_ufixed];
fnfrom_ostring
lines 1359–1362
from_ostring function from_ostring (
ostring : STRING; -- Octal string
size_res : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING, UNRESOLVED_ufixed
return UNRESOLVED_ufixed];
fnfrom_hstring
lines 1366–1369
from_hstring function from_hstring (
hstring : STRING; -- hex string
size_res : UNRESOLVED_ufixed)
return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING, UNRESOLVED_ufixed
return UNRESOLVED_ufixed];
fnfrom_string
lines 1373–1376
from_string function from_string (
bstring : STRING; -- binary string
size_res : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING, UNRESOLVED_sfixed
return UNRESOLVED_sfixed];
alias from_binary_string is from_string [STRING, UNRESOLVED_sfixed
return UNRESOLVED_sfixed];
fnfrom_ostring
lines 1382–1385
from_ostring function from_ostring (
ostring : STRING; -- Octal string
size_res : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed; alias from_octal_string is from_ostring [STRING, UNRESOLVED_sfixed
return UNRESOLVED_sfixed];
fnfrom_hstring
lines 1389–1392
from_hstring function from_hstring (
hstring : STRING; -- hex string
size_res : UNRESOLVED_sfixed)
return UNRESOLVED_sfixed; alias from_hex_string is from_hstring [STRING, UNRESOLVED_sfixed
return UNRESOLVED_sfixed];
fnfrom_string
lines 1396–1404
from_string -- Direct conversion functions. Example:
-- signal uf1 : ufixed (3 downto -3);
-- uf1 <= from_string ("0110.100"); -- 6.5
-- In this case the "." is not optional, and the size of
-- the output must match exactly.
function from_string (
bstring : STRING) -- binary string
return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING return UNRESOLVED_ufixed];
alias from_binary_string is from_string [STRING return UNRESOLVED_ufixed];
fnfrom_ostring
lines 1408–1415
from_ostring -- Direct octal and hex conversion functions. In this case
-- the string lengths must match. Example:
-- signal sf1 := sfixed (5 downto -3);
-- sf1 <= from_ostring ("71.4") -- -6.5
function from_ostring (
ostring : STRING) -- Octal string
return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING return UNRESOLVED_ufixed];
fnfrom_hstring
lines 1418–1420
from_hstring function from_hstring (
hstring : STRING) -- hex string
return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING return UNRESOLVED_ufixed];
fnfrom_string
lines 1423–1425
from_string function from_string (
bstring : STRING) -- binary string
return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING return UNRESOLVED_sfixed];
alias from_binary_string is from_string [STRING return UNRESOLVED_sfixed];
fnfrom_ostring
lines 1429–1431
from_ostring function from_ostring (
ostring : STRING) -- Octal string
return UNRESOLVED_sfixed; alias from_octal_string is from_ostring [STRING return UNRESOLVED_sfixed];
fnfrom_hstring
lines 1434–1436
from_hstring function from_hstring (
hstring : STRING) -- hex string
return UNRESOLVED_sfixed; alias from_hex_string is from_hstring [STRING return UNRESOLVED_sfixed];
end package fixed_generic_pkg;
