chipsalliance / UHDM

Universal Hardware Data Model. A complete modeling of the IEEE SystemVerilog Object Model with VPI Interface, Elaborator, Serialization, Visitor and Listener. Used as a compiled interchange format in between SystemVerilog tools. Compiles on Linux gcc, Windows msys2-gcc & msvc, OsX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can the #defienes be an enumeration ?

hzeller opened this issue · comments

Given that the C++ part allows us to use all kinds of features we can use there, I wonder if we should replace the
#define ... list in headers/uhdm.h with a C++ enum class.

#defines are very annoying as they pollute the global namespace.

There are 1000s of define in vpi_user.h and sv_vpi_user.h, I only add a few more.
We can't get rid of the IEEE ones, is it worth getting rid of these? They kinda work hand-in-hand

So I guess if this is something we only do within our own implementation, we should be strict and use the strictest way to define things these days.

If we expect the end-user actually using these values as 'extension' to whatever vpi-values exist, then we should maybe prefix them with uhdm_ ?

Oh, I see, they are already prefixed with uhdm. But still they might be more readable with an additional underscore uhdm_ to indicate that that is essentially the 'namespace'.