Appendix A

Package Listings

This Appendix lists the package headers of all the standard packages in the std and ieee libraries that are relevant to synthesis.

A.1 Package Standard

Package standard defines the basic types provided by VHDL in all circumstances. This is the VHDL-1993 version and is supplemented by package standard_additions (see Appendix A.2). In VHDL-2008, the additions are merged into package standard.

package standard is

  type boolean is (false, true);

  function "and"(l, r: boolean) return boolean;

  function "or"(l, r: boolean) return boolean;

  function "nand"(l, r: boolean) return boolean;

  function "nor"(l, r: boolean) return boolean;

  function "xor"(l, r: boolean) return boolean;

  function "xnor"(l, r: boolean) return boolean;

  function "not"(l: boolean) return boolean;

  function "="(l, r: boolean) return boolean;

  function "/="(l, r: boolean) return boolean;

  function "<"(l, r: boolean) return boolean;

  function "<="(l, r: boolean) return boolean;

  function ">"(l, r: boolean) return boolean;

  function ">="(l, r: boolean) return boolean;

  type bit is ('0', '1'),

  function "and"(l, r: bit) return bit;

  function "or"(l, r: bit) return bit;

  function "nand"(l, r: bit) return bit;

  function "nor"(l, r: bit) return bit;

  function "xor"(l, r: bit) return bit;

  function "xnor"(l, r: bit) return bit;

  function "not"(l: bit) return bit;

  function "="(l, r: bit) return boolean;

  function "/="(l, r: bit) return boolean;

  function "<"(l, r: bit) return boolean;

  function "<="(l, r: bit) return boolean;

  function ">"(l, r: bit) return boolean;

  function ">="(l, r: bit) return boolean;

  type character is (...); -- ascii 8-bit values

  function "="(l, r: character) return boolean;

  function "/="(l, r: character) return boolean;

  function "<"(l, r: character) return boolean;

  function "<="(l, r: character) return boolean;

  function ">"(l, r: character) return boolean;

  function ">="(l, r: character) return boolean;

  type severity_level is (note, warning, error, failure);

  function "="(l, r: severity_level) return boolean;

  function "/="(l, r: severity_level) return boolean;

  function "<"(l, r: severity_level) return boolean;

  function "<="(l, r: severity_level) return boolean;

  function ">"(l, r: severity_level) return boolean;

  function ">="(l, r: severity_level) return boolean;

  -- universal types cannot be used but are implicit

  type _uni_int is range implementation_defined;

  function "="(l, r: _uni_int) return boolean;

  function "/="(l, r: _uni_int) return boolean;

  function "<"(l, r: _uni_int) return boolean;

  function "<="(l, r: _uni_int) return boolean;

  function ">"(l, r: _uni_int) return boolean;

  function ">="(l, r: _uni_int) return boolean;

  function "+"(l: _uni_int) return _uni_int;

  function "-"(l: _uni_int) return _uni_int;

  function "abs"(l: _uni_int) return _uni_int;

  function "+"(l, r: _uni_int) return _uni_int;

  function "+"(l, r: _uni_int) return _uni_int;

  function "*"(l, r: _uni_int) return _uni_int;

  function "/"(l, r: _uni_int) return _uni_int;

  function "mod"(l, r: _uni_int) return _uni_int;

  function "rem"(l, r: _uni_int) return _uni_int;

  type _uni_real is range implementation_defined;

  function "="(l, r: _uni_real) return boolean;

  function "/="(l, r: _uni_real) return boolean;

  function "<"(l, r: _uni_real) return boolean;

  function "<="(l, r: _uni_real) return boolean;

  function ">"(l, r: _uni_real) return boolean;

  function ">="(l, r: _uni_real) return boolean;

  function "+"(l: _uni_real) return _uni_real;

  function "+"(l: _uni_real) return _uni_real;

  function "abs"(l: _uni_real) return _uni_real;

  function "+"(l, r: _uni_real) return _uni_real;

  function "+"(l, r: _uni_real) return _uni_real;

  function "*"(l, r: _uni_real) return _uni_real;

  function "/"(l, r: _uni_real) return _uni_real;

  function "*"(l: _uni_real; anonymous: _uni_int)return _uni_real;

  function "*"(l: _uni_int; anonymous: _uni_real)return _uni_real;

  function "/"(l: _uni_real; anonymous: _uni_int)return _uni_real;

  type integer is range implementation_defined;

  function "**"(l: _uni_int; anonymous: integer)return _uni_int;

  function "**"(l: _uni_real; anonymous: integer)return _uni_real;

  function "="(l, r: integer) return boolean;

  function "/="(l, r: integer) return boolean;

  function "<"(l, r: integer) return boolean;

  function "<="(l, r: integer) return boolean;

  function ">"(l, r: integer) return boolean;

  function ">="(l, r: integer) return boolean;

  function "+"(l: integer) return integer;

  function "+"(l: integer) return integer;

  function "abs"(l: integer) return integer;

  function "+"(l, r: integer) return integer;

  function "+"(l, r: integer) return integer;

  function "*"(l, r: integer) return integer;

  function "/"(l, r: integer) return integer;

  function "mod"(l, r: integer) return integer;

  function "rem"(l, r: integer) return integer;

  function "**"(l: integer; anonymous: integer) return integer;

  type real is range implementation_defined;

  function "="(l, r: real) return boolean;

  function "/="(l, r: real) return boolean;

  function "<"(l, r: real) return boolean;

  function "<="(l, r: real) return boolean;

  function ">"(l, r: real) return boolean;

  function ">="(l, r: real) return boolean;

  function "+"(l: real) return real;

  function "+"(l: real) return real;

  function "abs"(l: real) return real;

  function "+"(l, r: real) return real;

  function "+"(l, r: real) return real;

  function "*"(l, r: real) return real;

  function "/"(l, r: real) return real;

  function "**"(l: real; r: integer) return real;

  type time is range implementation_defined

    units

      fs;

      ps=1000 fs;

      ns=1000 ps;

      us=1000 ns;

      ms=1000 us;

      sec=1000 ms;

      min=60 sec;

      hr=60 min;

    end units;

  function "="(l, r: time) return boolean;

  function "/="(l, r: time) return boolean;

  function "<"(l, r: time) return boolean;

  function "<="(l, r: time) return boolean;

  function ">"(l, r: time) return boolean;

  function ">="(l, r: time) return boolean;

  function "+"(l: time) return time;

  function "+"(l: time) return time;

  function "abs"(l: time) return time;

  function "+"(l, r: time) return time;

  function "+"(l, r: time) return time;

  function "*"(l: time; r: integer) return time;

  function "*"(l: time; r: real) return time;

  function "*"(l: integer; r: time) return time;

  function "*"(l: real; r: time) return time;

  function "/"(l: time; r: integer) return time;

  function "/"(l: time; r: real) return time;

  function "/"(l, r: time) return _uni_int;

  subtype delay_length is time range 0 fs to time'high;

  pure function now return delay_length;

  subtype natural is integer range 0 to integer'high;

  subtype positive is integer range 1 to integer'high;

  type string is array (positive range <>) of character;

  function "="(l, r: string) return boolean;

  function "/="(l, r: string) return boolean;

  function "<"(l, r: string) return boolean;

  function "<="(l, r: string) return boolean;

  function ">"(l, r: string) return boolean;

  function ">="(l, r: string) return boolean;

  function "&"(l: string; r: string) return string;

  function "&"(l: string; r: character) return string;

  function "&"(l: character; r: string) return string;

  function "&"(l: character; r: character)return string;

  type bit_vector is array (natural range <>) of bit;

  function "and"(l, r: bit_vector) return bit_vector;

  function "or"(l, r: bit_vector) return bit_vector;

  function "nand"(l, r: bit_vector) return bit_vector;

  function "nor"(l, r: bit_vector) return bit_vector;

  function "xor"(l, r: bit_vector) return bit_vector;

  function "xnor"(l, r: bit_vector) return bit_vector;

  function "not"(l: bit_vector) return bit_vector;

  function "sll"(l: bit_vector; r: integer)return bit_vector;

  function "srl"(l: bit_vector; r: integer)return bit_vector;

  function "sla"(l: bit_vector; r: integer)return bit_vector;

  function "sra"(l: bit_vector; r: integer)return bit_vector;

  function "rol"(l: bit_vector; r: integer)return bit_vector;

  function "ror"(l: bit_vector; r: integer)return bit_vector;

  function "="(l, r: bit_vector) return boolean;

  function "/="(l, r: bit_vector) return boolean;

  function "<"(l, r: bit_vector) return boolean;

  function "<="(l, r: bit_vector) return boolean;

  function ">"(l, r: bit_vector) return boolean;

  function ">="(l, r: bit_vector) return boolean;

  function "&"(l: bit_vector; r: bit_vector)return bit_vector;

  function "&"(l: bit_vector; r: bit) return bit_vector;

  function "&"(l: bit; r: bit_vector) return bit_vector;

  function "&"(l: bit; r: bit) return bit_vector;

  type file_open_kind is (read_mode, write_mode, append_mode);

  function "="(l, r: file_open_kind) return boolean;

  function "/="(l, r: file_open_kind) return boolean;

  function "<"(l, r: file_open_kind) return boolean;

  function "<="(l, r: file_open_kind) return boolean;

  function ">"(l, r: file_open_kind) return boolean;

  function ">="(l, r: file_open_kind) return boolean;

  type file_open_status is

    (open_ok, status_error, name_error, mode_error);

  function "="(l, r: file_open_status)return boolean;

  function "/="(l, r: file_open_status)return boolean;

  function "<"(l, r: file_open_status)return boolean;

  function "<="(l, r: file_open_status)return boolean;

  function ">"(l, r: file_open_status)return boolean;

  function ">="(l, r: file_open_status)return boolean;

  attribute foreign: string;

end;

A.2 Package Standard_Additions

Package standard_additions is the VHDL-1993 supplement to package standard (see Appendix A.1). In VHDL-2008, the additions are merged into package standard and so this package is empty.

