Issue Rollup: Proposal Ben_P2: Numeric_Unsigned,


Subject: Issue Rollup: Proposal Ben_P2: Numeric_Unsigned,
From: Jim Lewis (jim@synthworks.com)
Date: Tue Oct 08 2002 - 07:35:16 PDT


Looks like we have basic agreement.

>> Package Name
Numeric_Unsigned vs. Numeric_Std_Unsigned vs. numeric_1164 (from Rob)

> From David
> The problem here is that MTI already has a package by that name
> "numeric_unsigned". Unless we match the functions exactly, we can
> cause problems with existing code. The MTI package only supports
> "std_logic_vector", but has shift operations in it (ours does not).
>
> Why not call our packages "numeric_std_unsigned" so as not to
> conflict?

The compatibility issue works the other way also. P1164 is going to
contain the shift operators. If we can coordinate with P1164
(which it sounds like we can), then we should keep the name
numeric_unsigned to allow those using the Mentor package a working
replacement. Since the MTI/Mentor package has the shift operators
any program using them will break, unless they switch to our package.

So if P1076.3 + P1164 is a superset of what is in MTI/Mentor package
then we should keep the name Numeric_Unsigned.

Name is least of my concern.
I would be happy with any of the above names.

>> Issues with comparison operators.
According to Alex, to support comparison operators in a package separate
from std_logic_1164 would require a language revision/resolution by ISAC.
Perhaps we should look to ISAC for some help? I will take this up.

To correctly use the implicit operators, two conditions must be upheld.
1) Arrays need to be the same length.
2) Arrays must not have any resistive strengths (H, L). Use TO_X01.

I would rather have the arithmetic and not have the comparison operators
than have nothing at all.

>> Resize
Resize is currently in the draft of BEN_P2. My concern is that like
the STD_MATCH functions, perhaps it would be best to put this in
std_logic_1164 instead.

>> From Peter:
>> - overloaded array/scalar [logic] operators for std_(u)logic: P1164.
> From Ben:
> Looks like Peter did not cover where the overloaded array/scalar operators for
> std_logic_[u]vector. We need an Excel table to show where things go.
In P1164, this covers array = std_(u)logic_vector with scalar std_(u)logic
for logic operators. Peter's table works well for me.
I recommend you read: http://www.eda.org/vhdl-std-logic/proposals/

Cheers,
Jim

