Search code examples
system-veriloguvm

Register virtual class with UVM factory


Does anyone have a way of registering virtual classes with the factory? Using the object_utils macro will define the type_id::create(...) method which calls new(...) for the virtual class which is illegal.

Naturally, a type override would be mandatory for any virtual class registered with the factory. It would be cool if anyone had an elegant solution for this.


Solution

  • Unfortunately, there is no way to do this in the UVM with a virtual class without recreating your own factory. However, you could instrument the build_phase() of this class to check that the class has been overridden. Either way you would not be able to check this until run time. So you lose the compiler check that a virtual class provides, so why bother using it.