# How to Terminate UVM simulation?

**URL:** <https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026>\
**Category:** UVM\
**Tags:** UVM, simulation-Terminate\
**Created:** [December 26, 2013, 10:03am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026 "2013-12-26T10:03:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 10:03am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/1 "2013-12-26T10:03:08Z")

</div>

Hi Everyone,

```
   i have gone through the verious recommanded approches to teminate my uvm simulation but i have not find good solution. the simulation is not terminating.

```

approch 1:

a. i am raising and dropping objection in run\_phase() of all components.  
using phase.raise\_objection(this) , phase.drop\_objection(this)  
b. in test class using phase.phase\_done.display\_objections();  
c. above statement show all objections are dropped.  
d. but my simulation has hanged at top module while clock generation.

approch 2:  
along with approch 1 , i have called global\_stop\_request()/stop\_request() function. But result, simulation did not terminate.

approch 3:  
along with approch 1,2 , i have set\_drain\_time(), even status is same. i have not seen any differnce with seting drain time to 0 ,20 ,30 or any value.

How the Drain time will effect to terminate simulation.

approch 4:  
i added following two staments at “task body()”/ pre\_body(),post\_body();  
uvm\_test\_done.raise\_objection(this).  
uvm\_test\_done.dropp\_objection(this);

please give me guide line to stop simulation();

Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [December 26, 2013, 11:02am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/2 "2013-12-26T11:02:17Z")

</div>

You should only raise\_objection() and drop\_objection() in the run\_phase() of your tests, using the phase itself and not uvm\_test\_done (i.e. phase.raise\_objection() and phase.drop\_objection()). Do not use them in any components or sequences as it is difficult to track down any offenders as you are finding out. By using these in your tests, you will only have one outstanding objection per test.

Do not use global\_stop\_request() as this will not work in UVM.

Drain time is an additional amount of time that the run\_phase() will execute after all objections are dropped. This can be set on a per-test basis to account for any additional processing time needed after all your test sequences have completed.

---

<div class="post-metadata">

**Author:** ![Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/73ab20/32.png) [@Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/u/Chandra_Bhushan_Singh)\
**Post date:** [December 26, 2013, 11:05am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/3 "2013-12-26T11:05:04Z")

</div>

Use raise\_objection and drop objection in test and environment run phase . May be your EOT is blocking the end of simulation some where please check for it.  
Implement the watchdog timer and use UVM\_TIMEOUT=3500\_0ns.

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 11:11am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/4 "2013-12-26T11:11:56Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/3):_

HI cgales ,

Thank you very much.

my top module is as follows :

module top;

1. interface instance
2. DUT instance and signal connection
3. generating clock as follows

always  
#10 clock = ~clock;

initial  
begin  
  
calling run\_test();  
end

endmodule

The simulation is not terminating because the clock generation is running infinitely, so my test objection is not dropping.

Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [December 26, 2013, 11:16am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/5 "2013-12-26T11:16:36Z")

</div>

The clock generation running infinitely is not an issue. When the UVM phasing mechanism reaches the end of all phases, a $finish will be called to terminate simulator execution, including the clock.

There must be something else that is preventing the UVM from finishing. If you set UVM\_VERBOSITY to UVM\_DEBUG, you should see messages as each UVM phase executes.

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 12:34pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/6 "2013-12-26T12:34:55Z")

</div>

_In reply to [Chandra Bhushan Singh](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/5):_

HI chandra ,

thank you.

i used uvm\_timeout. it’s giving uvm\_fatal error and terminating simuation. i think we can do this by printing some fatal error.

Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/73ab20/32.png) [@Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/u/Chandra_Bhushan_Singh)\
**Post date:** [December 26, 2013, 12:48pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/7 "2013-12-26T12:48:11Z")

</div>

I think you are blocked in some where in wait statement in some logic or @. One think you can do don not use raise\_objection and drop\_objection in deep in hierarchical. Just use it in test and enviroment . And put your eot condition in env in run phase. When all sequences is completed test also drop the obection.

---

<div class="post-metadata">

**Author:** ![Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/73ab20/32.png) [@Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/u/Chandra_Bhushan_Singh)\
**Post date:** [December 26, 2013, 1:03pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/8 "2013-12-26T13:03:52Z")

</div>

Can you post your test code if possible otherwise use stepping into your test code and check where it is blocking.

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 1:05pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/9 "2013-12-26T13:05:25Z")

</div>

_In reply to [Chandra Bhushan Singh](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/8):_

Hi chandra,

i put some display() statments at end of each phase , all messages are displayed.  
i put only raise/drop objection in test. the raising is happening but not drop\_objection();

Following message displaying :

The total objection count is 1

# ---------------------------------------------------------

# Source Total

# Count Count Object

# ---------------------------------------------------------

# 0 1 uvm\_top

# 1 1 uvm\_test\_top

# ---------------------------------------------------------

# 

