# UVM Phase Jumping

**URL:** <https://verificationacademy.com/forums/t/uvm-phase-jumping/28809>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [September 13, 2013, 11:08am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809 "2013-09-13T11:08:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 13, 2013, 11:08am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/1 "2013-09-13T11:08:06Z")

</div>

All,  
I want to have a basic idea of UVM phase jumping and its basic functionailty.  
Which functions/tasks(Eg.:jump/jump\_all/get\_domain) should I try and how?

Also,  
Can anyone explain clear and easy difference between uvm\_phase, uvm\_schedule and uvm\_domain?? And relation between them…

Thanx in advance…

Regards,.  
Anamika

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 13, 2013, 2:12pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/2 "2013-09-13T14:12:38Z")

</div>

Phase jumping in UVM is not recommended. There are issues with respect to shutting down executing processes when you jump between phases and the VIP-TSC (a.k.a. “The UVM Committee”) is seriously considering major changes to this functionality.  
Perhaps it would be better for you to explain what you’d like to do and then we can explore a way of doing it without phase jumping. A mix of virtual sequences, barriers and events is most likely sufficient for your needs.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 15, 2013, 1:39pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/3 "2013-09-15T13:39:01Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/2):_

Hi tfitz,  
I want to know if I want to add user defined phase and then jump to that phase in run phase of testcase. How can I do that??

What is the way to add user defined phase??/

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 16, 2013, 12:37pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/4 "2013-09-16T12:37:25Z")

</div>

Hi Anamika,  
Using user-defined phases is even less recommended than using the predefined phases. If you explain what you’re trying to do exactly, we can probably come up with an alternative approach.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 16, 2013, 4:15pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/5 "2013-09-16T16:15:16Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/4):_

Hi.  
I have to try maximum experiments on phase jumping and its effects.  
So, just want to kow what are the things I should try.

Also, can u explain difference between uvm\_domain, uvm\_schedule ??

Thanx,  
Anamika

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 16, 2013, 6:33pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/6 "2013-09-16T18:33:56Z")

</div>

_In reply to [Anamika Sharma](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/5):_

Since you shouldn’t use them, it would be a waste of your time to run experiments on user-defined phases and/or phase jumping.

However, to answer your question:  
There is no such type as uvm\_schedule. A “schedule” is typically of type uvm\_phase and defines the before/with/after relationship of a set of uvm\_phase objects. If you wanted to add your own user-defined phases, you’d have to create a schedule and add the phases to it.

The uvm\_domain type is an extension of uvm\_phase that defines the set of phases/schedules that get assigned to any particular uvm\_component.

That said, I had to look it up and, even having been involved in the design of domains and schedules, I’m not sure that explanation is going to help you. Please just don’t use them.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 17, 2013, 4:51pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/7 "2013-09-17T16:51:58Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/6):_

Hi tfitz,  
Thanx for the explanation.

One thing i want is that I have 2 agents in my testcase. Now all phase of both agents start synchronously. Like if I am having some delay in main\_phase of driver\_1, and no delay in main\_phase of driver\_2, still main\_phase of driver\_2 waits for completion of main\_phase of driver\_1 and then both go to their pre\_shutdown\_phase.

Now, first i want to implement like main\_phase of driver\_2 should not wait for completion of main\_phase of driver\_1.

Then , when I add domain synchronisation, then only main\_phase of driver\_2 should wait for completion of main\_phase of driver\_1.

I want to implement domain synchronisation myself.

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 17, 2013, 7:13pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/8 "2013-09-17T19:13:22Z")

</div>

_In reply to [Anamika Sharma](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/7):_

We don’t recommend using main\_phase at all, but especially not for drivers. The reason is that your driver should be written to use run\_phase so that it can always respond (even with just an idle cycle) to traffic on the interface to which is is connected. Similarly for monitors.  
The additional run-time phases were best suited to controlling stimulus, and it’s really just easier to use [virtual sequences](https://verificationacademy.com/cookbook/sequences/virtual). Rather than delaying the operation of driver1, what you really want to do is delay the start of sequence1, which sends transactions to driver1.

> Now, first i want to implement like main\_phase of driver\_2 should not wait for completion of main\_phase of driver\_1.

You need to ask yourself what you need to do in pre\_shutdown\_phase. Remember, eventually you’ll need both agents to complete main and shutdown so you can exit run\_phase and move to extract\_phase. Try something like this in your virtual sequence:

```auto
fork
  begin
    main_seq2.start(sequencer2); // sequencer2 is a pointer to env.agent2.sequencer
    shutdown_seq2.start(sequencer2);
  end
  begin
    main_seq1.start(sequencer1);
    shutdown_seq1.start(sequencer1);
  end
join

```

Notice how each branch of the fork/join allows two sets of stimulus to execute in parallel. In each branch, the main\_seq will complete followed by the shutdown\_seq, independent of the other branch. Once both branches have completed, you can drop the objection and proceed to extract\_phase.

> Then , when I add domain synchronisation, then only main\_phase of driver\_2 should wait for completion of main\_phase of driver\_1.

```auto
fork
  begin
    sync_event.wait_trigger();
    main_seq2.start(sequencer2); // sequencer2 is a pointer to env.agent2.sequencer
    shutdown_seq2.start(sequencer2);
  end
  begin
    main_seq1.start(sequencer1);
    sync_event.trigger();
    shutdown_seq1.start(sequencer1);
  end
join

```

Using a combination of fork/join, begin/end, events and objections, you should be able to get whatever synchronization you require.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 18, 2013, 3:49am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/9 "2013-09-18T03:49:15Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/8):_

Hi,  
Actually I have not run any sequence . Just waitung for 2 edges of clock in run\_phase of driver\_1 and only displaying a message in run\_phase of driver\_2. So, run\_phase of driver\_2 should complete first since it is not waiting for any event. like :

run\_phase of driver\_1 start  
//

run\_phase of driver\_2 start  
//

run\_phase of driver\_2 ends  
//

shutdown\_phase of driver\_2 start  
//  
shutdown\_phase of driver\_2 ends  
//

run\_phase of driver\_1 ends  
//

shutdown\_phase of driver\_1 starts  
//

shutdown\_phase of driver\_1 ends  
//

Like this i want. Driver\_2 should enter into its shutdown\_phase even before completion of run\_phase of driver\_1… can it be done???

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 18, 2013, 12:03pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/10 "2013-09-18T12:03:14Z")

