Why OVM should wait for watchdog timeout?

Dear all,
I run a testcase which builded by OVM.
in simple,it contain a provider which generate 10 packet and a comsumer which get the packet out from ovm channel.
I found if I did not explictly to stop the simulation.OVM will run till the watchdog timeout!
How to specify this watchdog timer?
How to stop the simulation in proper time?
Why the progrom can not stop when provider have not more packet and all the threads are waiting for nothing?
Thank you very much!

and how to use set_global_timeout?
I invoke ovm_top.set_global_stop_timeout(1000),but simulator did not recognize it.
It seems it’s not a function in ovm_top.
Thank you!

my god !
in ovm_reference,in page 276,there is a ovm_top’s function set_global_stop_timeout.but in release note of 1.1,it said set_global_stop_timeout is removed!
It take me a lot of time to …


faint!

I found something interesting in OVM1.1,ovm_root.svh:
1.

time phase_timeout = `OVM_DEFAULT_TIMEOUT;
 time stop_timeout  = `OVM_DEFAULT_TIMEOUT;
timeout = (phase_timeout==0) ?  `OVM_DEFAULT_TIMEOUT : phase_timeout;
....
#timeout ovm_report_error("TIMOUT",
                      $psprintf("Watchdog timeout of '%0t' expired.", timeout));

That means,we can not to set the stop_timeout to achieve the exact timeout unless you set the phase_timeout the same value instead of stop_timeout!
Is it right?

Dear all,
Who know how to specify the exact watchdog timer to have the simulation exit on the right time I want?
Thank you very much!

Dear all
Nobody know or nobody did it or it’s not a good question?
Thanks

Who know how to specify the exact watchdog timer to have the simulation exit on the right time I want?

Use the global function

set_global_timeout(VALUE);

or

ovm_top.phase_timeout = VALUE;
The reason there are two ways is due to backward compatibility.

The OVM can make no assumptions about when to end the run phase. It must be done explicitly by the user. We recommend using global_stop_request() at the appropriate time.

To answer your other questions:

How to stop the simulation in proper time?
Why the progrom can not stop when provider have not more packet and all the threads are waiting for nothing?

The OVM can not know what time the user wishes to exit the run phase. That has to be programmed in. There are many ways to do this. Here are some:

initial #DELAY global_stop_request();

where DELAY is > than time to process the 10 transactions
2. Have producer call
global_stop_request()
after putting 10 transactions. The stop() mechanism will then govern when individual components shut down.
3. Set a transaction count var in the consumer.[LIST=1]
4. Once reached, calls
global_stop_request(),
or
5. Instead of having consumer call
global_stop_request
, do (2), and have the consumer set
enable_stop_interrupt
and implement
stop()
task as
@(trans_countdown==0);

[]Instantiate a scoreboard/response checker that makes sure the consumer executes as many transactions as the producer.
[
]In consumer, if fifo stays empty for > X time, call
global_stop_request()
[/LIST]Hope this helps.

Hi Tom,
Thanks for your detailed explaination!
Could you give more information about how to do this:

Instead of having consumer call
global_stop_request
, do (2), and have the consumer set
enable_stop_interrupt
and implement
stop()
task as
@(trans_countdown==0);

I mean how OVM will invoke stop() task? and how to implement stop()task? can we use Delay in stop() task?what’s the relationship between stop() and stop_timeout?
Thank you very much!

Hi Ahan,

The stop task is called automatically by global_stop_request or ovm_top.stop_request. Please see my reply to your other thread for an example (http://ovmworld.org/forums/showthread.php?t=382)

The ovm_top.stop_timeout sets a maximum time that any phase may remain active (e.g. due to a stop task) following a call to stop_request.

Regards,
Dave

With the Help from David long,Tom …
I finally know how the ovm is runing.
Here are my understanding,please correct me:
1.ovm fork all the phase of every component,m_stop_process() and phase_timeout thread in ovm_root.svh:

fork : task_based_phase
          m_stop_process();
          begin
            m_do_phase_all(this,m_curr_phase);
            wait fork;
          end
          #timeout ovm_report_error("TIMOUT",
                      $psprintf("Watchdog timeout of '%0t' expired.", timeout));
        join_any
        disable task_based_phase;

If you do not explicitly to stop the simulation,it will run till phase_timeout.

How to stop manually:
2.you can explicity call ovm_top.stop_request or
global_stop_request()

function void ovm_root::stop_request();
  ->m_stop_request_e;
endfunction
 
// m_stop_process
// --------------
task ovm_root::m_stop_process();
  @m_stop_request_e;
  m_stop_request(stop_timeout);
endtask

The m_stop_request will fork all stop() of verification component and stop_timeout thread before it kill all the process.

fork begin // guard process
    fork
      begin
        m_do_stop_all(this);
        wait fork;
      end
      begin
        #timeout;
        ovm_report_warning("STPTO",
         $psprintf("Stop-request timeout of %0t expired. Stopping phase '%0s'",
                           timeout, m_curr_phase.get_name()));
      end
    join_any
    disable fork;
  end

Only if the enable_stop_interrupt==1,verification component will start the stop() task.otherwise,it will exit and directly go to kill all the process.
If enable_stop_interrupt==1 and stop task is longer(time) than stop_timeout.then it will exit at stop_timeout!
Any one of above two thread will exit fork and kill all the process.

That’s all.
Thanks all the kind help from expertise.
Hope this topics can help others.
Thank you!