my last statements in test :

phase.phase\_done.display\_objections();  
phase.drop\_objection(this);  
phase.phase\_done.display\_objections();

Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 1:29pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/10 "2013-12-26T13:29:48Z")

</div>

_In reply to [Chandra Bhushan Singh](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/9):_

Hi chandra ,

in test ,  
0.phase.drop\_objection(this);

1. fork
2. starting slave seqr
3. starting master seqr  
4.join  
5.phase.phase\_done.display\_objections();  
6.phase.drop\_objection(this);  
7.phase.phase\_done.display\_objections();

the simulation is coming upto line number 5. but not executing line 6.

whenever i will comment line 3(i.e staring master seqr) my simulation is teminating. so i came to know there is problem in master sequencer. how to debug it . please guide me

very thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/73ab20/32.png) [@Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/u/Chandra_Bhushan_Singh)\
**Post date:** [December 26, 2013, 1:48pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/11 "2013-12-26T13:48:09Z")

</div>

0.phase.drop\_objection(this); i think it is typo or you doing it ??.  
Can you make sure that test run phase should have only raise\_objection and drop objection.  
If its true then only one case it is blocked because of starting master.start() is not completing.

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 1:56pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/12 "2013-12-26T13:56:08Z")

</div>

_In reply to [Chandra Bhushan Singh](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/11):_

sorry that is phase.raise\_objection(this). typing mistake.

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 26, 2013, 2:01pm UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/13 "2013-12-26T14:01:25Z")

</div>

_In reply to [kbkdec15](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/12):_

why should we raise/drop\_objection in test or env.

what happens if we raise/drop\_objection is all run\_phase();

is there any way to drop the objection which is not dropped.

Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/73ab20/32.png) [@Chandra\_Bhushan\_Singh](https://verificationacademy.com/forums/u/Chandra_Bhushan_Singh)\
**Post date:** [December 27, 2013, 5:09am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/14 "2013-12-27T05:09:25Z")

</div>

hi,

If you raise objection in run phase of each component then it may be the case then some run phases are not completing, so that will block your end of simulation. For example your driver may be the thread which will never end. So your driver may hold the simulation. If you raise objection in env with eot condition done For example ( tx\_msg == rx\_msg) its mean you are holding simulation to complete your purpose. then drop the objection. In test you are waiting for completion of all sequences.

Thanks  
CB Singh

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 27, 2013, 5:13am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/15 "2013-12-27T05:13:56Z")

</div>

_In reply to [Chandra Bhushan Singh](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/14):_

Hi chandra ,

Thank you.

last one , is there any way to drop the objection which is not dropped ?

Regards/Thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![Hash](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/e56c9b/32.png) [@Hash](https://verificationacademy.com/forums/u/Hash)\
**Post date:** [December 27, 2013, 6:24am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/16 "2013-12-27T06:24:46Z")

</div>

Hi

I think this Sunburst paper is useful,take a look  
[http://www.sunburst-design.com/papers/CummingsDVCon2011\_UVM\_TerminationTechniques.pdf](http://www.sunburst-design.com/papers/CummingsDVCon2011_UVM_TerminationTechniques.pdf)

-BR  
Hash

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [December 27, 2013, 6:32am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/17 "2013-12-27T06:32:33Z")

</div>

_In reply to [Hash](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/16):_

Hi hash ,

Thank you for reply.

i had gone through. Because of multiple concepts i got confused.

thanks  
kbkdec15

---

<div class="post-metadata">

**Author:** ![rakhimittal](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@rakhimittal](https://verificationacademy.com/forums/u/rakhimittal)\
**Post date:** [January 28, 2014, 11:36am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/18 "2014-01-28T11:36:21Z")

</div>

Hi kbkdec15  
I am a beginner in UVM. I also faced the problem of non stopping simulation.  
In my case I gave `timescale in my files. Then it worked. I don’t know whether it will work in your case.

Rakhi

---

<div class="post-metadata">

**Author:** ![Balu\_15](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@Balu\_15](https://verificationacademy.com/forums/u/Balu_15)\
**Post date:** [January 28, 2014, 11:45am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/19 "2014-01-28T11:45:26Z")

</div>

_In reply to [rakhimittal](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/18):_

hi rakhi

thanks for your reply.

i had done it,working well.

---

<div class="post-metadata">

**Author:** ![ramesh.mr](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/c5a1d2/32.png) [@ramesh.mr](https://verificationacademy.com/forums/u/ramesh.mr)\
**Post date:** [April 9, 2020, 3:39am UTC](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/20 "2020-04-09T03:39:30Z")

</div>

_In reply to [Balu\_15](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026/19):_

Hi,  
How did you resolve this issue.  
I am also facing the same issue, not able to terminate the UVM Simulation.  
Please help.

[Next page](https://verificationacademy.com/forums/t/how-to-terminate-uvm-simulation/29026.md?page=2)
