Jump to content

UVM phase method names and arguments - are they really necessary?


Recommended Posts

Hi, All -

UVM uses a different phase-calling syntax than OVM. Examples:

function void build_phase(uvm_phase phase);

super.build_phase(phase); ...

task run_phase (uvm_phase phase); ...

I see the value of having "phase" with the run_phase(s) because I am going to do:

phase.raise_objection(this);

phase.drop_objection(this);

But I am trying to understand why I would use this syntax with function-phases where I will not raise/drop objections. In fact, in the src/base/uvm_component.svh file, the code for the connect_phase() is the following:

function void uvm_component::connect_phase(uvm_phase phase);

connect();

return;

endfunction

So the function just appears to call the simpler-syntax connect() method. I had a student in UVM training that chose to use the simple names and the labs worked just fine. Only the final_phase() does not have a simpler OVM counterpart and there is also a final keyword in the SystemVerilog language.

Any experts care to comment on the more complex calling syntax with no readily apparent value?

Regards - Cliff Cummings

www.sunburst-design.com

Link to comment
Share on other sites

As far as I recall, it was for symmetry.

Also, should accessing the phase object be useful/necessary in a future release, this approach made it readily accessible. It would not have been possible to add this argument in a subsequent release as you cannot modify the signature of virtual methods in SV.

Link to comment
Share on other sites

Thanks, Janick -

I had a hunch that this capability might be related to reserving the capability for a future enhancement, although I can't imagine what that enhancement might be for the function phases (hence, the term enhancement!)

Good point about setting the prototype signature for that possible future enhancement, although it could be argued that using the existing phase names would still allow the creation of the name_phase(uvm_phase phase) syntax in the future when such enhancements made sense. Considering the much simpler syntax of the old function-phase() name syntax, and am mildly inclined to promote the older syntax until I can justify the extra verbosity of the newer syntax. I will have to think this one through. It would mean that the final_phase() would be an exception and exceptions can be equally confusing.

Regards - Cliff Cummings

www.sunburst-design.com

Link to comment
Share on other sites

Cliff,

The older syntax is already deprecated - it's only there for backward compatibility with OVM. You will create confusion if people assume that connect and connect_phase are just syntactic synonyms for each other and people start extending their classes with connect() from classes already using connect_phase()or vice versa - these methods will not be called in the right order.

I can see some purpose in using the phase argument when calling common routines for reporting or debugging to know which phase you were called from.

Link to comment
Share on other sites

Okay, Janick & Dave have convinced me to keep teaching the proper name_phase(uvm_phase phase) syntax. I was wavering, but when Janick used the "Thou shalt not use them" commandment, I decided to obey!

Dave - have you used the phase argument in any reporting and debugging calls from the function phases?

Regards - Cliff Cummings

www.sunburst-design.com

Link to comment
Share on other sites

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...