Jump to content

Inherit uvm_root?


Recommended Posts

hi,

technically you can extend uvm_root (because there is no "final" in the language) BUT you cant make uvm use your derived class without edits.if you could explain your use case we hopefully can identify other paths to accomplish the functionality without interacting with the critical core classes.

/uwe

Link to comment
Share on other sites

  • 10 months later...

Basically, if there's anything that I need/want to do at simulation time-zero and UVM time-zero, then extending the uvm_top class would allow for that.

This actually came up when I was trying to register a global report-server. Because I cannot extend uvm_root and I cannot guarantee instantiation order of global variables, then some messages were reported by UVM classes and a 3rd party VIP class instance prior to my report-server registration. My post processing scripts will miss that because they expect a specific formatting.

Even though this was for the global report-server, I think it stands for any functionality requiring UVM time-zero to execute. In my environment, I created an extensible proj_root class globally instantiated:

`define PROJ_ROOT_CLASS proj_root

class proj_root; ... endclass

const `PROJ_ROOT_CLASS proj_top = `PROJ_ROOT_CLASS::get();

I can extend proj_root to a new class that handles some time-zero activity know that it will be instantiated by redefining PROJ_ROOT_CLASS macro.

It seems like UVM could do something similar while guaranteeing uvm_top purity (to some extent) by just using the macro at the function call:

const uvm_root uvm_top = `UVM_ROOT_CLASS::get();

This would mean that the const variable itself would still be const at uvm_root scoping, but now I get to synchronize my time-zero activities with UVM time-zero.

I suppose the alternative would be to add hooks (do_local_configure?) in uvm_root to allow UVM time-zero activity, but I think class extension would be more general-case.

Sorry for the very long explication delay.

Thanks.

Link to comment
Share on other sites

well, a better solution for a couple of issues would be

1. make a uvmCoreServiceClass class with virtual members like "virtual uvm_root getUVMRoot();" ... and potentially other global reporter, resource_pool, factory ...

2. make a single const instance "const uvmCoreServiceClass uvmCoreService = `UVM_CORE_SERVICE::get();" //so you CAN override the class

3. now replace all static calls like uvm_root::bla or uvm_factory::boo with calls to the service class. (the static calls just make sure it will be this class forever and this is not really extensible and base class friendly)

4. now it would be possible to derive from uvmCoreServiceClass and reimplement getUVMRoot() returning a derived uvm_root.

/uwe

Edited by uwes
Link to comment
Share on other sites

You should be able to safely modify the global report server before calling run_test(). That should handle anything that happens within the UVM phasing (it's still possible for static initializers to run before that, but there's never going to be a way to control the order of that).

It seems to me that any extension of uvm_root would suffer from the same timing problem you have now with extending the report server.

Link to comment
Share on other sites

  • 2 months later...

Hi guys,

 

I want to override all_dropped() call back in uvm_root class.I tried inheriting uvm_root but am facing multiple fatal issues.I have multiple objections raised in different components of my test-bench  I want a single point control of all those objection.I put an print statement in uvm_root's all dropped task and observed that it gets called after all the objections I raised in parent test and all its decedent classes are dropped.I don't want to touch the uvm_root source code.Is there any other way to do this?

 

Basically, I want to make a flag/signal go high after all my objections are dropped.I have objections scattered at different places ,in different base classes controlling different things.

 

task all_dropped() begin

 

all_done = 1;

 

endtask

Link to comment
Share on other sites

  • 3 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...