Can we use run task instead of body task inside a sequence

Hi,

Can we write the logic to start and stop a transaction inside run task of a sequence class instead of body task? If not can you please explain me why

Thanks

In reply to sj1992:

I recommend you try it and see. When it doesn’t work, use your simulator’s interactive mode to step through your simulation to see how it gets to the body() of a sequence. That will teach you what you want to know and much more.

In reply to sj1992:

A class derived from uvm_sequence does not have a run method.

In reply to dave_59:

Thanks for your help warner.

Hi Dave,

Can you tell me the difference between body task and run task. I believe we can use both the tasks in uvm test

Thanks

In reply to sj1992:

In reply to dave_59:
Thanks for your help warner.
Hi Dave,
Can you tell me the difference between body task and run task. I believe we can use both the tasks in uvm test
Thanks

The run_phase can be used only in components which extended from uvm_component such as uvm_test, uvm_env, uvm_monitor, etc. The uvm_sequence is not extended from uvm_component (it is being extended from uvm_sequence_base, uvm_sequence_item, uvm_transaction, uvm_object), then the run_phase never existed. If you use uvm_phase in sequence, it will be your own defined task. The uvm_sequence only has body task which is implemented in base class, this task will be called when you start the sequence.

In reply to sj1992:

What “run” task are asking about?

In reply to dave_59:

In reply to sj1992:
What “run” task are asking about?

task run();
    ovm_test_done.raise_objection(this);
      super.run();
    // start main test sequence
    seq = basic_vseq::type_id::create("seq", this);
    void'(seq.randomize());
    seq.start(vseqr);
       ovm_test_done.drop_objection(this);
  endtask : run

I saw this above code in the test class of one of my projects. And we also have a build method in this test. I don’t exactly know what code goes into these tasks

In reply to sj1992:

The OVM “run” task was renamed “run_phase” in UVM. They are virtual methods of the ovm_component/uvm_component base classes. The phasing scheduler in the OVM/UVM has a database of all components and concurrently calls these methods for each component. There is no body() method defined in the base class for components. If you define a body() method in your test component (a bad idea) it will not execute unless some other phase method calls it.