Background sequences and phases methodology

Hi,

In most testbenches I’ve worked on there’s often a need to launch some background sequence e.g. an audio stream, sensor data, mains supply etc…
these are

  • always running background sequences
  • that don’t raise any objections to ending the run_phase()
  • statically configured from config object.

I generally start them from the run_phase in a concurrent thread (join_none) and have little interaction with them from the testcase. except maybe a change of audio volume etc… At the end of simulation they’re automatically killed.

My question is, is this the right approach? is there a better way to handle background sequences? I often considered that they should be started in configure_phase() instead of run_phase() but its not possible to have an always on sequence in any phase other than run_phase(). Is it ok to leave them to be killed automatically or should the process be recorded and stopped in shutdown_phase(). There’s a suggestion in forum to run background sequences in uvm_env.run_phase()…

Best regards

Damian

In reply to DamianS:

You are taking the only valid approach which is to start them at the beginning of the run_phase(). All other phases are not time consuming, so you can’t run any sequences during those phases. Having them killed at the end of the run_phase() shouldn’t cause any issues unless there is something that you need to extract from them.

In reply to cgales:

Cgales I believe SamianS is asking something differently, because the configure_phase is also time consuming. But it is a bad approach to mix the run_phase with the sub_phases like the configure_phase. Instead of the run_phase you should use then the main_phase.
But it is unclear to me if you really need the configure_phase, because you do not describe what your non-background sequences are doing.

In reply to chr_sue:

You are correct. The configure_phase() is a sub-phase of the run_phase(). The issue with using a sub-phase of the run_phase() is that all sequences started in a sub-phase will be killed when that sub-phase ends. If you want a sequence to run for the entire run_phase(), it needs to be started within that phase. Hence one reason that sub-phases aren’t recommended.

In reply to cgales:

Thanks for replies, I think that’s clear then. Launching from run_phase() is ok and I can let the UVM magic take care of killing them at the end of test. Sub phases aren’t recommended.