Make packages easier to test
Is your capability/feature request related to a problem?
When writing tests for the standard VHDL packages things are very much complicated by two things:
- The packages are assumed to be compiled into a library named
ieee
. For example,numeric_std.vhdl
is doing
use IEEE.STD_LOGIC_1164.all;
No simulator I've tested allow that you recompile the libraries in ieee
so in order to verify a new feature the current VUnit script uses a preprocessor to replace all references to ieee
with new_ieee
such that the code can be verified in another namespace. It works but it's an extra complicating step and I think idiomatic use of VHDL is to use work
.
- The standard packages are not self-contained. Here's an example from
std_logic_1164.vhd
-- the following operations are predefined
-- function "?=" (l, r : STD_ULOGIC) return STD_ULOGIC;
-- function "?=" (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC;
-- function "?/=" (l, r : STD_ULOGIC) return STD_ULOGIC;
-- function "?/=" (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC;
-- function "?<" (l, r : STD_ULOGIC) return STD_ULOGIC;
-- function "?<=" (l, r : STD_ULOGIC) return STD_ULOGIC;
-- function "?>" (l, r : STD_ULOGIC) return STD_ULOGIC;
-- function "?>=" (l, r : STD_ULOGIC) return STD_ULOGIC;
The VUnit preprocessor cannot replace references to ieee.std_logic_1164
with new_ieee.std_logic_1164
because if std_logic_1164
is compiled into new_ieee
some function definitions will be missing. For that reason the original std_logic_1164
must be used. That works today but what if we want to test updates to std_logic_1164
?
Describe the solution you'd like
- Replace all references to
ieee
withwork
. In that way the tested code can be compiled into any namespace without being modified - Make packages self-contained such that they can be fully tested. Note that this means that anyone can start using release candidates of these packages before they have been released or start using new releases before supported by the vendors.
Describe alternatives you've considered
The only alternative I considered is the existing work-around for our tests
Additional context
I can understand why ieee
was used over work
but it would be interesting to know the background for the predefined functions.