picker/example/Pack/02_UVM2Py/example.py

29 lines
951 B
Python

# File : example_dut.py
# Author : automatically generated by picker
# Date : 2025-12-15 20:01:23
# Description: Example usage of adder_trans DUT class
# This demonstrates pin-level interface for UVM transaction testing
# Version : v0.1
# Import from the package
from adder_trans import Agent, adder_trans
def monitor_callback(trans_type, trans_obj):
"""
Example callback function that gets called after monitor updates.
This demonstrates how to track and respond to state changes.
"""
print(f" [Monitor Update] {trans_obj.a.value} + {trans_obj.b.value} + cin -> {trans_obj.sum.value} with carry {trans_obj.cout.value}")
if __name__ == "__main__":
# Initialize Agent (transactions auto-registered by default)
agent = Agent(monitor_callback=monitor_callback)
agent.run(100)
print(" Example Completed Successfully! ".center(70))
print("="*70 + "\n")