numeric_std_additions.vhdl -- Additions to the package "ieee.numeric_std"
Use model:
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee_proposed.numeric_std_additions.all;
Dependencies: ieee.std_logic_1164, ieee.numeric_std
- SIGNED or UNSIGNED + std_ulogic operators
- SIGNED or UNSIGNED - std_ulogic operators
- type UNRESOLVED_UNSIGNED (aliased to U_UNSIGNED) is an unresolved
verion of UNSIGNED. It is aliased to "UNSIGNED" for compatability.
- type UNRESOLVED_SIGNED (aliased to U_SIGNED) is an unresolved
verion of SIGNED. It is aliased to "SIGNED" for compatability.
- \?=\, \?/=\ - similar to "std_match", but return std_ulogic values.
\?<\, \?<=\, \?>\, \?>=\ - compare functions which retrun std_ulogic.
(these will be "?="... operators in the release)
- To_X01, To_X01Z, To_U01X, Is_X - same as std_logic_1164 functions,
but overloaded for SIGNED and UNSIGNED.
- "sla" and "sra" - Mathmetically correct versions of these functions.
- minimum and maximum - smaller or larger of two SIGNED or UNSIGNED values.
- find_leftmost and find_rightmost - finds the first bit in a string.
Example:
find_leftmost (c12, '1'); -- returns the Log2 of "c12".
returns -1 if not found.
- _reduce functions (and_reduce, nand_reduce, or_reduce ...) are defined
These functions reduce a SIGNED or an UNSIGNED to a single bit.
(will overload the "or" and "and", ... operators in the release)
- SIGNED or UNSIGNED and "std_ulogic" operations are defined.
These will perform a boolean operation of a vector.
Example:
"1" xor "1010" = "0101";
- READ and WRITE procedures for "SIGNED", and "UNSIGNED" are defined.
- HREAD and HWRITE (Hex read and write) for SIGNED and UNSIGNED.
These are more "forgiving" than the ones
originally from "std_logic_textio"
- OREAD and OWRITE (octal read and write) for "SIGNED" and "UNSIGNED.
These are more "forgiving" than the ones
originally from "std_logic_textio"
- BREAD and BWRITE (binary read and write, same as "READ" and "WRITE" for
SIGNED and UNSIGNED.
- to_string function - Converts a "SIGNED" or "UNSIGNED" types into a
string. Example:
assert (UNS = "101") report "result was " & to_string(UNS) severity note;
- to_hstring and to_ostring function (SIGNED or UNSIGNED to hex or octal
string)
Please send feedback to David W. Bishop
dbishop@vhdl.org.