Cummings Why Use Classes For UVM Transactions
Cummings Why Use Classes For UVM Transactions
Cummings Why Use Classes For UVM Transactions
Clifford E. Cummings
Sunburst Design, Inc.
[email protected]
www.sunburst-design.com
I was clearly not the only engineer that had this question, and this is still a Frequently Asked
Question (FAQ) in my training classes. This Cliff-note will answer that question.
Classes Structs
Can have multiple fields. Can have multiple fields.
Can have randomizable fields. CANNOT have automatically
randomizable fields.
Can include randomization CANNOT include randomization
constraints. constraints.
Have a built-in randomize() method. DO NOT HAVE a built-in randomize()
method.
Can include important user-defined CANNOT include user-defined methods.
methods (such as copy, compare and
print-my-contents).
Are a dynamic type that can be Are a static type that requires all user-
generated on demand. defined structs to be declared at the
beginning of the simulation.
Class types can be extended to easily New versions of structs require a user to
create a new version with added fields completely copy the original into a new
and methods. struct and then add new fields.
Classes can be put into a UVM Non-dynamic structs cannot be put into a
factory for easy runtime substitution. UVM factory.
Classes are basically dynamic, ultra-flexible structs that can be easily randomized, easily control
the randomization, and be created whenever they are needed. Classes have the multiple field
encapsulation capability that exists in structs, plus so much more. That is why classes are the
preferred structure to represent testbench transactions.
References
Clifford E. Cummings, "UVM Transactions - Definitions, Methods and Usage," SNUG-SV 2014
- www.sunburst-design.com/papers/CummingsSNUG2014SV_UVM_Transactions.pdf
Sunburst Design, Inc. offers World Class SystemVerilog & UVM training courses. For more
information, visit the www.sunburst-design.com web site.
Email address: [email protected]