package standard_additions is

  -- std_match operators

  -- implemented as extended-named functions in VHDL-1993

  -- implemented as operators in VHDL-2008

  function ?= (l, r : boolean)

    return boolean;

  function ?/= (l, r : boolean)

    return boolean;

  function ?< (l, r : boolean)

    return boolean;

  function ?<= (l, r : boolean)

    return boolean;

  function ?> (l, r : boolean)

    return boolean;

  function ?>= (l, r : boolean)

    return boolean;

  function ?= (l, r : bit)

    return bit;

  function ?/= (l, r : bit)

    return bit;

  function ?< (l, r : bit)

    return bit;

  function ?<= (l, r : bit)

    return bit;

  function ?> (l, r : bit)

    return bit;

  function ?>= (l, r : bit)

    return bit;

  function ?? (l : bit)

    return boolean;

  function ?= (l, r : bit_vector)

    return bit;

  function ?/= (l, r : bit_vector)

    return bit;

  -- minimum/maximum functions

  function minimum (l, r : boolean)

    return boolean;

  function maximum (l, r : boolean)

    return boolean;

  function minimum (l, r : bit)

    return bit;

  function maximum (l, r : bit)

    return bit;

  function minimum (l, r : character)

    return character;

  function maximum (l, r : character)

    return character;

  function minimum (l, r : severity_level)

    return severity_level;

  function maximum (l, r : severity_level)

    return severity_level;

  function minimum (l, r : integer)

    return integer;

  function maximum (l, r : integer)

    return integer;

  function minimum (l, r : real)

    return real;

  function maximum (l, r : real)

    return real;

  function minimum (l, r : time)

    return time;

  function maximum (l, r : time)

    return time;

  function minimum (l, r : string)

    return string;

  function maximum (l, r : string)

    return string;

  function minimum (l : string)

    return character;

  function maximum (l : string)

    return character;

  function minimum (l, r : bit_vector)

    return bit_vector;

  function maximum (l, r : bit_vector)

    return bit_vector;

  function minimum (l : bit_vector)

    return bit;

  function maximum (l : bit_vector)

    return bit;

  function minimum (l, r : file_open_kind)

    return file_open_kind;

  function maximum (l, r : file_open_kind)

    return file_open_kind;

  function minimum (l, r : file_open_status)

    return file_open_status;

  function maximum (l, r : file_open_status)

    return file_open_status;

  -- edge detection for possible clock types

  function rising_edge (signal s : boolean)

    return boolean;

  function falling_edge (signal s : boolean)

    return boolean;

  function rising_edge (signal s : bit)

    return boolean;

  function falling_edge (signal s : bit)

    return boolean;

  -- selecting boolean operators

  function "and" (l : bit_vector; r : bit)

    return bit_vector;

  function "and" (l : bit; r : bit_vector)

    return bit_vector;

  function "or" (l : bit_vector; r : bit)

    return bit_vector;

  function "or" (l : bit; r : bit_vector)

    return bit_vector;

  function "nand" (l : bit_vector; r : bit)

    return bit_vector;

  function "nand" (l : bit; r : bit_vector)

    return bit_vector;

  function "nor" (l : bit_vector; r : bit)

    return bit_vector;

  function "nor" (l : bit; r : bit_vector)

    return bit_vector;

  function "xor" (l : bit_vector; r : bit)

    return bit_vector;

  function "xor" (l : bit; r : bit_vector)

    return bit_vector;

  function "xnor" (l : bit_vector; r : bit)

    return bit_vector;

  function "xnor" (l : bit; r : bit_vector)

    return bit_vector;

  -- reducing boolean operators

  -- implemented as functions in VHDL-1993

  -- implemented as boolean operators in VHDL-2008

  function and_reduce (l : bit_vector)

     return bit;

  function or_reduce (l : bit_vector)

    return bit;

  function nand_reduce (l : bit_vector)

    return bit;

  function nor_reduce (l : bit_vector)

    return bit;

  function xor_reduce (l : bit_vector)

    return bit;

  function xnor_reduce (l : bit_vector)

    return bit;

  -- arithmetic operations

  function "mod" (l, r : time)

    return time;

  function "rem" (l, r : time)

    return time;

  -- String formatting functions

  function to_string (value : bit_vector)

    return string;

  alias to_bstring is

    to_string [bit_vector return string];

  alias to_binary_string is

    to_string [bit_vector return string];

  function to_ostring (value : bit_vector)

    return string;

  alias to_octal_string is

    to_ostring [bit_vector return string];

  function to_hstring (value : bit_vector)

    return string;

  alias to_hex_string is

    to_hstring [bit_vector return string];

  function to_string (value : boolean)

    return string;

  function to_string (value : bit)

    return string;

  function to_string (value : character)

    return string;

  function to_string (value : severity_level)

    return string;

  function to_string (value : integer)

    return string;

  function to_string (value : real)

    return string;

  function to_string (value : time)

    return string;

  function to_string (value : file_open_kind)

    return string;

  function to_string (value : file_open_status)

    return string;

  function to_string (value : real; digits : natural)

    return string;

  function to_string (value : real; format : string)

    return string;

  function to_string (value : time; unit : time)

    return string;

  -- new type boolean_vector

  type boolean_vector is array (natural range <>) of boolean;

  function "and" (l, r : boolean_vector)

    return boolean_vector;

  function "or" (l, r : boolean_vector)

    return boolean_vector;

  function "nand" (l, r : boolean_vector)

    return boolean_vector;

  function "nor" (l, r : boolean_vector)

    return boolean_vector;

  function "xor" (l, r : boolean_vector)

    return boolean_vector;

  function "xnor" (l, r : boolean_vector)

    return boolean_vector;

  function "not" (l : boolean_vector)

    return boolean_vector;

  function "and" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "and" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "or" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "or" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "nand" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "nand" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "nor" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "nor" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "xor" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "xor" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "xnor" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "xnor" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function and_reduce (l : boolean_vector)

    return boolean;

  function or_reduce (l : boolean_vector)

    return boolean;

  function nand_reduce (l : boolean_vector)

    return boolean;

  function nor_reduce (l : boolean_vector)

    return boolean;

  function xor_reduce (l : boolean_vector)

    return boolean;

  function xnor_reduce (l : boolean_vector)

    return boolean;

  function "sll" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "srl" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "sla" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "sra" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "rol" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "ror" (l : boolean_vector; r : integer)

    return boolean_vector;

  function "=" (l, r : boolean_vector)

    return boolean;

  function "/=" (l, r : boolean_vector)

    return boolean;

  function "<" (l, r : boolean_vector)

    return boolean;

  function "<=" (l, r : boolean_vector)

    return boolean;

  function ">" (l, r : boolean_vector)

    return boolean;

  function ">=" (l, r : boolean_vector)

    return boolean;

  function ?= (l, r : boolean_vector)

    return boolean;

  function ?/= (l, r : boolean_vector)

    return boolean;

  function "&" (l : boolean_vector; r : boolean_vector)

    return boolean_vector;

  function "&" (l : boolean_vector; r : boolean)

    return boolean_vector;

  function "&" (l : boolean; r : boolean_vector)

    return boolean_vector;

  function "&" (l : boolean; r : boolean)

    return boolean_vector;

  function minimum (l, r : boolean_vector)

    return boolean_vector;

  function maximum (l, r : boolean_vector)

    return boolean_vector;

  function minimum (l : boolean_vector)

    return boolean;

  function maximum (l : boolean_vector)

    return boolean;

  -- New type integer_vector

  type integer_vector is array (natural range <>) of integer;

  function "=" (l, r : integer_vector)

    return boolean;

  function "/=" (l, r : integer_vector)

    return boolean;

  function "<" (l, r : integer_vector)

    return boolean;

  function "<=" (l, r : integer_vector)

    return boolean;

  function ">" (l, r : integer_vector)

    return boolean;

  function ">=" (l, r : integer_vector)

    return boolean;

  function "&" (l : integer_vector; r : integer_vector)

    return integer_vector;

  function "&" (l : integer_vector; r : integer)

    return integer_vector;

  function "&" (l : integer; r : integer_vector)

    return integer_vector;

  function "&" (l : integer; r : integer)

    return integer_vector;

  function minimum (l, r : integer_vector)

    return integer_vector;

  function maximum (l, r : integer_vector)

    return integer_vector;

  function minimum (l : integer_vector)

    return integer;

  function maximum (l : integer_vector)

    return integer;

  -- New type real_vector

  type real_vector is array (natural range <>) of real;

  function "=" (l, r : real_vector)

    return boolean;

  function "/=" (l, r : real_vector)

    return boolean;

  function "<" (l, r : real_vector)

    return boolean;

  function "<=" (l, r : real_vector)

    return boolean;

  function ">" (l, r : real_vector)

    return boolean;

  function ">=" (l, r : real_vector)

    return boolean;

  function "&" (l : real_vector; r : real_vector)

    return real_vector;

  function "&" (l : real_vector; r : real)

    return real_vector;

  function "&" (l : real; r : real_vector)

    return real_vector;

  function "&" (l : real; r : real)

    return real_vector;

  function minimum (l, r : real_vector)

    return real_vector;

  function maximum (l, r : real_vector)

    return real_vector;

  function minimum (l : real_vector)

    return real;

  function maximum (l : real_vector)

    return real;

  -- New type time_vector

  type time_vector is array (natural range <>) of time;

  function "=" (l, r : time_vector)

    return boolean;

  function "/=" (l, r : time_vector)

    return boolean;

  function "<" (l, r : time_vector)

    return boolean;

  function "<=" (l, r : time_vector)

    return boolean;

  function ">" (l, r : time_vector)

    return boolean;

  function ">=" (l, r : time_vector)

    return boolean;

  function "&" (l : time_vector; r : time_vector)

    return time_vector;

  function "&" (l : time_vector; r : time)

    return time_vector;

  function "&" (l : time; r : time_vector)

    return time_vector;

  function "&" (l : time; r : time)

    return time_vector;

  function minimum (l, r : time_vector)

    return time_vector;

  function maximum (l, r : time_vector)

    return time_vector;

  function minimum (l : time_vector)

    return time;

  function maximum (l : time_vector)

    return time;

end;

A.3 Package Std_Logic_1164

Package std_logic_1164 defines the 9-value logic type std_ulogic and its arrays. This is the VHDL-1993 version and is supplemented by package std_logic_1164_additions (see Appendix A.4). In VHDL-2008, the additions are merged into package std_logic_1164.

