Uvm Systemc Language Reference Manual

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 1

UVM-SystemC
Language Reference Manual
DRAFT
7 January 2017
UVM-SystemC Language Reference Manual DRAFT Page 2
Copyright notice
© 2012 2017 NXP B.V. All rights reserved.
© 2011 2013 Accellera Systems Initiative. All rights reserved.
© 2009 2011 Cadence Design Systems, Inc. (Cadence). All rights reserved.
License
This documentation 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/
Trademarks
Accellera, Accellera Systems Initiative, SystemC and UVM are trademarks of Accellera Systems Initiative Inc. All
other trademarks and trade names are the property of their respective owners.
Destination Control Statement
All technical data contained in this publication is subject to the export control laws of the United States of America.
Disclosure to nationals of other countries contrary to United States law is prohibited. It is the reader’s responsibility
to determine the applicable regulations and comply with them.
Disclaimer
THE CONTRIBUTORS AND THEIR LICENSORS MAKE NO WARRANTY OF ANY KIND WITH REGARD
TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgements
The creation of this document has been supported by the European Commission as part of the Seventh Framework
Programme (FP7) for Research and Technological Development in the project 'VERIFICATION FOR
HETEROGENOUS RELIABLE DESIGN AND INTEGRATION' (VERDI). The research leading to this result has
received funding from the European Commission under grand agreement No 287562.
More information on the Seventh Framework Programme (FP7) and VERDI project can be found here:
http://cordis.europa.eu/fp7
http://www.verdi-fp7.eu
Special thanks to the Accellera Systems Initiative to grant authorization to use portions of its Universal Verification
Methodology Reference Implementation (UVM version 1.1d, March 2013) in this document.
The partners in the VERDI consortium wish to thank Cadence Design Systems Inc. for the initial donation of the
UVM-SC Library Reference and documentation (UVM version 1.0, June 2011). This document has been derived
from this work, and further enhanced and extended to make it compatible with the UVM 1.1 standard.
Bugs and Suggestions
Please report bugs and suggestions about this document to:
uvm-systemc-feedback@lists.accellera.org
Page 3 UVM-SystemC Language Reference Manual DRAFT
Table of Contents
1. INTRODUCTION ............................................................................................................................................. 16
2. TERMINOLOGY .............................................................................................................................................. 17
2.1 SHALL, SHOULD, MAY, CAN ...................................................................................................................... 17
2.2 IMPLEMENTATION, APPLICATION ............................................................................................................. 17
2.3 CALL, CALLED FROM, DERIVED FROM ...................................................................................................... 17
2.4 IMPLEMENTATION-DEFINED ..................................................................................................................... 17
3. UVM-SYSTEMC OVERVIEW ........................................................................................................................ 18
3.1 NAMESPACE ............................................................................................................................................. 18
3.2 HEADER FILES .......................................................................................................................................... 18
3.3 GLOBAL FUNCTIONS ................................................................................................................................. 18
3.4 BASE CLASSES .......................................................................................................................................... 18
3.5 POLICY CLASSES ...................................................................................................................................... 18
3.6 REGISTRY AND FACTORY CLASSES ........................................................................................................... 19
3.7 COMPONENT HIERARCHY CLASSES ........................................................................................................... 19
3.8 SEQUENCER CLASSES ............................................................................................................................... 20
3.9 SEQUENCE CLASSES ................................................................................................................................. 20
3.10 CONFIGURATION AND RESOURCE CLASSES ............................................................................................... 20
3.11 PHASING AND SYNCHRONIZATION CLASSES ............................................................................................. 20
3.12 REPORTING CLASSES ................................................................................................................................ 21
3.13 MACROS ................................................................................................................................................... 21
3.14 EXISTING SYSTEMC FUNCTIONALITY USED IN UVM-SYSTEMC ............................................................... 22
3.15 METHODOLOGY FOR HIERARCHY CONSTRUCTION .................................................................................... 23
4. GLOBAL FUNCTIONS .................................................................................................................................... 24
4.1 UVM_SET_CONFIG_INT ........................................................................................................................... 24
4.2 UVM_SET_CONFIG_STRING ..................................................................................................................... 24
4.3 RUN_TEST ................................................................................................................................................ 24
5. BASE CLASSES ............................................................................................................................................... 25
5.1 UVM_VOID ............................................................................................................................................... 25
5.1.1 Class definition .......................................................................................................................... 25
5.2 UVM_OBJECT ............................................................................................................................................ 25
5.2.1 Class definition .......................................................................................................................... 25
5.2.2 Construction ............................................................................................................................... 27
5.2.3 Identification .............................................................................................................................. 27
5.2.4 Creation...................................................................................................................................... 28
5.2.5 Printing ...................................................................................................................................... 29
5.2.6 Recording ................................................................................................................................... 30
UVM-SystemC Language Reference Manual DRAFT Page 4
5.2.7 Copying...................................................................................................................................... 30
5.2.8 Comparing ................................................................................................................................. 31
5.2.9 Packing ...................................................................................................................................... 31
5.2.10 Unpacking .................................................................................................................................. 32
5.2.11 Object macros ............................................................................................................................ 33
5.3 UVM_ROOT ............................................................................................................................................... 34
5.3.1 Class definition .......................................................................................................................... 34
5.3.2 Simulation control...................................................................................................................... 35
5.3.3 Topology .................................................................................................................................... 36
5.3.4 Global variable ........................................................................................................................... 36
5.4 UVM_PORT_BASE ..................................................................................................................................... 37
5.4.1 Class definition .......................................................................................................................... 37
5.4.2 Template parameter IF ............................................................................................................... 38
5.4.3 Constructor ................................................................................................................................ 38
5.4.4 Member functions ...................................................................................................................... 38
5.5 UVM_COMPONENT_NAME ....................................................................................................................... 39
5.5.1 Class definition .......................................................................................................................... 39
5.5.2 Constraints on usage .................................................................................................................. 39
5.5.3 Constructor ................................................................................................................................ 40
5.5.4 Destructor .................................................................................................................................. 40
5.5.5 operator const char* ................................................................................................................... 40
5.6 UVM_CORESERVICE_T .............................................................................................................................. 40
5.6.1 Class definition .......................................................................................................................... 40
5.6.2 Constraints on usage .................................................................................................................. 41
5.6.3 Member functions ...................................................................................................................... 41
5.7 UVM_DEFAULT_CORESERVICE_T ............................................................................................................. 42
5.7.1 Class definition .......................................................................................................................... 42
5.7.2 Constraints on usage .................................................................................................................. 42
5.7.3 Member functions ...................................................................................................................... 42
6. POLICY CLASSES ........................................................................................................................................... 44
6.1 UVM_PACKER ........................................................................................................................................... 44
6.1.1 Class definition .......................................................................................................................... 44
6.1.2 Constraints on usage .................................................................................................................. 47
6.1.3 Packing ...................................................................................................................................... 47
6.1.4 Unpacking .................................................................................................................................. 48
6.1.5 operator <<, operator >> ............................................................................................................ 49
6.1.6 Data members (variables) .......................................................................................................... 49
6.2 UVM_PRINTER .......................................................................................................................................... 50
Page 5 UVM-SystemC Language Reference Manual DRAFT
6.2.1 Class definition .......................................................................................................................... 50
6.2.2 Constraints on usage .................................................................................................................. 53
6.2.3 Printing types ............................................................................................................................. 53
6.2.4 Printer subtyping ........................................................................................................................ 55
6.2.5 Data members ............................................................................................................................ 56
6.3 UVM_TABLE_PRINTER .............................................................................................................................. 56
6.3.1 Class definition .......................................................................................................................... 57
6.3.2 Constructor ................................................................................................................................ 57
6.3.3 emit ............................................................................................................................................ 57
6.4 UVM_TREE_PRINTER ................................................................................................................................ 57
6.4.1 Class definition .......................................................................................................................... 57
6.4.2 Constructor ................................................................................................................................ 57
6.4.3 emit ............................................................................................................................................ 58
6.5 UVM_LINE_PRINTER ................................................................................................................................. 58
6.5.1 Class definition .......................................................................................................................... 58
6.5.2 Constructor ................................................................................................................................ 58
6.5.3 emit ............................................................................................................................................ 58
6.6 UVM_COMPARER ...................................................................................................................................... 58
6.6.1 Class definition .......................................................................................................................... 58
6.6.2 Constraints on usage .................................................................................................................. 60
6.6.3 Member functions ...................................................................................................................... 60
6.6.4 Comparer settings ...................................................................................................................... 62
6.7 DEFAULT POLICY OBJECTS ....................................................................................................................... 64
7. REGISTRY AND FACTORY CLASSES ......................................................................................................... 66
7.1 UVM_OBJECT_WRAPPER ........................................................................................................................... 66
7.1.1 Class definition .......................................................................................................................... 66
7.1.2 Member functions ...................................................................................................................... 67
7.2 UVM_OBJECT_REGISTRY .......................................................................................................................... 67
7.2.1 Class definition .......................................................................................................................... 67
7.2.2 Template parameter T ................................................................................................................ 68
7.2.3 Member functions ...................................................................................................................... 68
7.3 UVM_COMPONENT_REGISTRY .................................................................................................................. 69
7.3.1 Class definition .......................................................................................................................... 69
7.3.2 Template parameter T ................................................................................................................ 70
7.3.3 Member functions ...................................................................................................................... 70
7.4 UVM_FACTORY ........................................................................................................................................ 72
7.4.1 Class definition .......................................................................................................................... 72
7.4.2 Retreiving the factory ................................................................................................................ 74
UVM-SystemC Language Reference Manual DRAFT Page 6
7.4.3 Registering types........................................................................................................................ 74
7.4.4 Type and instance overrides ....................................................................................................... 74
7.4.5 Creation...................................................................................................................................... 76
7.4.6 Debug ......................................................................................................................................... 77
7.5 UVM_DEFAULT_FACTORY ........................................................................................................................ 78
7.5.1 Class definition .......................................................................................................................... 78
7.5.2 Registering types........................................................................................................................ 80
7.5.3 Type and instance overrides ....................................................................................................... 80
7.5.4 Creation...................................................................................................................................... 82
7.5.5 Debug ......................................................................................................................................... 84
8. COMPONENT HIERARCHY CLASSES ......................................................................................................... 86
8.1 UVM_COMPONENT .................................................................................................................................... 86
8.1.1 Class definition .......................................................................................................................... 86
8.1.2 Construction interface ................................................................................................................ 90
8.1.3 Hierarchy interface .................................................................................................................... 90
8.1.4 Phasing interface ........................................................................................................................ 92
8.1.5 Process control interface ............................................................................................................ 99
8.1.6 Configuration interface ............................................................................................................ 100
8.1.7 Objection interface ................................................................................................................... 100
8.1.8 Factory interface ...................................................................................................................... 101
8.1.9 Hierarchical reporting interface ............................................................................................... 103
8.1.10 Macros ..................................................................................................................................... 105
8.2 UVM_DRIVER.......................................................................................................................................... 106
8.2.1 Class definition ........................................................................................................................ 106
8.2.2 Template parameters ................................................................................................................ 106
8.2.3 Ports ......................................................................................................................................... 106
8.2.4 Member functions .................................................................................................................... 107
8.3 UVM_MONITOR....................................................................................................................................... 107
8.3.1 Class definition ........................................................................................................................ 107
8.3.2 Member functions .................................................................................................................... 108
8.4 UVM_AGENT ........................................................................................................................................... 108
8.4.1 Class definition ........................................................................................................................ 108
8.4.2 Member functions .................................................................................................................... 108
8.5 UVM_ENV ............................................................................................................................................... 109
8.5.1 Class definition ........................................................................................................................ 109
8.5.2 Member functions .................................................................................................................... 109
8.6 UVM_TEST .............................................................................................................................................. 110
8.6.1 Class definition ........................................................................................................................ 110
Page 7 UVM-SystemC Language Reference Manual DRAFT
8.6.2 Member functions .................................................................................................................... 110
8.7 UVM_SCOREBOARD ................................................................................................................................ 110
8.7.1 Class definition ........................................................................................................................ 110
8.7.2 Member functions .................................................................................................................... 111
8.8 UVM_SUBSCRIBER .................................................................................................................................. 111
8.8.1 Class definition ........................................................................................................................ 111
8.8.2 Template parameter T .............................................................................................................. 112
8.8.3 Export ...................................................................................................................................... 112
8.8.4 Member functions .................................................................................................................... 112
9. SEQUENCER CLASSES ................................................................................................................................ 113
9.1 UVM_SEQUENCER_BASE......................................................................................................................... 113
9.1.1 Class definition ........................................................................................................................ 113
9.1.2 Constructor .............................................................................................................................. 114
9.1.3 Member functions .................................................................................................................... 114
9.2 UVM_SEQUENCER_PARAM_BASE ........................................................................................................... 118
9.2.1 Class definition ........................................................................................................................ 118
9.2.2 Template parameters ................................................................................................................ 119
9.2.3 Constructor .............................................................................................................................. 119
9.2.4 Requests ................................................................................................................................... 119
9.3 UVM_SEQUENCER ................................................................................................................................... 119
9.3.1 Class definition ........................................................................................................................ 119
9.3.2 Template parameters ................................................................................................................ 120
9.3.3 Constructor .............................................................................................................................. 120
9.3.4 Exports ..................................................................................................................................... 120
9.3.5 Sequencer interface .................................................................................................................. 121
9.3.6 Macros ..................................................................................................................................... 122
10. SEQUENCE CLASSES ................................................................................................................................... 123
10.1 UVM_TRANSACTION ............................................................................................................................... 123
10.1.1 Class definition ........................................................................................................................ 123
10.1.2 Constructors ............................................................................................................................. 124
10.1.3 Constraints on usage ................................................................................................................ 124
10.1.4 Member functions .................................................................................................................... 124
10.2 UVM_SEQUENCE_ITEM ........................................................................................................................... 124
10.2.1 Class definition ........................................................................................................................ 124
10.2.2 Constructors ............................................................................................................................. 125
10.2.3 Member functions .................................................................................................................... 125
10.3 UVM_SEQUENCE_BASE ........................................................................................................................... 127
10.3.1 Class definition ........................................................................................................................ 127
UVM-SystemC Language Reference Manual DRAFT Page 8
10.3.2 Constructor .............................................................................................................................. 129
10.3.3 Sequence state .......................................................................................................................... 130
10.3.4 Sequence execution .................................................................................................................. 130
10.3.5 Sequence control ...................................................................................................................... 132
10.3.6 Sequence item execution.......................................................................................................... 134
10.3.7 Response interface ................................................................................................................... 135
10.3.8 Data members .......................................................................................................................... 137
10.4 UVM_SEQUENCE ..................................................................................................................................... 137
10.4.1 Class definition ........................................................................................................................ 137
10.4.2 Template parameters ................................................................................................................ 137
10.4.3 Constructor .............................................................................................................................. 138
10.4.4 Member functions .................................................................................................................... 138
11. CONFIGURATION AND RESOURCE CLASSES........................................................................................ 139
11.1 UVM_CONFIG_DB ................................................................................................................................... 139
11.1.1 Class definition ........................................................................................................................ 139
11.1.2 Template parameter T .............................................................................................................. 140
11.1.3 Constraints on usage ................................................................................................................ 140
11.1.4 Member functions .................................................................................................................... 140
11.2 UVM_RESOURCE_DB .............................................................................................................................. 141
11.2.1 Class definition ........................................................................................................................ 141
11.2.2 Template parameter T .............................................................................................................. 143
11.2.3 Constraints on usage ................................................................................................................ 143
11.2.4 Member functions .................................................................................................................... 143
11.3 UVM_RESOURCE_DB_OPTIONS ............................................................................................................... 145
11.3.1 Class definition ........................................................................................................................ 145
11.3.2 Member functions .................................................................................................................... 146
11.4 UVM_RESOURCE_OPTIONS ..................................................................................................................... 146
11.4.1 Class definition ........................................................................................................................ 146
11.4.2 Member functions .................................................................................................................... 147
11.5 UVM_RESOURCE_BASE ........................................................................................................................... 147
11.5.1 Class definition ........................................................................................................................ 147
11.5.2 Constructor .............................................................................................................................. 148
11.5.3 Resource database interface ..................................................................................................... 149
11.5.4 Read-only interface .................................................................................................................. 149
11.5.5 Notification .............................................................................................................................. 149
11.5.6 Scope interface ......................................................................................................................... 149
11.5.7 Priority ..................................................................................................................................... 150
11.5.8 Utility functions ....................................................................................................................... 150
Page 9 UVM-SystemC Language Reference Manual DRAFT
11.5.9 Audit trail ................................................................................................................................. 150
11.6 UVM_RESOURCE_POOL .......................................................................................................................... 151
11.6.1 Class definition ........................................................................................................................ 151
11.6.2 get ............................................................................................................................................ 152
11.6.3 spell_check .............................................................................................................................. 152
11.6.4 Set interface ............................................................................................................................. 153
11.6.5 Lookup ..................................................................................................................................... 153
11.6.6 Set priority ............................................................................................................................... 155
11.6.7 Debug ....................................................................................................................................... 156
11.7 UVM_RESOURCE ..................................................................................................................................... 156
11.7.1 Class definition ........................................................................................................................ 156
11.7.2 Template parameter T .............................................................................................................. 157
11.7.3 Type interface .......................................................................................................................... 157
11.7.4 Set/Get interface ...................................................................................................................... 158
11.7.5 Read/Write interface ................................................................................................................ 158
11.7.6 Priority ..................................................................................................................................... 159
11.8 UVM_RESOURCE_TYPES ......................................................................................................................... 159
11.8.1 Class definition ........................................................................................................................ 159
11.8.2 Type definitions (typedefs) ...................................................................................................... 160
12. PHASING AND SYNCHRONIZATION CLASSES ...................................................................................... 161
12.1 UVM_PHASE ........................................................................................................................................... 161
12.1.1 Class definition ........................................................................................................................ 161
12.1.2 Construction ............................................................................................................................. 163
12.1.3 State ......................................................................................................................................... 163
12.1.4 Callbacks.................................................................................................................................. 164
12.1.5 Schedule ................................................................................................................................... 165
12.1.6 Synchronization ....................................................................................................................... 166
12.1.7 Jumping.................................................................................................................................... 167
12.2 UVM_DOMAIN ........................................................................................................................................ 167
12.2.1 Class definition ........................................................................................................................ 167
12.2.2 Constructor .............................................................................................................................. 168
12.2.3 Member functions .................................................................................................................... 168
12.3 UVM_BOTTOMUP_PHASE ........................................................................................................................ 169
12.3.1 Class definition ........................................................................................................................ 169
12.3.2 Constructor .............................................................................................................................. 169
12.3.3 Member functions .................................................................................................................... 170
12.4 UVM_TOPDOWN_PHASE ......................................................................................................................... 170
12.4.1 Class definition ........................................................................................................................ 170
UVM-SystemC Language Reference Manual DRAFT Page 10
12.4.2 Constructor
Page 11 UVM-SystemC Language Reference Manual DRAFT
13.2 UVM_REPORT_HANDLER ........................................................................................................................ 195
13.2.1 Class definition ........................................................................................................................ 196
13.2.2 Constructor .............................................................................................................................. 196
13.2.3 Member functions .................................................................................................................... 196
13.3 UVM_REPORT_SERVER ........................................................................................................................... 197
13.3.1 Class definition ........................................................................................................................ 197
13.3.2 Member functions .................................................................................................................... 198
13.4 UVM_DEFAULT_REPORT_SERVER ........................................................................................................... 201
13.4.1 Class definition ........................................................................................................................ 201
13.4.2 Constructor .............................................................................................................................. 202
13.4.3 Generic member functions ....................................................................................................... 202
13.4.4 Quit count ................................................................................................................................ 202
13.4.5 Severity count .......................................................................................................................... 203
13.4.6 Id count .................................................................................................................................... 204
13.4.7 Message recording ................................................................................................................... 204
13.4.8 Message processing ................................................................................................................. 205
13.5 UVM_REPORT_CATCHER ........................................................................................................................ 205
13.5.1 Class definition ........................................................................................................................ 206
13.5.2 Constructor .............................................................................................................................. 208
13.5.3 Current message state .............................................................................................................. 208
13.5.4 Change message state .............................................................................................................. 210
13.5.5 Debug ....................................................................................................................................... 211
13.5.6 Callback interface .................................................................................................................... 211
13.5.7 Reporting ................................................................................................................................. 212
13.6 UVM_REPORT_MESSAGE_ELEMENT_BASE ............................................................................................. 213
13.6.1 Class definition ........................................................................................................................ 213
13.6.2 Member functions .................................................................................................................... 214
13.7 UVM_REPORT_MESSAGE_INT_ELEMENT ................................................................................................ 214
13.7.1 Class definition ........................................................................................................................ 214
13.7.2 Member functions .................................................................................................................... 215
13.8 UVM_REPORT_MESSAGE_STRING_ELEMENT .......................................................................................... 215
13.8.1 Class definition ........................................................................................................................ 215
13.8.2 Member functions .................................................................................................................... 216
13.9 UVM_REPORT_MESSAGE_OBJECT_ELEMENT .......................................................................................... 216
13.9.1 Class definition ........................................................................................................................ 216
13.9.2 Member functions .................................................................................................................... 216
13.10 UVM_REPORT_MESSAGE_ELEMENT_CONTAINER ................................................................................... 217
13.10.1 Class definition ........................................................................................................................ 217
UVM-SystemC Language Reference Manual DRAFT Page 12
13.10.2 Constructor .............................................................................................................................. 218
13.10.3 Member functions .................................................................................................................... 218
13.11 UVM_REPORT_MESSAGE ........................................................................................................................ 219
13.11.1 Class definition ........................................................................................................................ 219
13.11.2 Constructor .............................................................................................................................. 221
13.11.3 Generic member functions ....................................................................................................... 221
13.11.4 Infrastructure references .......................................................................................................... 221
13.11.5 Message fields ......................................................................................................................... 222
13.11.6 Message element APIs ............................................................................................................. 225
14. MACROS ......................................................................................................................................................... 226
14.1 COMPONENT AND OBJECT REGISTRATION MACROS ................................................................................ 226
14.1.1 Macro definitions ..................................................................................................................... 226
14.1.2 UVM_OBJECT_UTILS, UVM_OBJECT_PARAM_UTILS ................................................. 226
14.1.3 UVM_COMPONENT_UTILS, UVM_COMPONENT_PARAM_UTILS ............................. 227
14.2 REPORTING MACROS .............................................................................................................................. 227
14.2.1 Macro definitions ..................................................................................................................... 227
14.2.2 UVM_INFO ............................................................................................................................. 227
14.2.3 UVM_WARNING ................................................................................................................... 228
14.2.4 UVM_ERROR ......................................................................................................................... 228
14.2.5 UVM_FATAL ......................................................................................................................... 228
14.3 SEQUENCE EXECUTION MACROS............................................................................................................. 228
14.3.1 Macro definitions ..................................................................................................................... 228
14.3.2 UVM_DO ................................................................................................................................ 229
14.3.3 UVM_DO_PRI ........................................................................................................................ 229
14.3.4 UVM_DO_ON ........................................................................................................................ 229
14.3.5 UVM_DO_ON_PRI ................................................................................................................ 229
14.3.6 UVM_CREATE....................................................................................................................... 229
14.3.7 UVM_CREATE_ON ............................................................................................................... 230
14.3.8 UVM_DECLARE_P_SEQUENCER ...................................................................................... 230
14.4 CALLBACK MACROS ............................................................................................................................... 230
14.4.1 Macro definitions ..................................................................................................................... 230
14.4.2 UVM_REGISTER_CB ............................................................................................................ 230
14.4.3 UVM_DO_CALLBACKS ....................................................................................................... 230
15. TLM INTERFACES ........................................................................................................................................ 232
15.1 UVM_BLOCKING_PUT_PORT ................................................................................................................... 233
15.1.1 Class definition ........................................................................................................................ 233
15.1.2 Template parameter T .............................................................................................................. 233
15.1.3 Constructor .............................................................................................................................. 233
Page 13 UVM-SystemC Language Reference Manual DRAFT
15.1.4 Member functions .................................................................................................................... 233
15.2 UVM_BLOCKING_GET_PORT ................................................................................................................... 234
15.2.1 Class definition ........................................................................................................................ 234
15.2.2 Template parameter T .............................................................................................................. 234
15.2.3 Constructor .............................................................................................................................. 234
15.2.4 Member functions .................................................................................................................... 235
15.3 UVM_BLOCKING_PEEK_PORT ................................................................................................................. 235
15.3.1 Class definition ........................................................................................................................ 235
15.3.2 Template parameter T .............................................................................................................. 235
15.3.3 Constructor .............................................................................................................................. 236
15.3.4 Member functions .................................................................................................................... 236
15.4 UVM_BLOCKING_GET_PEEK_PORT ......................................................................................................... 236
15.4.1 Class definition ........................................................................................................................ 236
15.4.2 Template parameter T .............................................................................................................. 237
15.4.3 Constructor .............................................................................................................................. 237
15.4.4 Member functions .................................................................................................................... 237
15.5 UVM_NONBLOCKING_PUT_PORT ............................................................................................................ 238
15.5.1 Class definition ........................................................................................................................ 238
15.5.2 Template parameter T .............................................................................................................. 238
15.5.3 Constructor .............................................................................................................................. 238
15.5.4 Member functions .................................................................................................................... 238
15.6 UVM_NONBLOCKING_GET_PORT ............................................................................................................ 239
15.6.1 Class definition ........................................................................................................................ 239
15.6.2 Template parameter T .............................................................................................................. 239
15.6.3 Constructor .............................................................................................................................. 239
15.6.4 Member functions .................................................................................................................... 240
15.7 UVM_NONBLOCKING_PEEK_PORT .......................................................................................................... 240
15.7.1 Class definition ........................................................................................................................ 240
15.7.2 Template parameter T .............................................................................................................. 241
15.7.3 Constructor .............................................................................................................................. 241
15.7.4 Member functions .................................................................................................................... 241
15.8 UVM_NONBLOCKING_GET_PEEK_PORT .................................................................................................. 241
15.8.1 Class definition ........................................................................................................................ 241
15.8.2 Template parameter T .............................................................................................................. 242
15.8.3 Constructor .............................................................................................................................. 242
15.8.4 Member functions .................................................................................................................... 242
15.9 UVM_ANALYSIS_PORT............................................................................................................................ 243
15.9.1 Class definition ........................................................................................................................ 243
UVM-SystemC Language Reference Manual DRAFT Page 14
15.9.2 Template parameter T .............................................................................................................. 244
15.9.3 Constructor .............................................................................................................................. 244
15.9.4 Member functions .................................................................................................................... 244
15.10 UVM_ANALYSIS_EXPORT ....................................................................................................................... 244
15.10.1 Class definition ........................................................................................................................ 245
15.10.2 Template parameter T .............................................................................................................. 245
15.10.3 Constructor .............................................................................................................................. 245
15.10.4 Member functions .................................................................................................................... 245
15.11 UVM_ANALYSIS_IMP .............................................................................................................................. 246
15.11.1 Class definition ........................................................................................................................ 246
15.11.2 Template parameters ................................................................................................................ 246
15.11.3 Constructor .............................................................................................................................. 246
15.11.4 Member functions .................................................................................................................... 247
15.12 UVM_TLM_REQ_RSP_CHANNEL ............................................................................................................. 247
15.12.1 Class definition ........................................................................................................................ 247
15.12.2 Template parameters ................................................................................................................ 248
15.12.3 Ports and exports ...................................................................................................................... 248
15.12.4 Constructor .............................................................................................................................. 250
15.13 UVM_SQR_IF_BASE ................................................................................................................................ 250
15.13.1 Class definition ........................................................................................................................ 250
15.13.2 Template parameters ................................................................................................................ 251
15.13.3 Member functions .................................................................................................................... 251
15.14 UVM_SEQ_ITEM_PULL_PORT .................................................................................................................. 253
15.14.1 Class definition ........................................................................................................................ 254
15.14.2 Template parameters ................................................................................................................ 254
15.14.3 Constructor .............................................................................................................................. 254
15.14.4 Member functions .................................................................................................................... 254
15.15 UVM_SEQ_ITEM_PULL_EXPORT ............................................................................................................. 254
15.15.1 Class definition ........................................................................................................................ 254
15.15.2 Template parameters ................................................................................................................ 255
15.15.3 Constructor .............................................................................................................................. 255
15.15.4 Member functions .................................................................................................................... 255
15.16 UVM_SEQ_ITEM_PULL_IMP .................................................................................................................... 255
15.16.1 Class definition ........................................................................................................................ 255
15.16.2 Template parameters ................................................................................................................ 256
15.16.3 Constructor .............................................................................................................................. 256
15.16.4 Member functions .................................................................................................................... 256
Page 15 UVM-SystemC Language Reference Manual DRAFT
16. GLOBAL DEFINES, TYPEDEFS AND ENUMERATIONS......................................................................... 257
16.1 GLOBAL DEFINES ................................................................................................................................... 257
16.1.1 UVM_MAX_STREAMBITS .................................................................................................. 257
16.1.2 UVM_PACKER_MAX_BYTES............................................................................................. 257
16.1.3 UVM_DEFAULT_TIMEOUT ................................................................................................ 257
16.2 TYPE DEFINITIONS (TYPEDEFS) ............................................................................................................... 257
16.2.1 uvm_bitstream_t ...................................................................................................................... 257
16.2.2 uvm_integral_t ......................................................................................................................... 257
16.2.3 UVM_FILE .............................................................................................................................. 257
16.2.4 uvm_report_cb ......................................................................................................................... 257
16.2.5 uvm_config_int ........................................................................................................................ 257
16.2.6 uvm_config_string ................................................................................................................... 258
16.2.7 uvm_config_object .................................................................................................................. 258
16.2.8 uvm_config_wrapper ............................................................................................................... 258
16.3 ENUMERATION ....................................................................................................................................... 258
16.3.1 uvm_action .............................................................................................................................. 258
16.3.2 uvm_severity ............................................................................................................................ 258
16.3.3 uvm_verbosity ......................................................................................................................... 258
16.3.4 uvm_active_passive_enum ...................................................................................................... 259
16.3.5 uvm_sequence_state_enum ...................................................................................................... 259
16.3.6 uvm_phase_type ...................................................................................................................... 259
ANNEX A. UVM-SYSTEMVERILOG FEATURES NOT INCLUDED IN UVM-SYSTEMC ........................ 261
A.1 NO FIELD MACROS .................................................................................................................................. 261
A.2 NO AUTOMATED CONFIGURATION .......................................................................................................... 261
A.3 NO TRANSACTION RECORDING ............................................................................................................... 261
A.4 NO REGISTER ABSTRACTION LAYER ....................................................................................................... 261
A.5 NO CONSTRAINT RANDOMIZATION AND COVERAGE CLASSES ................................................................. 261
A.6 NO ASSERTIONS...................................................................................................................................... 261
ANNEX B. RENAMED FUNCTIONS UVM-SYSTEMC VERSUS UVM-SYSTEMVERILOG .................... 262
ANNEX C. TERMINOLOGY .............................................................................................................................. 263
C.1 DEFINITIONS .......................................................................................................................................... 263
C.2 ACRONYMS AND ABBREVIATIONS .......................................................................................................... 265
INDEX....................................................................................................................................................................... 267
UVM-SystemC Language Reference Manual DRAFT Page 16
1. Introduction
UVM-SystemC is a SystemC library extension offering features compatible with the Universal Verification
Methodology (UVM). This library is built on top of the SystemC language standard and defines the Application
Programming Interface aligned with that of the existing UVM standard and associated base class library
implementation in SystemVerilog (SV). The UVM-SystemC library does not cover the entire UVM standard, nor
the existing UVM implementation in SystemVerilog. However, the UVM-SystemC library offers the essential
ingredients to create verification environments which are compliant with the UVM standard.
UVM-SystemC is released as proof-of-concept library that works with any IEEE 1666-2011 compliant SystemC
simulation environment. Note that UVM-SystemC uses certain specialized SystemC features introduced since the
revision in 2011, such as process control constructs, which are not implemented in all SystemC simulators. The
UVM-SystemC functionality can be used together with the Accellera Systems Initiative (formerly OSCI) SystemC
proof-of-concept library [1].
UVM-SystemC uses existing SystemC functionality wherever suitable, and introduces new UVM classes on top of
the SystemC base classes to facilitate the creation of modular, configurable and reusable verification environments.
Certain UVM in SystemVerilog functionality is available as native SystemC language features, and therefore UVM-
SystemC uses the existing SystemC classes as foundations for the UVM extensions. Also the transaction-level
modeling (TLM) concepts natively exist in SystemC and IEEE Std. 1666-2011, so UVM-SystemC uses the original
SystemC TLM definitions and base classes.
Elements which are part of the UVM-SystemC library and language definition and which are not part of the
UVM SystemVerilog standard are marked with symbol . Elements marked with symbol are renamed in UVM-
SystemC, in contrast to the UVM SystemVerilog standard, due to their incompatibility due to reserved keywords in
C/C++ or an inappropriate name in the context of SystemC base class of member function definitions. The reference
to the original UVM SystemVerilog name is given in brackets and marked with . Note that these original names are
not used in UVM-SystemC.
[1] As process control extensions are only supported in the Accellera Systems Initiative SystemC 2.3.0 release (or later) of the
proof-of-concept library, it is required to have this library installed prior to UVM-SystemC installation.
Page 17 UVM-SystemC Language Reference Manual DRAFT
2. Terminology
2.1 Shall, should, may, can
The word shall is used to indicate a mandatory requirement.
The word should is used to recommend a particular course of action, but it does not impose any obligation.
The word may is used to mean shall be permitted (in the sense of being legally allowed).
The word can is used to mean shall be able to (in the sense of being technically possible).
In some cases, word usage is qualified to indicate on whom the obligation falls, such as an application may or an
implementation shall.
2.2 Implementation, application
The word implementation is used to mean any specific implementation of the full UVM-SystemC class library as
defined in this standard, only the public interface of which need be exposed to the application.
The word application is used to mean a C++ program, written by an end user, that uses the UVM-SystemC class
library, that is, uses classes, functions, or macros defined in this standard.
2.3 Call, called from, derived from
The term call is taken to mean call directly or indirectly. Call indirectly means call an intermediate function that in
turn calls the function in question, where the chain of function calls may be extended indefinitely.
Similarly, called from means called from directly or indirectly.
Except where explicitly qualified, the term derived from is taken to mean derived directly or indirectly from.
Derived indirectly from means derived from one or more intermediate base classes.
2.4 Implementation-defined
The italicized term implementation-defined is used where part of a C++ definition is omitted from this standard. In
such cases, an implementation shall provide an appropriate definition that honors the semantics defined in this
standard.
UVM-SystemC Language Reference Manual DRAFT Page 18
3. UVM-SystemC overview
3.1 Namespace
All UVM-SystemC classes and functions shall reside inside the namespace uvm.
3.2 Header files
An application shall include the C++ header file uvm or uvm.h to make use of the UVM-SystemC class library
functions. The header file named uvm shall only add the name uvm to the declarative region in which it is included,
whereas the header file named uvm.h shall add all of the names from the namespace uvm to the declarative region
in which it is included.
NOTEIt is recommended that an application includes the header file uvm rather than the header file uvm.h. This means the
namespace uvm has to be mentioned explicitly when using UVM-SystemC classes and functions. Alternatively, an application
may use the C++ using directive at the global and local scope to gain access to these classes and functions.
3.3 Global functions
A minimal set of global functions is defined in the global namespace offering generic UVM capabilities and
convenience functions for configuration and printing. The global functions are specified in section 4.
3.4 Base classes
These classes define the base UVM class for all other UVM classes, and the base class for data objects:
uvm_void
uvm_object
uvm_root
uvm_port_base
uvm_component_name
uvm_coreservice_t
The base classes are specified in section 5.
3.5 Policy classes
These classes include policy objects for various operations based on class uvm_object:
The class uvm_printer provides an interface for printing objects of type uvm_object in various formats.
Classes derived from class uvm_printer implement pre-defined printing formats or policies:
The class uvm_table_printer prints the object in a tabular form.
The class uvm_tree_printer prints the object in a tree form.
The class uvm_line_printer prints the information on a single line, but uses the same object separators
as the tree printer.
Page 19 UVM-SystemC Language Reference Manual DRAFT
These printer classes have knobs that an application may use to control what and how information is
printed. These knobs are contained in a separate knob class uvm_printer_knobs
uvm_comparer: performs deep comparison of objects derived from uvm_object. An application may
configure what is compared and how miscompares are reported.
uvm_packer: performs packing (serialization) and unpacking of properties.
The policy classes are specified in section 6.
3.6 Registry and factory classes
The registry and factory classes include the uvm_factory and associated classes for object and component
registration. The class uvm_default_factory implements the factory pattern. A singleton factory instance is created
for a given simulation run. Class types are registered with the factory using the class uvm_object_wrapper and its
derivatives. The factory supports type and instance overrides.
The factory classes are:
uvm_object_wrapper
uvm_object_registry
uvm_component_registry
uvm_factory
uvm_default_factory
The registry and factory classes are specified in section 7.
3.7 Component hierarchy classes
These classes define the base class for hierarchical UVM components and the test environment. The class
uvm_component provides interfaces for:
HierarchyProvides methods for searching and traversing the component hierarchy.
ConfigurationProvides methods for configuring component topology and other parameters before and
during component construction.
PhasingDefines a phased test flow that all components follow. Methods include the phase callbacks, such
as run_phase and report_phase, overridden by the derived classes. During simulation, these callbacks are
executed in precise order.
FactoryProvides a convenience interface to the uvm_factory. The factory is used to create new
components and other objects based on type-wide and instance-specific configuration.
All structural component classes uvm_env, uvm_test, uvm_agent, uvm_driver, uvm_monitor, and
uvm_scoreboard are derived from the class uvm_component.
The UVM component classes are specified in section 8.
UVM-SystemC Language Reference Manual DRAFT Page 20
3.8 Sequencer classes
The sequencer classes serve as an arbiter for controlling transaction flow from multiple stimulus generators. More
specifically, the sequencer controls the flow of transactions of type uvm_sequence_item generated by one or more
sequences based on type uvm_sequence. The sequencer classes are:
uvm_sequencer_base
uvm_sequencer_param_base
uvm_sequencer
uvm_sqr_if_base
The sequencer classes are specified in section 9.
3.9 Sequence classes
The sequence classes offer the infrastructure to create stimuli descriptions based on transactions, encapsulated as a
sequence or sequence item. The following sequence classes are defined:
uvm_transaction
uvm_sequence_item
uvm_sequence_base
uvm_sequence
The sequence classes are specified in section 10.
3.10 Configuration and resource classes
The configuration and resource classes provide access to the configuration and resource database. The configuration
database is used to store and retrieve both configuration time and run time properties. The configuration and
resource classes are:
uvm_config_db: Configuration database, which acts as interface on top of the resource database.
uvm_resource_db: Resource database.
uvm_resource_options: Provides a namespace for managing options for the resources facility.
uvm_resource_base: Provides a non-parameterized base class for resources.
uvm_resource_pool: Provides the global resource database.
uvm_resource: Defines the parameterized resource.
This configuration and resource classes are specified in section 11.
3.11 Phasing and synchronization classes
The phasing classes define the order of execution of pre-defined callback function and processes, which run either
sequentially or concurrently. In addition, dedicated member functions for synchronization are available to coordinate
the execution of or status of these processes between all UVM components or objects.
Page 21 UVM-SystemC Language Reference Manual DRAFT
The phasing and synchronization classes are:
uvm_phase: The base class for defining a phase’s behavior, state, context.
uvm_domain: Phasing schedule node representing an independent branch of the schedule.
uvm_bottomup_phase: A phase implementation for bottom up function phases.
uvm_topdown_phase: A phase implementation for top-down function phases.
uvm_process_phase (uvm_task_phase): A phase implementation for phases which are launched as
spawned process.
uvm_objection: Mechanism to synchronize phases based on passing execution status information between
running processes.
uvm_callbacks: The base class for implementing callbacks, which are typically used to modify or
augment component behavior without changing the component base class for user-defined callback classes.
uvm_callback_iter: A class for iterating over callback queues of a specific callback type.
uvm_callback: The base class for user-defined callback classes.
The phasing and synchronization classes are specified in section 12.
3.12 Reporting classes
The reporting classes provide a facility for issuing reports (messages) with consistent formatting and configurable
side effects, such as logging to a file or exiting simulation. An application can also filter out reports based on their
verbosity, identity, or severity.
The following reporting classes are defined:
uvm_report_catcher: The class which captures and counts all reports issued by the class
uvm_report_server.
uvm_report_handler: The class which acting as implementation for the member functions defined in the
class uvm_report_object.
uvm_report_message: The base class which provides the interface to the UVM report message element.
uvm_report_object: The base class which provides the interface to the UVM reporting mechanism.
uvm_report_server: The class acting as global server that processes all of the reports generated by the
class uvm_report_handler.
The reporting classes are specified in section 13.
3.13 Macros
The UVM-SystemC macros make common code easier to write. It is not imperative to use the macros, but in many
cases the macros can save a substantial amount of user-written code. The macros defined in UVM-SystemC are:
Macros for component and object registration:
o UVM_OBJECT_UTILS
o UVM_OBJECT_PARAM_UTILS
UVM-SystemC Language Reference Manual DRAFT Page 22
o UVM_COMPONENT_UTILS
o UVM_COMPONENT_PARAM_UTILS
Sequence execution macros:
o UVM_DO, UVM_DO_ON and UVM_DO_ON_PRI
o UVM_CREATE, UVM_CREATE_ON
o UVM_DECLARE_P_SEQUENCER
Reporting macros:
o UVM_INFO, UVM_ERROR, UVM_WARNING and UVM_FATAL
Callback macros:
o UVM_REGISTER_CB and UVM_DO_CALLBACKS
Detailed information for the macros or the associated member functions are specified in section 14.
3.14 Existing SystemC functionality used in UVM-SystemC
Because SystemVerilog does not support multiple inheritance, UVM-SystemVerilog is constrained to have only one
base class, from which both data elements and hierarchical elements inherit. As SystemC is based on C++, it
supports multiple inheritance. As such, UVM-SystemC uses multiple inheritance where suitable.
In UVM-SystemVerilog, the class uvm_component inherits from class uvm_report_object. In UVM-SystemC,
class uvm_component applies multiple inheritance and derives from the SystemC class sc_core::sc_module and
from uvm_report_object. Note that the class uvm_object is not derived from class sc_core::sc_object, but from
class uvm_void.
The class sc_core::sc_module already offer the hierarchical features that uvm_component needs, namely parent
and children, and a full instance name. Therefore the parent of a component does not need to be explicitly specified
as a constructor argument; instead the class uvm_component_name keeps track of the component hierarchy.
The class sc_core::sc_module has natural equivalents to some of the UVM pre-run phases, which can used in a
UVM-SystemC uvm_component. For example:
The UVM-SystemC callback before_end_of_elaboration is mapped onto the UVM callback build_phase.
Note that UVM-SystemC also provides the callback build_phase as an alternative to
before_end_of_elaboration. It is recommended to use this UVM member function.
The UVM-SystemC callback end_of_elaboration is mapped onto the UVM callback
end_of_elaboration_phase. UVM-SystemC also provides the callback end_of_elaboration_phase with
the argument of type uvm_phase as an alternative to the callback end_of_elaboration, which does give
access to the phase information. It is recommended to use this UVM member function.
The UVM-SystemC callback start_of_simulation is mapped onto the UVM callback
start_of_simulation_phase. UVM-SystemC also provides the callback start_of_simulation_phase with
the argument of type uvm_phase as an alternative to the callback start_of_simulation, which does give
access to the phase information. It is recommended to use this UVM member function.
UVM-SystemC also defines the callback run_phase as a thread process of a uvm_component. This works because
sc_core::sc_module in SystemC already has the ability to own and spawn thread processes.
Page 23 UVM-SystemC Language Reference Manual DRAFT
UVM-SystemVerilog defines the TLM-1 interfaces like put and get, as well as some predefined TLM-1 channels
like tlm::tlm_fifo. These already natively exist in the SystemC standard. UVM-SystemC supports the original
SystemC TLM-1 definitions. The same holds for the analysis interface in UVM. UVM-SystemC offers a
compatibility and convenience layer on top of the SystemC TLM interface proper tlm::tlm_analysis_if and analysis
port tlm::tlm_analysis_port, defining elements such as uvm_analysis_port, uvm_analysis_export and
uvm_analysis_imp.
The SystemC fork-join constructs SC_FORK and SC_JOIN can be used as a pair to bracket a set of calls to
function sc_core::sc_spawn within a UVM component run_phase, enabling the creation of concurrent processes.
3.15 Methodology for hierarchy construction
The UVM in SystemVerilog recommends the use of configurations by using the static member function set of the
uvm_config_db in the build phase, followed by hierarchy construction through the factory, in the same phase.
In UVM-SystemVerilog, it is necessary to make the connections (port binding) in the connect phase, which happens
after hierarchy construction of components, ports and exports in the build phase. This enables configuration of
port/export construction using the configuration database uvm_config_db. In that case, if a parent creates a child in
the build phase, that child’s port/export does not exist at that point, and it has to wait for the next phase to bind the
child’s port/export.
Consistent with UVM in SystemVerilog, UVM-SystemC also recommends configurations using uvm_config_db
and hierarchy construction through the factory uvm_factory in the build phase. This implies that child objects
derived from class uvm_component should be declared as pointers inside the parent class, and these children should
be constructed in the UVM callback build_phase through the UVM factory, which does not contradict the
SystemC standard, as the SystemC standard allows construction activity in the callback
before_end_of_elaboration, which is equivalent to the UVM build phase.
In SystemC, the ports/exports are usually becoming members of a uvm_component and not pointers. In that case,
the ports/exports are automatically created and initialized in the constructor of the parent uvm_component. This
implies that in UVM-SystemC the ports/export construction is not configurable through uvm_config_db. Because
the bulk of the UVM hierarchy construction occurs in the build phase, the port/export bindings that depend on the
entire hierarchy being constructed have to be done in a later phase. Similar as in UVM-SystemVerilog, the connect
phase is introduced in UVM-SystemC to perform the port bindings using the sc_core::sc_port member function
bind or operator(). The UVM binding mechanism using the member function connect of the ports is made
available for compatibility purposes.
UVM-SystemC Language Reference Manual DRAFT Page 24
4. Global functions
All global functions reside in the UVM namespace. Functions marked with symbol are not compatible with the
UVM SystemVerilog standard.
4.1 uvm_set_config_int
void uvm_set_config_int( const std::string& inst_name,
const std::string& field_name,
int value );
The global function uvm_set_config_int shall create and place an integer in a configuration database. The argument
inst_name shall define the full hierarchical pathname of the object being configured. The argument field_name is the
specific field that is being searched for. Both arguments inst_name and field_name may contain wildcards.
NOTEThis global function is made available since there is no command line interface option to pass configuration data.
4.2 uvm_set_config_string
void uvm_set_config_string( const std::string& inst_name,
const std::string& field_name,
const std::string& value );
The global function uvm_set_config_string shall create and place a string in a configuration database. The
argument inst_name shall define the full hierarchical pathname of the object being configured. The argument
field_name is the specific field that is being searched for. Both arguments inst_name and field_name may contain
wildcards.
NOTEThis global function is made available since there is no command line interface option to pass configuration data.
4.3 run_test
void run_test( const std::string& test_name = "" );
The function run_test is a convenience function to start member function uvm_root::run_test. (See 5.3.2.1)
Page 25 UVM-SystemC Language Reference Manual DRAFT
5. Base Classes
5.1 uvm_void
The class uvm_void shall provide the base class for all UVM classes. It shall be an abstract class with no data
members or functions, to allow the creation of a generic container of objects.
An application may derive directly from this class and will inherit none of the UVM functionality, but such classes
may be placed in uvm_void-typed containers along with other UVM objects.
5.1.1 Class definition
namespace uvm {
class uvm_void {};
} // namespace uvm
5.2 uvm_object
The class uvm_object shall provide the base class for all UVM data and hierarchical classes. Its primary role is to
define a set of member functions for common operations such as create, copy, compare, print, and record. Classes
deriving from uvm_object shall implement the member functions such as create and get_type_name.
5.2.1 Class definition
namespace uvm {
class uvm_object : public uvm_void
{
public:
// Group: Construction
uvm_object();
explicit uvm_object( const std::string& name );
// Group: Identification
virtual void set_name( const std::string& name );
virtual const std::string get_name() const;
virtual const std::string get_full_name() const;
virtual int get_inst_id() const;
static int get_inst_count();
static const uvm_object_wrapper* get_type();
virtual const uvm_object_wrapper* get_object_type() const;
UVM-SystemC Language Reference Manual DRAFT Page 26
virtual const std::string get_type_name() const;
// Group: Creation
virtual uvm_object* create( const std::string& name = "" );
virtual uvm_object* clone();
// Group: Printing
void print( uvm_printer* printer = NULL ) const;
std::string sprint( uvm_printer* printer = NULL ) const;
virtual void do_print( const uvm_printer& printer ) const;
virtual std::string convert2string() const;
// Group: Recording
void record( uvm_recorder* recorder = NULL );
virtual void do_record( const uvm_recorder& recorder );
// Group: Copying
void copy( const uvm_object& rhs );
virtual void do_copy( const uvm_object& rhs );
// Group: Comparing
bool compare( const uvm_object& rhs,
const uvm_comparer* comparer = NULL ) const;
virtual bool do_compare( const uvm_object& rhs,
const uvm_comparer* comparer = NULL ) const;
// Group: Packing
int pack( std::vector<bool>& bitstream, uvm_packer* packer = NULL );
int pack_bytes( std::vector<unsigned char>& bytestream, uvm_packer* packer = NULL );
int pack_ints( std::vector<unsigned int>& intstream, uvm_packer* packer = NULL );
virtual void do_pack( uvm_packer& packer ) const;
// Group: Unpacking
int unpack( const std::vector<bool>& v, uvm_packer* packer = NULL );
int unpack_bytes( const std::vector<unsigned char>& v, uvm_packer* packer = NULL );
int unpack_ints( const std::vector<unsigned int>& v, uvm_packer* packer = NULL );
virtual void do_unpack( uvm_packer& packer );
Page 27 UVM-SystemC Language Reference Manual DRAFT
}; // class uvm_object
} // namespace uvm
5.2.2 Construction
5.2.2.1 Constructors
uvm_object();
explicit uvm_object( const std::string& name );
The constructor shall create a new uvm_object with the given instance name passed as argument. If no argument is
given, the default constructor shall call function sc_core::sc_gen_unique_name(“object”) to generate a unique
string name as instance name of this object.
5.2.3 Identification
5.2.3.1 set_name
virtual void set_name( const std::string& name );
The member function set_name shall set the instance name of this object passed as argument, overwriting any
previously given name. It shall be an error if the name is already in use for another object.
5.2.3.2 get_name
virtual const std::string get_name() const;
The member function get_name shall return the name of the object, as provided by the argument name via the
constructor or member function set_name.
5.2.3.3 get_full_name
virtual const std::string get_full_name() const;
The member function get_full_name shall return the full hierarchical name of this object. The default
implementation is the same as get_name, as objects of type uvm_object do not inherently possess hierarchy.
NOTEObjects possessing hierarchy, such as objects of type uvm_component, override the default implementation. Other
objects might be associated with component hierarchy, but are not themselves components. For example, sequence classes of
type uvm_sequence are typically associated with a sequencer class of type uvm_sequencer. In this case, it is useful to override
get_full_name to return the sequencer’s full name concatenated with the sequence’s name. This provides the sequence a full
context, which is useful when debugging.
5.2.3.4 get_inst_id
virtual int get_inst_id() const;
UVM-SystemC Language Reference Manual DRAFT Page 28
The member function get_inst_id shall return the object’s unique, numeric instance identifier.
5.2.3.5 get_inst_count
static int get_inst_count();
The member function get_inst_count shall return the current value of the instance counter, which represents the
total number of objects of type uvm_object that have been allocated in simulation. The instance counter is used to
form a unique numeric instance identifier.
5.2.3.6 get_type
static const uvm_object_wrapper* get_type();
The member function get_type shall return the type-proxy (wrapper) for this object. The uvm_factory’s type-based
override and creation member functions take arguments of uvm_object_wrapper. The default implementation of
this member function shall produce an error and return NULL.
To enable use of this member function, a user’s subtype must implement a version that returns the subtype’s
wrapper.
5.2.3.7 get_object_type
virtual const uvm_object_wrapper* get_object_type() const;
The member function get_object_type shall the return the type-proxy (wrapper) for this object. The uvm_factory’s
type-based override and creation member functions take arguments of uvm_object_wrapper. The default
implementation of this member function does a factory lookup of the proxy using the return value from
get_type_name. If the type returned by get_type_name is not registered with the factory, then the member function
shall return NULL.
This member function behaves the same as the static member function get_type, but uses an already allocated object
to determine the type-proxy to access (instead of using the static object).
5.2.3.8 get_type_name
virtual const std::string get_type_name() const;
The member function get_type_name shall return the type name of the object, which is typically the type identifier
enclosed in quotes. It is used for various debugging functions in the library, and it is used by the factory for creating
objects.
5.2.4 Creation
5.2.4.1 create
virtual uvm_object* create( const std::string& name = "" );
The member function create shall allocate a new object of the same type as this object and returns it via a base
handle of type uvm_object. Every class deriving from uvm_object, directly or indirectly, shall implement the
member function create.
Page 29 UVM-SystemC Language Reference Manual DRAFT
5.2.4.2 clone
virtual uvm_object* clone();
The member function clone shall create and return a pointer to an exact copy of this object.
NOTEAs the member function clone is virtual, derived classes may override this implementation if desired.
5.2.5 Printing
5.2.5.1 print
void print( uvm_printer* printer = NULL ) const;
The member function print shall deep-print this object’s properties in a format and manner governed by the given
argument printer. If the argument printer is not provided, the global uvm_default_printer shall be used (see
6.7.1.4)
The member function print is not virtual and shall not be overloaded. To include custom information in the print
and sprint operations, derived classes shall override the member function do_print and can use the provided printer
policy class to format the output.
5.2.5.2 sprint
std::string sprint( uvm_printer* printer = NULL ) const;
The member function sprint shall return the object’s properties as a string and in a format and manner governed by
the given argument printer. If the argument printer is not provided, the global uvm_default_printer shall be used
(see 6.7.1.4)
The member function sprint is not virtual and shall not be overloaded. To include additional fields in the print and
sprint operation, derived classes shall override the member function do_print and use the provided printer policy
class to format the output. The printer policy will manage all string concatenations and provide the string to sprint
to return to the caller.
5.2.5.3 do_print
virtual void do_print( const uvm_printer& printer ) const;
The member function do_print shall provide a context called by the member functions print and sprint that allows
an application to customize what gets printed. The argument printer is the policy object that governs the format and
content of the output. To ensure correct print and sprint operation, and to ensure a consistent output format, the
printer shall be used by all do_print implementations.
5.2.5.4 convert2string
virtual std::string convert2string() const;
The member function convert2string shall provide a context which may be called directly by the application, to
provide object information in the form of a string. Unlike the member function sprint, there is no requirement to use
UVM-SystemC Language Reference Manual DRAFT Page 30
a uvm_printer policy object. As such, the format and content of the output is fully customizable, which may be
suitable for applications not requiring the consistent formatting offered by the print/sprint/do_print API.
5.2.6 Recording
5.2.6.1 record
void record( uvm_recorder* recorder = NULL );
The member function record shall deep-records this object’s properties according to an optional recorder policy.
The member function is not virtual and shall not be overloaded. To include additional fields in the record operation,
derived classes should override the member function do_record.
The optional argument recorder specifies the recording policy, which governs how recording takes place. If a
recorder policy is not provided explicitly, then the global uvm_default_recorder policy is used (see 6.7.1.7).
NOTEThe recording mechanism is vendor-specific. By providing access via a common interface, the uvm_recorder policy
provides vendor-independent access to a simulator’s recording capabilities.
5.2.6.2 do_record
virtual void do_record( const uvm_recorder& recorder );
The member function do_record shall provide a context called by the member function record. A derived class
should overload this member function to include its fields in a record operation.
The argument recorder is policy object for recording this object. A do_record implementation should call the
appropriate recorder member function for each of its fields.
NOTEVendor-specific recording implementations are encapsulated in the recorder policy, thereby insulating user-code from
vendor-specific behavior.
5.2.7 Copying
5.2.7.1 copy
void copy( const uvm_object& rhs );
The member function copy shall make a copy of the specified object passed as argument.
The member function is not virtual and shall not be overloaded in derived classes. To copy the fields of a derived
class, that class shall overload the member function do_copy.
5.2.7.2 do_copy
virtual void do_copy( const uvm_object& rhs );
The member function do_copy shall provide a context called by the member function copy. A derived class should
overload this member function to include its fields in a copy operation.
Page 31 UVM-SystemC Language Reference Manual DRAFT
5.2.8 Comparing
5.2.8.1 compare
bool compare( const uvm_object& rhs,
const uvm_comparer* comparer = NULL ) const;
The member function compare shall compare members of this data object with those of the object provided in the
rhs (right-hand side) argument. It shall return true on a match; otherwise it shall return false.
The optional argument comparer specifies the comparison policy. It allows an application to control some aspects of
the comparison operation. It also stores the results of the comparison, such as field-by-field miscompare information
and the total number of miscompares. If a comparer policy is not provided or set to NULL, then the global
uvm_default_comparer policy is used (see 6.7.1.6).
The member function is not virtual and shall not be overloaded in derived classes. To compare the fields of a derived
class, that class shall overload the member function do_compare.
5.2.8.2 do_compare
virtual bool do_compare( const uvm_object& rhs,
const uvm_comparer* comparer = NULL ) const;
The member function do_compare shall provide a context called by the member function compare. A derived class
should overload this member function to include its fields in a compare operation. The member function shall return
true if the comparison succeeds; otherwise it shall return false.
5.2.9 Packing
5.2.9.1 pack
int pack( std::vector<bool>& bitstream, uvm_packer* packer = NULL );
The member function pack shall concatenate the object properties into a vector of bits. The member function shall
return the total number of bits packed into the given vector.
The optional argument packer specifies the packing policy, which governs the packing operation. If a packer policy
is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the
pack operation, derived classes shall overload the member function do_pack.
5.2.9.2 pack_bytes
int pack_bytes( std::vector<char>& bytestream, uvm_packer* packer = NULL );
The member function pack_bytes shall concatenate the object properties into a vector of bytes. The member
function shall return the total number of bytes packed into the given vector.
The optional argument packer specifies the packing policy, which governs the packing operation. If a packer policy
is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
UVM-SystemC Language Reference Manual DRAFT Page 32
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the
pack operation, derived classes shall overload the member function do_pack.
5.2.9.3 pack_ints
int pack_ints( std::vector<int>& intstream, uvm_packer* packer = NULL );
The member function pack_ints shall concatenate the object properties into a vector of integers. The member
function shall return the total number of integers packed into the given vector.
The optional argument packer specifies the packing policy, which governs the packing operation. If a packer policy
is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the
pack operation, derived classes shall overload the member function do_pack.
5.2.9.4 do_pack
virtual void do_pack( uvm_packer& packer ) const;
The member function do_pack shall provide a context called by the member functions pack, pack_bytes and
pack_ints. A derived class should overload this member function to include its fields in a packing operation.
The argument packer is the policy object for packing and should be used to pack objects.
5.2.10 Unpacking
5.2.10.1 unpack
int unpack( const std::vector<bool>& bitstream, uvm_packer* packer = NULL );
The member function unpack shall extract the values from a vector of bits. The member function shall return the
total number of bits unpacked from the given vector.
The optional argument packer specifies the packing policy, which governs both the pack and unpack operation. If a
packer policy is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the
unpack operation, derived classes shall overload the member function do_unpack.
NOTEThe application of the member function for unpacking shall exactly correspond to the member function for packing. This
is assured if (a) the same packer policy is used to pack and unpack, and (b) the order of unpacking is the same as the order of
packing used to create the input vector. The behavior is undefined in case a different packer policy or ordering is applied for
packing and unpacking.
5.2.10.2 unpack_bytes
int unpack_bytes( const std::vector<char>& bytestream, uvm_packer* packer = NULL );
The member function unpack_bytes shall extract the values from a vector of bytes. The member function shall
return the total number of bytes unpacked from the given vector.
Page 33 UVM-SystemC Language Reference Manual DRAFT
The optional argument packer specifies the packing policy, which governs the pack and unpack operation. If a
packer policy is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the
unpack operation, derived classes shall overload the member function do_unpack.
NOTEThe application of the member function for unpacking shall exactly correspond to the member function for packing. This
is assured if (a) the same packer policy is used to pack and unpack, and (b) the order of unpacking is the same as the order of
packing used to create the input vector. The behavior is undefined in case a different packer policy or ordering is applied for
packing and unpacking.
5.2.10.3 unpack_ints
int unpack_ints( const std::vector<int>& intstream, uvm_packer* packer = NULL );
The member function unpack_ints shall extract the values from a vector of integers. The member function shall
return the total number of integers unpacked from the given vector.
The optional argument packer specifies the packing policy, which governs the pack and unpack operation. If a
packer policy is not provided or set to NULL, the global uvm_default_packer policy shall be used (see 6.7.1.5).
The member function is not virtual and shall not be overloaded in derived classes. To include additional fields in the unpack
operation, derived classes shall overload the member function do_unpack.
NOTEThe application of the member function for unpacking shall exactly correspond to the member function for packing. This
is assured if (a) the same packer policy is used to pack and unpack, and (b) the order of unpacking is the same as the order of
packing used to create the input vector. The behavior is undefined in case a different packer policy or ordering is applied for
packing and unpacking.
5.2.10.4 do_unpack
virtual void do_unpack( uvm_packer& packer ) const;
The member function do_unpack shall provide a context called by the member functions unpack, unpack_bytes
and unpack_ints. A derived class should overload this member function to include its fields in a unpacking
operation. The member function shall return true if the unpacking succeeds; otherwise it shall return false.
The argument packer is the policy object for unpacking and should be used to unpack objects.
NOTEThe application of the member function for unpacking shall exactly correspond to the member function for packing. This
is assured if (a) the same packer policy is used to pack and unpack, and (b) the order of unpacking is the same as the order of
packing used to create the input vector. The behavior is undefined in case a different packer policy or ordering is applied for
packing and unpacking.
5.2.11 Object macros
UVM-SystemC provides the following macros for a uvm_object:
utility macro UVM_OBJECT_UTILS(classname) is to be used inside the class definition that expands to:
o The declaration of the member function get_type_name, which returns the type of a class as string
o The declaration of the member function get_type, which returns a factory proxy object for the
type
o The declaration of the proxy class uvm_object_registry<classname> used by the factory.
UVM-SystemC Language Reference Manual DRAFT Page 34
Template classes shall use the macro UVM_OBJECT_PARAM_UTILS, to guarantee correct registration of one or
more parameters passed to the class template. Note that template classes are not evaluated at compile-time, and thus
not registered with the factory. Due to this, name-based lookup with the factory for template classes is not possible.
Instead, an application shall use the member function get_type for factory overrides.
5.3 uvm_root
The class uvm_root serves as the implicit top-level and phase controller for all UVM components. An application
shall not directly instantiate uvm_root. A UVM implementation shall create a single instance of uvm_root that an
application can access via the global variable uvm_top.
5.3.1 Class definition
namespace uvm {
class uvm_root : public uvm_component
{
public:
static uvm_root* get();
// Group: Simulation control
virtual void run_test( const std::string& test_name = "" );
virtual void die();
void set_timeout( const sc_core::sc_time& timeout, bool overridable = true );
void set_finish_on_completion( bool enable );
bool get_finish_on_completion();
// Group: Topology
uvm_component* find( const std::string& comp_match );
void find_all( const std::string& comp_match,
std::vector<uvm_component*>& comps,
uvm_component* comp = NULL );
void print_topology( uvm_printer* printer = NULL );
void enable_print_topology( bool enable = true );
// Global variable
const uvm_root* uvm_top;
}; // class uvm_root
} // namespace uvm
Page 35 UVM-SystemC Language Reference Manual DRAFT
5.3.2 Simulation control
5.3.2.1 run_test
virtual void run_test( const std::string& test_name = "" );
The member function run_test shall register the UVM phasing mechanism. If the optional argument test_name is
provided, then the specified test component is created just prior to phasing, if and only if this component is derived
from class uvm_test. Otherwise it shall be an error.
The phasing mechanism is used during test execution, where all components are called following a defined set of
registered phases. The member function run_test will register both the common phases as well as the UVM run-
time phases. (See section 12).
NOTE 1Selection of the test via the command line interface is not yet available.
NOTE 2The test execution is started using the SystemC function sc_core::sc_start. It is recommended not to specify the
simulation stop time, as the end-of-test is automatically managed by the phasing mechanism.
5.3.2.2 die
virtual void die();
The member function die shall be called by the report server if a report reaches the maximum quit count or has a
UVM_EXIT action associated with it, e.g., as with fatal errors. The member function shall call the member function
uvm_component::pre_abort on the entire UVM component hierarchy in a bottom-up fashion. It then shall call
uvm_report_server::report_summarize and terminate the simulation.
5.3.2.3 set_timeout
void set_timeout( const sc_core::sc_time& timeout, bool overridable = true );
The member function set_timeout shall define the timeout for the run phases. If not called, the default timeout shall
be set to UVM_DEFAULT_TIMEOUT (see 16.1.3).
5.3.2.4 set_finish_on_completion
void set_finish_on_completion( bool enable );
The member function set_finish_on_completion shall define how simulation is finalized. If the application did not
call this member function or if the argument enable is set to true, it shall terminate the simulation after execution of
the UVM phases. If the argument enable is set to false, the simulation shall be paused after execution of the UVM
phases.
NOTEAn implementation may call the function sc_core::sc_stop to terminate the simulation. An implementation may call the
function sc_core::sc_pause to pause the simulation.
5.3.2.5 get_finish_on_completion
bool get_finish_on_completion();
UVM-SystemC Language Reference Manual DRAFT Page 36
The member function get_finish_on_completion shall return true if the application has not called member function
set_finish_on_completion or if the member function was called with the argument enable as true; otherwise it shall
return false. (See also 5.3.2.4.)
5.3.3 Topology
5.3.3.1 find
uvm_component* find( const std::string& comp_match );
The member function find shall return a component handle matching the given string comp_match. The string may
contain the wildcards ‘*’ and ‘?. Strings beginning with character ‘.’ are absolute path names.
5.3.3.2 find_all
void find_all( const std::string& comp_match,
std::vector<uvm_component*>& comps,
uvm_component* comp = NULL );
The member function find_all shall return a vector of component handles matching the given string comp_match.
The string may contain the wildcards ‘*’ and ?. Strings beginning with character ‘.’ are absolute path names. If the
optional component argument comp is provided, then the search begins from that component down; otherwise it
searches all components.
5.3.3.3 print_topology
void print_topology( uvm_printer* printer = NULL );
The member function print_topology shall print the verification environment’s component topology. The argument
printer shall be an object of class uvm_printer that controls the format of the topology printout; a NULL printer
prints with the default output.
5.3.3.4 enable_print_topology
void enable_print_topology( bool enable = true );
The member function enable_print_topology shall print the entire testbench topology just after completion of the
end_of_elaboration phase, if enabled. By default, the testbench topology is not printed, unless enabled by the
application by calling this member function.
5.3.4 Global variable
5.3.4.1 uvm_top
const uvm_root* uvm_top;
The data member uvm_top is a handle to the top-level (root) component that governs phase execution and provides
the component search interface. By default, this handle is provided by the uvm_root singleton.
The uvm_top instance of uvm_root plays several key roles in the UVM:
Page 37 UVM-SystemC Language Reference Manual DRAFT
Implicit top-level: The uvm_top serves as an implicit top-level component. Any UVM component which is
not instantiated in another UVM component (e.g. when instantiated in an sc_core::sc_module or in
sc_main) becomes a child of uvm_top. Thus, all UVM components in simulation are descendants of
uvm_top.
Phase control: uvm_top manages the phasing for all components.
Search: An application may use uvm_top to search for components based on their hierarchical name. See
member functions find and find_all.
Report configuration: An application may use uvm_top to globally configure report verbosity, log files,
and actions. For example, uvm_top.set_report_verbosity_level_hier(UVM_FULL) would set full
verbosity for all components in simulation.
Global reporter: Because uvm_top is globally accessible, the UVM reporting mechanism is accessible
from anywhere outside uvm_component, such as in modules and sequences. See uvm_report_error,
uvm_report_warning, and other global methods.
The uvm_top instance checks during the end_of_elaboration_phase if any errors have been generated so far. If
errors are found a UVM_FATAL error is generated as result so that the simulation will not continue to the
start_of_simulation_phase.
5.4 uvm_port_base
The class uvm_port_base shall provide methods to bind ports to interfaces or to other ports or exports, and to
forward interface method calls to the channel to which the port is bound, according to the same mechanism as
defined in SystemC. Therefore this class shall be derived from the class sc_core::sc_port.
5.4.1 Class definition
namespace uvm {
template <class IF>
class uvm_port_base : public sc_core::sc_port<IF>
{
public:
uvm_port_base();
explicit uvm_port_base( const std::string& name );
virtual const std::string get_name() const;
virtual const std::string get_full_name() const;
virtual uvm_component* get_parent() const;
virtual const std::string get_type_name() const;
virtual void connect( IF& );
virtual void connect( uvm_port_base<IF>& );
UVM-SystemC Language Reference Manual DRAFT Page 38
// class uvm_port_base
} // namespace uvm
5.4.2 Template parameter IF
The template parameter IF shall specify the name of the interface type used for the port. The port can only be bound
to a channel which is derived from the same type, or to another port or export which is derived from this type.
5.4.3 Constructor
uvm_port_base();
explicit uvm_port_base( const std::string& name );
The constructor shall create and initialize an instance of the class with the name name, if passed as an argument.
5.4.4 Member functions
5.4.4.1 get_name
virtual const std::string get_name() const;
The member function get_name shall return the leaf name of this port.
5.4.4.2 get_full_name
virtual const std::string get_full_name() const;
The member function get_full_name shall return the full hierarchical name of this port.
5.4.4.3 get_parent
virtual uvm_component* get_parent() const;
The member function get_parent shall return the handle to this port’s parent, or NULL if it has no parent.
5.4.4.4 get_type_name
virtual const std::string get_type_name() const;
The member function get_type_name shall return the type name to this port. Derived port classes shall implement
this member function to return the concrete type.
5.4.4.5 connect
virtual void connect( IF& );
virtual void connect( uvm_port_base<IF>& );
Page 39 UVM-SystemC Language Reference Manual DRAFT
The member function connect shall bind this port to the interface given as argument.
NOTEThe member function connect implements the same functionality as the SystemC member function bind.
5.5 uvm_component_name
The class uvm_component_name is shall provide the mechanism for building the hierarchical names of component
instances and component hierarchy during elaboration.
An implementation shall maintain the UVM component hierarchy, that is, it shall build a list of hierarchical
component names, where each component instance is named as if it were a child of another component (its parent).
The mechanism to implement such component hierarchy is implementation-defined.
NOTE 1The hierarchical name of an instance in the component hierarchy is returned from member function get_full_name of
class uvm_component, which is the base class of all component instances.
NOTE 2An object of type uvm_object may have a hierarchical name and may have a parent in the component hierarchy, but
such object is not part of the component hierarchy.
5.5.1 Class definition
namespace uvm {
class uvm_component_name
{
public:
uvm_component_name( const char* name );
uvm_component_name( const uvm_component_name& name );
~uvm_component_name();
operator const char*() const;
private:
// Disabled
uvm_component_name();
uvm_component_name& operator= ( const uvm_component_name& name );
}; // class uvm_component_name
} // namespace uvm
5.5.2 Constraints on usage
The class uvm_component_name shall only be used as argument in a constructor of a class derived from class
uvm_component. Such constructor shall only contain this argument of type uvm_component_name.
UVM-SystemC Language Reference Manual DRAFT Page 40
5.5.3 Constructor
uvm_component_name( const char* name );
The constructor uvm_component_name( const char* name ) shall store the name in the component hierarchy. The
constructor argument name shall be used as the string name for that component being instantiated within the
component hierarchy.
NOTEAn application shall define for each class derived directly or indirectly from class uvm_component a constructor with a
single argument of type uvm_component_name, where the constructor uvm_component_name( const char* ) is called as an
implicit conversion.
uvm_component_name( const uvm_componet_name& name );
The constructor uvm_component_name( const uvm_component_name& name ) shall copy the constructor
argument but shall not modify the component hierarchy.
NOTEWhen an application derives a class directly or indirectly from class uvm_component, the derived class constructor calls
the base class constructor with an argument of class uvm_component_name and thus this copy constructor is called.
5.5.4 Destructor
~uvm_component_name();
The destructor shall remove the object from the component hierarchy if, and only if, the object being destroyed was
constructed by using the constructor signature uvm_component_name( const char* name ).
5.5.5 operator const char*
operator const char*() const;
This conversion function shall return the string name (not the hierarchical name) associated with the
uvm_component_name.
5.6 uvm_coreservice_t
The class uvm_coreservice_t shall provide a common entry for all central UVM services such as uvm_factory,
uvm_report_server, etc.
5.6.1 Class definition
namespace uvm {
class uvm_coreservice_t
{
public:
virtual uvm_factory* get_factory() const = 0;
virtual void set_factory( uvm_factory* f ) = 0;
virtual uvm_report_server* get_report_server() const = 0;
Page 41 UVM-SystemC Language Reference Manual DRAFT
virtual void set_report_server( uvm_report_server* server ) = 0;
virtual uvm_root* get_root() const = 0;
static uvm_default_coreservice_t* get();
private:
uvm_coreservice_t();
}; // class uvm_coreservice_t
} // namespace uvm
5.6.2 Constraints on usage
An application should not create an object of type uvm_corservice_t. Instead, it should call the static member
function get which returns a handle to the object uvm_default_coreservice_t, which give access to the member
functions to get and set the services.
5.6.3 Member functions
5.6.3.1 get_factory
virtual uvm_factory* get_factory() const = 0;
The member function get_factory shall return a handle to the currently enabled UVM factory.
5.6.3.2 set_factory
virtual void set_factory( uvm_factory* f ) = 0;
The member function set_factory shall set the current UVM factory.
5.6.3.3 get_report_server
virtual uvm_report_server* get_report_server() const = 0;
The member function get_report_server shall return a handle to the current report server.
5.6.3.4 set_report_server
virtual void set_report_server( uvm_report_server* server ) = 0;
The member function set_report_server shall set the current report server.
5.6.3.5 get_root
virtual uvm_root* get_root() const = 0;
The member function get_root shall return a handle to the root UVM component (uvm_root).
UVM-SystemC Language Reference Manual DRAFT Page 42
5.6.3.6 get
static uvm_default_coreservice_t* get();
The member function get shall return a handle to the object uvm_default_coreservice_t.
5.7 uvm_default_coreservice_t
The class uvm_default_coreservice_t shall provide a default implementation of the uvm_coreservice_t API. It
instantiates uvm_default_factory, uvm_default_report_server, and uvm_root.
5.7.1 Class definition
namespace uvm {
class uvm_default_coreservice_t : public uvm_coreservice_t
{
public:
virtual uvm_factory* get_factory() const;
virtual void set_factory( uvm_factory* f );
virtual uvm_report_server* get_report_server() const;
virtual void set_report_server( uvm_report_server* server );
virtual uvm_root* get_root() const;
private:
uvm_default_coreservice_t();
}; // class uvm_default_coreservice_t
} // namespace uvm
5.7.2 Constraints on usage
An application should not create an object of type uvm_default_corservice_t. Instead, it should call the static
member function uvm_corservice_t::get which returns a handle to this object, which give access to the member
functions to get and set the services.
5.7.3 Member functions
5.7.3.1 get_factory
virtual uvm_factory* get_factory() const;
Page 43 UVM-SystemC Language Reference Manual DRAFT
The member function get_factory shall return a handle to the currently enabled UVM factory. When no factory has
been set before, it shall instantiate the default factory of type uvm_default_factory and return the handle to this
object.
5.7.3.2 set_factory
virtual void set_factory( uvm_factory* f );
The member function set_factory shall set the current UVM factory.
NOTEIn case an application-specific factory is used, the application should comply to the factory API and offer functionality
which is compatible with or delegated to the original factory.
5.7.3.3 get_report_server
virtual uvm_report_server* get_report_server() const;
The member function get_report_server shall return a handle to the current report server. If no report server has
been set before, it shall return a handle to the default report server of type uvm_default_report_server.
5.7.3.4 set_report_server
virtual void set_report_server( uvm_report_server* server );
The member function set_report_server shall set the current report server.
5.7.3.5 get_root
virtual uvm_root* get_root() const;
The member function get_root shall return a handle to the root UVM component (uvm_root). When no root
component has been set before, it shall instantiate the UVM root component and return the handle to this
component.
UVM-SystemC Language Reference Manual DRAFT Page 44
6. Policy classes
The UVM policy classes provide specific tasks for printing, comparing, recording, packing, and unpacking of
objects derived from class uvm_object. They are implemented separately from class uvm_object so that an
application can plug in different ways to print, compare, etc. without modifying the object class being operated on.
The user can simply apply a different printer or compare “policy” to change how an object is printed or compared.
Each policy class includes several user-configurable parameters that control the operation. An application may also
customize operations by deriving new policy subtypes from these base types. For example, the UVM provides four
different printer policy classes derived from the policy base class uvm_printer, each of which print objects in a
different format.
The following policy classes are defined:
uvm_packer
uvm_printer, uvm_table_printer, uvm_tree_printer, uvm_line_printer and uvm_printer_knobs.
uvm_recorder
uvm_comparer
6.1 uvm_packer
The class uvm_packer provides a policy object for packing and unpacking objects of type uvm_object. The
policies determine how packing and unpacking should be done. Packing an object causes the object to be placed into
a packed array of type byte or int. Unpacking an object causes the object to be filled from the pack array. The logic
values X and Z are lost on packing. The maximum size of the packed array is defined by
UVM_PACKER_MAX_BYTES (see 16.1.2).
6.1.1 Class definition
namespace uvm {
class uvm_packer
{
public:
// Group: Packing
virtual void pack_field( const uvm_bitstream_t& value, int size );
virtual void pack_field_int( const uvm_integral_t& value, int size );
virtual void pack_string( const std::string& value );
virtual void pack_time( const sc_core::sc_time& value );
virtual void pack_real( double value );
virtual void pack_real( float value );
virtual void pack_object( const uvm_object& value );
virtual uvm_packer& operator<< ( bool value );
Page 45 UVM-SystemC Language Reference Manual DRAFT
virtual uvm_packer& operator<< ( double& value );
virtual uvm_packer& operator<< ( float& value );
virtual uvm_packer& operator<< ( char value );
virtual uvm_packer& operator<< ( unsigned char value );
virtual uvm_packer& operator<< ( short value );
virtual uvm_packer& operator<< ( unsigned short value );
virtual uvm_packer& operator<< ( int value );
virtual uvm_packer& operator<< ( unsigned int value );
virtual uvm_packer& operator<< ( long value );
virtual uvm_packer& operator<< ( unsigned long value );
virtual uvm_packer& operator<< ( long long value );
virtual uvm_packer& operator<< ( unsigned long long value );
virtual uvm_packer& operator<< ( const std::string& value );
virtual uvm_packer& operator<< ( const char* value );
virtual uvm_packer& operator<< ( const uvm_object& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_logic& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_bv_base& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_lv_base& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_int_base& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_uint_base& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_signed& value );
virtual uvm_packer& operator<< ( const sc_dt::sc_unsigned& value );
template <class T>
uvm_packer& operator<< ( const std::vector<T>& value );
// Group: Unpacking
virtual bool is_null();
virtual uvm_integral_t unpack_field_int( int size );
virtual uvm_bitstream_t unpack_field( int size );
virtual std::string unpack_string( int num_chars = -1 );
virtual sc_core::sc_time unpack_time();
virtual double unpack_real();
virtual float unpack_real();
virtual void unpack_object( uvm_object& value );
virtual unsigned int get_packed_size() const;
virtual uvm_packer& operator>> ( bool& value );
UVM-SystemC Language Reference Manual DRAFT Page 46
virtual uvm_packer& operator>> ( double& value );
virtual uvm_packer& operator>> ( float& value );
virtual uvm_packer& operator>> ( char& value );
virtual uvm_packer& operator>> ( unsigned char& value );
virtual uvm_packer& operator>> ( short& value );
virtual uvm_packer& operator>> ( unsigned short& value );
virtual uvm_packer& operator>> ( int& value );
virtual uvm_packer& operator>> ( unsigned int& value );
virtual uvm_packer& operator>> ( long& value );
virtual uvm_packer& operator>> ( unsigned long& value );
virtual uvm_packer& operator>> ( long long& value );
virtual uvm_packer& operator>> ( unsigned long long& value );
virtual uvm_packer& operator>> ( std::string& value );
virtual uvm_packer& operator>> ( uvm_object& value );
virtual uvm_packer& operator>> ( sc_dt::sc_logic& value );
virtual uvm_packer& operator>> ( sc_dt::sc_bv_base& value );
virtual uvm_packer& operator>> ( sc_dt::sc_lv_base& value );
virtual uvm_packer& operator>> ( sc_dt::sc_int_base& value );
virtual uvm_packer& operator>> ( sc_dt::sc_uint_base& value );
virtual uvm_packer& operator>> ( sc_dt::sc_signed& value );
virtual uvm_packer& operator>> ( sc_dt::sc_unsigned& value );
template <class T>
virtual uvm_packer& operator>> ( std::vector<T>& value );
// Data members (variables)
bool physical;
bool abstract;
bool use_metadata;
bool big_endian;
private:
// Disabled
uvm_packer();
}; // class uvm_packer
} // namespace uvm
Page 47 UVM-SystemC Language Reference Manual DRAFT
6.1.2 Constraints on usage
An application shall not explicitly create an instance of the class uvm_packer.
6.1.3 Packing
6.1.3.1 pack_field
virtual void pack_field( const uvm_bitstream_t& value, int size );
The member function pack_field shall pack an integral value (less than or equal to UVM_MAX_STREAMBITS)
into the packed array. The argument size is the number of bits of value to pack.
6.1.3.2 pack_field_int
virtual void pack_field_int( const uvm_integral_t& value, int size );
The member function pack_field_int shall pack the integral value (less than or equal to 64 bits) into the packed
array. The argument size is the number of bits of value to pack.
NOTEThis member function is the optimized version of pack_field is useful for sizes up to 64 bits.
6.1.3.3 pack_string
virtual void pack_string( const std::string& value );
The member function pack_string shall pack a string value into the packed array. When the variable metadata is
set, the packed string is terminated by a NULL character to mark the end of the string.
6.1.3.4 pack_time
virtual void pack_time( const sc_core::sc_time& value );
The member function pack_time shall pack a time value as 64 bits into the packed array.
6.1.3.5 pack_real
virtual void pack_real( double value );
virtual void pack_real( float value );
The member function pack_real shall pack a real value as binary vector into the packed array. When the argument
is a double precision floating point value of type double, a 64 bit binary vector shall be used. When the argument is
a single precision floating point value of type float, a 32 bit binary vector shall be used. The convertion of the
floating point representation to binary vector shall be according to the IEEE Standard for Floating-Point Arithmetic
(IEEE Std. 754-1985).
6.1.3.6 pack_object
virtual void pack_object( const uvm_object& value );
UVM-SystemC Language Reference Manual DRAFT Page 48
The member function pack_object shall pack an object value into the packed array. A 4-bit header is inserted ahead
of the string to indicate the number of bits that was packed. If a NULL object was packed, then this header will be 0.
6.1.4 Unpacking
6.1.4.1 is_null
virtual bool is_null();
The member function is_null shall be used during unpack operations to peek at the next 4-bit chunk of the pack data
and determine if it is zero. If the next four bits are all zero, then the return value is a true; otherwise it returns false.
NOTEThis member function is useful when unpacking objects, to decide whether a new object needs to be allocated or not.
6.1.4.2 unpack_field_int
virtual uvm_integral_t unpack_field_int( int size );
The member function unpack_field_int shall unpack bits from the packed array and returns the bit-stream that was
unpacked. The argument size is the number of bits to unpack; the maximum is 64 bits.
NOTEThis member function is a more efficient variant than unpack_field when unpacking into smaller vectors.
6.1.4.3 unpack_field
virtual uvm_bitstream_t unpack_field( int size );
The member function unpack_field shall unpack bits from the packed array and returns the bit-stream that was
unpacked. The argument size is the number of bits to unpack; the maximum is defined by
UVM_MAX_STREAMBITS.
6.1.4.4 unpack_string
virtual std::string unpack_string( int num_chars = -1 );
The member function unpack_string shall unpack a string. The argument num_chars specifies the number of bytes
that are unpacked into a string. If num_chars is -1, then unpacking stops on at the first NULL character that is
encountered.
6.1.4.5 unpack_time
virtual sc_core::sc_time unpack_time();
The member function unpack_time shall unpack the next 64 bits of the packed array and places them into a time
variable.
6.1.4.6 unpack_real
virtual double unpack_real();
virtual float unpack_real();
Page 49 UVM-SystemC Language Reference Manual DRAFT
The member function unpack_real shall unpack the next 64 bits of the packed array and places them into a real
variable. The 64 bits of packed data shall be converted to double precision floating point notation according to the
IEEE Standard for Floating-Point Arithmetic (IEEE Std. 754-1985).
6.1.4.7 unpack_object
virtual void unpack_object( uvm_object& value );
The member function unpack_object shall unpack an object and stores the result into value. Argument value must
be an allocated object that has enough space for the data being unpacked. The first four bits of packed data are used
to determine if a null object was packed into the array. The member function is_null can be used to peek at the next
four bits in the pack array before calling this member function.
6.1.4.8 get_packed_size
virtual unsigned int get_packed_size() const;
The member function get_packed_size returns the number of bits that were packed.
6.1.5 operator <<, operator >>
The class uvm_packer defines operator<< for packing, and operator >> for unpacking basic C++ types, SystemC
types, the type uvm_object, and std::vector types. The supported data types are:
Basic C++ types: bool, double, float, char, unsigned char, short, unsigned short, int, unsigned int, long,
unsigned long, long long, and unsigned long long.
SystemC types: sc_dt::sc_logic, sc_dt::sc_bv, sc_dt::sc_lv, sc_dt::sc_int, sc_dt::sc_uint,
sc_dt::sc_signed, and sc_dt::sc_unsigned.
String of type std::string and const char*
o When packing, an additional NULL byte is packed after the string is packed when use_metadata
is set to true (see 6.1.6.3).
Any type that derives from class uvm_object
Vector types: std::vector<T>, where T is one of the supported data types listed above, and has an
operator<< defined for it:
o When packing, additional 32 bits are packed indicating the size of the vector, prior to packing
individual elements.
An application may use operator<< or operator>> for the implementation of the member function do_pack and
do_unpack as part of an application-specific object definition derived from class uvm_object.
6.1.6 Data members (variables)
6.1.6.1 physical
bool physical;
UVM-SystemC Language Reference Manual DRAFT Page 50
The data member physical shall provides a filtering mechanism for fields. The abstract and physical settings allow
an object to distinguish between two different classes of fields. An application may, in the member functions
uvm_object::do_pack and uvm_object::do_unpack, test the setting of this field, to use it as a filter. By default, the
data member physical is set to true in the constructor of uvm_packer.
6.1.6.2 abstract
bool abstract;
The data member abstract shall provides a filtering mechanism for fields. The abstract and physical settings allow
an object to distinguish between two different classes of fields. An application may, in the member functions
uvm_object::do_pack and uvm_object::do_unpack, test the setting of this field, to use it as a filter. By default, the
data member abstract is set to false in the constructor of uvm_packer.
6.1.6.3 use_metadata
bool use_metadata;
The data member use_metadata shall indicate whether to encode metadata when packing dynamic data, or to
decode metadata when unpacking. Implementations of uvm_object::do_pack and uvm_object::do_unpack should
regard this bit when performing their respective operation. When set to true, metadata should be encoded as follows:
For strings, pack an additional NULL byte after the string is packed.
For objects, pack 4 bits prior to packing the object itself. Use 0b0000 to indicate the object being packed is
null, otherwise pack 0b0001 (the remaining 3 bits are reserved).
For queues, dynamic arrays, and associative arrays, pack 32 bits indicating the size of the array prior to to
packing individual elements.
By default, use_metadata is set to false.
6.1.6.4 big_endian
bool big_endian;
The data member big_endian shall determine the order that integral data is packed (using the member functions
pack_field, pack_field_int, pack_time, or pack_real) and how the data is unpacked from the pack array (using the
member functions unpack_field, unpack_field_int, unpack_time, or unpack_real). By default, the data member
is set to true in the constructor of uvm_packer. When the data member is set, data is associated msb to lsb;
otherwise, it is associated lsb to msb.
6.2 uvm_printer
The class uvm_printer shall provide the basic printer functionality, which shall be overloaded by derived classes to
support various pre-defined printing formats.
6.2.1 Class definition
namespace uvm {
Page 51 UVM-SystemC Language Reference Manual DRAFT
class uvm_printer
{
public:
// Group: Printing types
virtual void print_field( const std::string& name,
const uvm_bitstream_t& value,
int size = -1,
uvm_radix_enum radix = UVM_NORADIX,
const char* scope_separator = ".",
const std::string& type_name = "" ) const;
virtual void print_field_int( const std::string& name,
const uvm_integral_t& value,
int size = -1,
uvm_radix_enum radix = UVM_NORADIX,
const char* scope_separator = ".",
const std::string& type_name = "" ) const;
virtual void print_real( const std::string& name,
double value,
const char* scope_separator = "." ) const;
virtual void print_double( const std::string& name,
double value,
const char* scope_separator = "." ) const;
virtual void print_object( const std::string& name,
const uvm_object& value,
const char* scope_separator = "." ) const;
virtual void print_object_header( const std::string& name,
const uvm_object& value,
const char* scope_separator = "." ) const;
virtual void print_string( const std::string& name,
const std::string& value,
const char* scope_separator = "." ) const;
UVM-SystemC Language Reference Manual DRAFT Page 52
virtual void print_time( const std::string& name,
const sc_core::sc_time& value,
const char* scope_separator = "." ) const;
virtual void print_generic( const std::string& name,
const std::string& type_name,
int size,
const std::string& value,
const char* scope_separator = "." ) const;
// Group: Printer subtyping
virtual std::string emit();
virtual std::string format_row( const uvm_printer_row_info& row );
virtual std::string format_header();
virtual std::string format_footer();
std::string adjust_name( const std::string& id,
const char* scope_separator = "." ) const;
virtual void print_array_header( const std::string& name,
int size,
const std::string& arraytype = "array",
const char* scope_separator = "." ) const;
void print_array_range( int min, int max ) const;
void print_array_footer( int size = 0 ) const;
// Data members
uvm_printer_knobs knobs;
protected:
// Disabled
uvm_printer();
}; // class uvm_printer
} // namespace uvm
Page 53 UVM-SystemC Language Reference Manual DRAFT
6.2.2 Constraints on usage
An application shall not explicitly create an instance of the class uvm_printer.
6.2.3 Printing types
6.2.3.1 print_field
virtual void print_field( const std::string& name,
const uvm_bitstream_t& value,
int size = -1,
uvm_radix_enum radix = UVM_NORADIX,
const char* scope_separator = ".",
const std::string& type_name = "" );
The member function print_field shall print a field of type uvm_bitstream_t. The argument name defines the name
of the field. The argument value contains the value of the field. The argument size defines the number of bits of the
field. The argument radix defined radix to use for printing. The printer knob for radix is used if no radix is specified.
The argument scope_separator is used to find the leaf name since many printers only print the leaf name of a field.
Typical values for the separator are a “.” (dot) or “[” (open bracket).
6.2.3.2 print_field_int
virtual void print_field_int( const std::string& name,
const uvm_integral_t& value,
int size = -1,
uvm_radix_enum radix = UVM_NORADIX,
const char* scope_separator = ".",
const std::string& type_name = "" );
The member function print_field_int shall print an integer field. The argument name defines the name of the field.
The argument value contains the value of the field. The argument size defines the number of bits of the field. The
argument radix defined radix to use for printing. The printer knob for radix is used if no radix is specified. The
argument scope_separator is used to find the leaf name since many printers only print the leaf name of a field.
Typical values for the separator are a “.” (dot) or “[” (open bracket).
6.2.3.3 print_real
virtual void print_real( const std::string& name,
double value,
const char* scope_separator = "." );
The member function print_real shall print a real (double) field. The argument name defines the name of the field.
The argument value contains the value of the field. The argument scope_separator is used to find the leaf name
since many printers only print the leaf name of a field.
UVM-SystemC Language Reference Manual DRAFT Page 54
6.2.3.4 print_double
virtual void print_double( const std::string& name,
double value,
const char* scope_separator = "." );
The member function print_double shall print a real (double) field. The argument name defines the name of the
field. The argument value contains the value of the field. The argument scope_separator is used to find the leaf
name since many printers only print the leaf name of a field.
NOTEThis member function has been introduced to be more compatible with C++/SystemC coding styles and types. The
member function has identical functionality to print_real.
6.2.3.5 print_object
virtual void print_object( const std::string& name,
const uvm_object& value,
const char* scope_separator = "." ) const;
The member function print_object shall print an object. The argument name defines the name of the object. The
argument value contains the reference to the object. The argument scope_separator is used to find the leaf name
since many printers only print the leaf name of the object.
Whether the object is recursed depends on a variety of knobs, such as the depth knob; if the current depth is at or
below the depth setting, then the object is not recursed. By default, the children of objects of type uvm_component
are printed. To disable automatic printing of these objects, an application can set the member function
uvm_component::print_enabled to false for the specific children to be excluded from printing.
6.2.3.6 print_object_header
virtual void print_object_header( const std::string& name,
const uvm_object& value,
const char* scope_separator = "." ) const;
The member function print_object_header shall print an object header. The argument name defines the name of the
object. The argument value contains the reference to the object. The argument scope_separator is used to find the
leaf name since many printers only print the leaf name of a field.
6.2.3.7 print_string
virtual void print_string( const std::string& name,
const std::string& value,
const char* scope_separator = "." );
The member function print_string shall print a string field. The argument name defines the name of the field. The
argument value contains the value of the field. The argument scope_separator is used to find the leaf name since
many printers only print the leaf name of a field.
Page 55 UVM-SystemC Language Reference Manual DRAFT
6.2.3.8 print_time
virtual void print_time( const std::string& name,
const sc_core::sc_time& value,
const char* scope_separator = "." );
The member function print_time shall print the time. The argument name defines the name of the field. The
argument value contains the value of the field. The argument scope_separator is used to find the leaf name since
many printers only print the leaf name of a field.
6.2.3.9 print_generic
virtual void print_generic( const std::string& name,
const std::string& type_name,
int size,
const std::string& value,
const char* scope_separator = "." );
The member function print_generic shall print a field using the arguments name, type_name, size, and value. The
argument scope_separator is used to find the leaf name since many printers only print the leaf name of a field.
6.2.4 Printer subtyping
6.2.4.1 emit
virtual std::string emit();
The member emit shall return a string representing the contents of an object in a format defined by an extension of
this object.
6.2.4.2 format_row
virtual std::string format_row( const uvm_printer_row_info& row );
The member format_row shall offer a hook for producing custom output of a single field (row).
6.2.4.3 format_header
virtual std::string format_header();
The member format_header shall offer a hook to override the base header with a custom header.
6.2.4.4 format_footer
virtual std::string format_footer();
The member format_footer shall offer a hook to override the base footer with a custom footer.
UVM-SystemC Language Reference Manual DRAFT Page 56
6.2.4.5 adjust_name
std::string adjust_name( const std::string& id,
const char* scope_separator = "." ) const;
The member function adjust_name shall print a field’s name, or id, which is the full instance name. The intent of
the separator is to mark where the leaf name starts if the printer is configured to print only the leaf name of the
identifier.
6.2.4.6 print_array_header
virtual void print_array_header( const std::string& name,
int size,
const std::string& arraytype = "array",
const char* scope_separator = "." ) const;
The member function print_array_header shall print the header of an array. This member function shall be called
before each individual element is printed. The member function print_array_footer shall be called to mark the
completion of array printing.
6.2.4.7 print_array_range
void print_array_range( int min, int max ) const;
The member function print_array_range shall print a range using ellipses for values. This method is used when
honoring the array knobs for partial printing of large arrays, uvm_printer_knobs::begin_elements and
uvm_printer_knobs::end_elements. This member function should be called after
uvm_printer_knobs::begin_elements have been printed and before uvm_printer_knobs::end_elements have
been printed.
6.2.4.8 print_array_footer
void print_array_footer( int size = 0 ) const;
The member function print_array_footer shall print the footer of an array. This member function marks the end of
an array print. Generally, there is no output associated with the array footer, but this method lets the printer know
that the array printing is complete.
6.2.5 Data members
6.2.5.1 knobs
uvm_printer_knobs knobs;
The data member knobs shall provide access to the variety of knobs associated with a specific printer instance.
6.3 uvm_table_printer
The class uvm_table_printer shall provide a pre-defined printing output in a tabular format.
Page 57 UVM-SystemC Language Reference Manual DRAFT
6.3.1 Class definition
namespace uvm {
class uvm_table_printer : public uvm_printer
{
public:
uvm_table_printer();
virtual std::string emit();
}; // class uvm_table_printer
} // namespace uvm
6.3.2 Constructor
uvm_table_printer();
The constructor shall create a new instance of type uvm_table_printer.
6.3.3 emit
The member function emit shall format the collected information for printing into a table format.
6.4 uvm_tree_printer
The class uvm_tree_printer shall provide a pre-defined printing output in a tree format.
6.4.1 Class definition
namespace uvm {
class uvm_tree_printer : public uvm_printer
{
public:
uvm_tree_printer();
virtual std::string emit();
}; // class uvm_tree_printer
} // namespace uvm
6.4.2 Constructor
uvm_tree_printer();
UVM-SystemC Language Reference Manual DRAFT Page 58
The constructor shall create a new instance of type uvm_tree_printer.
6.4.3 emit
The member function emit shall format the collected information for printing into a hierarchical tree format.
6.5 uvm_line_printer
The class uvm_table_printer shall provide a pre-defined printing output in a line format.
6.5.1 Class definition
namespace uvm {
class uvm_line_printer : public uvm_printer
{
public:
uvm_line_printer();
virtual std::string emit();
}; // class uvm_line_printer
} // namespace uvm
6.5.2 Constructor
uvm_line_printer();
The constructor shall create a new instance of type uvm_line_printer.
6.5.3 emit
The member function emit shall format the collected information for printing into a line format, which contains no
line-feeds and indentation.
6.6 uvm_comparer
The class uvm_comparer shall provide a policy object for doing comparisons. The policies determine how
miscompares are treated and counted. Results of a comparison are stored in the comparer object. The member
functions uvm_object::compare and uvm_object::do_compare are passed a uvm_comparer policy object.
6.6.1 Class definition
namespace uvm {
class uvm_comparer
{
Page 59 UVM-SystemC Language Reference Manual DRAFT
public:
// Group: member functions
virtual bool compare_field( const std::string& name,
const uvm_bitstream_t& lhs,
const uvm_bitstream_t& rhs,
int size,
uvm_radix_enum radix = UVM_NORADIX ) const;
virtual bool compare_field_int( const std::string& name,
const uvm_integral_t& lhs,
const uvm_integral_t& rhs,
int size,
uvm_radix_enum radix = UVM_NORADIX ) const;
virtual bool compare_field_real( const std::string& name,
double lhs,
double rhs ) const;
virtual bool compare_field_real( const std::string& name,
float lhs,
float rhs ) const;
virtual bool compare_object( const std::string& name,
const uvm_object& lhs,
const uvm_object& rhs ) const;
virtual bool compare_string( const std::string& name,
const std::string& lhs,
const std::string& rhs ) const;
void print_msg( const std::string& msg ) const;
// Group: Comparer settings
void set_policy( uvm_recursion_policy_enum policy = UVM_DEFAULT_POLICY );
uvm_recursion_policy_enum get_policy() const;
void set_max_messages( unsigned int num = 1 );
unsigned int get_max_messages() const;
void set_verbosity( unsigned int verbosity = UVM_LOW );
UVM-SystemC Language Reference Manual DRAFT Page 60
unsigned int get_verbosity() const;
void set_severity( uvm_severity sev = UVM_INFO );
uvm_severity get_severity () const;
void set_miscompare_string( const std::string& miscompares = "" );
std::string get_miscompare_string() const;
void set_field_attribute( uvm_field_enum attr = UVM_PHYSICAL );
uvm_field_enum get_field_attribute() const;
void compare_type( bool enable = true );
unsigned int get_result() const;
private:
// Disabled
uvm_comparer();
}; // class uvm_comparer
} // namespace uvm
6.6.2 Constraints on usage
An application shall not explicitly create an instance of the class uvm_comparer.
6.6.3 Member functions
6.6.3.1 compare_field
virtual bool compare_field( const std::string& name,
const uvm_bitstream_t& lhs,
const uvm_bitstream_t& rhs,
int size,
uvm_radix_enum radix = UVM_NORADIX ) const;
The member function compare_field shall compare two integral values. The argument name is used for purposes of
storing and printing a miscompare. The left-hand-side lhs and right-hand-side rhs objects are the two objects used
for comparison. The size variable indicates the number of bits to compare; size must be less than or equal to
UVM_MAX_STREAMBITS. The argument radix is used for reporting purposes, the default radix is hex.
6.6.3.2 compare_field_int
virtual bool compare_field_int( const std::string& name,
const uvm_integral_t& lhs,
const uvm_integral_t& rhs,
Page 61 UVM-SystemC Language Reference Manual DRAFT
int size,
uvm_radix_enum radix = UVM_NORADIX ) const;
The member function compare_field_int shall compare two integral values. This member function is same as
compare_field except that the arguments are small integers, less than or equal to 64 bits. It is automatically called
by compare_field if the operand size is less than or equal to 64.
The argument name is used for purposes of storing and printing a miscompare. The left-hand-side lhs and right-
hand-side rhs objects are the two objects used for comparison. The size variable indicates the number of bits to
compare; size must be less than or equal to 64. The argument radix is used for reporting purposes, the default radix
is hex.
6.6.3.3 compare_field_real, compare_field_double
virtual bool compare_field_real( const std::string& name,
double lhs,
double rhs ) const;
virtual bool compare_field_real( const std::string& name,
float lhs,
float rhs ) const;
The member function compare_field_real shall compare two real numbers, represented by type double or float. The
left-hand-side lhs and right-hand-side rhs arguments are used for comparison.
6.6.3.4 compare_object
virtual bool compare_object( const std::string& name,
const uvm_object& lhs,
const uvm_object& rhs ) const;
The member function compare_object shall compare two class objects using the data member policy to determine
whether the comparison should be deep, shallow, or reference. The argument name is used for purposes of storing
and printing a miscompare. The lhs and rhs objects are the two objects used for comparison. The data member
check_type determines whether or not to verify the object types match (the return from lhs.get_type_name()
matches rhs.get_type_name() ).
6.6.3.5 compare_string
virtual bool compare_string( const std::string& name,
const std::string& lhs,
const std::string& rhs ) const;
The member function compare_string shall compare two two string variables. The argument name is used for
purposes of storing and printing a miscompare. The lhs and rhs objects are the two objects used for comparison.
UVM-SystemC Language Reference Manual DRAFT Page 62
6.6.3.6 print_msg
void print_msg( const std::string& msg ) const;
The member function print_msg shall cause the error count to be incremented and the message passed as argument
to be appended to the miscompares string (a newline is used to separate messages). If the message count is less than
the data member show_max setting, then the message is printed to standard-out using the current verbosity (see
6.6.4.5) and severity (see 6.6.4.7) settings.
6.6.4 Comparer settings
6.6.4.1 set_policy
set_policy( uvm_recursion_policy_enum policy = UVM_DEFAULT_POLICY );
The member function set_policy shall set the comparison policy. The following arguments are valid: UVM_DEEP,
UVM_REFERENCE, or UVM_SHALLOW. The default policy shall be set to UVM_DEFAULT_POLICY.
6.6.4.2 get_policy
uvm_recursion_policy_enum get_policy() const;
The member function get_policy shall return the comparison policy.
6.6.4.3 set_max_messages
void set_max_messages( unsigned int num = 1 );
The member function set_max_messages sets the maximum number of messages to send to the printer for
miscompares of an object. The default number of messages shall be set to one.
6.6.4.4 get_max_messages
unsigned int get_max_messages() const;
The member function get_max_messages shall return the maximum number of messages to send to the printer for
miscompares of an object.
6.6.4.5 set_verbosity
void set_verbosity( unsigned int verbosity = UVM_LOW );
The member function set_verbosity shall set the verbosity for printed messages. The verbosity setting is used by the
messaging mechanism to determine whether messages should be suppressed or shown. The default verbosity shall
be set to UVM_LOW.
6.6.4.6 get_verbosity
unsigned int get_verbosity() const;
The member function get_verbosity shall return the verbosity for printed messages.
Page 63 UVM-SystemC Language Reference Manual DRAFT
6.6.4.7 set_severity
void set_severity( uvm_severity sev = UVM_INFO);
The member function set_severity shall set the severity for printed messages. The severity setting is used by the
messaging mechanism for printing and filtering messages. The default severity shall be set to UVM_INFO.
6.6.4.8 get_severity
uvm_severity get_severity() const;
The member function get_severity shall return the severity for printed messages.
6.6.4.9 set_miscompare_string
void set_miscompare_string( const std::string& miscompares = "" );
The member function set_miscompare_string shall set the miscompare string. This string is reset to an empty string
when a comparison is started. The string holds the last set of miscompares that occurred during a comparison. The
default miscompare string shall be empty.
6.6.4.10 get_miscompare_string
std::string get_miscompare_string() const;
The member function get_miscompare_string shall return the last set of miscompares that occurred during a
comparison.
6.6.4.11 set_field_attribute
void set_field_attribute( uvm_field_enum attr = UVM_PHYSICAL );
The member function set_field_attribute shall set the field attribute to UVM_PHYSICAL or UVM_ABSTRACT.
The physical and abstract settings allow an object to distinguish between these two different classes of fields.
NOTEAn application can use the callback uvm_object::do_compare to check the field attribute if it wants to use it as a filter.
6.6.4.12 get_field_attribute
uvm_field_enum get_field_attribute() const;
The member function get_field_attribute shall return the field attribute being UVM_PHYSICAL or
UVM_ABSTRACT.
6.6.4.13 compare_type
void compare_type( bool enable = true );
The member function compare_type shall determine whether the type, given by uvm_object::get_type_name, is
used to verify that the types of two objects are the same. If enabled, the member function compare_object is called.
By default, type checking shall be enabled.
UVM-SystemC Language Reference Manual DRAFT Page 64
NOTEIn some cases an application may disable type checking, when the two operands are related by inheritance but are of
different types.
6.6.4.14 get_result
unsigned int get_result() const;
The member function get_result shall return the number of miscompares for a given compare operation. An
application can use the result to determine the number of miscompares that were found.
6.7 Default policy objects
This section lists the default policy objects.
6.7.1.1 uvm_default_table_printer
extern uvm_table_printer* uvm_default_table_printer;
The global object uvm_default_table_printer shall define a handle to an object of type uvm_table_printer, which
can be used with uvm_object::do_print to get tabular style printing.
6.7.1.2 uvm_default_tree_printer
extern uvm_tree_printer* uvm_default_tree_printer;
The global object uvm_default_tree_printer shall define a handle to an object of type uvm_tree_printer, which
can be used with uvm_object::do_print to get a multi-line tree style printing.
6.7.1.3 uvm_default_line_printer
extern uvm_line_printer* uvm_default_line_printer;
The global object uvm_default_line_printer shall define a handle to an object of type uvm_line_printer, which
can be used with uvm_object::do_print to get a single-line style printing.
6.7.1.4 uvm_default_printer
extern uvm_printer* uvm_default_printer;
The global object uvm_default_printer shall define the default printer policy, which shall be set to
uvm_default_table_printer. An application can redefine the default printer, by setting it to any legal uvm_printer
derived type, including the global line, tree, and table printers in the previous sections.
6.7.1.5 uvm_default_packer
extern uvm_printer* uvm_default_printer;
The global object uvm_default_packer shall define the default packer policy. It shall be used when calls to
uvm_object::pack and uvm_object::unpack do not specify a packer policy.
Page 65 UVM-SystemC Language Reference Manual DRAFT
6.7.1.6 uvm_default_comparer
extern uvm_comparer* uvm_default_comparer;
The global object uvm_default_comparer shall define the default comparer policy. It shall be used when calls to
uvm_object::compare do not specify a comparer policy.
6.7.1.7 uvm_default_recorder
extern uvm_recorder* uvm_default_recorder;
The global object uvm_default_recorder shall define the default recorder policy. It shall be used when calls to
uvm_object::record do not specify a recorder policy.
UVM-SystemC Language Reference Manual DRAFT Page 66
7. Registry and factory classes
The registry and factory classes offer the interface to register and use UVM objects and components via the factory.
The following classes are defined:
uvm_object_wrapper
uvm_object_registry
uvm_component_registry
uvm_factory
uvm_default_factory
The class uvm_object_wrapper forms the base class for the registry classes uvm_object_registry and
uvm_component_registry, which act as lightweight proxies for UVM objects and components, respectively.
UVM object and component types are registered with the factory via typedef or macro invocation. When the
application requests a new object or component from the factory, the factory will determine what type of object to
create based on its configuration, and will ask that type’s proxy to create an instance of the type, which is returned to
the application.
7.1 uvm_object_wrapper
The class uvm_object_wrapper shall provide an abstract interface for creating object and component proxies.
Instances of these lightweight proxies, representing every object or component derived from uvm_object or
uvm_component respectively in the test environment, are registered with the uvm_factory. When the factory is
called upon to create an object or component, it shall find and delegate the request to the appropriate proxy.
7.1.1 Class definition
namespace uvm {
class uvm_object_wrapper
{
public:
virtual uvm_object* create_object( const std::string& name = "" );
virtual uvm_component* create_component( const std::string& name,
uvm_component* parent );
virtual const std::string get_type_name() const = 0;
};
} // namespace uvm
Page 67 UVM-SystemC Language Reference Manual DRAFT
7.1.2 Member functions
7.1.2.1 create_object
virtual uvm_object* create_object( const std::string& name = "" );
The member function create_object shall create a new object with the optional name passed as argument. An object
proxy (e.g., uvm_object_registry<T>) implements this member function to create an object of a specific type, T
(see 7.2).
7.1.2.2 create_component
virtual uvm_component* create_component( const std::string& name,
uvm_component* parent );
The member function create_component shall create a new component, by passing to its constructor the given
name and parent. The component proxy (e.g. uvm_component_registry<T>) implements this member function to
create a component of a specific type, T (see 7.3).
7.1.2.3 get_type_name
virtual const std::string get_type_name() const = 0;
The implementation of the pure virtual member function get_type_name shall return the type name of the object
created by create_component or create_object. The factory uses this name when matching against the requested
type in name-based lookups.
7.2 uvm_object_registry
The class uvm_object_registry shall provide a lightweight proxy for a uvm_object of type T. The proxy enables
efficient registration with the uvm_factory. Without it, registration would require an instance of the object itself.
The macros UVM_OBJECT_UTILS or UVM_OBJECT_PARAM_UTILS shall create the appropriate class
uvm_object_registry necessary to register that particular object wth the factory.
7.2.1 Class definition
namespace uvm {
template <typename T = uvm_object>
class uvm_object_registry<T> : public uvm_object_wrapper
{
public:
virtual uvm_object* create_object( const std::string& name = "" );
virtual const std::string get_type_name() const;
static uvm_object_registry<T>* get();
UVM-SystemC Language Reference Manual DRAFT Page 68
static T* create( const std::string& name = "",
uvm_component* parent = NULL,
const std::string& contxt = "" );
static void set_type_override( uvm_object_wrapper* override_type,
bool replace = true );
static void set_inst_override( uvm_object_wrapper* override_type,
const std::string& inst_path,
uvm_component* parent = NULL );
}; // class uvm_object_registry
} // namespace uvm
7.2.2 Template parameter T
The template parameter T specifies the object type of the objects being registered. The object type must be a
derivative of class uvm_object.
7.2.3 Member functions
7.2.3.1 create_object
virtual uvm_object* create_object( const std::string& name = "" );
The member function create_object shall create an object of type T and returns it as a handle to a uvm_object. This
is an overload of the member function in uvm_object_wrapper. It is called by the factory after determining the type
of object to create. An application shall not call this member function directly. Instead, an application shall call the
static member function create.
7.2.3.2 get_type_name
virtual const std::string get_type_name() const;
The member function get_type_name shall return the type name of the object. This member function overloads the
member function in uvm_object_wrapper.
7.2.3.3 get
static uvm_object_registry<T>* get();
The member function get shall return the singleton instance of this type. Type-based factory operation depends on
there being a single proxy instance for each registered type.
Page 69 UVM-SystemC Language Reference Manual DRAFT
7.2.3.4 create
static T* create( const std::string& name = "",
uvm_component* parent = NULL,
const std::string& contxt = "" );
The member function create shall return a new instance of the object type, T, represented by this proxy, subject to
any factory overrides based on the context provided by the parent’s full name. The new instance shall have the given
leaf name name, if provided as argument. The argument contxt, if supplied, supersedes the parent’s context.
7.2.3.5 set_type_override
static void set_type_override( uvm_object_wrapper* override_type,
bool replace = true );
The member function set_type_override shall configure the factory to create an object of the type represented by
override_type whenever a request is made to create an object of the type represented by this proxy, provided no
instance override applies. The original type, T, is typically a super class of the override type.
When replace is true, a previous override on original_type is replaced, otherwise a previous override, if any, remains
intact.
7.2.3.6 set_inst_override
static void set_inst_override( uvm_object_wrapper* override_type,
const std::string& inst_path,
uvm_component* parent = NULL );
The member function set_inst_override shall configure the factory to create an object of the type represented by
argument override_type whenever a request is made to create an object of the type represented by this proxy, with
matching instance paths. The original type, T, is typically a super class of the override type.
If argument parent is not specified, argument inst_path is interpreted as an absolute instance path, which enables
instance overrides to be set from outside component classes. If argument parent is specified, argument inst_path is
interpreted as being relative to the parent’s hierarchical instance path. The argument inst_path may contain
wildcards for matching against multiple contexts.
7.3 uvm_component_registry
The class uvm_component_registry shall provide a lightweight proxy for a uvm_component of type T. The proxy
enables efficient registration with the uvm_factory. Without it, registration would require an instance of the
component itself.
The macros UVM_COMPONENT_UTILS and UVM_COMPONENT_PARAM_UTILS shall create the
appropriate class uvm_component_registry necessary to register that particular component with the factory.
7.3.1 Class definition
namespace uvm {
UVM-SystemC Language Reference Manual DRAFT Page 70
template <typename T = uvm_component>
class uvm_component_registry : public uvm_object_wrapper
{
public:
virtual uvm_component* create_component( const std::string& name,
uvm_component* parent );
virtual const std::string get_type_name() const;
static uvm_component_registry<T>* get();
static T* create( const std::string& name = "",
uvm_component* parent = NULL,
const std::string& contxt = "" );
static void set_type_override( uvm_object_wrapper* override_type,
bool replace = true );
static void set_inst_override( uvm_object_wrapper* override_type,
const std::string& inst_path,
uvm_component* parent = NULL );
}; // class uvm_component_registry
} // namespace uvm
7.3.2 Template parameter T
The template parameter T specifies the object type of the components being registered. The object type must be a
derivative of class uvm_component.
7.3.3 Member functions
7.3.3.1 create_component
virtual uvm_component* create_component( const std::string& name,
uvm_component* parent );
The member function create_component shall create an object of type T having the provided name and parent, and
returns it as a handle to a uvm_component. This is