Why is uvm_registry not a singleton in UVM?

Hello,

I think the uvm_registry class must be a singleton class to avoid the possibility of duplicate registrations in factory. Is there any reason it is not implemented as singleton in UVM? Is it a bug?

Thanks
Prasad.

In reply to prasadaddagarla:

The specialization of class uvm_object_registry is what registers the class with the factory, not construction of it. This has to so with static members of the class. See my DVCon paper, and this article.

In reply to dave_59:

Hi Dave,
Thanks for the reply. I understand that each specialization is what registers with factory. But one can meddle with the factory operation if each of those specializations is not a Singleton. Since the actual registration with factory happens in the create call, and since all of the code within create is UVM code there is less chance of tampering. But there is nothing stopping me from doing the following in any class that I would like to register:


type_id me;
me = new(); // This would not be allowed if type_id was singleton
factory f = factory::get();
f.register(me);

Please let me know what you think. Consider the code not in compliance with actual UVM code but just a psuedo code.

Thanks
Prasad.

In reply to prasadaddagarla:

This is most likely an oversight. From the OVM, some tools had difficulty implementing a local or protected constructor.

Note that the register() function does check for duplicate type names.