mirror of https://github.com/XS-MLVP/picker.git
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
# File : example_dut.py
|
|
# Author : automatically generated by picker
|
|
# Date : 2025-12-15 19:01:04
|
|
# 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
|
|
import random
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
# Initialize Agent (transactions auto-registered by default)
|
|
print("Initializing Agent...")
|
|
|
|
def monitor_callback(trans_type, trans_obj):
|
|
print(f"[Monitor] Receive from UVM{trans_type}: {trans_obj}")
|
|
|
|
agent = Agent(monitor_callback=monitor_callback)
|
|
print("✓ Agent initialized successfully\n")
|
|
print("-" * 70)
|
|
for i in range(5):
|
|
# Set field values using clean interface: dut.field.value
|
|
tr = adder_trans()
|
|
tr.a.value = random.randint(0, (1 << 128) - 1)
|
|
tr.b.value = random.randint(0, (1 << 128) - 1)
|
|
tr.cin.value = random.randint(0, 1)
|
|
tr.sum.value = random.randint(1, 10)
|
|
tr.cout.value = random.randint(1, 10)
|
|
print(f"[Driver] Send to UVM: {tr}")
|
|
agent.drive(tr)
|
|
|
|
agent.run(1)
|
|
|
|
|