Package: utils

Constants

Name Type Value Description
C_BCD_MINUS T_BCD "1010"
C_BCD_OFF T_BCD "1011"

Types

Name Type Description
T_BOOLVEC array(natural range <>) of boolean deferred constant declaration Type declarations ========================================================================== + Vectors of primitive standard types +++++++++++++++++++++++++++++++++++++
T_INTVEC array(natural range <>) of integer
T_NATVEC array(natural range <>) of natural
T_POSVEC array(natural range <>) of positive
T_REALVEC array(natural range <>) of REAL
T_IPSTYLE (IPSTYLE_UNKNOWN,
IPSTYLE_HARD,
IPSTYLE_SOFT)
+ Enums ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Intellectual Property (IP) type
T_BIT_ORDER (LSB_FIRST,
MSB_FIRST)
Bit order
T_BYTE_ORDER (LITTLE_ENDIAN,
BIG_ENDIAN)
Byte order (Endian)
T_POLARITY (HIGH_ACTIVE,
LOW_ACTIVE)
Active logic level
T_CLOCK_EDGE (RISING_EDGE,
FALLING_EDGE)
active clock edge
T_ROUNDING_STYLE (ROUND_TO_NEAREST,
ROUND_TO_ZERO,
ROUND_TO_INF,
ROUND_UP,
ROUND_DOWN)
rounding style
T_BCD define a new unrelated type T_BCD for arithmetic QUESTION: extract to an own BCD package? => overloaded operators for +/-/=/… and conversion functions
T_BCD_VECTOR array(natural range <>) of T_BCD

Functions

Description
Function declarations
==========================================================================

  • Division ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Calculates: ceil(a / b)

Description

  • Power +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    is input a power of 2?

Description
round to next power of 2

Description
round to previous power of 2

Description

  • Logarithm ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Calculates: ceil(ld(arg))

Description
Calculates: max(1, ceil(ld(arg)))

Description
Calculates: ceil(lg(arg))

Description
Calculates: max(1, ceil(lg(arg)))

Description

  • if-then-else (ite) +++++++++++++++++++++++++++++++++++++++++++++++++++++

Description
conditional increment / decrement

Description
Calculates: min(arg1, arg2) for integers

Description
Calculates: min(vec) for a integer vector

Description
Calculates: min(vec) for a natural vector

Description
Calculates: min(vec) for a positive vector

Description
Calculates: min(vec) of real vector

Description
Calculates: max(arg1, arg2) for integers

Description
Calculates: max(vec) for a integer vector

Description
Calculates: max(vec) for a natural vector

Description
Calculates: max(vec) for a positive vector

Description
Calculates: max(vec) of real vector

Description
Calculates: sum(vec) for a natural vector

Description
Calculates: sum(vec) for a positive vector

Description
Calculates: sum(vec) of integer vector

Description
Calculates: sum(vec) of real vector

Description

  • Conversions ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    to integer: to_int

Description
to std_logic: to_sl

Description
short for std_logic_vector(to_unsigned(Value, Size))

Description
TODO: comment

Description
is_*

Description

  • Basic Vector Utilities +++++++++++++++++++++++++++++++++++++++++++++++++
    Aggregate functions

Description
NO slv_xnor! This operation would not be well-defined as
not xor(vec) /= vec_{n-1} xnor … xnor vec_1 xnor vec_0 iff n is odd.
Reverses the elements of the passed Vector.

@synthesis supported

Description
scale a value into a range [Minimum, Maximum]

Description
Resizes the vector to the specified length. The adjustment is make on
on the 'high end of the vector. The 'low index remains as in the argument.
If the result vector is larger, the extension uses the provided fill value
(default: '0').
Use the resize functions of the numeric_std package for value-preserving
resizes of the signed and unsigned data types.

@synthesis supported

Description
Shift the index range of a vector by the specified offset.

Description
Shift the index range of a vector making vec'low = 0.

Description
Least-Significant Set Bit (lssb):
Computes a vector of the same length as the argument with
at most one bit set at the rightmost '1' found in arg.

@synthesis supported

Description
Returns the index of the least-significant set bit.

@synthesis supported

Description
Most-Significant Set Bit (mssb): computes a vector of the same length
with at most one bit set at the leftmost '1' found in arg.

Description
Swap sub vectors in vector (endian reversal)

Description
Swap the bits in a chunk

Description
generate bit masks

Description
Encodings
===========================================================================
One-Hot-Code to Binary-Code.
If a non-negative value empty_val is specified, its unsigned
representation will be returned upon an all-zero input. As a consequence
of specifying this value, no simulation warnings will be issued upon empty
inputs. Alleged 1-hot-encoded inputs with more than one bit asserted
will always raise a simulation warning.

Description
Converts Gray-Code into Binary-Code.

@synthesis supported

Description
Binary-Code to One-Hot-Code

Description
Binary-Code to One-Cold-Code

Description
Binary-Code to Gray-Code