Testbench Timeout

Hi,

I am looking for a good way to set a timeout for sequences. Generally, some of our sequences can get stuck if the module does not work correctly, e.g. when waiting for certain outputs.

Currently, this is solved by forking the sequences and starting a timeout in parallel:

fork
  seq.start(m_seqr);
  begin
    #1ms;
    `uvm_fatal(get_name(), "Reached timeout for sequence")
  end
join_any;

The advantage is that this is easier to debug instead of having some global timeout that will stop the testbench after some set time. You directly know which sequence got stuck.
This disadvantage is that it makes the tests/virtual sequences a lot less readable and maybe someone has a better solution for this.

Thanks!

This is also how we do timeouts, except with the addition of a “protection fork” and disable fork statement:

fork begin fork
  seq.start(m_seqr);
  begin
    #1ms;
    `uvm_fatal(get_name(), "Reached timeout for sequence")
  end
join_any disable fork; end join

It kills whichever thread does not complete first without potentially killing other forked threads. It’s weird, but we use it enough that it is very familiar. Maybe you could use a macro or two to make it look better and to avoid typos.