Change _vector declarations to use integer as range rather than natural
Currently, all _vectors are declared like this :
type integer_vector is array(natural range <>) of integer;
I would like this changed to:
type integer_vector is array(integer range <>) of integer;
Why is this important?
OSVVM RandomPType has a DistInt
function that takes an integer_vector
of weights. Because natural is used for the range, only +ve numbers can be generated. If I want to generate a distrubution from -10 to +10, I would currently have to do this:
-- Distribute around 10, 10 = 80%, all others 1%
constant my_dist : integer_vector(0 to 20) => (10 => 80, others => 1);
constant x : integer;
...
x := rand.DistInt(my_dist);
x := x - 10; -- normalise -10 to +10
If integer vector was already declared with an integer range, the normalisation above would not be an issue.
I cannot see this being a problem with backwards compatability?
Types I would expect to support it:
- all _vector in std.standard
-
std_logic_vector
inieee.std_logic_1164
Type to remain as natural range <>
-
Unsigned/signed
innumeric_std/bit