Search code examples
system-veriloguvm

How to synchronize two unrelated UVM sequence items from different UVM agents?


UVM Testbench scenario

This is my scenario for verifying a Parity Encoder-Decoder DUT. Decoder Input agent here is the re-active agent and injects error into the data stream captured from Passive monitor in Encoder Output agent.

Now I have sequence and sequence items separately for both encoder and decoder input agents. But how do I synchronize both the agents such that decoder re-active agent adds error and creates a new packet for every data in order.

e.g suppose encoder sends data in the order - 1000, 1010, 0100, 1011 and decoder re-active agent creates error packets in the order (one hot bit) - 0010, 1000, 0001, 0100. Now both create data packets unrelated to each other. However the re-active agent should xor 1st data with its 1st packet like 1000 ^ 0010 even if it receives two data i.e 1000 and 1010 together from the passive agent monitor. Also since both agents are generating items, decoder should not send an item before it receives data from encoder agent (via passive encoder agent monitor).


Solution

  • I think, you want to use the lockign mechanism between different objects.

    You can use the IPC (Interprocess Communication) methods to control that, like events, mailboxes, semaphores.

    In UVM, the advanced methods are available, like uvm_event, TLM FIFOs, which can be used in your purpose.