Universal Verification Methodology
(UVM) 1.1 User’s Guide
May 18, 2011
ii UVM 1.1 User’s Guide May 18, 2011
Copyright
©
2011 Accellera. All rights reserved.
Copyright
©
2011 Cadence Design Systems, Inc. (Cadence). All rights reserved.
Cadence Design Systems, Inc., 2655 Seely Ave., San Jose, CA 95134, USA.
Copyright
©
2011 Mentor Graphics, Corp. (Mentor). All rights reserved.
Mentor Graphics, Corp., 8005 SW Boeckman Rd., Wilsonville, OR 97070, USA
Copyright
©
2011 Synopsys, Inc. (Synopsys). All rights reserved.
Synopsys, Inc., 700 E. Middlefield Rd, Mountain View, CA 94043
This product is licensed under the Apache Software Foundation’s Apache License, Version 2.0,
January 2004. The full license is available at: http://www.apache.org/licenses/
.
Notices
While this guide offers a set of instructions to perform one or more specific verification tasks, it should be
supplemented by education, experience, and professional judgment. Not all aspects of this guide may be
applicable in all circumstances. The UVM 1.1 User’s Guide does not necessarily represent the standard of
care by which the adequacy of a given professional service must be judged nor should this document be
applied without consideration of a project’s unique aspects. This guide has been approved through the
Accellera consensus process and serves to increase the awareness of information and approaches in
verification methodology. This guide may have several recommendations to accomplish the same thing and
may require some judgment to determine the best course of action.
The UVM 1.1 Class Reference represents the foundation used to create the UVM 1.1 User’s Guide. This
guide is a way to apply the UVM 1.1 Class Reference, but is not the only way. Accellera believes standards
are an important ingredient to foster innovation and continues to encourage industry innovation based on its
standards.
Suggestions for improvements to the UVM 1.1 User’s Guide are welcome. They should be sent to the VIP
email reflector
vip-tc@lists.accellera.org
The current Working Group’s website address is
www.accellera.org/activities/vip
May 18, 2011 UVM 1.1 User’s Guide iii
Contents
1. Overview.............................................................................................................................................. 1
1.1 Introduction to UVM.................................................................................................................. 1
1.1.1 Coverage-Driven Verification (CDV) ........................................................................ 1
1.1.2 Testbenches and Environments .................................................................................. 1
1.2 Verification Component Overview ............................................................................................ 3
1.2.1 Data Item (Transaction) .............................................................................................. 3
1.2.2 Driver (BFM) ..............................................................................................................3
1.2.3 Sequencer .................................................................................................................... 3
1.2.4 Monitor ....................................................................................................................... 3
1.2.5 Agent ........................................................................................................................... 4
1.2.6 Environment ................................................................................................................ 4
1.3 The UVM Class Library............................................................................................................. 5
1.4 Other UVM Facilities................................................................................................................. 7
1.4.1 UVM Factory .............................................................................................................. 7
1.4.2 Transaction-Level Modeling (TLM) .......................................................................... 8
2. Transaction-Level Modeling (TLM) ................................................................................................... 9
2.1 Overview .................................................................................................................................... 9
2.2 TLM, TLM-1, and TLM-2.0 ......................................................................................................9
2.2.1 TLM-1 Implementation ............................................................................................ 10
2.2.2 TLM-2.0 Implementation ......................................................................................... 10
2.3 Basics ....................................................................................................................................... 10
2.3.1 Transactions ..............................................................................................................10
2.3.2 Transaction-Level Communication .......................................................................... 11
2.3.3 Basic TLM Communication ..................................................................................... 11
2.3.4 Communicating between Processes .......................................................................... 12
2.3.5 Blocking versus Nonblocking ................................................................................... 13
2.3.6 Connecting Transaction-Level Components ............................................................ 13
2.3.7 Peer-to-Peer connections .......................................................................................... 14
2.3.8 Port/Export Compatibility ......................................................................................... 14
2.4 Encapsulation and Hierarchy ................................................................................................... 14
2.4.1 Hierarchical Connections .......................................................................................... 14
2.4.2 Connection Types ..................................................................................................... 16
2.5 Analysis Communication ......................................................................................................... 16
2.5.1 Analysis Ports ........................................................................................................... 16
2.5.2 Analysis Exports ....................................................................................................... 17
2.6 Generic Payload ....................................................................................................................... 18
2.6.1 Attributes .................................................................................................................. 18
2.6.2 Accessors .................................................................................................................. 19
2.6.3 Extensions ................................................................................................................. 20
2.7 Core Interfaces and Ports ......................................................................................................... 21
2.8 Blocking Transport................................................................................................................... 22
2.9 Nonblocking Transport ............................................................................................................ 22
2.10 Sockets ..................................................................................................................................... 24
2.11 Time ......................................................................................................................................... 26
2.12 Use Models............................................................................................................................... 28
iv UVM 1.1 User’s Guide May 18, 2011
3. Developing Reusable Verification Components................................................................................ 31
3.1 Modeling Data Items for Generation ....................................................................................... 31
3.1.1 Inheritance and Constraint Layering ......................................................................... 32
3.1.2 Defining Control Fields (“Knobs”) ........................................................................... 33
3.2 Transaction-Level Components ............................................................................................... 34
3.3 Creating the Driver................................................................................................................... 36
3.4 Creating the Sequencer............................................................................................................. 37
3.5 Connecting the Driver and Sequencer..................................................................................... 37
3.5.1 Basic Sequencer and Driver Interaction ................................................................... 38
3.5.2 Querying for the Randomized Item .......................................................................... 38
3.5.3 Fetching Consecutive Randomized Items ................................................................. 39
3.5.4 Sending Processed Data back to the Sequencer ........................................................ 39
3.5.5 Using TLM-Based Drivers ....................................................................................... 40
3.6 Creating the Monitor ................................................................................................................ 40
3.7 Instantiating Components......................................................................................................... 42
3.8 Creating the Agent ................................................................................................................... 43
3.8.1 Operating Modes ....................................................................................................... 44
3.8.2 Connecting Components ........................................................................................... 45
3.9 Creating the Environment ........................................................................................................ 45
3.9.1 The Environment Class ............................................................................................. 46
3.9.2 The UVM Configuration Mechanism ....................................................................... 46
3.10 Enabling Scenario Creation...................................................................................................... 47
3.10.1 Declaring User-Defined Sequences .......................................................................... 48
3.10.2 Generating Stimulus with Sequences and Sequence Items ...................................... 49
3.10.3 Configuring the Sequencer’s Default Sequence ....................................................... 52
3.10.4 Overriding Sequence Items and Sequences .............................................................. 53
3.11 Managing End of Test.............................................................................................................. 54
3.12 Implementing Checks and Coverage........................................................................................ 55
3.12.1 Implementing Checks and Coverage in Classes ....................................................... 56
3.12.2 Implementing Checks and Coverage in Interfaces ................................................... 57
3.12.3 Controlling Checks and Coverage ............................................................................ 58
4. Using Verification Components ........................................................................................................ 59
4.1 Using a Verification Component.............................................................................................. 59
4.2 Testbench Class........................................................................................................................ 59
4.3 Instantiating Verification Components .................................................................................... 60
4.4 Test Class ................................................................................................................................. 62
4.5 Verification Component Configuration ................................................................................... 62
4.5.1 Verification Component Configurable Parameters ................................................... 62
4.5.2 Verification Component Configuration Mechanism ................................................ 63
4.5.3 Choosing between uvm_resource_db and uvm_config_db ...................................... 64
4.5.4 Using a Configuration Class ..................................................................................... 64
4.6 Creating and Selecting a User-Defined Test ............................................................................ 65
4.6.1 Creating the Base Test .............................................................................................. 65
4.6.2 Creating Tests from a Test-Family Base Class ......................................................... 65
4.6.3 Test Selection ............................................................................................................66
4.7 Creating Meaningful Tests ....................................................................................................... 67
4.7.1 Constraining Data Items ........................................................................................... 67
4.7.2 Data Item Definitions ................................................................................................ 68
4.7.3 Creating a Test-Specific Frame ................................................................................ 68
May 18, 2011 UVM 1.1 User’s Guide v
4.8 Virtual Sequences..................................................................................................................... 69
4.8.1 Creating a Virtual Sequencer .................................................................................... 70
4.8.2 Creating a Virtual Sequence ..................................................................................... 71
4.8.3 Controlling Other Sequencers ................................................................................... 72
4.8.4 Connecting a Virtual Sequencer to Subsequencers .................................................. 72
4.9 Checking for DUT Correctness................................................................................................ 73
4.10 Scoreboards .............................................................................................................................. 74
4.10.1 Creating the Scoreboard ............................................................................................ 74
4.10.2 Adding Exports to uvm_scoreboard ......................................................................... 75
4.10.3 Requirements of the TLM Implementation .............................................................. 75
4.10.4 Defining the Action Taken ....................................................................................... 75
4.10.5 Adding the Scoreboard to the Environment ............................................................. 76
4.10.6 Summary ................................................................................................................... 76
4.11 Implementing a Coverage Model............................................................................................. 77
4.11.1 Selecting a Coverage Method ................................................................................... 77
4.11.2 Implementing a Functional Coverage Model ........................................................... 77
4.11.3 Enabling and Disabling Coverage ............................................................................ 77
5. Using the Register Layer Classes ...................................................................................................... 79
5.1 Overview .................................................................................................................................. 79
5.2 Usage Model ............................................................................................................................ 79
5.2.1 Sub-register Access ................................................................................................... 82
5.2.2 Mirroring ................................................................................................................... 83
5.2.3 Memories are not Mirrored ....................................................................................... 84
5.3 Access API ............................................................................................................................... 84
5.3.1 read / write ................................................................................................................ 84
5.3.2 peek / poke ................................................................................................................ 85
5.3.3 get / set ...................................................................................................................... 85
5.3.4 randomize .................................................................................................................. 85
5.3.5 update ........................................................................................................................ 86
5.3.6 mirror ........................................................................................................................ 86
5.3.7 Concurrent Accesses ................................................................................................. 86
5.4 Coverage Models...................................................................................................................... 87
5.4.1 Predefined Coverage Identifiers ............................................................................... 87
5.4.2 Controlling Coverage Model Construction and Sampling ....................................... 87
5.5 Constructing a Register Model................................................................................................. 88
5.5.1 Field Types ...............................................................................................................88
5.5.2 Register Types .......................................................................................................... 94
5.5.3 Register File Types ................................................................................................... 97
5.5.4 Memory Types .......................................................................................................... 99
5.5.5 Block Types ............................................................................................................ 100
5.5.6 Packaging a Register Model ................................................................................... 104
5.5.7 Maximum Data Size ............................................................................................... 104
5.6 Back-door Access................................................................................................................... 105
5.6.1 Back-door read/write vs. peek/poke ....................................................................... 105
5.6.2 Hierarchical HDL Paths .......................................................................................... 106
5.6.3 VPI-based Back-door Access ................................................................................. 107
5.6.4 User-defined Back-door Access ............................................................................. 108
5.6.5 Back-door Access for Protected Memories ............................................................ 108
5.6.6 Active Monitoring ................................................................................................... 109
5.7 Special Registers .................................................................................................................... 110
5.7.1 Pre-defined Special Registers ................................................................................. 111
5.7.2 Unmapped Registers and Memories ....................................................................... 112
评论0