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

SymbolFactory internalization identifier should be its own type

hzeller opened this issue · comments

Right now, the identifier SymbolFactory gives out is an unsigned int. I think this should be more opaque so that it is more clear when used

  class SymbolFactory {
   public:
      typdef unsigned int ID;
      //...
     ID make(const std::string& symbol);
  }

Then later, in the generated files, we can instead, instead of

unsigned int vpiFile_;

use

SymbolFactory::ID vpiFile_;

This makes code easier to navigate and understand and also allows to do interesting things with the ID in the future (it could be a more type-safe thing than an alias to an int value for instance).