package std_logic_1164 is

  -- logic state system

  type std_ulogic is ('U', -- Uninitialised

                      'X', -- Forcing Unknown

                      '0', -- Forcing 0

                      '1', -- Forcing 1

                      'Z', -- High Impedance

                      'W', -- Weak Unknown

                      'L', -- Weak 0

                      'H', -- Weak 1

                      '-' -- Don't care

                      );

  function resolved (s : std_ulogic_vector) return std_ulogic;

  subtype std_logic is resolved std_ulogic;

  type std_ulogic_vector is array (natural range <>) of std_ulogic;

  type std_logic_vector is array (natural range <>) of std_logic;

  -- common subtypes

  subtype X01 is resolved std_ulogic range 'X' TO '1';

  subtype X01Z is resolved std_ulogic range 'X' TO 'Z';

  subtype UX01 is resolved std_ulogic range 'U' TO '1';

  subtype UX01Z is resolved std_ulogic range 'U' TO 'Z';

  -- overloaded logical operators

  function "and" (l : std_ulogic; r : std_ulogic) return UX01;

  function "nand" (l : std_ulogic; r : std_ulogic) return UX01;

  function "or" (l : std_ulogic; r : std_ulogic) return UX01;

  function "nor" (l : std_ulogic; r : std_ulogic) return UX01;

  function "xor" (l : std_ulogic; r : std_ulogic) return UX01;

  function "xnor" (l : std_ulogic; r : std_ulogic) return UX01;

  function "not" (l : std_ulogic) return UX01;

  -- vectorized overloaded logical operators

  function "and" (l, r : std_logic_vector)

    return std_logic_vector;

  function "and" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "nand" (l, r : std_logic_vector)

    return std_logic_vector;

  function "nand" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "or" (l, r : std_logic_vector)

    return std_logic_vector;

  function "or" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "nor" (l, r : std_logic_vector)

    return std_logic_vector;

  function "nor" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "xor" (l, r : std_logic_vector)

    return std_logic_vector;

  function "xor" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "xnor" (l, r : std_logic_vector)

    return std_logic_vector;

  function "xnor" (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function "not" (l : std_logic_vector)

    return std_logic_vector;

  function "not" (l : std_ulogic_vector)

    return std_ulogic_vector;

  -- conversion functions

  function To_bit (s : std_ulogic; xmap : bit := '0')

    return bit;

  function To_bitvector (s : std_logic_vector; xmap : bit := '0')

    return bit_vector;

  function To_bitvector (s : std_ulogic_vector; xmap : bit := '0')

    return bit_vector;

  function To_StdULogic (b : bit)

    return std_ulogic;

  function To_StdLogicVector (b : bit_vector)

    return std_logic_vector;

  function To_StdLogicVector (s : std_ulogic_vector)

    return std_logic_vector;

  function To_StdULogicVector (b : bit_vector)

    return std_ulogic_vector;

  function To_StdULogicVector (s : std_logic_vector)

    return std_ulogic_vector;

  -- strength strippers and type convertors

  function To_X01 (s : std_logic_vector)

    return std_logic_vector;

  function To_X01 (s : std_ulogic_vector)

    return std_ulogic_vector;

  function To_X01 (s : std_ulogic)

    return X01;

  function To_X01 (b : bit_vector)

    return std_logic_vector;

  function To_X01 (b : bit_vector)

    return std_ulogic_vector;

  function To_X01 (b : bit)

    return X01;

  function To_X01Z (s : std_logic_vector)

    return std_logic_vector;

  function To_X01Z (s : std_ulogic_vector)

    return std_ulogic_vector;

  function To_X01Z (s : std_ulogic)

    return X01Z;

  function To_X01Z (b : bit_vector)

    return std_logic_vector;

  function To_X01Z (b : bit_vector)

    return std_ulogic_vector;

  function To_X01Z (b : bit)

    return X01Z;

  function To_UX01 (s : std_logic_vector)

    return std_logic_vector;

  function To_UX01 (s : std_ulogic_vector)

    return std_ulogic_vector;

  function To_UX01 (s : std_ulogic)

    return UX01;

  function To_UX01 (b : bit_vector)

    return std_logic_vector;

  function To_UX01 (b : bit_vector)

    return std_ulogic_vector;

  function To_UX01 (b : bit)

    return UX01;

  -- edge detection

  function rising_edge (signal s : std_ulogic) return boolean;

  function falling_edge (signal s : std_ulogic) return boolean;

  -- object contains an unknown

  function Is_X (s : std_ulogic_vector) return boolean;

  function Is_X (s : std_logic_vector) return boolean;

  function Is_X (s : std_ulogic) return boolean;

end;

A.4 Package Std_Logic_1164_Additions

Package std_logic_1164_additions is the VHDL-1993 supplement to package std_logic_1164 (see Appendix A.3). In VHDL-2008, the additions are merged into package std_logic_1164 and so this package is empty.

package std_logic_1164_additions is

  -- std_match operators

  -- implemented as extended-named functions in VHDL-1993

  -- implemented as operators in VHDL-2008

  function ?= (l, r : std_ulogic) return std_ulogic;

  function ?= (l, r : std_logic_vector) return std_ulogic;

  function ?= (l, r : std_ulogic_vector) return std_ulogic;

  function ?/= (l, r : std_ulogic) return std_ulogic;

  function ?/= (l, r : std_logic_vector) return std_ulogic;

  function ?/= (l, r : std_ulogic_vector) return std_ulogic;

  function ?> (l, r : std_ulogic) return std_ulogic;

  function ?>= (l, r : std_ulogic) return std_ulogic;

  function ?< (l, r : std_ulogic) return std_ulogic;

  function ?<= (l, r : std_ulogic) return std_ulogic;

  function ?? (s : std_ulogic) return boolean;

  -- minimum/maximum functions

  function maximum (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function maximum (l, r : std_logic_vector)

    return std_logic_vector;

  function maximum (l, r : std_ulogic)

    return std_ulogic;

  function minimum (l, r : std_ulogic_vector)

    return std_ulogic_vector;

  function minimum (l, r : std_logic_vector)

    return std_logic_vector;

  function minimum (l, r : std_ulogic)

    return std_ulogic;

  -- selecting boolean operators

  function "and" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "and" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "and" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "and" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  function "nand" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "nand" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "nand" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "nand" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  function "or" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "or" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "or" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "or" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  function "nor" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "nor" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "nor" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "nor" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  function "xor" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "xor" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "xor" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "xor" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  function "xnor" (l : std_logic_vector; r : std_ulogic)

    return std_logic_vector;

  function "xnor" (l : std_ulogic_vector; r : std_ulogic)

    return std_ulogic_vector;

  function "xnor" (l : std_ulogic; r : std_logic_vector)

    return std_logic_vector;

  function "xnor" (l : std_ulogic; r : std_ulogic_vector)

    return std_ulogic_vector;

  -- reducing boolean operators

  -- implemented as functions in VHDL-1993

  -- implemented as boolean operators in VHDL-2008

  function and_reduce (l : std_logic_vector)

    return std_ulogic;

  function and_reduce (l : std_ulogic_vector)

    return std_ulogic;

  function nand_reduce (l : std_logic_vector)

    return std_ulogic;

  function nand_reduce (l : std_ulogic_vector)

    return std_ulogic;

  function or_reduce (l : std_logic_vector)

    return std_ulogic;

  function or_reduce (l : std_ulogic_vector)

    return std_ulogic;

  function nor_reduce (l : std_logic_vector)

    return std_ulogic;

  function nor_reduce (l : std_ulogic_vector)

    return std_ulogic;

  function xor_reduce (l : std_logic_vector)

    return std_ulogic;

  function xor_reduce (l : std_ulogic_vector)

    return std_ulogic;

  function xnor_reduce (l : std_logic_vector)

    return std_ulogic;

  function xnor_reduce (l : std_ulogic_vector)

    return std_ulogic;

  -- shift operators

  function "sll" (l : std_logic_vector; r : integer)

    return std_logic_vector;

  function "sll" (l : std_ulogic_vector; r : integer)

    return std_ulogic_vector;

  function "srl" (l : std_logic_vector; r : integer)

    return std_logic_vector;

  function "srl" (l : std_ulogic_vector; r : integer)

    return std_ulogic_vector;

  function "rol" (l : std_logic_vector; r : integer)

    return std_logic_vector;

  function "rol" (l : std_ulogic_vector; r : integer)

    return std_ulogic_vector;

  function "ror" (l : std_logic_vector; r : integer)

    return std_logic_vector;

  function "ror" (l : std_ulogic_vector; r : integer)

    return std_ulogic_vector;

  -- type conversions

  alias to_bv is

    ieee.std_logic_1164.to_bitvector

    [std_logic_vector, bit return bit_vector];

  alias to_bv is

    ieee.std_logic_1164.to_bitvector

    [std_ulogic_vector, bit return bit_vector];

  alias to_bit_vector is ieee.std_logic_1164.to_bitvector

    [std_logic_vector, bit return bit_vector];

  alias to_bit_vector is ieee.std_logic_1164.to_bitvector

    [std_ulogic_vector, bit return bit_vector];

  alias to_slv is ieee.std_logic_1164.to_stdlogicvector

    [bit_vector return std_logic_vector];

  alias to_slv is ieee.std_logic_1164.to_stdlogicvector

    [std_ulogic_vector return std_logic_vector];

  alias to_std_logic_vector is

    ieee.std_logic_1164.to_stdlogicvector

    [bit_vector return std_logic_vector];

  alias to_std_logic_vector is

    ieee.std_logic_1164.to_stdlogicvector

    [std_ulogic_vector return std_logic_vector];

  alias to_suv is

    ieee.std_logic_1164.to_stdulogicvector

    [bit_vector return std_ulogic_vector];

  alias to_suv is

    ieee.std_logic_1164.to_stdulogicvector

    [std_logic_vector return std_ulogic_vector];

  alias to_std_ulogic_vector is

    ieee.std_logic_1164.to_stdulogicvector

    [bit_vector return std_ulogic_vector];

  alias to_std_ulogic_vector is

    ieee.std_logic_1164.to_stdulogicvector

    [std_logic_vector return std_ulogic_vector];

  -- String formatting functions

  function to_string (value : std_ulogic)

    return string;

  function to_string (value : std_ulogic_vector)

    return string;

  function to_string (value : std_logic_vector)

    return string;

  alias to_bstring is

    to_string [std_ulogic_vector return string];

  alias to_bstring is

    to_string [std_logic_vector return string];

  alias to_binary_string is

    to_string [std_ulogic_vector return string];

  alias to_binary_string is

    to_string [std_logic_vector return string];

  function to_ostring (value : std_ulogic_vector)

    return string;

  function to_ostring (value : std_logic_vector)

    return string;

  alias to_octal_string is

    to_ostring [std_ulogic_vector return string];

  alias to_octal_string is

    to_ostring [std_logic_vector return string];

  function to_hstring (value : std_ulogic_vector)

    return string;

  function to_hstring (value : std_logic_vector)

    return string;

  alias to_hex_string is

    to_hstring [std_ulogic_vector return string];

  alias to_hex_string is

    to_hstring [std_logic_vector return string];

  -- Text I/O procedures

  procedure read (l : inout line;

                  value : out std_ulogic;

                  good : out boolean);

  procedure read (l : inout line;

                  value : out std_ulogic);

  procedure read (l : inout line;

                  value : out std_ulogic_vector;

                  good : out boolean);

  procedure read (l : inout line;

                  value : out std_ulogic_vector);

  procedure read (l : inout line;

                  value : out std_logic_vector;

                  good : out boolean);

  procedure read (l : inout line;

                  value : out std_logic_vector);

  alias bread is

    read [line, std_ulogic_vector, boolean];

  alias bread is

    read [line, std_ulogic_vector];

  alias bread is

    read [line, std_logic_vector, boolean];

  alias bread is

    read [line, std_logic_vector];

  alias binary_read is

    read [line, std_ulogic_vector, boolean];

  alias binary_read is

    read [line, std_ulogic_vector];

  alias binary_read is

    read [line, std_logic_vector, boolean];

  alias binary_read is

    read [line, std_logic_vector];

  procedure oread (l : inout line;

                   value : out std_ulogic_vector;

                   good : out boolean);

  procedure oread (l : inout line;

                   value : out std_ulogic_vector);

  procedure oread (l : inout line;

                   value : out std_logic_vector;

                   good : out boolean);

  procedure oread (l : inout line;

                   value : out std_logic_vector);

  alias octal_read is

    oread [line, std_ulogic_vector, boolean];

  alias octal_read is

    oread [line, std_ulogic_vector];

  alias octal_read is

    oread [line, std_logic_vector, boolean];

  alias octal_read is

    oread [line, std_logic_vector];

  procedure hread (l : inout line;

                   value : out std_ulogic_vector;

                   good : out boolean);

  procedure hread (l : inout line;

                   value : out std_ulogic_vector);

  procedure hread (l : inout line;

                   value : out std_logic_vector;

                   good : out boolean);

  procedure hread (l : inout line;

                   value : out std_logic_vector);

  alias hex_read is

    hread [line, std_ulogic_vector, boolean];

  alias hex_read is

    hread [line, std_ulogic_vector];

  alias hex_read is

    hread [line, std_logic_vector, boolean];

  alias hex_read is

    hread [line, std_logic_vector];

  procedure write (l : inout line;

                   value : in std_ulogic;

                   justified : in side := right;

                   field : in width := 0);

  procedure write (l : inout line;

                   value : in std_ulogic_vector;

                   justified : in side := right;

                   field : in width := 0);

  procedure write (l : inout line;

                   value : in std_logic_vector;

                   justified : in side := right;

                   field : in width := 0);

  alias bwrite is

    write [line, std_ulogic_vector, side, width];

  alias bwrite is

    write [line, std_logic_vector, side, width];

  alias binary_write is

    write [line, std_ulogic_vector, side, width];

  alias binary_write is

    write [line, std_logic_vector, side, width];

 procedure owrite (l : inout line;

                    value : in std_ulogic_vector;

                    justified : in side := right;

                    field : in width := 0);

  procedure owrite (l : inout line;

                    value : in std_logic_vector;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is

    owrite [line, std_ulogic_vector, side, width];

  alias octal_write is

    owrite [line, std_logic_vector, side, width];

  procedure hwrite (l : inout line;

                    value : in std_ulogic_vector;

                    justified : in side := right;

                    field : in width := 0);

  procedure hwrite (l : inout line;

                    value : in std_logic_vector;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is

    hwrite [line, std_ulogic_vector, side, width];

  alias hex_write is

    hwrite [line, std_logic_vector, side, width];

end;

A.5 Package Numeric_Std

Package numeric_std provided the synthesisable arbitrary-precision integer arithmetic types signed and unsigned. This is the VHDL-1993 version and is supplemented by package numeric_std_additions (see Appendix A.6). In VHDL-2008, the additions are merged into package numeric_std.

package numeric_std is

  ------------------------------------------------------

  -- numeric array type definitions

  ------------------------------------------------------

      

  type unsigned is array (natural range <>) of std_logic;

  type signed is array (natural range <>) of std_logic;

  ------------------------------------------------------

  -- arithmetic operators:

  ------------------------------------------------------

  function "abs"(l: signed) return signed;

  function "-"(l: signed) return signed;

  

  ------------------------------------------------------

  function "+"(l, r: unsigned) return unsigned;

  function "+"(l, r: signed) return signed;

  function "+"(l: unsigned; r: natural) return unsigned;

  function "+"(l: natural; r: unsigned) return unsigned;

  function "+"(l: integer; r: signed) return signed;

  function "+"(l: signed; r: integer) return signed;

  ------------------------------------------------------

  function "-"(l, r: unsigned) return unsigned;

  function "-"(l, r: signed) return signed;

  function "-"(l: unsigned;r: natural) return unsigned;

  function "-"(l: natural; r: unsigned) return unsigned;

  function "-"(l: signed; r: integer) return signed;

  function "-"(l: integer; r: signed) return signed;

  ------------------------------------------------------

  function "*"(l, r: unsigned) return unsigned;

  function "*"(l, r: signed) return signed;

  function "*"(l: unsigned; r: natural) return unsigned;

  function "*"(l: natural; r: unsigned) return unsigned;

  function "*"(l: signed; r: integer) return signed;

  function "*"(l: integer; r: signed) return signed;

    

  ------------------------------------------------------

      

  function "/"(l, r: unsigned) return unsigned;

  function "/"(l, r: signed) return signed;

  function "/"(l: unsigned; r: natural) return unsigned;

  function "/"(l: natural; r: unsigned) return unsigned;

  function "/"(l: signed; r: integer) return signed;

  function "/"(l: integer; r: signed) return signed;

    

  ------------------------------------------------------

    

  function "rem"(l, r: unsigned) return unsigned;

  function "rem"(l, r: signed) return signed;

  function "rem"(l: unsigned; r: natural) return unsigned;

  function "rem"(l: natural; r: unsigned) return unsigned;

  function "rem"(l: signed; r: integer) return signed;

  function "rem"(l: integer; r: signed) return signed;

  ------------------------------------------------------

    

  function "mod"(l, r: unsigned) return unsigned;

  function "mod"(l, r: signed) return signed;

  function "mod"(l: unsigned; r: natural) return unsigned;

  function "mod"(l: natural; r: unsigned) return unsigned;

  function "mod"(l: signed; r: integer) return signed;

  function "mod"(l: integer; r: signed) return signed;

    

  ------------------------------------------------------

  -- comparison operators

  ------------------------------------------------------

    

  function ">"(l, r: unsigned) return boolean;

  function ">"(l, r: signed) return boolean;

  function ">"(l: natural; r: unsigned) return boolean;

  function ">"(l: integer; r: signed) return boolean;

  function ">"(l: unsigned; r: natural) return boolean;

  function ">"(l: signed; r: integer) return boolean;

  ------------------------------------------------------

    

  function "<"(l, r: unsigned) return boolean;

  function "<"(l, r: signed) return boolean;

  function "<"(l: natural; r: unsigned) return boolean;

  function "<"(l: integer; r: signed) return boolean;

  function "<"(l: unsigned; r: natural) return boolean;

  function "<"(l: signed; r: integer) return boolean;

  ------------------------------------------------------

  function "<="(l, r: unsigned) return boolean;

  function "<="(l, r: signed) return boolean;

  function "<="(l: natural; r: unsigned) return boolean;

  function "<="(l: integer; r: signed) return boolean;

  function "<="(l: unsigned; r: natural) return boolean;

  function "<="(l: signed; r: integer) return boolean;

  ------------------------------------------------------

  function ">="(l, r: unsigned) return boolean;

  function ">="(l, r: signed) return boolean;

  function ">="(l: natural; r: unsigned) return boolean;

  function ">="(l: integer; r: signed) return boolean;

  function ">="(l: unsigned; r: natural) return boolean;

  function ">="(l: signed; r: integer) return boolean;

  ------------------------------------------------------

  function "="(l, r: unsigned) return boolean;

  function "="(l, r: signed) return boolean;

  function "="(l: natural; r: unsigned) return boolean;

  function "="(l: integer; r: signed) return boolean;

  function "="(l: unsigned; r: natural) return boolean;

  function "="(l: signed; r: integer) return boolean;

  ------------------------------------------------------

  function "/="(l, r: unsigned) return boolean;

  function "/="(l, r: signed) return boolean;

  function "/="(l: natural; r: unsigned) return boolean;

  function "/="(l: integer; r: signed) return boolean;

  function "/="(l: unsigned; r: natural) return boolean;

  function "/="(l: signed; r: integer) return boolean;

  ------------------------------------------------------

  -- shift and rotate functions

  ------------------------------------------------------

  function shift_left(l: unsigned; n: natural) return unsigned;

  function shift_right(l: unsigned; n: natural) return unsigned;

  function shift_left(l: signed; n: natural) return signed;

  function shift_right(l: signed; n: natural) return signed;

  function rotate_left(l: unsigned; n: natural) return unsigned;

  function rotate_right(l: unsigned; n: natural) return unsigned;

  function rotate_left(l: signed; n: natural) return signed;

  function rotate_right(l: signed; n: natural) return signed;

  function "sll"(l: unsigned; n: integer) return unsigned;

  function "sll"(l: signed; n: integer) return signed;

  function "srl"(l: unsigned; n: integer) return unsigned;

  function "srl"(l: signed; n: integer) return signed;

  function "rol"(l: unsigned; n: integer) return unsigned;

  function "rol"(l: signed; n: integer) return signed;

  function "ror"(l: unsigned; n: integer) return unsigned;

  function "ror"(l: signed; n: integer) return signed;

  ------------------------------------------------------

  -- resize functions

  ------------------------------------------------------

    

  function resize(l: signed; s: natural) return signed;

  function resize(l: unsigned; s: natural) return unsigned;

  ------------------------------------------------------

  -- conversion functions

  ------------------------------------------------------

  function to_integer(l: unsigned) return natural;

  function to_integer(l: signed) return integer;

  function to_unsigned(l: natural; s: natural) return unsigned;

  function to_signed(l: integer; s: natural) return signed;

  ------------------------------------------------------

  -- logical operators

  ------------------------------------------------------

  function "not"(l: unsigned) return unsigned;

  function "and"(l, r: unsigned) return unsigned;

  function "or"(l, r: unsigned) return unsigned;

  function "nand"(l, r: unsigned) return unsigned;

  function "nor"(l, r: unsigned) return unsigned;

  function "xor"(l, r: unsigned) return unsigned;

  function "xnor"(l, r: unsigned) return unsigned;

  function "not"(l: signed) return signed;

  function "and"(l, r: signed) return signed;

  function "or"(l, r: signed) return signed;

  function "nand"(l, r: signed) return signed;

  function "nor"(l, r: signed) return signed;

  function "xor"(l, r: signed) return signed;

  function "xnor"(l, r: signed) return signed;

  ------------------------------------------------------

  -- match functions

  ------------------------------------------------------

  function std_match(l, r: std_ulogic) return boolean;

  function std_match(l, r: unsigned) return boolean;

  function std_match(l, r: signed) return boolean;

  function std_match(l, r: std_logic_vector) return boolean;

  function std_match(l, r: std_ulogic_vector) return boolean;

  ------------------------------------------------------

  -- translation functions

  ------------------------------------------------------

    

  function to_01(s: unsigned; xmap: std_logic := '0')

    return unsigned;

  function to_01(s: signed; xmap: std_logic := '0')

    return signed;

end;

A.6 Package Numeric_Std_Additions

Package numeric_std_additions is the VHDL-1993 supplement to package numeric_std (see Appendix A.5). In VHDL-2008, the additions are merged into package numeric_std and so this package is empty.

library ieee;

use ieee.std_logic_1164.all;

use ieee.numeric_std.all;

use std.textio.all;

package numeric_std_additions is

  -- unresolved variant of signed/unsigned

  -- these are only unresolved in VHDL-2008

  -- in VHDL-1993 they are subtypes of the resolved type

  subtype unresolved_unsigned is unsigned;

  subtype unresolved_signed is signed;

  subtype u_unsigned is unsigned;

  subtype u_signed is signed;

  -- add and subtract with a one-bit value

  function "+"(l : unsigned; r : std_ulogic)

    return unsigned;

  function "+"(l : std_ulogic; r : unsigned)

    return unsigned;

  function "+"(l : signed; r : std_ulogic)

    return signed;

  function "+"(l : std_ulogic; r : signed)

    return signed;

  function "-"(l : unsigned; r : std_ulogic)

    return unsigned;

  function "-"(l : std_ulogic; r : unsigned)

    return unsigned;

  function "-"(l : signed; r : std_ulogic)

    return signed;

  function "-"(l : std_ulogic; r : signed)

    return signed;

  -- std_match operators

  -- implemented as extended-named functions in VHDL-1993

  -- implemented as operators in VHDL-2008

  function ?= (l, r : unsigned)

    return std_ulogic;

  function ?/= (l, r : unsigned)

    return std_ulogic;

  function ?> (l, r : unsigned)

    return std_ulogic;

  function ?>= (l, r : unsigned)

    return std_ulogic;

  function ?< (l, r : unsigned)

    return std_ulogic;

  function ?<= (l, r : unsigned)

    return std_ulogic;

  function ?= (l : unsigned; r : natural)

    return std_ulogic;

  function ?/= (l : unsigned; r : natural)

    return std_ulogic;

  function ?> (l : unsigned; r : natural)

    return std_ulogic;

  function ?>= (l : unsigned; r : natural)

    return std_ulogic;

  function ?< (l : unsigned; r : natural)

    return std_ulogic;

  function ?<= (l : unsigned; r : natural)

    return std_ulogic;

  function ?= (l : natural; r : unsigned)

    return std_ulogic;

  function ?/= (l : natural; r : unsigned)

    return std_ulogic;

  function ?> (l : natural; r : unsigned)

    return std_ulogic;

  function ?>= (l : natural; r : unsigned)

    return std_ulogic;

  function ?< (l : natural; r : unsigned)

    return std_ulogic;

  function ?<= (l : natural; r : unsigned)

    return std_ulogic;

  function ?= (l, r : signed)

    return std_ulogic;

  function ?/= (l, r : signed)

    return std_ulogic;

  function ?> (l, r : signed)

    return std_ulogic;

  function ?>= (l, r : signed)

    return std_ulogic;

  function ?< (l, r : signed)

    return std_ulogic;

  function ?<= (l, r : signed)

    return std_ulogic;

  function ?= (l : signed; r : integer)

    return std_ulogic;

  function ?/= (l : signed; r : integer)

    return std_ulogic;

  function ?> (l : signed; r : integer)

    return std_ulogic;

  function ?>= (l : signed; r : integer)

    return std_ulogic;

  function ?< (l : signed; r : integer)

    return std_ulogic;

  function ?<= (l : signed; r : integer)

    return std_ulogic;

  function ?= (l : integer; r : signed)

    return std_ulogic;

  function ?/= (l : integer; r : signed)

    return std_ulogic;

  function ?> (l : integer; r : signed)

    return std_ulogic;

  function ?>= (l : integer; r : signed)

    return std_ulogic;

  function ?< (l : integer; r : signed)

    return std_ulogic;

  function ?<= (l : integer; r : signed)

    return std_ulogic;

  -- selecting boolean operators

  function "and" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "and" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "or" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "or" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "nand" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "nand" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "nor" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "nor" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "xor" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "xor" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "xnor" (l : std_ulogic; r : unsigned)

    return unsigned;

  function "xnor" (l : unsigned; r : std_ulogic)

    return unsigned;

  function "and" (l : std_ulogic; r : signed)

    return signed;

  function "and" (l : signed; r : std_ulogic)

    return signed;

  function "or" (l : std_ulogic; r : signed)

    return signed;

  function "or" (l : signed; r : std_ulogic)

    return signed;

  function "nand" (l : std_ulogic; r : signed)

    return signed;

  function "nand" (l : signed; r : std_ulogic)

    return signed;

  function "nor" (l : std_ulogic; r : signed)

    return signed;

  function "nor" (l : signed; r : std_ulogic)

    return signed;

  function "xor" (l : std_ulogic; r : signed)

    return signed;

  function "xor" (l : signed; r : std_ulogic)

    return signed;

  function "xnor" (l : std_ulogic; r : signed)

    return signed;

  function "xnor" (l : signed; r : std_ulogic)

    return signed;

  -- reducing boolean operators

  -- implemented as reduction functions in VHDL-1993

  -- proper operators in VHDL-2008 function and_reduce(l : signed)

    return std_ulogic;

  function nand_reduce(l : signed)

    return std_ulogic;

  function or_reduce(l : signed)

    return std_ulogic;

  function nor_reduce(l : signed)

    return std_ulogic;

  function xor_reduce(l : signed)

    return std_ulogic;

  function xnor_reduce(l : signed)

    return std_ulogic;

  function and_reduce(l : unsigned)

    return std_ulogic;

  function nand_reduce(l : unsigned)

    return std_ulogic;

  function or_reduce(l : unsigned)

    return std_ulogic;

  function nor_reduce(l : unsigned)

    return std_ulogic;

  function xor_reduce(l : unsigned)

    return std_ulogic;

  function xnor_reduce(l : unsigned)

    return std_ulogic;

  -- arithmetic shift operators

  function "sla" (arg : signed; count : integer)

    return signed;

  function "sla" (arg : unsigned; count : integer)

    return unsigned;

  function "sra" (arg : signed; count : integer)

    return signed;

  function "sra" (arg : unsigned; count : integer)

    return unsigned;

  -- maximum-minimum functions

  function maximum (l, r : unsigned)

    return unsigned;

  function maximum (l, r : signed)

    return signed;

  function minimum (l, r : unsigned)

    return unsigned;

  function minimum (l, r : signed)

    return signed;

  function maximum (l : unsigned; r : natural)

    return unsigned;

  function maximum (l : signed; r : integer)

    return signed;

  function minimum (l : unsigned; r : natural)

    return unsigned;

  function minimum (l : signed; r : integer)

    return signed;

  function maximum (l : natural; r : unsigned)

    return unsigned;

  function maximum (l : integer; r : signed)

    return signed;

  function minimum (l : natural; r : unsigned)

    return unsigned;

  function minimum (l : integer; r : signed)

    return signed;

  function find_rightmost (arg : unsigned; y : std_ulogic)

    return integer;

  function find_rightmost (arg : signed; y : std_ulogic)

    return integer;

  function find_leftmost (arg : unsigned; y : std_ulogic)

    return integer;

  function find_leftmost (arg : signed; y : std_ulogic)

    return integer;

  -- type conversions

  function to_unresolved_unsigned (arg, size : natural)

    return unresolved_unsigned;

  alias to_u_unsigned is

    to_unresolved_unsigned

    [natural, natural return unresolved_unsigned];

  function to_unresolved_signed (arg : integer; size : natural)

    return unresolved_signed;

  alias to_u_signed is

    to_unresolved_signed

    [natural, natural return unresolved_signed];

  -- strength changers - not synthesisable

  function to_x01 (s : unsigned)

    return unsigned;

  function to_x01 (s : signed)

    return signed;

  function to_x01z (s : unsigned)

    return unsigned;

  function to_x01z (s : signed)

    return signed;

  function to_ux01 (s : unsigned)

    return unsigned;

  function to_ux01 (s : signed)

    return signed;

  function is_x (s : unsigned)

    return boolean;

  function is_x (s : signed)

    return boolean;

  -- printable string values

  function to_string (value : unsigned)

    return string;

  function to_string (value : signed)

    return string;

  alias to_bstring is

    to_string [unsigned return string];

  alias to_bstring is

    to_string [signed return string];

  alias to_binary_string is

    to_string [unsigned return string];

  alias to_binary_string is

    to_string [signed return string];

  function to_ostring (value : unsigned)

    return string;

  function to_ostring (value : signed)

    return string;

  alias to_octal_string is

    to_ostring [unsigned return string];

  alias to_octal_string is

    to_ostring [signed return string];

  function to_hstring (value : unsigned)

    return string;

  function to_hstring (value : signed)

    return string;

  alias to_hex_string is

    to_hstring [unsigned return string];

  alias to_hex_string is

    to_hstring [signed return string];

  -- Text I/O extensions

  procedure read(l : inout line;

                 value : out unsigned;

                 good : out boolean);

  procedure read(l : inout line;

                 value : out unsigned);

  procedure read(l : inout line;

                 value : out signed;

                 good : out boolean);

  procedure read(l : inout line;

                 value : out signed);

  alias binary_read is

    read [line, unsigned, boolean];

  alias binary_read is

    read [line, signed, boolean];

  alias binary_read is

    read [line, unsigned];

  alias binary_read is

    read [line, signed];

  procedure oread (l : inout line;

                   value : out unsigned;

                   good : out boolean);

  procedure oread (l : inout line;

                   value : out signed;

                   good : out boolean);

  procedure oread (l : inout line;

                   value : out unsigned);

  procedure oread (l : inout line;

                   value : out signed);

  alias octal_read is

    oread [line, unsigned, boolean];

  alias octal_read is

    oread [line, signed, boolean];

  alias octal_read is

    oread [line, unsigned];

  alias octal_read is

    oread [line, signed];

  procedure hread (l : inout line;

                    value : out unsigned;

                    good : out boolean);

  procedure hread (l : inout line;

                   value : out signed;

                   good : out boolean);

  procedure hread (l : inout line;

                   value : out unsigned);

  procedure hread (l : inout line;

                   value : out signed);

  alias hex_read is

    hread [line, unsigned, boolean];

  alias hex_read is

    hread [line, signed, boolean];

  alias hex_read is

    hread [line, unsigned];

  alias hex_read is

    hread [line, signed];

  procedure write (l : inout line;

                   value : in unsigned;

                   justified : in side := right;

                   field : in width := 0);

  procedure write (l : inout line;

                   value : in signed;

                   justified : in side := right;

                   field : in width := 0);

  alias binary_write is

    write [line, unsigned, side, width];

  alias binary_write is

    write [line, signed, side, width];

  procedure owrite (l : inout line;

                    value : in unsigned;

                    justified : in side := right;

                    field : in width := 0);

  procedure owrite (l : inout line;

                    value : in signed;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is

    owrite [line, unsigned, side, width];

  alias octal_write is

    owrite [line, signed, side, width];

  procedure hwrite (l : inout line;

                    value : in unsigned;

                    justified : in side := right;

                    field : in width := 0);

  procedure hwrite (l : inout line;

                    value : in signed;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is

    hwrite [line, unsigned, side, width];

  alias hex_write is

    hwrite [line, signed, side, width];

end;

A.7 Package Fixed_Float_Types

Package fixed_float_types is used to define enumeration types used as generic parameters to fixed_generic_pkg and float_generic_pkg. For consistency, these enumerations are still defined here for the VHDL-1993 compatibility versions of the packages even though they do not have generic parameters.

package fixed_float_types is

  -- used in fixed_pkg

  type fixed_round_style_type is

    (fixed_round, fixed_truncate);

  type fixed_overflow_style_type is

    (fixed_saturate, fixed_wrap);

  -- used in float_pkg

  type round_type is

    (round_nearest, round_inf, round_neginf, round_zero);

end;

A.8 Package Fixed_Pkg

Package fixed_pkg listed here is the VHDL-1993 compatibility version of the VHDL-2008 instantiation of fixed_generic_pkg with the default generic parameters. It is therefore usable in both VHDL-1993 and VHDL-2008 systems without change.

package fixed_pkg is

  -- generics converted into constants for VHDL-1993

  constant fixed_round_style : fixed_round_style_type :=

    fixed_round;

  constant fixed_overflow_style : fixed_overflow_style_type :=

    fixed_saturate;

  constant fixed_guard_bits : natural := 3;

  constant no_warning : boolean := false;

  type unresolved_ufixed is array (integer range <>) of std_ulogic;

  type unresolved_sfixed is array (integer range <>) of std_ulogic;

  subtype u_ufixed is unresolved_ufixed;

  subtype u_sfixed is unresolved_sfixed;

  subtype ufixed is u_ufixed;

  subtype sfixed is u_sfixed;

------------------------------------------------------

  -- arithmetic operators

  -- ufixed

  function "+" (l, r : ufixed) return ufixed;

  function "-" (l, r : ufixed) return ufixed;

  function "*" (l, r : ufixed) return ufixed;

  function "/" (l, r : ufixed) return ufixed;

  function "rem" (l, r : ufixed) return ufixed;

  function "mod" (l, r : ufixed) return ufixed;

  procedure add_carry (

    l, r : in ufixed; c_in : in std_ulogic;

    result : out ufixed; c_out : out std_ulogic);

  function divide (l, r : ufixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return ufixed;

  function reciprocal (arg : ufixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return ufixed;

  function remainder (l, r : ufixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return ufixed;

  function modulo (l, r : ufixed;

    round_style : fixed_round_style_type := fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return ufixed;

  function scalb (y : ufixed; n : integer) return ufixed;

  function scalb (y : ufixed; n : signed) return ufixed;

  -- sfixed

  function is_negative (arg : sfixed) return boolean;

  function "abs" (arg : sfixed) return sfixed;

  function "-" (arg : sfixed)return sfixed;

  function "+" (l, r : sfixed) return sfixed;

  function "-" (l, r : sfixed) return sfixed;

  function "*" (l, r : sfixed) return sfixed;

  function "/" (l, r : sfixed) return sfixed;

  function "rem" (l, r : sfixed) return sfixed;

  function "mod" (l, r : sfixed) return sfixed;

  procedure add_carry (

    l, r : in sfixed; c_in : in std_ulogic;

    result : out sfixed; c_out : out std_ulogic);

  function divide (l, r : sfixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return sfixed;

  function reciprocal (arg : sfixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return sfixed;

  function remainder (l, r : sfixed;

    round_style : fixed_round_style_type :=

      fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return sfixed;

  function modulo (l, r : sfixed;

    overflow_style : fixed_overflow_style_type :=

       fixed_overflow_style;

    round_style : fixed_round_style_type :=

       fixed_round_style;

    guard_bits : natural := fixed_guard_bits)

    return sfixed;

  function scalb (y : sfixed; n : integer) return sfixed;

  function scalb (y : sfixed; n : signed) return sfixed;

------------------------------------------------------

  -- comparison operators

  -- ufixed

  function ">" (l, r : ufixed) return boolean;

  function "<" (l, r : ufixed) return boolean;

  function "<=" (l, r : ufixed) return boolean;

  function ">=" (l, r : ufixed) return boolean;

  function "=" (l, r : ufixed) return boolean;

  function "/=" (l, r : ufixed) return boolean;

  function ?= (l, r : ufixed) return std_ulogic;

  function ?/= (l, r : ufixed) return std_ulogic;

  function ?> (l, r : ufixed) return std_ulogic;

  function ?>= (l, r : ufixed) return std_ulogic;

  function ?< (l, r : ufixed) return std_ulogic;

  function ?<= (l, r : ufixed) return std_ulogic;

  function std_match (l, r : ufixed) return boolean;

  function maximum (l, r : ufixed) return ufixed;

  function minimum (l, r : ufixed) return ufixed;

  -- sfixed

  function ">" (l, r : sfixed) return boolean;

  function "<" (l, r : sfixed) return boolean;

  function "<=" (l, r : sfixed) return boolean;

  function ">=" (l, r : sfixed) return boolean;

  function "=" (l, r : sfixed) return boolean;

  function "/=" (l, r : sfixed) return boolean;

  function ?= (l, r : sfixed) return std_ulogic;

  function ?/= (l, r : sfixed) return std_ulogic;

  function ?> (l, r : sfixed) return std_ulogic;

  function ?>= (l, r : sfixed) return std_ulogic;

  function ?< (l, r : sfixed) return std_ulogic;

  function ?<= (l, r : sfixed) return std_ulogic;

  function std_match (l, r : sfixed) return boolean;

  function maximum (l, r : sfixed) return sfixed;

  function minimum (l, r : sfixed) return sfixed;

------------------------------------------------------

  -- shift and rotate functions

  -- ufixed

  function "sll" (l : ufixed; n : integer) return ufixed;

  function "srl" (l : ufixed; n : integer) return ufixed;

  function "rol" (l : ufixed; n : integer) return ufixed;

  function "ror" (l : ufixed; n : integer) return ufixed;

  function "sla" (l : ufixed; n : integer) return ufixed;

  function "sra" (l : ufixed; n : integer) return ufixed;

  function shift_left (l : ufixed; n : natural) return ufixed;

  function shift_right (l : ufixed; n : natural) return ufixed;

  -- sfixed

  function "sll" (l : sfixed; n : integer) return sfixed;

  function "srl" (l : sfixed; n : integer) return sfixed;

  function "rol" (l : sfixed; n : integer) return sfixed;

  function "ror" (l : sfixed; n : integer) return sfixed;

  function "sla" (l : sfixed; n : integer) return sfixed;

  function "sra" (l : sfixed; n : integer) return sfixed;

  function shift_left (l : sfixed; n : natural) return sfixed;

  function shift_right (l : sfixed; n : natural) return sfixed;

------------------------------------------------------

  -- logical functions

    

  -- ufixed

  function "not" (l : ufixed) return ufixed;

  function "and" (l, r : ufixed) return ufixed;

  function "or" (l, r : ufixed) return ufixed;

  function "nand" (l, r : ufixed) return ufixed;

  function "nor" (l, r : ufixed) return ufixed;

  function "xor" (l, r : ufixed) return ufixed;

  function "xnor" (l, r : ufixed) return ufixed;

  function and_reduce (l : ufixed) return std_ulogic;

  function nand_reduce (l : ufixed) return std_ulogic;

  function or_reduce (l : ufixed) return std_ulogic;

  function nor_reduce (l : ufixed) return std_ulogic;

  function xor_reduce (l : ufixed) return std_ulogic;

  function xnor_reduce (l : ufixed) return std_ulogic;

  function find_leftmost (arg : ufixed; y : std_ulogic)

    return integer;

  function find_rightmost (arg : ufixed; y : std_ulogic)

    return integer;

  -- sfixed

  function "not" (l : sfixed) return sfixed;

  function "and" (l, r : sfixed) return sfixed;

  function "or" (l, r : sfixed) return sfixed;

  function "nand" (l, r : sfixed) return sfixed;

  function "nor" (l, r : sfixed) return sfixed;

  function "xor" (l, r : sfixed) return sfixed;

  function "xnor" (l, r : sfixed) return sfixed;

  function and_reduce (l : sfixed) return std_ulogic;

  function nand_reduce (l : sfixed) return std_ulogic;

  function or_reduce (l : sfixed) return std_ulogic;

  function nor_reduce (l : sfixed) return std_ulogic;

  function xor_reduce (l : sfixed) return std_ulogic;

  function xnor_reduce (l : sfixed) return std_ulogic;

  function find_leftmost (arg : sfixed; y : std_ulogic)

    return integer;

  function find_rightmost (arg : sfixed; y : std_ulogic)

    return integer;

------------------------------------------------------

  -- resize functions

  -- ufixed

  function resize (arg : ufixed;

    left_index : integer;

    right_index : integer;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return ufixed;

  function resize (arg : ufixed;

    size_res : ufixed;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return ufixed;

  -- sfixed

  function resize (arg : sfixed;

    left_index : integer;

    right_index : integer;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return sfixed;

    function resize (arg : sfixed;

    size_res : sfixed;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return sfixed;

------------------------------------------------------

  -- conversion functions

  -- ufixed

  function to_ufixed (arg : natural;

    left_index : integer;

    right_index : integer := 0;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return ufixed;

    function to_ufixed (arg : natural;

    size_res : ufixed;

    overflow_style : fixed_overflow_style_type :=

       fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return ufixed;

  function to_ufixed (arg : unsigned) return ufixed;

  function to_unsigned (arg : ufixed;

    size : natural;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return unsigned;

  function to_unsigned (arg : ufixed;

    size_res : unsigned;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return unsigned;

  function to_real (arg : ufixed) return real;

  function to_integer (arg : ufixed;

    overflow_style : fixed_overflow_style_type :=

       fixed_overflow_style;

    round_style : fixed_round_style_type :=

       fixed_round_style)

    return natural;

  function ufixed_high (left_index, right_index : integer;

    operation : character := 'X';

    left_index2 : integer := 0;

    right_index2 : integer := 0)

    return integer;

  function ufixed_high (size_res : ufixed;

    operation : character := 'X';

    size_res2 : ufixed)

    return integer;

  function ufixed_low (left_index, right_index : integer;

    operation : character := 'X';

    left_index2 : integer := 0;

    right_index2 : integer := 0)

    return integer;

  function ufixed_low (size_res : ufixed;

    operation : character := 'X';

    size_res2 : ufixed)

    return integer;

  function saturate (left_index, right_index : integer)

    return ufixed;

  function saturate (size_res : ufixed) return ufixed;

  -- sfixed

  function to_sfixed (arg : integer;

    left_index : integer;

    right_index : integer := 0;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return sfixed;

  function to_sfixed (arg : integer;

    size_res : sfixed;

    overflow_style : fixed_overflow_style_type :=

       fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return sfixed;

  function to_sfixed (arg : signed) return sfixed;

  function to_sfixed (arg : ufixed) return sfixed;

  function to_signed (arg : sfixed;

    size : natural;

    overflow_style : fixed_overflow_style_type :=

       fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return signed;

  function to_signed (arg : sfixed;

    size_res : signed;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return signed;

  function to_real (arg : sfixed) return real;

  function to_integer (arg : sfixed;

    overflow_style : fixed_overflow_style_type :=

      fixed_overflow_style;

    round_style : fixed_round_style_type :=

      fixed_round_style)

    return integer;

  function sfixed_high (left_index, right_index : integer;

    operation : character := 'X';

    left_index2 : integer := 0;

    right_index2 : integer := 0)

    return integer;

  function sfixed_low (left_index, right_index : integer;

    operation : character := 'X';

    left_index2 : integer := 0;

    right_index2 : integer := 0)

    return integer;

  function sfixed_high (size_res : sfixed;

    operation : character := 'X';

    size_res2 : sfixed)

    return integer;

  function sfixed_low (size_res : sfixed;

    operation : character := 'X';

    size_res2 : sfixed)

    return integer;

  function saturate (left_index, right_index : integer)

    return sfixed;

  function saturate (size_res : sfixed)

    return sfixed;

------------------------------------------------------

  -- translation functions

  -- ufixed

  function to_01 (s : ufixed; xmap : std_ulogic := '0')

    return ufixed;

  function is_x (arg : ufixed) return boolean;

  function to_x01 (arg : ufixed) return ufixed;

  function to_x01z (arg : ufixed) return ufixed;

  function to_ux01 (arg : ufixed) return ufixed;

  function to_slv (arg : ufixed)

    return std_logic_vector;

  alias to_stdlogicvector is

    to_slv [ufixed return std_logic_vector];

  alias to_std_logic_vector is

    to_slv [ufixed return std_logic_vector];

  function to_sulv (arg : ufixed)

    return std_ulogic_vector;

  alias to_stdulogicvector is

    to_sulv [ufixed return std_ulogic_vector];

  alias to_std_ulogic_vector is

    to_sulv [ufixed return std_ulogic_vector];

  function to_ufixed (arg : std_ulogic_vector;

    left_index : integer;

    right_index : integer)

    return ufixed;

  function to_ufixed (arg : std_ulogic_vector;

    size_res : ufixed)

    return ufixed;

  function to_ufixed (arg : std_logic_vector;

    left_index : integer;

    right_index : integer)

    return ufixed;

  function to_ufixed (arg : std_logic_vector;

    size_res : ufixed)

    return ufixed;

  function to_ufix (arg : std_ulogic_vector;

    width : natural;

    fraction : natural)

    return ufixed;

  function to_ufix (arg : std_logic_vector;

    width : natural;

    fraction : natural)

    return ufixed;

  function ufix_high (width, fraction : natural;

    operation : character := 'X';

    width2 : natural := 0;

    fraction2 : natural := 0)

    return integer;

  function ufix_low (width, fraction : natural;

    operation : character := 'X';

    width2 : natural := 0;

    fraction2 : natural := 0)

    return integer;

  -- sfixed

  function to_01 (s : sfixed; xmap : std_ulogic := '0')

    return sfixed;

  function is_x (arg : sfixed) return boolean;

  function to_x01 (arg : sfixed) return sfixed;

  function to_x01z (arg : sfixed) return sfixed;

  function to_ux01 (arg : sfixed) return sfixed;

  function to_slv (arg : sfixed) return std_logic_vector;

  alias to_stdlogicvector is

    to_slv [sfixed return std_logic_vector];

  alias to_std_logic_vector is

    to_slv [sfixed return std_logic_vector];

  function to_sulv (arg : sfixed) return std_ulogic_vector;

  alias to_stdulogicvector is

    to_sulv [sfixed return std_ulogic_vector];

  alias to_std_ulogic_vector is

    to_sulv [sfixed return std_ulogic_vector];

  function to_sfixed (arg : std_ulogic_vector;

    left_index : integer;

    right_index : integer)

    return sfixed;

  function to_sfixed (arg : std_ulogic_vector;

    size_res : sfixed)

    return sfixed;

  function to_sfixed (arg : std_logic_vector;

    left_index : integer;

    right_index : integer)

    return sfixed;

  function to_sfixed (arg : std_logic_vector;

    size_res : sfixed)

    return sfixed;

  function to_sfix (arg : std_ulogic_vector;

    width : natural;

    fraction : natural)

    return sfixed;

  function to_sfix (arg : std_logic_vector;

    width : natural;

    fraction : natural)

    return sfixed;

  function sfix_high (width, fraction : natural;

    operation : character := 'X';

    width2 : natural := 0;

    fraction2 : natural := 0)

    return integer;

  function sfix_low (width, fraction : natural;

    operation : character := 'X';

    width2 : natural := 0;

    fraction2 : natural := 0)

    return integer;

------------------------------------------------------

  -- textio functions

  -- ufixed

  procedure read(l : inout line;

                 value : out ufixed);

  alias bread is read [line, ufixed];

  alias binary_read is read [line, ufixed];

  procedure read(l : inout line;

                 value : out ufixed;

                 good : out boolean);

  alias bread is read [line, ufixed, boolean];

  alias binary_read is read [line, ufixed, boolean];

  procedure write (l : inout line;

                   value : in ufixed;

                   justified : in side := right;

                   field : in width := 0);

  alias bwrite is write [line, ufixed, side, width];

  alias binary_write is write [line, ufixed, side, width];

  procedure oread(l : inout line;

                  value : out sfixed);

  alias octal_read is oread [line, ufixed];

  procedure oread(l : inout line;

                  value : out sfixed;

                  good : out boolean);

  alias octal_read is oread [line, ufixed, boolean];

  procedure owrite (l : inout line;

                    value : in ufixed;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is owrite [line, ufixed, side, width];

  procedure hread(l : inout line;

                  value : out ufixed);

  alias hex_read is hread [line, ufixed];

  procedure hread(l : inout line;

                  value : out ufixed;

                  good : out boolean);

  alias hex_read is hread [line, ufixed, boolean];

  procedure hwrite (l : inout line;

                    value : in ufixed;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is hwrite [line, ufixed, side, width];

   -- sfixed

  procedure read(l : inout line;

                 value : out sfixed);

  alias bread is read [line, sfixed];

  alias binary_read is read [line, sfixed];

  procedure read(l : inout line;

                 value : out sfixed;

                 good : out boolean);

  alias bread is read [line, sfixed, boolean];

  alias binary_read is read [line, sfixed, boolean];

  procedure write (l : inout line;

                   value : in sfixed;

                   justified : in side := right;

                   field : in width := 0);

  alias bwrite is write [line, sfixed, side, width];

  alias binary_write is write [line, sfixed, side, width];

  procedure oread(l : inout line;

                  value : out ufixed);

  alias octal_read is oread [line, sfixed];

  procedure oread(l : inout line;

                  value : out ufixed;

                  good : out boolean);

  alias octal_read is oread [line, sfixed, boolean];

  procedure owrite (l : inout line;

                    value : in sfixed;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is owrite [line, sfixed, side, width];

  procedure hread(l : inout line;

                  value : out sfixed);

  alias hex_read is hread [line, sfixed];

  procedure hread(l : inout line;

                  value : out sfixed;

                  good : out boolean);

  alias hex_read is hread [line, sfixed, boolean];

  procedure hwrite (l : inout line;

                    value : in sfixed;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is hwrite [line, sfixed, side, width];

------------------------------------------------------

  -- string functions

  -- ufixed

  function to_string (value : ufixed) return string;

  alias to_bstring is to_string [ufixed return string];

  alias to_binary_string is to_string [ufixed return string];

  function to_ostring (value : ufixed) return string;

  alias to_octal_string is to_ostring [ufixed return string];

  function to_hstring (value : ufixed) return string;

  alias to_hex_string is to_hstring [ufixed return string];

  function from_string (bstring : string;

    left_index : integer;

    right_index : integer)

    return ufixed;

  alias from_bstring is

    from_string [string, integer, integer return ufixed];

  alias from_binary_string is

    from_string [string, integer, integer return ufixed];

  function from_string (bstring : string;

    size_res : ufixed)

    return ufixed;

  alias from_bstring is

    from_string [string, ufixed return ufixed];

  alias from_binary_string is

    from_string [string, ufixed return ufixed];

  function from_string (bstring : string) return ufixed;

  alias from_bstring is from_string [string return ufixed];

  alias from_binary_string is from_string [string return ufixed];

  function from_ostring (ostring : string;

    left_index : integer;

    right_index : integer)

    return ufixed;

  alias from_octal_string is

    from_ostring [string, integer, integer return ufixed];

  function from_ostring (ostring : string;

    size_res : ufixed)

    return ufixed;

  alias from_octal_string is

    from_ostring [string, ufixed return ufixed];

  function from_ostring (ostring : string) return ufixed;

  alias from_octal_string is from_ostring [string return ufixed];

  function from_hstring (hstring : string;

    left_index : integer;

    right_index : integer)

    return ufixed;

  alias from_hex_string is

    from_hstring [string, integer, integer return ufixed];

  function from_hstring (hstring : string;

    size_res : ufixed)

    return ufixed;

  alias from_hex_string is

    from_hstring [string, ufixed return ufixed];

  function from_hstring (hstring : string) return ufixed;

  alias from_hex_string is from_hstring [string return ufixed];

  --sfixed

  function to_string (value : sfixed) return string;

  alias to_bstring is to_string [sfixed return string];

  alias to_binary_string is to_string [sfixed return string];

  function to_ostring (value : sfixed) return string;

  alias to_octal_string is to_ostring [sfixed return string];

  function to_hstring (value : sfixed) return string;

  alias to_hex_string is to_hstring [sfixed return string];

  function from_string (bstring : string;

    left_index : integer;

    right_index : integer)

    return sfixed;

  alias from_bstring is

    from_string [string, integer, integer return sfixed];

  alias from_binary_string is

    from_string [string, integer, integer return sfixed];

  function from_string (bstring : string;

    size_res : sfixed)

    return sfixed;

  alias from_bstring is

    from_string [string, sfixed return sfixed];

  alias from_binary_string is

    from_string [string, sfixed return sfixed];

  function from_string (bstring : string) return sfixed;

  alias from_bstring is from_string [string return sfixed];

  alias from_binary_string is from_string [string return sfixed];

  function from_ostring (ostring : string;

    left_index : integer;

    right_index : integer)

    return sfixed;

  alias from_octal_string is

    from_ostring [string, integer, integer return sfixed];

  function from_ostring (ostring : string;

    size_res : sfixed)

    return sfixed;

  alias from_octal_string is

    from_ostring [string, sfixed return sfixed];

  function from_ostring (ostring : string) return sfixed;

  alias from_octal_string is from_ostring [string return sfixed];

  function from_hstring (hstring : string;

    left_index : integer;

    right_index : integer)

    return sfixed;

  alias from_hex_string is

    from_hstring [string, integer, integer return sfixed];

  function from_hstring (hstring : string;

    size_res : sfixed)

    return sfixed;

  alias from_hex_string is

    from_hstring [string, sfixed return sfixed];

  function from_hstring (hstring : string) return sfixed;

  alias from_hex_string is from_hstring [string return sfixed];

end;

A.9 Package Float_Pkg

Package float_pkg listed here is the VHDL-1993 compatibility version of the VHDL-2008 instantiation of float_generic_pkg with the default generic parameters. It is therefore usable in both VHDL-1993 and VHDL-2008 systems without change.

package float_pkg is

    

------------------------------------------------------

  constant float_exponent_width : natural := 8;

  constant float_fraction_width : natural := 23;

  constant float_round_style : round_type := round_nearest;

  constant float_denormalize : boolean := true;

  constant float_check_error : boolean := true;

  constant float_guard_bits : natural := 3;

  constant no_warning : boolean := false;

    

------------------------------------------------------

  type unresolved_float is array (integer range <>) of std_ulogic;

  subtype u_float is unresolved_float;

  subtype float is unresolved_float;

  subtype unresolved_float32 is unresolved_float(8 downto -23);

  alias u_float32 is unresolved_float32;

  subtype float32 is float(8 downto -23);

  subtype unresolved_float64 is unresolved_float(11 downto -52);

  alias u_float64 is unresolved_float64;

  subtype float64 is float(11 downto -52);

  subtype unresolved_float128 is unresolved_float(15 downto -112);

  alias u_float128 is unresolved_float128;

  subtype float128 is float(15 downto -112);

    

------------------------------------------------------

  type valid_fpstate is (nan,

                        quiet_nan,

                        neg_inf,

                        neg_normal,

                        neg_denormal,

                        neg_zero,

                        pos_zero,

                        pos_denormal,

                        pos_normal,

                        pos_inf,

                        isx);

  function classfp (x : float; check_error : boolean := true)

    return valid_fpstate;

    

------------------------------------------------------

  function "abs" (arg : float) return float;

  function "-" (arg : float) return float;

  function "+" (l, r : float) return float;

  function "-" (l, r : float) return float;

  function "*" (l, r : float) return float;

  function "/" (l, r : float) return float;

  function "rem"(l, r : float) return float;

  function "mod"(l, r : float) return float;

  function add (l, r : float;

    round_style : round_type := round_nearest;

    guard : natural := 3;

    check_error : boolean := true;

    denormalize : boolean := true)

    return float;

  function subtract (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function multiply (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function divide (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function remainder (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function modulo (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function reciprocal (arg : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function dividebyp2 (l, r : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function mac (l, r, c : float;

      round_style : round_type := round_nearest;

      guard : natural := 3;

      check_error : boolean := true;

      denormalize : boolean := true)

      return float;

  function sqrt (arg : float;

      round_style : round_type := round_nearest;

    guard : natural := 3;

    check_error : boolean := true;

    denormalize : boolean := true)

    return float;

  function is_negative (arg : float) return boolean;

    

------------------------------------------------------

  function "=" (l, r : float) return boolean;

  function "/=" (l, r : float) return boolean;

  function ">=" (l, r : float) return boolean;

  function "<=" (l, r : float) return boolean;

  function ">" (l, r : float) return boolean;

  function "<" (l, r : float) return boolean;

  function eq (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function ne (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function lt (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function gt (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function le (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function ge (l, r : float;

      check_error : boolean := true;

    denormalize : boolean := true)

    return boolean;

  function ?= (l, r : float) return std_ulogic;

  function ?/= (l, r : float) return std_ulogic;

  function ?> (l, r : float) return std_ulogic;

  function ?>= (l, r : float) return std_ulogic;

  function ?< (l, r : float) return std_ulogic;

  function ?<= (l, r : float) return std_ulogic;

  function std_match (l, r : float) return boolean;

  function find_rightmost (arg : float; y : std_ulogic)

    return integer;

  function find_leftmost (arg : float; y : std_ulogic)

    return integer;

  function maximum (l, r : float) return float;

  function minimum (l, r : float) return float;

    

------------------------------------------------------

  function resize (arg : float;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize_in : boolean := true;

    denormalize : boolean := true)

    return float;

  function resize (arg : float;

      size_res : float;

    round_style : round_type := round_nearest;

      check_error : boolean := true;

    denormalize_in : boolean := true;

      denormalize : boolean := true)

      return float;

  function to_float32 (arg : float;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize_in : boolean := true;

    denormalize : boolean := true)

    return float32;

  function to_float64 (arg : float;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize_in : boolean := true;

    denormalize : boolean := true)

    return float64;

  function to_float128 (arg : float;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize_in : boolean := true;

    denormalize : boolean := true)

    return float128;

    

------------------------------------------------------

  

  function to_slv (arg : float) return std_logic_vector;

  alias to_stdlogicvector is

    to_slv [float return std_logic_vector];

  alias to_std_logic_vector is

    to_slv [float return std_logic_vector];

  function to_sulv (arg : float) return std_ulogic_vector;

  alias to_stdulogicvector is

    to_sulv [float return std_ulogic_vector];

  alias to_std_ulogic_vector is

    to_sulv [float return std_ulogic_vector];

  function to_float (arg : std_ulogic_vector;

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function to_float (arg : integer;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : real;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

    return float;

  function to_float (arg : unsigned;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : signed;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : ufixed;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

    return float;

  function to_float (arg : sfixed;

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

    return float;

  function to_float (arg : integer;

    size_res : float;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : real;

    size_res : float;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

    return float;

  function to_float (arg : unsigned;

    size_res : float;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : signed;

    size_res : float;

    round_style : round_type := round_nearest)

    return float;

  function to_float (arg : std_ulogic_vector;

    size_res : float)

    return float;

  function to_float (arg : ufixed;

    size_res : float;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

    return float;

  function to_float (arg : sfixed;

    size_res : float;

    round_style : round_type := round_nearest;

    denormalize : boolean := true)

      return float;

  function to_float (arg : std_logic_vector;

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function to_float (arg : std_logic_vector;

    size_res : float)

    return float;

  function to_unsigned (arg : float;

    size : natural;

    round_style : round_type := round_nearest;

    check_error : boolean := true)

    return unsigned;

  function to_signed (arg : float;

    size : natural;

    round_style : round_type := round_nearest;

    check_error : boolean := true)

    return signed;

  function to_ufixed (arg : float;

    left_index : integer;

    right_index : integer;

    overflow_style : fixed_overflow_style_type := fixed_saturate;

    round_style : fixed_round_style_type := fixed_round;

    check_error : boolean := true;

    denormalize : boolean := true)

    return ufixed;

  function to_sfixed (arg : float;

    left_index : integer;

    right_index : integer;

    overflow_style : fixed_overflow_style_type := fixed_saturate;

    round_style : fixed_round_style_type := fixed_round;

    check_error : boolean := true;

    denormalize : boolean := true)

    return sfixed;

  function to_unsigned (arg : float;

    size_res : unsigned;

    round_style : round_type := round_nearest;

    check_error : boolean := true)

    return unsigned;

  function to_signed (arg : float;

    size_res : signed;

    round_style : round_type := round_nearest;

    check_error : boolean := true)

    return signed;

  function to_ufixed (arg : float;

    size_res : ufixed;

    overflow_style : fixed_overflow_style_type := fixed_saturate;

    round_style : fixed_round_style_type := fixed_round;

    check_error : boolean := true;

    denormalize : boolean := true)

    return ufixed;

  function to_sfixed (arg : float;

    size_res : sfixed;

    overflow_style : fixed_overflow_style_type := fixed_saturate;

    round_style : fixed_round_style_type := fixed_round;

    check_error : boolean := true;

    denormalize : boolean := true)

    return sfixed;

  function to_real (arg : float;

    check_error : boolean := true;

    denormalize : boolean := true)

    return real;

  function to_integer (arg : float;

    round_style : round_type := round_nearest;

    check_error : boolean := true)

    return integer;

    

------------------------------------------------------

  function realtobits (arg : real) return std_ulogic_vector;

  function bitstoreal (arg : std_ulogic_vector) return real;

  function realtobits (arg : real) return std_logic_vector;

  function bitstoreal (arg : std_logic_vector) return real;

  function to_01 (arg : float; xmap : std_logic := '0')

    return float;

  function is_x (arg : float) return boolean;

  function to_x01 (arg : float) return float;

  function to_x01z (arg : float) return float;

  function to_ux01 (arg : float) return float;

    

------------------------------------------------------

  procedure break_number (

    arg : in float;

    denormalize : in boolean := true;

    check_error : in boolean := true;

    fract : out unsigned;

    expon : out signed;

    sign : out std_ulogic);

  procedure break_number (

    arg : in float;

    denormalize : in boolean := true;

    check_error : in boolean := true;

    fract : out ufixed;

    expon : out signed;

    sign : out std_ulogic);

  function normalize (

    fract : unsigned;

    expon : signed;

    sign : std_ulogic;

    sticky : std_ulogic := '0';

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    denormalize : boolean := true;

    nguard : natural := 3)

    return float;

  function normalize (

    fract : ufixed;

    expon : signed;

    sign : std_ulogic;

    sticky : std_ulogic := '0';

    exponent_width : natural := 8;

    fraction_width : natural := 23;

    round_style : round_type := round_nearest;

    denormalize : boolean := true;

    nguard : natural := 3)

    return float;

  function normalize (

    fract : unsigned;

    expon : signed;

    sign : std_ulogic;

    sticky : std_ulogic := '0';

    size_res : float;

    round_style : round_type := round_nearest;

    denormalize : boolean := true;

    nguard : natural := 3)

    return float;

  function normalize (

    fract : ufixed;

    expon : signed;

    sign : std_ulogic;

    sticky : std_ulogic := '0';

    size_res : float;

    round_style : round_type := round_nearest;

    denormalize : boolean := true;

    nguard : natural := 3)

    return float;

    

------------------------------------------------------

  function "+" (l : float; r : real) return float;

  function "+" (l : real; r : float) return float;

  function "+" (l : float; r : integer) return float;

  function "+" (l : integer; r : float) return float;

  function "-" (l : float; r : real) return float;

  function "-" (l : real; r : float) return float;

  function "-" (l : float; r : integer) return float;

  function "-" (l : integer; r : float) return float;

  function "*" (l : float; r : real) return float;

  function "*" (l : real; r : float) return float;

  function "*" (l : float; r : integer) return float;

  function "*" (l : integer; r : float) return float;

  function "/" (l : float; r : real) return float;

  function "/" (l : real; r : float) return float;

  function "/" (l : float; r : integer) return float;

  function "/" (l : integer; r : float) return float;

  function "rem" (l : float; r : real) return float;

  function "rem" (l : real; r : float) return float;

  function "rem" (l : float; r : integer) return float;

  function "rem" (l : integer; r : float) return float;

  function "mod" (l : float; r : real) return float;

  function "mod" (l : real; r : float) return float;

  function "mod" (l : float; r : integer) return float;

  function "mod" (l : integer; r : float) return float;

  function "=" (l : float; r : real) return boolean;

  function "/=" (l : float; r : real) return boolean;

  function ">=" (l : float; r : real) return boolean;

  function "<=" (l : float; r : real) return boolean;

  function ">" (l : float; r : real) return boolean;

  function "<" (l : float; r : real) return boolean;

  function "=" (l : real; r : float) return boolean;

  function "/=" (l : real; r : float) return boolean;

  function ">=" (l : real; r : float) return boolean;

  function "<=" (l : real; r : float) return boolean;

  function ">" (l : real; r : float) return boolean;

  function "<" (l : real; r : float) return boolean;

  function "=" (l : float; r : integer) return boolean;

  function "/=" (l : float; r : integer) return boolean;

  function ">=" (l : float; r : integer) return boolean;

  function "<=" (l : float; r : integer) return boolean;

  function ">" (l : float; r : integer) return boolean;

  function "<" (l : float; r : integer) return boolean;

  function "=" (l : integer; r : float) return boolean;

  function "/=" (l : integer; r : float) return boolean;

  function ">=" (l : integer; r : float) return boolean;

  function "<=" (l : integer; r : float) return boolean;

  function ">" (l : integer; r : float) return boolean;

  function "<" (l : integer; r : float) return boolean;

  function ?= (l : float; r : real) return std_ulogic;

  function ?/= (l : float; r : real) return std_ulogic;

  function ?> (l : float; r : real) return std_ulogic;

  function ?>= (l : float; r : real) return std_ulogic;

  function ?< (l : float; r : real) return std_ulogic;

  function ?<= (l : float; r : real) return std_ulogic;

  function ?= (l : real; r : float) return std_ulogic;

  function ?/= (l : real; r : float) return std_ulogic;

  function ?> (l : real; r : float) return std_ulogic;

  function ?>= (l : real; r : float) return std_ulogic;

  function ?< (l : real; r : float) return std_ulogic;

  function ?<= (l : real; r : float) return std_ulogic;

  function ?= (l : float; r : integer) return std_ulogic;

  function ?/= (l : float; r : integer) return std_ulogic;

  function ?> (l : float; r : integer) return std_ulogic;

  function ?>= (l : float; r : integer) return std_ulogic;

  function ?< (l : float; r : integer) return std_ulogic;

  function ?<= (l : float; r : integer) return std_ulogic;

  function ?= (l : integer; r : float) return std_ulogic;

  function ?/= (l : integer; r : float) return std_ulogic;

  function ?> (l : integer; r : float) return std_ulogic;

  function ?>= (l : integer; r : float) return std_ulogic;

  function ?< (l : integer; r : float) return std_ulogic;

  function ?<= (l : integer; r : float) return std_ulogic;

  function maximum (l : float; r : real) return float;

  function minimum (l : float; r : real) return float;

  function maximum (l : real; r : float) return float;

  function minimum (l : real; r : float) return float;

  function maximum (l : float; r : integer) return float;

  function minimum (l : float; r : integer) return float;

  function maximum (l : integer; r : float) return float;

  function minimum (l : integer; r : float) return float;

------------------------------------------------------

    

  function "not" (l : float) return float;

  function "and" (l, r : float) return float;

  function "or" (l, r : float) return float;

  function "nand" (l, r : float) return float;

  function "nor" (l, r : float) return float;

  function "xor" (l, r : float) return float;

  function "xnor" (l, r : float) return float;

  function "and" (l : std_ulogic; r : float) return float;

  function "and" (l : float; r : std_ulogic) return float;

  function "or" (l : std_ulogic; r : float) return float;

  function "or" (l : float; r : std_ulogic) return float;

  function "nand" (l : std_ulogic; r : float) return float;

  function "nand" (l : float; r : std_ulogic) return float;

  function "nor" (l : std_ulogic; r : float) return float;

  function "nor" (l : float; r : std_ulogic) return float;

  function "xor" (l : std_ulogic; r : float) return float;

  function "xor" (l : float; r : std_ulogic) return float;

  function "xnor" (l : std_ulogic; r : float) return float;

  function "xnor" (l : float; r : std_ulogic) return float;

  

  function and_reduce (l : float) return std_ulogic;

  function nand_reduce (l : float) return std_ulogic;

  function or_reduce (l : float) return std_ulogic;

  function nor_reduce (l : float) return std_ulogic;

  function xor_reduce (l : float) return std_ulogic;

  function xnor_reduce (l : float) return std_ulogic;

------------------------------------------------------

      

  function copysign (x, y : float) return float;

  function scalb (y : float; n : integer;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize : boolean := true)

    return float;

  function scalb (y : float; n : signed;

    round_style : round_type := round_nearest;

    check_error : boolean := true;

    denormalize : boolean := true)

    return float;

  function logb (x : float) return integer;

  function logb (x : float) return signed;

  function nextafter (x, y : float;

    check_error : boolean := true;

    denormalize : boolean := true)

    return float;

  function unordered (x, y : float) return boolean;

  function finite (x : float) return boolean;

  function isnan (x : float) return boolean;

  function zerofp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function nanfp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function qnanfp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function pos_inffp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function neg_inffp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function neg_zerofp (

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  function zerofp (size_res : float) return float;

  function nanfp (size_res : float) return float;

  function qnanfp (size_res : float) return float;

  function pos_inffp (size_res : float) return float;

  function neg_inffp (size_res : float) return float;

  function neg_zerofp (size_res : float) return float;

------------------------------------------------------

    

  procedure read (l : inout line;

                  value : out float);

  alias bread is read [line, float];

  alias binary_read is read [line, float, boolean];

  procedure read (l : inout line;

                  value : out float;

                  good : out boolean);

  alias bread is read [line, float, boolean];

  alias binary_read is read [line, float];

  procedure write (l : inout line;

                   value : in float;

                   justified : in side := right;

                   field : in width := 0);

  alias bwrite is write [line, float, side, width];

  alias binary_write is write [line, float, side, width];

  procedure oread (l : inout line;

                   value : out float);

  alias octal_read is oread [line, float];

  procedure oread (l : inout line;

                   value : out float;

                   good : out boolean);

  alias octal_read is oread [line, float, boolean];

  procedure owrite (l : inout line;

                    value : in float;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is owrite [line, float, side, width];

  procedure hread (l : inout line;

                   value : out float);

  alias hex_read is hread [line, float];

  procedure hread (l : inout line;

                   value : out float;

                   good : out boolean);

  alias hex_read is hread [line, float, boolean];

  procedure hwrite (l : inout line;

                    value : in float;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is hwrite [line, float, side, width];

------------------------------------------------------

  function to_string (value : float) return string;

  alias to_bstring is to_string [float return string];

  alias to_binary_string is to_string [float return string];

  function to_hstring (value : float) return string;

  alias to_hex_string is to_hstring [float return string];

  function to_ostring (value : float) return string;

  alias to_octal_string is to_ostring [float return string];

  function from_string (bstring : string;

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  alias from_bstring is

    from_string [string, natural, natural return float];

  alias from_binary_string is

    from_string [string, natural, natural return float];

  function from_ostring (ostring : string;

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  alias from_octal_string is

    from_ostring [string, natural, natural return float];

  function from_hstring (hstring : string;

    exponent_width : natural := 8;

    fraction_width : natural := 23)

    return float;

  alias from_hex_string is

    from_hstring [string, natural, natural return float];

  function from_string (bstring : string;

    size_res : float)

    return float;

  alias from_bstring is

    from_string [string, float return float];

  alias from_binary_string is

    from_string [string, float return float];

  function from_ostring (ostring : string;

    size_res : float)

    return float;

  alias from_octal_string is

    from_ostring [string, float return float];

  function from_hstring (hstring : string;

    size_res : float)

    return float;

  alias from_hex_string is

    from_hstring [string, float return float];

------------------------------------------------------

end;

A.10 Package TextIO

Package textio defines the basic I/O provided by VHDL. This is the VHDL-1993 version and is supplemented by package standard_textio_additions (see Appendix A.11). In VHDL-2008, the additions are merged into package textio.

package textio is

  type line is access string;

  function "="(l, r: line) return boolean;

  function "/="(l, r: line) return boolean;

  type text is file of string;

  procedure file_open (file f: text;

                     external_name; in string;

                     open_kind: in file_open_kind := read_mode);

  procedure file_open (status: out file_open_status;

                     file f: text;

                     external_name: in string;

                     open_kind: in file_open_kind := read_mode);

  procedure file_close (file f: text);

  procedure read (file f: text; value: out string);

  procedure write (file f: text; value: in string);

  function endfile (file f: text) return boolean;

  type side is (right, left);

  function "="(l, r: side) return boolean;

  function "/="(l, r: side) return boolean;

  function "<"(l, r: side) return boolean;

  function "<="(l, r: side) return boolean;

  function ">"(l, r: side) return boolean;

  function ">="(l, r: side) return boolean;

  subtype width is natural;

  file input:text open read_mode is "std_input";

  file output:text open write_mode is "std_output";

  procedure readline (file f: text; l: inout line);

  procedure read (l: inout line;value: out bit;

                  good: out boolean);

  procedure read (l: inout line;value: out bit);

  procedure read (l: inout line;value: out bit_vector;

                  good: out boolean);

  procedure read (l: inout line;value: out bit_vector);

  procedure read (l: inout line;value: out boolean;

                  good: out boolean);

  procedure read (l: inout line;value: out boolean);

  procedure read (l: inout line;value: out character;

                  good: out boolean);

  procedure read (l: inout line;value: out character);

  procedure read (l: inout line;value: out integer;

                  good: out boolean);

  procedure read (l: inout line;value: out integer);

  procedure read (l: inout line;value: out real;

                  good: out boolean);

  procedure read (l: inout line;value: out real);

  procedure read (l: inout line;value: out string;

                  good: out boolean);

  procedure read (l: inout line;value: out string);

  procedure read (l: inout line;value: out time;

                  good: out boolean);

  procedure read (l: inout line;value: out time);

  procedure writeline (file f: text; l: inout line);

  procedure write (l: inout line;

                   value: in bit;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in bit_vector;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in boolean;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in character;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in integer;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in real;

                   justified: in side:= right;

                   field: in width := 0;

                   digits: in natural:= 0);

  procedure write (l: inout line;

                   value: in string;

                   justified: in side:= right;

                   field: in width := 0);

  procedure write (l: inout line;

                   value: in time;

                   justified: in side:= right;

                   field: in width := 0;

                   unit: in time:= ns);

end;

A.11 Package Standard_Textio_Additions

Package standard_textio_additions is the VHDL-1993 supplement to package textio (see Appendix A.10). In VHDL-2008, the additions are merged into package textio and so this package is empty.

package standard_textio_additions is

  procedure deallocate (p : inout line);

  procedure flush (file f : text);

  function minimum (l, r : side) return side;

  function maximum (l, r : side) return side;

  function to_string (value : side) return string;

  function justify (value : string;

                    justified : side := right;

                    field : width := 0)

    return string;

  procedure sread (l : inout line;

                   value : out string;

                   strlen : out natural);

  alias string_read is sread [line, string, natural];

  alias bread is read [line, bit_vector, boolean];

  alias bread is read [line, bit_vector];

  alias binary_read is read [line, bit_vector, boolean];

  alias binary_read is read [line, bit_vector];

  procedure oread (l : inout line;

                   value : out bit_vector;

                   good : out boolean);

  procedure oread (l : inout line;

                   value : out bit_vector);

  alias octal_read is oread [line, bit_vector, boolean];

  alias octal_read is oread [line, bit_vector];

  procedure hread (l : inout line;

                   value : out bit_vector;

                   good : out boolean);

  procedure hread (l : inout line;

                   value : out bit_vector);

  alias hex_read is hread [line, bit_vector, boolean];

  alias hex_read is hread [line, bit_vector];

  procedure tee (file f : text; l : inout line);

  procedure write (l : inout line;

                   value : in real;

                   format : in string);

  alias swrite is write [line, string, side, width];

  alias string_write is write [line, string, side, width];

  alias bwrite is write [line, bit_vector, side, width];

  alias binary_write is write [line, bit_vector, side, width];

  procedure owrite (l : inout line;

                    value : in bit_vector;

                    justified : in side := right;

                    field : in width := 0);

  alias octal_write is owrite [line, bit_vector, side, width];

  procedure hwrite (l : inout line;

                    value : in bit_vector;

                    justified : in side := right;

                    field : in width := 0);

  alias hex_write is hwrite [line, bit_vector, side, width];

end;

A.12 Package Std_Logic_Arith

Package std_logic_arith is the old arbitrary-precision integer package from Synopsys, before the standardised package numeric_std became the preferred package for this functionality. It's use is now deprecated and it is only listed here for reference when working on changes to old designs.

--------------------------------------------------------------

--

-- Copyright (c) 1990,1991,1992 by Synopsys, inc.

-- all rights reserved.

--

-- this source file may be used and distributed without restriction

-- provided that this copyright statement is not removed from the

-- file and that any derivative work contains this copyright notice

--

--------------------------------------------------------------

library ieee;

use ieee.std_logic_1164.all;

package std_logic_arith is

  type unsigned is array (natural range <>) of std_logic;

  type signed is array (natural range <>) of std_logic;

  subtype small_int is integer range 0 to 1;

  function "+"(l: unsigned; r: unsigned) return unsigned;

  function "+"(l: signed; r: signed) return signed;

  function "+"(l: unsigned; r: signed) return signed;

  function "+"(l: signed; r: unsigned) return signed;

  function "+"(l: unsigned; r: integer) return unsigned;

  function "+"(l: integer; r: unsigned) return unsigned;

  function "+"(l: signed; r: integer) return signed;

  function "+"(l: integer; r: signed) return signed;

  function "+"(l: unsigned; r: std_ulogic) return unsigned;

  function "+"(l: std_ulogic; r: unsigned) return unsigned;

  function "+"(l: signed; r: std_ulogic) return signed;

  function "+"(l: std_ulogic; r: signed) return signed;

  function "+"(l: unsigned; r: unsigned) return std_logic_vector;

  function "+"(l: signed; r: signed) return std_logic_vector;

  function "+"(l: unsigned; r: signed) return std_logic_vector;

  function "+"(l: signed; r: unsigned) return std_logic_vector;

  function "+"(l: unsigned; r: integer) return std_logic_vector;

  function "+"(l: integer; r: unsigned) return std_logic_vector;

  function "+"(l: signed; r: integer) return std_logic_vector;

  function "+"(l: integer; r: signed) return std_logic_vector;

  function "+"(l: unsigned; r: std_ulogic) return std_logic_vector;

  function "+"(l: std_ulogic; r: unsigned) return std_logic_vector;

  function "+"(l: signed; r: std_ulogic) return std_logic_vector;

  function "+"(l: std_ulogic; r: signed) return std_logic_vector;

  function "-"(l: unsigned; r: unsigned) return unsigned;

  function "-"(l: signed; r: signed) return signed;

  function "-"(l: unsigned; r: signed) return signed;

  function "-"(l: signed; r: unsigned) return signed;

  function "-"(l: unsigned; r: integer) return unsigned;

  function "-"(l: integer; r: unsigned) return unsigned;

  function "-"(l: signed; r: integer) return signed;

  function "-"(l: integer; r: signed) return signed;

  function "-"(l: unsigned; r: std_ulogic) return unsigned;

  function "-"(l: std_ulogic; r: unsigned) return unsigned;

  function "-"(l: signed; r: std_ulogic) return signed;

  function "-"(l: std_ulogic; r: signed) return signed;

  function "-"(l: unsigned; r: unsigned) return std_logic_vector;

  function "-"(l: signed; r: signed) return std_logic_vector;

  function "-"(l: unsigned; r: signed) return std_logic_vector;

  function "-"(l: signed; r: unsigned) return std_logic_vector;

  function "-"(l: unsigned; r: integer) return std_logic_vector;

  function "-"(l: integer; r: unsigned) return std_logic_vector;

  function "-"(l: signed; r: integer) return std_logic_vector;

  function "-"(l: integer; r: signed) return std_logic_vector;

  function "-"(l: unsigned; r: std_ulogic) return std_logic_vector;

  function "-"(l: std_ulogic; r: unsigned) return std_logic_vector;

  function "-"(l: signed; r: std_ulogic) return std_logic_vector;

  function "-"(l: std_ulogic; r: signed) return std_logic_vector;

  function "+"(l: unsigned) return unsigned;

  function "+"(l: signed) return signed;

  function "-"(l: signed) return signed;

  function "abs"(l: signed) return signed;

  function "+"(l: unsigned) return std_logic_vector;

  function "+"(l: signed) return std_logic_vector;

  function "-"(l: signed) return std_logic_vector;

  function "abs"(l: signed) return std_logic_vector;

  function "*"(l: unsigned; r: unsigned) return unsigned;

  function "*"(l: signed; r: signed) return signed;

  function "*"(l: signed; r: unsigned) return signed;

  function "*"(l: unsigned; r: signed) return signed;

  function "*"(l: unsigned; r: unsigned) return std_logic_vector;

  function "*"(l: signed; r: signed) return std_logic_vector;

  function "*"(l: signed; r: unsigned) return std_logic_vector;

  function "*"(l: unsigned; r: signed) return std_logic_vector;

  function "<"(l: unsigned; r: unsigned) return boolean;

  function "<"(l: signed; r: signed) return boolean;

  function "<"(l: unsigned; r: signed) return boolean;

  function "<"(l: signed; r: unsigned) return boolean;

  function "<"(l: unsigned; r: integer) return boolean;

  function "<"(l: integer; r: unsigned) return boolean;

  function "<"(l: signed; r: integer) return boolean;

  function "<"(l: integer; r: signed) return boolean;

  function "<="(l: unsigned; r: unsigned) return boolean;

  function "<="(l: signed; r: signed) return boolean;

  function "<="(l: unsigned; r: signed) return boolean;

  function "<="(l: signed; r: unsigned) return boolean;

  function "<="(l: unsigned; r: integer) return boolean;

  function "<="(l: integer; r: unsigned) return boolean;

  function "<="(l: signed; r: integer) return boolean;

  function "<="(l: integer; r: signed) return boolean;

  function ">"(l: unsigned; r: unsigned) return boolean;

  function ">"(l: signed; r: signed) return boolean;

  function ">"(l: unsigned; r: signed) return boolean;

  function ">"(l: signed; r: unsigned) return boolean;

  function ">"(l: unsigned; r: integer) return boolean;

  function ">"(l: integer; r: unsigned) return boolean;

  function ">"(l: signed; r: integer) return boolean;

  function ">"(l: integer; r: signed) return boolean;

  function ">="(l: unsigned; r: unsigned) return boolean;

  function ">="(l: signed; r: signed) return boolean;

  function ">="(l: unsigned; r: signed) return boolean;

  function ">="(l: signed; r: unsigned) return boolean;

  function ">="(l: unsigned; r: integer) return boolean;

  function ">="(l: integer; r: unsigned) return boolean;

  function ">="(l: signed; r: integer) return boolean;

  function ">="(l: integer; r: signed) return boolean;

  function "="(l: unsigned; r: unsigned) return boolean;

  function "="(l: signed; r: signed) return boolean;

  function "="(l: unsigned; r: signed) return boolean;

  function "="(l: signed; r: unsigned) return boolean;

  function "="(l: unsigned; r: integer) return boolean;

  function "="(l: integer; r: unsigned) return boolean;

  function "="(l: signed; r: integer) return boolean;

  function "="(l: integer; r: signed) return boolean;

  function "/="(l: unsigned; r: unsigned) return boolean;

  function "/="(l: signed; r: signed) return boolean;

  function "/="(l: unsigned; r: signed) return boolean;

  function "/="(l: signed; r: unsigned) return boolean;

  function "/="(l: unsigned; r: integer) return boolean;

  function "/="(l: integer; r: unsigned) return boolean;

  function "/="(l: signed; r: integer) return boolean;

  function "/="(l: integer; r: signed) return boolean;

  function shl(arg: unsigned; count: unsigned) return unsigned;

  function shl(arg: signed; count: unsigned) return signed;

  function shr(arg: unsigned; count: unsigned) return unsigned;

  function shr(arg: signed; count: unsigned) return signed;

  function conv_integer(arg: integer)

    return integer;

  function conv_integer(arg: unsigned)

    return integer;

  function conv_integer(arg: signed)

    return integer;

  function conv_integer(arg: std_ulogic)

    return small_int;

  function conv_unsigned(arg: integer; size: integer)

    return unsigned;

  function conv_unsigned(arg: unsigned; size: integer)

    return unsigned;

  function conv_unsigned(arg: signed; size: integer)

    return unsigned;

  function conv_unsigned(arg: std_ulogic; size: integer)

    return unsigned;

  function conv_signed(arg: integer; size: integer)

    return signed;

  function conv_signed(arg: unsigned; size: integer)

    return signed;

  function conv_signed(arg: signed; size: integer)

    return signed;

  function conv_signed(arg: std_ulogic; size: integer)

    return signed;

  function conv_std_logic_vector(arg: integer; size: integer)

    return std_logic_vector;

  function conv_std_logic_vector(arg: unsigned; size: integer)

    return std_logic_vector;

  function conv_std_logic_vector(arg: signed; size: integer)

    return std_logic_vector;

  function conv_std_logic_vector(arg: std_ulogic; size: integer)

    return std_logic_vector;

  function ext(arg: std_logic_vector; size: integer)

    return std_logic_vector;

  function sxt(arg: std_logic_vector; size: integer)

    return std_logic_vector;

end;

A.13 Package Math_Real

Package math_real is completely unsynthesisable. It is included here because it is useful for writing test benches, as demonstrated by the case study in Chapter 15.

package math_real is

  constant math_e : real := 2.71828_18284_59045_23536;

  constant math_1_over_e : real := 0.36787_94411_71442_32160;

  constant math_pi : real := 3.14159_26535_89793_23846;

  constant math_2_pi : real := 6.28318_53071_79586_47693;

  constant math_1_over_pi : real := 0.31830_98861_83790_67154;

  constant math_pi_over_2 : real := 1.57079_63267_94896_61923;

  constant math_pi_over_3 : real := 1.04719_75511_96597_74615;

  constant math_pi_over_4 : real := 0.78539_81633_97448_30962;

  constant math_3_pi_over_2 : real := 4.71238_89803_84689_85769;

  constant math_log_of_2 : real := 0.69314_71805_59945_30942;

  constant math_log_of_10 : real := 2.30258_50929_94045_68402;

  constant math_log2_of_e : real := 1.44269_50408_88963_4074;

  constant math_log10_of_e : real := 0.43429_44819_03251_82765;

  constant math_sqrt_2 : real := 1.41421_35623_73095_04880;

  constant math_1_over_sqrt_2 : real := 0.70710_67811_86547_52440;

  constant math_sqrt_pi : real := 1.77245_38509_05516_02730;

  constant math_deg_to_rad : real := 0.01745_32925_19943_29577;

  constant math_rad_to_deg : real := 57.29577_95130_82320_87680;

  function sign (x : in real) return real;

  function ceil (x : in real) return real;

  function floor (x : in real) return real;

  function round (x : in real) return real;

  function trunc (x : in real) return real;

  function "mod" (x, y : in real) return real;

  function realmax (x, y : in real) return real;

  function realmin (x, y : in real) return real;

  procedure uniform(variable seed1, seed2 : inout positive;

                    variable x : out real);

  function sqrt (x : in real) return real;

  function cbrt (x : in real) return real;

  function "**" (x : in integer; y : in real) return real;

  function "**" (x : in real; y : in real) return real;

  function exp (x : in real) return real;

  function log (x : in real) return real;

  function log2 (x : in real) return real;

  function log (x : in real; base : in real) return real;

  function sin (x : in real) return real;

  function cos (x : in real) return real;

  function tan (x : in real) return real;

  function arcsin (x : in real) return real;

  function arccos (x : in real) return real;

  function arctan (y : in real) return real;

  function arctan (y : in real; x : in real) return real;

  function sinh (x : in real) return real;

  function cosh (x : in real) return real;

  function tanh (x : in real) return real;

  function arcsinh (x : in real) return real;

  function arccosh (x : in real) return real;

  function arctanh (x : in real) return real;

end;

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.155.100