I'm writing a generic multiplier in VHDL, which should be able to be instantiated to handle any combination of signed and unsigned factors.
It's my understanding that, in order to do all 4 combinations of signed and unsigned multiplication from a single generic entity, and because there is no data type/ port that can accept both signed and unsigned values (no polymorphism), I'll need to pass both factors as std_logic_vectors and recast them as signed or unsigned depending on their signedness.
In order to feed my generic_multiplier my factors' signedness, because signedness is static, I have decided to pass in the strings "signed" or "unsigned" as generic arguments. Depending on these statements, generate statements will take care of the necessary typecasting and sign extension from std_logic to multipliable factors.
I'd like my module to throw an error if the user passes in any string other than "signed" or "unsigned" into my signedness argument during generic template instantiation. I can think of an ad-hoc way to do this with if-statements, but is there any way for me to define a set of strings universal to all multiplier modules (namely, {"signed", "unsigned"}), and throw a compiler error if my input string fails to lie within that set?
I know this is possible with SystemVerilog containers or meta-programming libraries, but I don't think I can convince my team to use these kinds of tools, and was wondering if there were any such constructs to assist metaprogramming in base VHDL.