# About uvm set default\_sequence on virtual sequencer

**URL:** <https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150>\
**Category:** UVM\
**Tags:** UVM, default\_sequence, virtual-sequencer, uvm\_config\_db\
**Created:** [February 11, 2014, 10:06am UTC](https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150 "2014-02-11T10:06:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaobo\_zhang](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/x/a4c791/32.png) [@xiaobo\_zhang](https://verificationacademy.com/forums/u/xiaobo_zhang)\
**Post date:** [February 11, 2014, 10:06am UTC](https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150/1 "2014-02-11T10:06:40Z")

</div>

Hi all;

in my one test case’s build\_phase function , i write this code uvm\_config\_db#(uvm\_object\_wrapper)::set(this,“m\_env.m\_vsqr.main\_phase”, “default\_sequence”, az\_vseq::type\_id::get() ); to set a default\_sequence.

the m\_vsqr is a virtual sequencer and the az\_vseq is a virtual sequence.

in my env’s conncet\_phase function , i connect the virtual sequencer to actual sequencer;  
function void connect\_phase(uvm\_phase phase);  
super.connect\_phase(phase);  
m\_vsqr.m\_data\_sqr = bfm\_agent.m\_data\_sqr;  
m\_vsqr.m\_mdio\_sqr = mdio\_agent.m\_mdio\_sqr;  
endfunction

I create the actual sequencer in the agent class.

in my sequence code , i raise and drop objects in the pre\_body and post\_body task.

class az\_seq extends uvm\_sequence #(seq\_item);  
`uvm\_object\_utils(az\_seq)  
int m\_pkt\_num = 15;

```
function new(string name = "az_seq");
    super.new(name);
endfunction

virtual task pre_body();
    if(starting_phase != null)
    begin
        starting_phase.raise_objection(this);
    end
endtask

virtual task post_body();
    if(starting_phase != null)
    begin
        starting_phase.drop_objection(this);
    end
endtask

```

…

when i run this case , i found the sequence don’t send any sequence\_item and finish,the sequence don’t raise and drop any objects.

Does virtual sequencer not support to set this type of default\_sequence or my config is not right?

---

<div class="post-metadata">

**Author:** ![ndalia](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/n/a183cd/32.png) [@ndalia](https://verificationacademy.com/forums/u/ndalia)\
**Post date:** [February 12, 2014, 12:45am UTC](https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150/2 "2014-02-12T00:45:49Z")

</div>

Do you have `uvm\_declare\_p\_sequencer(m\_vz) in your virtual sequence? If not then it simply doesn’t know where to run.

---

<div class="post-metadata">

**Author:** ![xiaobo\_zhang](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/x/a4c791/32.png) [@xiaobo\_zhang](https://verificationacademy.com/forums/u/xiaobo_zhang)\
**Post date:** [February 12, 2014, 1:37am UTC](https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150/3 "2014-02-12T01:37:12Z")

</div>

Hi Ndalia, i have used `uvm\_declare\_p\_sequencer(az\_vsequencer) in my virtual sequence class.

class az\_vseq extends uvm\_sequence;

`uvm_object_utils(az_vseq) `uvm\_declare\_p\_sequencer(az\_vsequencer)

phy\_mdio\_seq m\_mdio\_seq;  
phy\_az\_seq m\_data\_seq;

function new ( string name = “virtual az sequence” );  
super.new(name);  
endfunction

task body();

```
`uvm_do_on(m_mdio_seq, p_sequencer.m_mdio_sqr)
//m_mdio_seq.get_response();
`uvm_do_on(m_data_seq, p_sequencer.m_data_sqr)
//m_data_seq.get_response();

```

endtask

endclass

i refer [http://www.vip-central.org/2012/11/virtual-sequences-in-uvm-why-how/](http://www.vip-central.org/2012/11/virtual-sequences-in-uvm-why-how/) to generate my verify simulation.

---

<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:** [February 12, 2014, 1:02pm UTC](https://verificationacademy.com/forums/t/about-uvm-set-default-sequence-on-virtual-sequencer/29150/4 "2014-02-12T13:02:59Z")

</div>

Some recommendations which will make things easier:

1. Do not use the “default\_sequence” method to execute a sequence. This is a legacy carry over from long ago and makes things very difficult to understand and control. Instead, you should start sequences directly from your test. This will give you the ability to coordinate sequence execution which is what you want in a test.

2. Don’t declare or use p\_sequencer. Your virtual sequences should contain handles to the sub-sequencers instead. This ensures portability and prevents being locked into a specific sequencer type.

3. Don’t use any phases except run\_phase(). This will prevent incompatibilities when mixing UVCs from different sources. You can control ‘phasing’ by coordinating your sequences.

4. Don’t raise/lower objections except in the test itself. Since your test controls the overall execution of the environment, this should be the only place where objections are needed. Adding objections to sub-sequences when they are only run from the top level test just adds unneeded complexity.
