Is it possible to pass generics into a package file? A lot of the
constants in my package file are dependent upon an INPUT_WIDTH generic
in my main file.
-Kevin
Not today. One work around though until VHDL-2008 is real is to make
the thing that you'd like to be a generic in your main package file
instead dependent on a constant from yet another package. Then each
design would use their own customized package.
i.e.
-- Put this package in a separate file that is 'design specific'. It
would contain all the 'parameters' of the main package file
'pkg_Lots_Of_Good_Stuff' and nothing else.
package pkg_User_Constants is
constant INPUT_WIDTH: natural := 100;
end package pkg_User_Constants;
-- In your 'main' file
package pkg_Lots_Of_Good_Stuff is
constant Blah_Blah: real :=
log(work.pkg_User_Constants.INPUT_WIDTH);
...
end package pkg_Lots_Of_Good_Stuff;
Although it doesn't accomplish the goal of being able to parameterize
the main package itself, it does separate out all the user controls
into a separate package that is easier for someone to pick up and be
able to confidently make changes to it (i.e. create a new file with a
new 'pkg_User_Constants' package.
In the end, any code that would be written to *use* the parameterized
package would most likely have to have a unique design file that tells
it to use the package with the unique parameterization which is not
terribly different than having the unique design file be the one that
contains 'pkg_User_Constants'.
Where this breaks down though is if you need to use
'pkg_Lots_Of_Good_Stuff' with different parameters but in the same
design.
Kevin Jennings