Can I pass variable from uvm_sequence to test class?

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!


In reply to peterjin:

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.