I am trying to change a port record based on a generic and don't know of a good way to do this. I am trying to avoid VHDL2008 constructs if possible as I want to avoid preventing backwards compatability with legacy code. Anyways, here is what I am trying to do:
--libs for pack256
package pack256 is
type myDataT is record
valid : std_logic;
data : std_logic_vector(255 downto 0);
end record;
end package;
-- libs for pack128
package pack128 is
type myDataT is record
valid : std_logic;
data : std_logic_vector(127 downto 0);
end record;
end package;
Now, I want to be able to choose which package I use in my entity as this record sits inside a port map. Is there some creative way I can use a VHDL configuration or something to determine which package to source components/records/types from in my top level? Unfortunately, we have a lot of code looking at something like the code below and need to be able to control which package gets used as some top levels use different data widths for the myDataT record. If there is no way to fix this without VHDL 2008 or creating two seperate entities, will Vivado AND Altera/Quartus support package generics/unconstrained records?
-- top level declaration stuff
library dataPack;
use dataPack.(pack128 or pack256).all; -- how to choose different package from top level?
entity myEntity is
generic(
-- generics);
port(
reset : in std_logic;
clk : in std_logic;
ctrl : myDataT;
-- other port stuff);
end myEntity;
Finally, I cannot declare the record signals in the entity port map and change widths via a generic as this will break thousands of legacy source code files.