# Advance time in uvm\_driver

**URL:** <https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585>\
**Category:** UVM\
**Tags:** UVM, driver, clock, data-flow-synchronization\
**Created:** [May 14, 2020, 10:14am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585 "2020-05-14T10:14:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sustrak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@Sustrak](https://verificationacademy.com/forums/u/Sustrak)\
**Post date:** [May 14, 2020, 10:14am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/1 "2020-05-14T10:14:16Z")

</div>

Given the following code, located in the _run\_phase_ of a _uvm\_driver_:

```verilog

task get_and_drive();
    seq_item_port.get_next_item(trans);
    $display("DRIVER ISSUE: %p @%t", trans, $time);
    while(credits.is_available() == 0) begin
        @(vif.cb);
    end
    `uvm_info(get_type_name(), trans.sprint(), UVM_DEBUG)

    if (trans.valid == 1)
        credits.consume();
    vif.cb.valid <= trans.valid;
    vif.cb.instr <= trans.instr;
    vif.cb.data <= trans.data;
    vif.cb.sb_id <= trans.sb_id;
    vif.cb.csr <= trans.csr;
    test_valid = trans.valid

    $display("DRIVER ISSUE TEST VALID: %0d @%t", test_valid, $time);
    seq_item_port.item_done();

    @(vif.cb);
    vif.cb.valid <= 1'b0;
    test_valid = 0;
    $display("DRIVER ISSUE TEST VALID2: %0d @%t", test_valid, $time);
    trans = null;
endtask : get_and_drive

```

I would expect an output like:

```verilog

# DRIVER ISSUE: '{m_leaf_name:"m_req", m_inst_id:3358, use_uvm_seeding:1, m_inst_count:3369, __m_uvm_status_container:@uvm_status_container@1, uvm_global_copy_map:'{ }, events:@uvm_object_string_pool__ 2@331, begin_event:@uvm_event __1@173, end_event:@uvm_event__ 1@174, m_transaction_id:8, begin_time:320000, end_time:18446744073709551615, accept_time:18446744073709551615, initiator:null, stream_handle:null, tr_recorder:null, m_sequence_id:8, m_use_sequence_info:1, m_depth:3, m_sequencer:@avispado_issue_sequencer@1, m_parent_sequence:@spike_seq@1, print_sequence_info:0, issued1:0, issued2:0, valid:1, instr:1577239255, data:1, sb_id:5, csr:139588599808, type_name:"avispado_issue_trans"} @320000

# DRIVER ISSUE TEST VALID: 1 @320000
# DRIVER ISSUE TEST VALID2: 0 @340000

```

But what I get is:

```verilog

# DRIVER ISSUE: '{m_leaf_name:"m_req", m_inst_id:3358, use_uvm_seeding:1, m_inst_count:3369, __m_uvm_status_container:@uvm_status_container@1, uvm_global_copy_map:'{ }, events:@uvm_object_string_pool__ 2@331, begin_event:@uvm_event __1@173, end_event:@uvm_event__ 1@174, m_transaction_id:8, begin_time:320000, end_time:18446744073709551615, accept_time:18446744073709551615, initiator:null, stream_handle:null, tr_recorder:null, m_sequence_id:8, m_use_sequence_info:1, m_depth:3, m_sequencer:@avispado_issue_sequencer@1, m_parent_sequence:@spike_seq@1, print_sequence_info:0, issued1:0, issued2:0, valid:1, instr:1577239255, data:1, sb_id:5, csr:139588599808, type_name:"avispado_issue_trans"} @320000
# DRIVER ISSUE TEST VALID: 1 @320000
# DRIVER ISSUE TEST VALID2: 0 @320000

```

Instead if we do the following modification in the code:

```verilog

$display("DRIVER ISSUE TEST VALID: %0d @%t", test_valid, $time);
seq_item_port.item_done();
@(vif.cb);
@(vif.cb);
vif.cb.valid <= 1'b0;
test_valid = 0;
$display("DRIVER ISSUE TEST VALID2: %0d @%t", test_valid, $time);

```

_Note the second @(vif.cb)_

The output generated is the following:

```verilog

# DRIVER ISSUE: '{m_leaf_name:"m_req", m_inst_id:3358, use_uvm_seeding:1, m_inst_count:3369, __m_uvm_status_container:@uvm_status_container@1, uvm_global_copy_map:'{ }, events:@uvm_object_string_pool__ 2@331, begin_event:@uvm_event __1@173, end_event:@uvm_event__ 1@174, m_transaction_id:8, begin_time:320000, end_time:18446744073709551615, accept_time:18446744073709551615, initiator:null, stream_handle:null, tr_recorder:null, m_sequence_id:8, m_use_sequence_info:1, m_depth:3, m_sequencer:@avispado_issue_sequencer@1, m_parent_sequence:@spike_seq@1, print_sequence_info:0, issued1:0, issued2:0, valid:1, instr:1577239255, data:1, sb_id:5, csr:139588599808, type_name:"avispado_issue_trans"} @320000
# DRIVER ISSUE TEST VALID: 1 @320000
# DRIVER ISSUE TEST VALID2: 0 @360000

```

Do you have any hint on why the time with one _@(vif.cb)_ do not advance but if we put two _@(vif.cb)_ it does it twice ?

Thanks.  
Salut!

---

<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:** [May 14, 2020, 6:22pm UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/2 "2020-05-14T18:22:14Z")

</div>

_In reply to [Sustrak](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585):_

Without seeing the entire environment, it’s difficult to determine the exact issue. The get\_next\_item() call is blocking, so there may be something in the sequence that has a time delay or different block that waits until the same time slice as your vif. When the sequence\_item is sent to the driver, the simulation is at time 320000, but the vif clocking block hasn’t been processed yet. You then wait for the vif clocking block (at the same time), which then occurs in the same time slice, hence the same simulation time displayed.

Look at the sequence and make sure that it is untimed or doesn’t have a different blocking mechanism.

---

<div class="post-metadata">

**Author:** ![Sustrak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@Sustrak](https://verificationacademy.com/forums/u/Sustrak)\
**Post date:** [May 21, 2020, 10:09am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/3 "2020-05-21T10:09:17Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/2):_

Thanks for the insight, indeed i was using in the sequence the #[time] construct to synchronize with the clock instead of using the @() notation. Once this was fixed the synchronization in the different parts of the UVM seems to follow a logical order.

Thanks.

Salut!

---

<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:** [May 21, 2020, 10:12am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/4 "2020-05-21T10:12:33Z")

</div>

_In reply to [Sustrak](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/3):_

As a follow-up, you should never have any timing constructs in your sequence. Timing events should only occur in your drivers.

---

<div class="post-metadata">

**Author:** ![Sustrak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@Sustrak](https://verificationacademy.com/forums/u/Sustrak)\
**Post date:** [May 21, 2020, 10:25am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/5 "2020-05-21T10:25:24Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/4):_

Agree but, for design reasons i need to have a forever loop in my sequence (in order to fetch instructions for my design) and I need to advance time there or the sequence will get stuck in a infinite loop.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [May 21, 2020, 11:41am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/6 "2020-05-21T11:41:47Z")

</div>

_In reply to [Sustrak](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/5):_

> _In reply to [cgales](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585/5):_  
> Agree but, for design reasons i need to have a forever loop in my sequence (in order to fetch instructions for my design) and I need to advance time there or the sequence will get stuck in a infinite loop.

The sequence is an untimed construct and does not know anything about clock cycles and progressing time.
