# Regarding Sequence issue related to UVM1.2

**URL:** <https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991>\
**Category:** UVM\
**Tags:** UVM\_INFO-packet\_sequencesv38--0-uvm\_test\_topeagseqrpacket\_sequence-TRACE-unitpacket\_sequencebody-wait-grant, UVM, sequence, UVM12\
**Created:** [January 6, 2020, 6:12pm UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991 "2020-01-06T18:12:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sravankumarpothu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@sravankumarpothu](https://verificationacademy.com/forums/u/sravankumarpothu)\
**Post date:** [January 6, 2020, 6:12pm UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/1 "2020-01-06T18:12:56Z")

</div>

Hi All, i am Sravan Kumar.

I am verifying One Small example code for testing UVM1.1d and UVM1.2 environment, i wrote a sequence and i am randomizing the packet for 5 times and driving it to the driver.  
The main problem i am facing here is when i ran the environment in UVM1.1d mode it drives 5 packets to the driver and in UVM1.2 mode driver getting only 2 packets .For the third packet the sequence is stucked at the wait\_grant method and drops the objection.  
Why it is happening ??  
can anyone provide me the solution ASAP?

```verilog
class packet_sequence extends uvm_sequence # (packet);
  
  `uvm_object_utils(packet_sequence)
  
  function new (string name = "packet_sequence");
    super.new(name);
    `uvm_info("packet_sequence",$sformatf("%m"),UVM_MEDIUM);
  endfunction
  
  task body();
    `uvm_info("TRACE",$sformatf("%m"),UVM_MEDIUM);
    `uvm_info("TRACE",$sformatf("%m 11111111111"),UVM_MEDIUM);
    if (starting_phase != null)
     begin
      starting_phase.raise_objection(this);
     end 
 
    repeat (5)
    begin
      req = packet::type_id::create("req");
     `uvm_info("TRACE",$sformatf("%m wait grant"),UVM_MEDIUM);
      wait_for_grant(10, 0);    
     `uvm_info("TRACE",$sformatf("%m get grant"),UVM_MEDIUM);
      assert(req.randomize());
      send_request(req);  
     `uvm_info("TRACE",$sformatf("%m send req"),UVM_MEDIUM);
      wait_for_item_done();  
     `uvm_info("TRACE",$sformatf("%m seq task done"),UVM_MEDIUM);
    end
    
    if (starting_phase != null)
    begin
      starting_phase.drop_objection(this);
      `uvm_info("TRACE",$sformatf("%m //TESTING//"),UVM_MEDIUM);
    end
    
  endtask
  
endclass

```

Result:

```auto
UVM_INFO driver.sv(43) @ 0: uvm_test_top.e.ag.drv [DRIVER] Waiting for data from sequencer
UVM_INFO packet_sequence.sv(7) @ 0: reporter@@packet_sequence [packet_sequence] $unit::\packet_sequence::new 
UVM_INFO packet_sequence.sv(11) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body 
UVM_INFO packet_sequence.sv(12) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body 11111111111
UVM_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new 
UVM_INFO packet_sequence.sv(38) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body wait grant
UVM_INFO packet_sequence.sv(40) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body get grant
UVM_INFO packet_sequence.sv(45) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body send req
UVM_INFO driver.sv(46) @ 0: uvm_test_top.e.ag.drv [DRIVER] Getting data
------------------------------
Name Type Size Value
------------------------------
req packet - @806 
  a integral 8 'h1  
  b integral 8 'h3  
  doAdd integral 1 'h0  
------------------------------
UVM_INFO driver.sv(54) @ 0: uvm_test_top.e.ag.drv [DRIVER] Driver task done
UVM_INFO driver.sv(43) @ 0: uvm_test_top.e.ag.drv [DRIVER] Waiting for data from sequencer
UVM_INFO packet_sequence.sv(47) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body seq task done
UVM_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new 
UVM_INFO packet_sequence.sv(38) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body wait grant
UVM_INFO packet_sequence.sv(40) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body get grant
UVM_INFO packet_sequence.sv(45) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body send req
UVM_INFO driver.sv(46) @ 0: uvm_test_top.e.ag.drv [DRIVER] Getting data
------------------------------
Name Type Size Value
------------------------------
req packet - @826 
  a integral 8 'h4  
  b integral 8 'h3  
  doAdd integral 1 'h0  
------------------------------
UVM_INFO driver.sv(54) @ 0: uvm_test_top.e.ag.drv [DRIVER] Driver task done
UVM_INFO driver.sv(43) @ 0: uvm_test_top.e.ag.drv [DRIVER] Waiting for data from sequencer
UVM_INFO packet_sequence.sv(47) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body seq task done
UVM_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new 
UVM_INFO packet_sequence.sv(38) @ 0: uvm_test_top.e.ag.seqr@@packet_sequence [TRACE] $unit::\packet_sequence::body wait grant
UVM_INFO /apps/vcsmx/vcs/P-2019.06-1//etc/uvm-1.2/src/base/uvm_report_server.svh(894) @ 0: reporter [UVM/REPORT/SERVER] 
--- UVM Report Summary ---

** Report counts by severity
UVM_INFO : 33
UVM_WARNING : 0
UVM_ERROR : 0
UVM_FATAL : 0
** Report counts by id
[DRIVER] 7
[RNTST] 1
[TRACE] 14
[UVM/RELNOTES] 1
[UVMTOP] 1
[agent] 1
[drv] 1
[env] 1
[packet] 4
[packet_sequence] 1
[test] 1

$finish called from file "/apps/vcsmx/vcs/P-2019.06-1//etc/uvm-1.2/src/base/uvm_root.svh", line 613.
$finish at simulation time 0

```

---

<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:** [January 7, 2020, 11:24am UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/2 "2020-01-07T11:24:50Z")

</div>

_In reply to [sravan kumar pothu](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991):_

Some comments that may help you:

- Don’t raise/drop objections in a sequence. You should only raise/drop one objection in your test, encompassing all of your test sequences.
- Don’t use wait\_for\_grant()/send\_request()/wait\_for\_item\_done(). Instead, use start\_item()/finish\_item(). It is simpler and easier to debug.
- Don’t use assert() around a randomize call. An assert statement may be optimized away inadvertently if assertions are disabled. Instead, explicitly check the return value.

All of your transactions are completing at time 0, which indicates that you may have a driver issue.

---

<div class="post-metadata">

**Author:** ![sravankumarpothu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@sravankumarpothu](https://verificationacademy.com/forums/u/sravankumarpothu)\
**Post date:** [January 7, 2020, 1:01pm UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/3 "2020-01-07T13:01:38Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/2):_

Hi cgales,Thank you for your response.  
Already I made all these changes and tried even though it is not working in UVM1.2 and it is giving the same result as before.

Below i am sharing the code which i have modified, If any mistakes i did please let me know.

```verilog

class packet_sequence extends uvm_sequence # (packet);
  
  `uvm_object_utils(packet_sequence)
  
  function new (string name = "packet_sequence");
    super.new(name);
    `uvm_info("packet_sequence",$sformatf("%m"),UVM_MEDIUM);
  endfunction
  
  task body();
    `uvm_info("TRACE",$sformatf("%m"),UVM_MEDIUM);
    `uvm_info("TRACE",$sformatf("%m 11111111111"),UVM_MEDIUM);
    if (starting_phase != null)
     begin
      starting_phase.raise_objection(this);
     end 
    
    repeat(5)
      begin
        req = packet::type_id::create("req");
        `uvm_info("TRACE",$sformatf("%m wait grant"),UVM_MEDIUM);
         start_item(req);
        `uvm_info ("SEQ", $sformatf("start_item() fn call done"), UVM_MEDIUM)
         req.randomize();    
         finish_item(req);
      end  
    if (starting_phase != null)
     begin
      starting_phase.drop_objection(this);
      `uvm_info("TRACE",$sformatf("%m 77777777777"),UVM_MEDIUM);
     end
    
  endtask
  
endclass

class test extends uvm_test;
  `uvm_component_utils(test)
  env e ;
  packet_sequence p_seq;
  uvm_sequencer #(packet) p_seqr0;
  //uvm_factory factory;
  //uvm_coreservice_t cs = uvm_coreservice_t::get();
  
  function new(string name,uvm_component parent);
    super.new(name,parent);
    `uvm_info("test",$sformatf("%m"),UVM_MEDIUM);
  endfunction : new 
  
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    `uvm_info("TRACE",$sformatf("%m"),UVM_MEDIUM);
    e=env::type_id::create("e",this);
    p_seqr0 = uvm_sequencer#(packet)::type_id::create ("p_seqr0", this);
  endfunction : build_phase 

  function void start_of_simulation_phase (uvm_phase phase);
    super.start_of_simulation_phase(phase);
    `uvm_info("TRACE",$sformatf("%m"),UVM_MEDIUM);
    uvm_top.print_topology();
  // factory.print();
    
  endfunction : start_of_simulation_phase
  
  virtual task run_phase(uvm_phase phase);
      p_seq=packet_sequence::type_id::create("p_seq",this);
      phase.raise_objection(this);
 	  p_seq.start(p_seqr0);
      phase.drop_objection(this);
  endtask
  
endclass

class driver extends uvm_driver # (packet);
  
  `uvm_component_utils(driver);
  
    virtual add_sub_if vif;

  
  function new(string name, uvm_component parent);
    super.new(name,parent);
    `uvm_info("drv",$sformatf("%m"),UVM_MEDIUM);
  endfunction
  
  function void build_phase (uvm_phase phase );
    super.build_phase(phase);
    uvm_config_db # (virtual add_sub_if) :: get (this, "", "add_sub_if",vif);
  endfunction
  
  task run_phase (uvm_phase phase);
    super.run_phase(phase);
    
    vif.a=0;
    vif.b=0;
    vif.doAdd=0;
    
    forever   
      begin
        //for the above line we are getting a cross module reference error . 
        `uvm_info ("DRIVER", $sformatf ("Waiting for data from sequencer"), UVM_MEDIUM);
        seq_item_port.get_next_item(req);
        
        `uvm_info ("DRIVER", $sformatf ("Getting data"), UVM_MEDIUM);
    // @(negedge vif.clk);
        send();
       // this.print();

        req.print(); 
        //this.print();
   // @(negedge vif.clk);
        seq_item_port.item_done();
        `uvm_info ("DRIVER", $sformatf ("Driver task done"), UVM_MEDIUM);
      end

       
  endtask
  
  task send ();
    vif.a<=req.a;
    vif.b<=req.b;
    vif.doAdd<=req.doAdd;
  endtask
  
endclass

```

## Result: UVM\_INFO driver.sv(43) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Waiting for data from sequencer UVM\_INFO packet\_sequence.sv(7) @ 0: reporter@@p\_seq [packet\_sequence] $unit::\packet\_sequence::new UVM\_INFO packet\_sequence.sv(11) @ 0: uvm\_test\_top.p\_seqr0@@p\_seq [TRACE] $unit::\packet\_sequence::body UVM\_INFO packet\_sequence.sv(12) @ 0: uvm\_test\_top.p\_seqr0@@p\_seq [TRACE] $unit::\packet\_sequence::body 11111111111 UVM\_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new UVM\_INFO packet\_sequence.sv(21) @ 0: uvm\_test\_top.p\_seqr0@@p\_seq [TRACE] $unit::\packet\_sequence::body wait grant UVM\_INFO packet\_sequence.sv(7) @ 0: reporter@@packet\_sequence [packet\_sequence] $unit::\packet\_sequence::new UVM\_INFO packet\_sequence.sv(11) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [TRACE] $unit::\packet\_sequence::body UVM\_INFO packet\_sequence.sv(12) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [TRACE] $unit::\packet\_sequence::body 11111111111 UVM\_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new UVM\_INFO packet\_sequence.sv(21) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [TRACE] $unit::\packet\_sequence::body wait grant UVM\_INFO packet\_sequence.sv(23) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [SEQ] start\_item() fn call done UVM\_INFO driver.sv(46) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Getting data

## Name Type Size Value

## req packet - @829 a integral 8 'h4 b integral 8 'h2 doAdd integral 1 'h1 begin\_time time 64 0 depth int 32 'd2 parent sequence (name) string 15 packet\_sequence parent sequence (full name) string 38 uvm\_test\_top.e.ag.seqr.packet\_sequence sequencer string 22 uvm\_test\_top.e.ag.seqr

## UVM\_INFO driver.sv(55) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Driver task done UVM\_INFO driver.sv(43) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Waiting for data from sequencer UVM\_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new UVM\_INFO packet\_sequence.sv(21) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [TRACE] $unit::\packet\_sequence::body wait grant UVM\_INFO packet\_sequence.sv(23) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [SEQ] start\_item() fn call done UVM\_INFO driver.sv(46) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Getting data

## Name Type Size Value

## req packet - @846 a integral 8 'h3 b integral 8 'h1 doAdd integral 1 'h1 begin\_time time 64 0 depth int 32 'd2 parent sequence (name) string 15 packet\_sequence parent sequence (full name) string 38 uvm\_test\_top.e.ag.seqr.packet\_sequence sequencer string 22 uvm\_test\_top.e.ag.seqr

UVM\_INFO driver.sv(55) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Driver task done  
UVM\_INFO driver.sv(43) @ 0: uvm\_test\_top.e.ag.drv [DRIVER] Waiting for data from sequencer  
UVM\_INFO packet.sv(20) @ 0: reporter@@req [packet] $unit::\packet::new  
UVM\_INFO packet\_sequence.sv(21) @ 0: uvm\_test\_top.e.ag.seqr@@packet\_sequence [TRACE] $unit::\packet\_sequence::body wait grant  
Execution interrupted or reached maximum runtime.  
Done

---

<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:** [January 7, 2020, 1:28pm UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/4 "2020-01-07T13:28:16Z")

</div>

_In reply to [sravan kumar pothu](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/3):_

Why are you creating ‘p\_seqr0’ in your test? You should be starting p\_seq on your agent sequencer, not an unconnected sequencer in you test.

---

<div class="post-metadata">

**Author:** ![sravankumarpothu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@sravankumarpothu](https://verificationacademy.com/forums/u/sravankumarpothu)\
**Post date:** [January 7, 2020, 1:58pm UTC](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/5 "2020-01-07T13:58:08Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/regarding-sequence-issue-related-to-uvm1-2/36991/4):_

Hi cgales,  
I tried with sequencer which is present inside the agent and i remove that p\_seq0.  
Now its working fine Thanks for your help.

Thanks and regards,  
Sravan Kumar
