bhunter1972 Posted November 28, 2011 Report Posted November 28, 2011 Let's say that hypothetically you want a task that is spawned by the run phase to be able to print out the name of the currently running run-time phase (ie are we in the reset, configure, main, or shutdown phase)? How could you do it? There doesn't seem to be any function or field that would implement uvm_top.get_current_phase(). My solution is not particularly elegant, so I'm wondering if there is a better one. Basically, I have a component that has a field: uvm_phase current_phase; And then I implement every single run-time phase to set the current_phase field to be the phase that's passed in. virtual task pre_main_phase(uvm_phase phase); current_phase = phase; endtask virtual task main_phase(uvm_phase phase); current_phase = phase; ... Again, not very elegant. Any thoughts? Quote
girodias Posted November 28, 2011 Report Posted November 28, 2011 The same can be achieved with the UVM phase_started function. virtual function void phase_started(uvm_phase phase); super.phase_started(phase); current_phase = phase; endfunction : phase_started Quote
bhunter1972 Posted November 28, 2011 Author Report Posted November 28, 2011 The same can be achieved with the UVM phase_started function. virtual function void phase_started(uvm_phase phase); super.phase_started(phase); current_phase = phase; endfunction : phase_started Ah, that is far more clever. I still feel like the uvm_root component should have a get_current_phase function, though. Thanks! Quote
uwes Posted November 29, 2011 Report Posted November 29, 2011 hi, the reason that there is not get_current_phase() is very simple. there is simply NO single current phase. at any time there is a SET of active phases (during simulation time it would be "run" + one of the 12 runtime phases + any user defined phases). the only way to know a "current" phase is to hook into the notification from the phasing system (phase_started, phase_ended and the xxxx_phase tasks). this however is only safe until "time" is spend (because the phaser could proceed to the successor phases (could be a set!), or jump, ...) Quote
Recommended Posts
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.