Systemverilog Constraint Layering Via Reusable Randomization Policy Classes Poster
Systemverilog Constraint Layering Via Reusable Randomization Policy Classes Poster
Problem: How to reuse Solution: Put constraints in Examples More details in the paper Conclusions
The two examples below illustrate the concept See the paper for more applications of this idea: Randomization policy classes provide a flexible
random constraints? “Policy Classes” for a simple address transaction. Two policies • policy_list classes encapsulate a list of and efficient way to add different types of
SystemVerilog constraints may be added to an Putting the constraints in a standalone class
constrain the generated addresses to lie within policies. Lists may be nested to any number constraints into an object being randomized.
object via inheritance or with inline constraints allows them to be defined once then added into
permitted regions and outside prohibited of levels. This technique can be used with native
specified when the object is randomized (e.g. other objects as needed. Policies can be mixed
regions. • Policies with persistent state information SystemVerilog or can be applied to UVM.
obj.randomize with {…} ) But the SV and matched in any combination.
e.g. keep track of recently used addresses
language doesn’t define a way to easily reuse
and use them in constraints for subsequent
constraints in multiple objects.
randomizations.
Transaction Class
4 Queue of policies for
this transaction
rand bit [31:0]
rand int
addr;
size;
class addr_txn;
rand bit [31:0] addr; rand policy_base#(addr_txn) policy[$];
rand int size;