klarson Posted June 5, 2012 Report Share Posted June 5, 2012 In every single published example that I've ever seen, including all of the 'official' UVM examples, the extended uvm_test test class always is defined inside of the SV program block. Is there any actual advantage or reason to do this, or is this simply a convention that has been established? I could see one advantage might be if you are instantiating your UVM environment inside the program block, then a test class which is defined inside the program block will be able to reference that environment pointer directly. This actually seems like a bad idea though, from an data encapsulation point of view, and sure enough many (but not all) of the example programs will do a uvm_root::get() with a find coupled with a $cast to locally get a pointer to the specific UVM environment before using it, even though they could simply reference the environment variable in the program block directly if they wanted. So if it's not for easy access to the UVM environment pointer, why define the class inside the program block at all? Couldn't you argue for more flexibility and reuse by defining the uvm_test objects independently from any program block? Why does everybody do it this way? I've tried definining the uvm_test object outside the program block and it seems to work just fine. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.