Jim Lewis wrote:
>
> We did not seem to reach consensus on the last proposal, so
> let me give this a shot. This one has no comparison functions
> and includes functions for both std_logic_vector and
> std_ulogic_vector.
>
> <BEN_P2>
> I would like to propose that we support an additional package
> named Numeric_Unsigned. This package will treat both std_logic_vector
> and std_ulogic_vector as unsigned and provide numeric operations
> for these types.
>
> -- Id: A.1
> function "abs" (ARG: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0).
> -- Result: Returns the absolute value of a STD_ULOGIC_VECTOR vector ARG.
>
> -- Id: A.2
> function "-" (ARG: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0).
> -- Result: Returns the value of the unary minus operation on a
> -- STD_ULOGIC_VECTOR vector ARG.
>
>
> --============================================================================
>
> -- Id: A.3
> function "+" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
> -- Result: Adds two STD_LOGIC_VECTOR vectors that may be of different
> lengths.
>
> -- Id: A.4
> function "+" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
> -- Result: Adds two STD_ULOGIC_VECTOR vectors that may be of different
> lengths.
>
> -- Id: A.5
> function "+" (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0).
> -- Result: Adds an STD_LOGIC_VECTOR vector, L, with a non-negative INTEGER,
> R.
>
> -- Id: A.6
> function "+" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0).
> -- Result: Adds a non-negative INTEGER, L, with an STD_LOGIC_VECTOR vector,
> R.
>
> -- Id: A.7
> function "+" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0).
> -- Result: Adds an INTEGER, L(may be positive or negative), to a
> STD_ULOGIC_VECTOR
> -- vector, R.
>
> -- Id: A.8
> function "+" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0).
> -- Result: Adds a STD_ULOGIC_VECTOR vector, L, to an INTEGER, R.
>
>
> --============================================================================
>
> -- Id: A.9
> function "-" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
> -- Result: Subtracts two STD_LOGIC_VECTOR vectors that may be of different
> lengths.
>
> -- Id: A.10
> function "-" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
> -- Result: Subtracts a STD_ULOGIC_VECTOR vector, R, from another
> STD_ULOGIC_VECTOR vector, L,
> -- that may possibly be of different lengths.
>
> -- Id: A.11
> function "-" (L: STD_LOGIC_VECTOR;R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0).
> -- Result: Subtracts a non-negative INTEGER, R, from an STD_LOGIC_VECTOR
> vector, L.
>
> -- Id: A.12
> function "-" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0).
> -- Result: Subtracts an STD_LOGIC_VECTOR vector, R, from a non-negative
> INTEGER, L.
>
> -- Id: A.13
> function "-" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0).
> -- Result: Subtracts an INTEGER, R, from a STD_ULOGIC_VECTOR vector, L.
>
> -- Id: A.14
> function "-" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0).
> -- Result: Subtracts a STD_ULOGIC_VECTOR vector, R, from an INTEGER, L.
>
>
> --============================================================================
>
> -- Id: A.15
> function "*" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR((L'LENGTH+R'LENGTH-1) downto 0).
> -- Result: Performs the multiplication operation on two STD_LOGIC_VECTOR
> vectors
> -- that may possibly be of different lengths.
>
> -- Id: A.16
> function "*" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR((L'LENGTH+R'LENGTH-1) downto 0)
> -- Result: Multiplies two STD_ULOGIC_VECTOR vectors that may possibly be of
> -- different lengths.
>
> -- Id: A.17
> function "*" (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR((L'LENGTH+L'LENGTH-1) downto 0).
> -- Result: Multiplies an STD_LOGIC_VECTOR vector, L, with a non-negative
> -- INTEGER, R. R is converted to an STD_LOGIC_VECTOR vector of
> -- SIZE L'LENGTH before multiplication.
>
> -- Id: A.18
> function "*" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR((R'LENGTH+R'LENGTH-1) downto 0).
> -- Result: Multiplies an STD_LOGIC_VECTOR vector, R, with a non-negative
> -- INTEGER, L. L is converted to an STD_LOGIC_VECTOR vector of
> -- SIZE R'LENGTH before multiplication.
>
> -- Id: A.19
> function "*" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR((L'LENGTH+L'LENGTH-1) downto 0)
> -- Result: Multiplies a STD_ULOGIC_VECTOR vector, L, with an INTEGER, R. R
> is
> -- converted to a STD_ULOGIC_VECTOR vector of SIZE L'LENGTH before
> -- multiplication.
>
> -- Id: A.20
> function "*" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR((R'LENGTH+R'LENGTH-1) downto 0)
> -- Result: Multiplies a STD_ULOGIC_VECTOR vector, R, with an INTEGER, L. L
> is
> -- converted to a STD_ULOGIC_VECTOR vector of SIZE R'LENGTH before
> -- multiplication.
>
>
> --============================================================================
> --
> -- NOTE: If second argument is zero for "/" operator, a severity level
> -- of ERROR is issued.
>
> -- Id: A.21
> function "/" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Divides an STD_LOGIC_VECTOR vector, L, by another
> STD_LOGIC_VECTOR vector, R.
>
> -- Id: A.22
> function "/" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Divides an STD_ULOGIC_VECTOR vector, L, by another
> STD_ULOGIC_VECTOR vector, R.
>
> -- Id: A.23
> function "/" (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Divides an STD_LOGIC_VECTOR vector, L, by a non-negative INTEGER,
> R.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.24
> function "/" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Divides a non-negative INTEGER, L, by an STD_LOGIC_VECTOR vector,
> R.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
> -- Id: A.25
> function "/" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Divides a STD_ULOGIC_VECTOR vector, L, by an INTEGER, R.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.26
> function "/" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Divides an INTEGER, L, by a STD_ULOGIC_VECTOR vector, R.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
>
> --============================================================================
> --
> -- NOTE: If second argument is zero for "rem" operator, a severity level
> -- of ERROR is issued.
>
> -- Id: A.27
> function "rem" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where L and R are STD_LOGIC_VECTOR vectors.
>
> -- Id: A.28
> function "rem" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where L and R are STD_ULOGIC_VECTOR vectors.
>
> -- Id: A.29
> function "rem" (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where L is an STD_LOGIC_VECTOR vector and R is
> a
> -- non-negative INTEGER.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.30
> function "rem" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where R is an STD_LOGIC_VECTOR vector and L is
> a
> -- non-negative INTEGER.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
> -- Id: A.31
> function "rem" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where L is STD_ULOGIC_VECTOR vector and R is
> an INTEGER.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.32
> function "rem" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L rem R" where R is STD_ULOGIC_VECTOR vector and L is
> an INTEGER.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
>
> --============================================================================
> --
> -- NOTE: If second argument is zero for "mod" operator, a severity level
> -- of ERROR is issued.
>
> -- Id: A.33
> function "mod" (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where L and R are STD_LOGIC_VECTOR vectors.
>
> -- Id: A.34
> function "mod" (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where L and R are STD_ULOGIC_VECTOR vectors.
>
> -- Id: A.35
> function "mod" (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where L is an STD_LOGIC_VECTOR vector and R
> -- is a non-negative INTEGER.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.36
> function "mod" (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where R is an STD_LOGIC_VECTOR vector and L
> -- is a non-negative INTEGER.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
> -- Id: A.37
> function "mod" (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where L is a STD_ULOGIC_VECTOR vector and
> -- R is an INTEGER.
> -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
>
> -- Id: A.38
> function "mod" (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
> -- Result: Computes "L mod R" where L is an INTEGER and
> -- R is a STD_ULOGIC_VECTOR vector.
> -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
>
>
> --============================================================================
> -- RESIZE Functions
>
> --============================================================================
>
> -- Id: R.1
> function RESIZE (ARG: STD_ULOGIC_VECTOR; NEW_SIZE: NATURAL) return
> STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(NEW_SIZE-1 downto 0)
> -- Result: Resizes the STD_ULOGIC_VECTOR vector ARG to the specified size.
> -- To create a larger vector, the new [leftmost] bit positions
> -- are filled with the sign bit (ARG'LEFT). When truncating,
> -- the sign bit is retained along with the rightmost part.
>
> -- Id: R.2
> function RESIZE (ARG: STD_LOGIC_VECTOR; NEW_SIZE: NATURAL) return
> STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(NEW_SIZE-1 downto 0)
> -- Result: Resizes the STD_ULOGIC_VECTOR vector ARG to the specified size.
> -- To create a larger vector, the new [leftmost] bit positions
> -- are filled with '0'. When truncating, the leftmost bits
> -- are dropped.
>
>
> --============================================================================
> -- Conversion Functions
>
> --============================================================================
>
> -- Id: D.1
> function TO_INTEGER (ARG: STD_LOGIC_VECTOR) return NATURAL;
> -- Result subtype: NATURAL. Value cannot be negative since parameter is an
> -- STD_LOGIC_VECTOR vector.
> -- Result: Converts the STD_LOGIC_VECTOR vector to an INTEGER.
>
> -- Id: D.2
> function TO_INTEGER (ARG: STD_ULOGIC_VECTOR) return NATURAL;
> -- Result subtype: NATURAL
> -- Result: Converts a STD_ULOGIC_VECTOR vector to an INTEGER.
>
> --==============================================================================
> --============================= New subprograms
> ================================
> --==============================================================================
>
> -- Id: A.3R
> function "+"(L: STD_LOGIC_VECTOR; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'RANGE)
> -- Result: Similar to A.3 where R is a one bit STD_LOGIC_VECTOR
>
> -- Id: A.3L
> function "+"(L: STD_ULOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'RANGE)
> -- Result: Similar to A.3 where L is a one bit STD_LOGIC_VECTOR
>
> -- Id: A.4R
> function "+"(L: STD_ULOGIC_VECTOR; R: STD_ULOGIC) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'RANGE)
> -- Result: Similar to A.4 where R is bit 0 of a non-negative
> -- STD_ULOGIC_VECTOR
>
> -- Id: A.4L
> function "+"(L: STD_ULOGIC; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'RANGE)
> -- Result: Similar to A.4 where L is bit 0 of a non-negative
> -- STD_ULOGIC_VECTOR
>
> -- Id: A.9R
> function "-"(L: STD_LOGIC_VECTOR; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(L'RANGE)
> -- Result: Similar to A.9 where R is a one bit STD_LOGIC_VECTOR
>
> -- Id: A.9L
> function "-"(L: STD_ULOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'RANGE)
> -- Result: Similar to A.9 where L is a one bit STD_LOGIC_VECTOR
>
> -- Id: A.10R
> function "-"(L: STD_ULOGIC_VECTOR; R: STD_ULOGIC) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_ULOGIC_VECTOR(L'RANGE)
> -- Result: Similar to A.10 where R is bit 0 of a non-negative
> -- STD_ULOGIC_VECTOR
>
> -- Id: A.10L
> function "-"(L: STD_ULOGIC; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
> -- Result subtype: STD_LOGIC_VECTOR(R'RANGE)
> -- Result: Similar to A.10 where R is bit 0 of a non-negative
> -- STD_ULOGIC_VECTOR
>
> </BEN_P2>
>
> Note, this is Numeric_Std functions with the following removed:
> Comparison operators (?language currently does not permit this?),
> Logic Operators (in Std_logic_1164),
> Shift Operators (in std_logic_1164 in the future),
> Match Functions (in Numeric_Std now, moving to std_logic_1164?),
> TO_01 (needs to be in std_logic_1164 - for parallel to numeric_std),
>
> Questions
> RESIZE should this be in std_logic_1164?
>



This archive was generated by hypermail 2b28 : Tue Oct 08 2002 - 07:38:16 PDT