Verification Academy Patterns Library
Verification Academy Patterns Library
Pattern Name: Resource Sharing Pattern
Intent: The Resource Sharing Pattern is used to share resources between
objects without requiring detailed knowledge of the resource. Related
resources share common access attributes thereby creating simple associations.
Motivation: A hierarchical simulation environment contains resources required
by other components as well as test writers. A consistent mechanism for
sharing resources promotes horizontal and vertical reuse. A simple mechanism
that requires no knowledge of the simulation environment hierarchy eases the
task of test and stimulus creation.
Applicability: The Resource Sharing Pattern can be used when reusing
verification components. It can also be used to reduce the overhead of adding
test writers to a project.
Structure:
Resource Sharing Attributes
Attribute Value
cntxt null
inst_name String identifying resource group
field_name String identifying specific resource
Page 1 © Mentor Graphics Corporation, all rights reserved.
Verification Academy Patterns Library
Implementation: The Resource Sharing Pattern can be implemented using
either the uvm_config_db or uvm_resource_db within UVM. For the example
below the uvm_config_db was selected because of its simplicity of use and use
model available. The uvm_config_db has two methods for resource sharing: set
and get. It also supports the generic scope use model shown in this example as
well as a hierarchical scope use model required to share specific resources with
specific objects. Resources shared can include but not be limited to
configuration objects, virtual interface handles and sequencer handles.
Example: Let us consider a DUT with various protocol interface ports. Each
interface on the DUT is given a unique string identifier. For this example let us
give one of the interface ports the unique string identifier
“INGRESS_DATA_PORT”. This unique string identifier is used for the field_name
attribute listed in the structure table. All resources for that interface including
the virtual interface handle, agent configuration handle and sequencer handle
are identified using the unique string identifier. The table below shows the
values used to provide and access the various resources associated with this
interface.
Resource cntxt inst_name filed_name
Configuration handle null “CONFIGURATIONS” “INGRESS_DATA_PORT”
Virtual interface handle null “INTERFACES” “INGRESS_DATA_PORT”
Sequencer handle null “SEQUENCERS” “INGRESS_DATA_PORT”
The required constructs are available to environment developers to share
resources within the environment. The test writer only needs to know the
information in the table to access resources associated with the ingress data
port on the design. No detailed knowledge of environment hierarchy is required
to write test scenarios.
Contributor: Bob Oden
Release Date: February 25, 2016
Page 2 © Mentor Graphics Corporation, all rights reserved.
Verification Academy Patterns Library
Corrections and Suggestions: To improve the quality of the Verification Academy
Patterns Library we welcome your comments, suggestions, and corrections. Please
contact us at: https://verificationacademy.com/contact
Page 3 © Mentor Graphics Corporation, all rights reserved.