Hardware interview practice
Share a named UVM configuration event
A producer and consumer are created independently but must rendezvous through the global UVM event pool after configuration is published. Write the two UVM tasks that publish and consume a version number without missing an early trigger.
Starting point
Question code
class cfg_version_obj extends uvm_object; int unsigned version; endclass
task publish_cfg(int unsigned version);
task wait_cfg(output int unsigned version);Reviewed example
Work through one case
Input
Start wait_cfg first, then call publish_cfg(7) using the shared global event.Expected output
wait_cfg returns version = 7.Both tasks resolve the same named event, and the trigger data carries the published version object to the waiter.
What to cover
Requirements
- Both tasks obtain the same uvm_event from uvm_event_pool::get_global_pool().get("cfg_done").
- publish_cfg creates cfg_version_obj, fills its version, and triggers the event once with that object.
- wait_cfg uses wait_on so a trigger that happened before the task began is still observed, then reads the stored trigger data.
- The producer never resets the event; only the test resets it between test cases after both tasks finish.
