A
Anne Onime
I have the following definitions in a VHDL architecture:
TYPE MemType IS ARRAY (MemDepth-1 DOWNTO 0) OF std_ulogic_vector(DataWidth-1 DOWNTO 0);
SIGNAL Mem : MemType := (OTHERS => (OTHERS => '0'));
such that MemDepth and DataWidth are generics on the entity. I would like to create the procedure "InitMem" in a
package to initialize the Mem signal to a specific pattern. But I do not know what the specific settings of
MemDepth and DataWidth will be for each instance of the entity that will be calling the procedure. So I would
ideally like to specify an unconstrained parameter for the procedure. Obviously, I can also pass the MemDepth and
DataWidth values along with the signal itself so that the procedure knows the array bounds.
Is this possible? If so, what would the procedure look like? I would have thought it would be something like this,
but I am getting compiler errors that I cannot define an unconstrained type:
PACKAGE InitPkg IS
TYPE MemType IS ARRAY (natural RANGE <>) OF std_ulogic_vector;
PROCEDURE InitMem (
SIGNAL Mem : INOUT MemType;
CONSTANT DataWidth : IN positive;
CONSTANT MemDepth : IN positive) IS
...
Note that this initialization is NOT intended to be synthesizable. Any suggestions?
- vhannak
TYPE MemType IS ARRAY (MemDepth-1 DOWNTO 0) OF std_ulogic_vector(DataWidth-1 DOWNTO 0);
SIGNAL Mem : MemType := (OTHERS => (OTHERS => '0'));
such that MemDepth and DataWidth are generics on the entity. I would like to create the procedure "InitMem" in a
package to initialize the Mem signal to a specific pattern. But I do not know what the specific settings of
MemDepth and DataWidth will be for each instance of the entity that will be calling the procedure. So I would
ideally like to specify an unconstrained parameter for the procedure. Obviously, I can also pass the MemDepth and
DataWidth values along with the signal itself so that the procedure knows the array bounds.
Is this possible? If so, what would the procedure look like? I would have thought it would be something like this,
but I am getting compiler errors that I cannot define an unconstrained type:
PACKAGE InitPkg IS
TYPE MemType IS ARRAY (natural RANGE <>) OF std_ulogic_vector;
PROCEDURE InitMem (
SIGNAL Mem : INOUT MemType;
CONSTANT DataWidth : IN positive;
CONSTANT MemDepth : IN positive) IS
...
Note that this initialization is NOT intended to be synthesizable. Any suggestions?
- vhannak