</div>

_In reply to [Anamika Sharma](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/9):_

First of all, even if you were to use main\_phase and shutdown\_phase, the recommendation would still be only to implement run\_phase in your drivers. The reset/config/main/shutdown phases are only intended to be used for stimulus control, if at all.  
I’m guessing that in your last post, you meant “main\_phase” where you wrote “run\_phase” since I’m sure you know that main\_phase()-shutdown\_phase() run in parallel with run\_phase(). Therefore shutdown\_phase() cannot execute after run\_phase().  
Assuming that’s the case, using run\_phase, your drivers would look something like this:

```auto
task driver2::run_phase(uvm_phase phase);
  `uvm_info("Driver2","display message",UVM_INFO)
  shutdown_driver2();
endtask

task driver1::run_phase(uvm_phase phase);
  repeat(2) @posedge(vif.clk);
  shutdown_driver1();
endtask

```

The real question you need to answer for yourself is what behavior you need to “shutdown” each driver. In reality, even if you were to use main\_phase and shutdown\_phase, as I said earlier, your driver would still just implement run\_phase, so your drivers would really just be in a get\_next\_item()/item\_done loop interacting with the sequences. “Shutdown” is usually just to allow the bus traffic to “drain” - allowing the drivers to complete the last transactions to get the bus back to a quiescent state. Since building any kind of communication between the drivers would lessen their reusability, you’re better off controlling them via sequences. The transactions you send could include tags like “do\_bus\_transaction” or “do\_shutdown”.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 18, 2013, 5:01pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/11 "2013-09-18T17:01:35Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/10):_

In class my\_driver, I have following objects and function:

uvm\_domain driver\_domain = uvm\_domain::get\_uvm\_domain(); // to be set to my\_driver class  
uvm\_domain get\_driver\_domain; // handle to get the assigned domain  
string driver\_domain\_name; // string to display domain assigned  
uvm\_domain driver\_domains[string]; // to display all available domains of my\_driver

function void my\_driver:: build\_phase( uvm\_phase phase );  
super.build\_phase( phase );  
uvm\_report\_info(get\_full\_name()," my\_driver:: build\_phase()",UVM\_NONE);  
define\_domain(driver\_domain);  
this.set\_domain(driver\_domain,1);  
driver\_domain\_name = phase.get\_domain\_name();

uvm\_domain:: get\_domains(driver\_domains);  
$display(" number of available domains is %d",driver\_domains.size());  
$display(“driver is in domain: %s” ,driver\_domain\_name);  
endfunction : build\_phase

What I am trying to do is set a domain (other than uvm\_domain and uvm\_common\_domain) to build\_phase of my\_driver. So available domains for this phase should be 3. And this phase should be in driver\_domain.

But it is displaying as if available domains for this are 2. And this phase is in common domain.

I am trying to set different domains to different components(my\_diver and my\_monitor). Now i am having one agent only.

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [September 18, 2013, 6:50pm UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/12 "2013-09-18T18:50:58Z")

</div>

_In reply to [Anamika Sharma](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/11):_

With all due respect, I’ve just shown you how to make the two agents/drivers do different things at different times without requiring domains. I’m not sure why you’re so hung up on using domains.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 20, 2013, 3:44am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/13 "2013-09-20T03:44:56Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/12):_

Hi,  
Actually I have to implement phase jumping. Thats why hung up in it only.

I have written following to set\_domain .

class my\_driver extends uvm\_driver;

uvm\_domain driver\_domain;  
uvm\_domain get\_driver\_domain;  
string driver\_domain\_name; // string to display domain assigned  
uvm\_domain driver\_domains[string]; // to display all available domains of my\_driver

* * *

* * *

endclass : my\_driver

function void my\_driver:: build\_phase( uvm\_phase phase );  
super.build\_phase( phase );  
ap = new(“ap”, this);  
uvm\_report\_info(get\_full\_name()," my\_driver:: build\_phase()",UVM\_NONE);  
driver\_domain = new(“uvm\_domain\_driver”);  
//define\_domain(driver\_domain);  
this.set\_domain(driver\_domain,1);  
driver\_domain\_name = phase.get\_domain\_name();  
get\_driver\_domain = get\_domain();  
uvm\_domain:: get\_domains(driver\_domains);  
$display(“driver is in domain: %s” ,driver\_domain\_name);

endfunction : build\_phase

class my\_monitor extends uvm\_monitor;

uvm\_domain monitor\_domain;  
uvm\_domain get\_monitor\_domain;  
string monitor\_domain\_name; // string to display domain assigned  
uvm\_domain monitor\_domains[string]; // to display all available domains of my\_monitor

* * *

* * *

endclass : my\_monitor

function void my\_monitor:: build\_phase( uvm\_phase phase );  
super.build\_phase( phase );  
ap = new(“ap”, this);  
uvm\_report\_info(get\_full\_name()," my\_monitor:: build\_phase()",UVM\_NONE);  
monitor\_domain = new(“uvm\_domain\_monitor”);  
//define\_domain(monitor\_domain);  
this.set\_domain(monitor\_domain,1);  
monitor\_domain\_name = phase.get\_domain\_name();  
get\_monitor\_domain = get\_domain();  
uvm\_domain:: get\_domains(monitor\_domains);  
$display(“monitor is in domain: %s” ,monitor\_domain\_name);

endfunction : build\_phase

When I am creating a new object of uvm\_domain as driver\_domain then, then number of domains available to phase are increased by 1.But, set\_domain command is not setting the domain to the assigned domain\_type.  
After using get\_domain\_name , I am getting the default domain value for that phase.

As per my understanding, set\_domain() itself calls define\_domain().

Do, I need to edit define\_domain() ??

Also I am trying to unsynchronise both these domains using :

monitor\_domain.unsync(.target(monitor\_domains[driver\_domain]));

Is it correct???  
Where and how should I write this line to unsynchronise.

---

<div class="post-metadata">

**Author:** ![AnamikaSharma](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@AnamikaSharma](https://verificationacademy.com/forums/u/AnamikaSharma)\
**Post date:** [September 27, 2013, 4:37am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/14 "2013-09-27T04:37:18Z")

</div>

Hi,

I have written following line for synchronising uvm\_pre\_shutdown\_phase of user defined domain domain0 and domain1:

domain0.sync(.target(domain1.get\_domain())  
.phase(uvm\_pre\_shutdown\_phase::get()));

But I am getting the following error :

add\_user\_defined\_domain.sv  
.phase(uvm\_pre\_shutdown\_phase::get()));  
|  
ncvlog: \*E,EXPRPA (add\_user\_defined\_domain.sv,336|15): expecting a right parenthesis (‘)’) [10.2.2(IEEE)].  
.phase(uvm\_pre\_shutdown\_phase::get()));  
|  
ncvlog: \*E,EXPSMC (add\_user\_defined\_domain.sv,336|52): expecting a semicolon (‘;’) [10.2.2][10.2(IEEE)].

Can anybody help?

---

<div class="post-metadata">

**Author:** ![harsh2020](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/da6949/32.png) [@harsh2020](https://verificationacademy.com/forums/u/harsh2020)\
**Post date:** [July 4, 2016, 9:14am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/15 "2016-07-04T09:14:43Z")

</div>

_In reply to [tfitz](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/14):_

Hello tfitz,

I am new to UVM and experimenting with various concepts.

After almost 3 years of this post’s inception, I would like to know if this thread and your answers are still valid!?

Is there any consensus on using/not-using the new run-time uvm phases and phase jumping? If still not usable/recommendable, why aren’t they deprecated yet?

Any reference to the latest article on this topic would be helpful too.

Sincerely looking forward to hearing from you.

Thanks,  
harsh2020

---

<div class="post-metadata">

**Author:** ![user60](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user60/32/1096_2.png) [@user60](https://verificationacademy.com/forums/u/user60)\
**Post date:** [July 4, 2016, 10:09am UTC](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/16 "2016-07-04T10:09:20Z")

</div>

_In reply to [harsh2020](https://verificationacademy.com/forums/t/uvm-phase-jumping/28809/15):_

Hi Harsh,  
I see lot of customer actively using these “active” phases (for active components within a UVC). I personally believe this is of great value to end users. I know my friends at Mentor differ - with some great counter-arguments, but that’s the beauty of having great people around - they offer opinions and let you - the real users choose! Also recall that for decades we have been using similar “active/run-time phases” with eRM, VMM etc. So it is not a crazy concept - rather proven to work for many chip designs for many years!

Our code generator for UVM (DVC\_UVM) generates these phases with right (optimal) objections instantly. So I believe the concerns of potential mis-use are diminishing I hope.

See my DVCon US tutorial to see some of the jumping case studies.

Regards  
Srini  
[www.verifworks.com](http://www.verifworks.com)
