# Can I pass variable from uvm\_sequence to test class?

**URL:** <https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112>\
**Category:** UVM\
**Tags:** UVM, config\_db, uvm\_sequence, UVM-uvm\_test\
**Created:** [February 21, 2018, 9:34pm UTC](https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112 "2018-02-21T21:34:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterjin](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@peterjin](https://verificationacademy.com/forums/u/peterjin)\
**Post date:** [February 21, 2018, 9:34pm UTC](https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112/1 "2018-02-21T21:34:49Z")

</div>

I have a uvm\_sequence that generates packets and this packet has an error bit. This sequence will also randomly set the error bit field when generating the packet. Besides, there is a counter in this sequence that counts how many error packets have been generated.

In addition, I have a test class that calls this uvm\_sequence, and I would like to know how many error packets the sequence has generated. I wonder if there is a way for the **test class** to get this error\_packets\_counter information **from the uvm\_sequence**?

Thanks in advance!

Hao

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [February 21, 2018, 11:29pm UTC](https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112/2 "2018-02-21T23:29:48Z")

</div>

_In reply to [peterjin](https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112):_

I assume you want this information for use after the run\_phase is over for reporting expected errors.

The easiest thing would be to have a test config\_object that stores this information and have the sequence share the same config object.

---

<div class="post-metadata">

**Author:** ![peterjin](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@peterjin](https://verificationacademy.com/forums/u/peterjin)\
**Post date:** [February 22, 2018, 2:34am UTC](https://verificationacademy.com/forums/t/can-i-pass-variable-from-uvm-sequence-to-test-class/34112/3 "2018-02-22T02:34:05Z")

</div>

Thanks!
