Beruflich Dokumente
Kultur Dokumente
Feature Descriptions
Version C-2009.06 Beta
December 2008
Comments?
E-mail your comments about this manual to:
vcs_support@synopsys.com.
Copyright Notice and Proprietary Information
Copyright © 2008 Synopsys, Inc. All rights reserved. This software and documentation contain confidential and
proprietary information that is the property of Synopsys, Inc. The software and documentation are furnished under a
license agreement and may be used or copied only in accordance with the terms of the license agreement. No part of
the software and documentation may be reproduced, transmitted, or translated, in any form or by any means,
electronic, mechanical, manual, optical, or otherwise, without prior written permission of Synopsys, Inc., or as
expressly provided by the license agreement.
Right to Copy Documentation
The license agreement with Synopsys permits licensee to make copies of the documentation for its internal use only.
Each copy shall include all copyrights, trademarks, service marks, and proprietary rights notices, if any. Licensee must
assign sequential numbers to all copies. These copies shall contain the following legend on the cover page:
This document is duplicated with the permission of Synopsys, Inc., for the exclusive use of
_________________________________ and its employees. This is copy number______.”
SystemC is a trademark of the Open SystemC Initiative and is used under license.
ARM and AMBA are registered trademarks of ARM Limited.
Saber is a registered trademark of SabreMark Limited Partnership and is used under license.
All other product or company names may be trademarks of their respective owners.
ii
Contents
1
2. Assertions
Use Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Overlapping Operators in Multiclock Environment . . . . . . . . . . . 42
Deferred Immediate Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Property Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Weak and Strong Sequence Operators . . . . . . . . . . . . . . . . . 44
Implication and Equivalence Operators . . . . . . . . . . . . . . . . . 45
until Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
nexttime Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
always Operator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
eventually Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
followed-by Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Mixed Strength Property Reporting . . . . . . . . . . . . . . . . . . . . 49
Modeling Abort Conditions: accept_on, reject_on . . . . . . . . . 50
Inferred Value Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Recursive Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Local Variable Initialization and Input . . . . . . . . . . . . . . . . . . . . . 52
Global Clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Past and Future Sampled Value Functions . . . . . . . . . . . . . . 54
let Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Debug Support for New Constructs . . . . . . . . . . . . . . . . . . . . 57
Note on Cross Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2
3. Coverage Enhancements
SystemVerilog Language Enhancements . . . . . . . . . . . . . . . . . . 60
Wildcard Support in binsof Expressions . . . . . . . . . . . . . . . . 60
Wildcard Array Bins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
State Bin Names as States in Transition Sequences . . . . . . . 66
OpenVera Language Enhancement . . . . . . . . . . . . . . . . . . . . . . 69
Wildcard Support in binsof Expressions . . . . . . . . . . . . . . . . 69
Coverage Exclusion Enhancement . . . . . . . . . . . . . . . . . . . . . . . 73
Understanding Half-Toggle Exclusion . . . . . . . . . . . . . . . . . . 73
Unified Coverage Reporting Enhancements . . . . . . . . . . . . . . . . 75
Reporting Only Uncovered Objects . . . . . . . . . . . . . . . . . . . . 75
Understanding Covergroup Page Splitting. . . . . . . . . . . . . . . 86
DVE Coverage Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Branch Coverage and Implied Branches . . . . . . . . . . . . . . . . 88
DVE Coverage Source / Database File Relocation . . . . . . . . 88
Container Exclusion State Markers . . . . . . . . . . . . . . . . . . . . 90
3
Constraints and Coverage Model on the Same Variables . . 98
No Procedural Overwriting of Values Generated by the Solver 98
Coverage Should Be Sampled Between Consecutive Calls to
randomize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Use Open Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Avoid Explicit or Implicit Partitioning in Constraints . . . . . . . 100
Avoid In-line Constraints and the Use of “constraint_mode” and
“rand_mode” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Automatic Generation a Coverage Model from Constraints . . . . 100
Coverage Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Contribution to Coverage Scoring . . . . . . . . . . . . . . . . . . . . . 108
Coverage Model Inference for In-line Constraints . . . . . . . . . 108
Use Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Understanding Bias Files and Coverage Convergence. . . . . . . . 110
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
What Is a “Test”? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Using Coverage Convergence Bias File to Pick Target Coverage
Holes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Automatic Generation of Coverage Convergence Bias Files . . . 113
Repeatability of Test Results for Parallel Regression Runs . . . . 114
Usage Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Running a Single Test with Randomized Configurations . . . . 115
Running a Single Test with Randomized Transactions . . . . . 115
Using a Bias File for a Parallel Regression . . . . . . . . . . . . . . 116
Autogenerating a Coverage Model . . . . . . . . . . . . . . . . . . . . 117
4
Methodology and Flow Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Scenario: All Tests Have the Same Constraints and Coverage Space
(Recommended). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Scenario: Tests Are Grouped Into Categories With Each Category
Having Specific Test Constraints . . . . . . . . . . . . . . . . . . . 119
Scenario: Coverage Database Being Loaded in the Beginning of a
Test Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5. DVE Features
Back Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Setting the Back Trace Properties . . . . . . . . . . . . . . . . . . . . . 124
Using the Back Trace Schematic Toolbar . . . . . . . . . . . . . . . 125
Editing the Bus Bit Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Creating and Updating Counters. . . . . . . . . . . . . . . . . . . . . . . . . 126
Deleting Signal Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Creating Multiple Groups when Adding Multiple Scopes into Wave View
130
Visualizing X at all Zoom Levels . . . . . . . . . . . . . . . . . . . . . . . . . 130
Using Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Viewing Interfaces as Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7. Constraints Features
SystemVerilog Constraint Features . . . . . . . . . . . . . . . . . . . . . . . 142
5
Array and XMR Support in std::randomize() . . . . . . . . . . . . . 142
XMR Support in Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 145
Constraint Debugging and Profiling. . . . . . . . . . . . . . . . . . . . . . . 148
Using Constraint Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Using the Hierarchical Constraint Debugger Report . . . . . . . 151
Debugging Constraint Solver Diagnostics . . . . . . . . . . . . . . . . . . 154
Solver Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Methodology for Using Unidirectional Constraints . . . . . . . . . 156
Constraint Solver Search Space and Solution Space . . . . . . 158
Search Space Reduction And Random Assignment . . . . . . . 159
Using the Constraint Solver Diagnostics . . . . . . . . . . . . . . . . 160
Classes of Constraint Diagnostics . . . . . . . . . . . . . . . . . . . . . 163
8. Parallel VCS
Parallel VCS Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Use Model for Design Profiling and Simulation . . . . . . . . . . . 173
Use Model for Assertion Simulation. . . . . . . . . . . . . . . . . . . . 174
Use Model for Toggle and Functional Coverage . . . . . . . . . . 174
Use Model for VPD Dumping. . . . . . . . . . . . . . . . . . . . . . . . . 175
Running Parallel Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Design Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Assertion Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Toggle Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Functional Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
VPD File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
6
Profiling a Simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Profiling a Serial Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Specifying Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Profiling a Parallel Simulation . . . . . . . . . . . . . . . . . . . . . . . . 183
Running PVCS Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Supported Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Current Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
7
vmm_scenario::repeat_thresh . . . . . . . . . . . . . . . . . . . . . . . . 230
vmm_scenario::repetition. . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
vmm_scenario::define_scenario() . . . . . . . . . . . . . . . . . . . . . 232
vmm_scenario::redefine_scenario(). . . . . . . . . . . . . . . . . . . . 233
vmm_scenario::scenario_name(). . . . . . . . . . . . . . . . . . . . . . 234
vmm_scenario::psdisplay() . . . . . . . . . . . . . . . . . . . . . . . . . . 235
vmm_scenario::set_parent_scenario(). . . . . . . . . . . . . . . . . . 236
vmm_scenario::get_parent_scenario() . . . . . . . . . . . . . . . . . 237
vmm_object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
vmm_object::type_e. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
vmm_object::new . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
vmm_object::set_parent() . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
vmm_object::get_parent() . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
vmm_object::get_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
vmm_object::get_hier_inst_name() . . . . . . . . . . . . . . . . . . . . 245
vmm_object::display() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
vmm_object::psdisplay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
vmm_ms_scenario_gen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
vmm_ms_scenario_gen::stop_after_n_scenarios . . . . . . . . . 249
vmm_ms_scenario_gen::stop_after_n_insts . . . . . . . . . . . . . 250
vmm_ms_scenario_gen::scenario_count . . . . . . . . . . . . . . . 251
vmm_ms_scenario_gen::inst_count . . . . . . . . . . . . . . . . . . . 252
vmm_ms_scenario_gen::get_n_scenarios() . . . . . . . . . . . . . 253
vmm_ms_scenario_gen::get_n_insts() . . . . . . . . . . . . . . . . . 254
vmm_ms_scenario_gen::GENERATED. . . . . . . . . . . . . . . . . 255
vmm_ms_scenario_gen::DONE . . . . . . . . . . . . . . . . . . . . . . 256
8
vmm_ms_scenario_gen::register_ms_scenario() . . . . . . . . . 257
vmm_ms_scenario_gen::ms_scenario_exists(). . . . . . . . . . . 258
vmm_ms_scenario_gen::get_ms_scenario() . . . . . . . . . . . . . 259
vmm_ms_scenario_gen::get_ms_scenario_name() . . . . . . . 260
vmm_ms_scenario_gen::get_ms_scenario_index() . . . . . . . 261
vmm_ms_scenario_gen::get_names_by_ms_scenario() . . . 262
vmm_ms_scenario_gen::get_all_ms_scenario_names(). . . . 263
vmm_ms_scenario_gen::replace_ms_scenario() . . . . . . . . . 264
vmm_ms_scenario_gen::unregister_ms_scenario() . . . . . . . 265
vmm_ms_scenario_gen::unregister_ms_scenario_by_name() 266
vmm_ms_scenario_gen::select_scenario . . . . . . . . . . . . . . . 267
vmm_ms_scenario_gen::scenario_set[$] . . . . . . . . . . . . . . . 268
vmm_ms_scenario_gen::register_channel() . . . . . . . . . . . . . 269
vmm_ms_scenario_gen::channel_exists(). . . . . . . . . . . . . . . 270
vmm_ms_scenario_gen::get_channel(). . . . . . . . . . . . . . . . . 271
vmm_ms_scenario_gen::get_channel_name() . . . . . . . . . . . 272
vmm_ms_scenario_gen::get_names_by_channel() . . . . . . . 273
vmm_ms_scenario_gen::get_all_channel_names() . . . . . . . 274
vmm_ms_scenario_gen::replace_channel() . . . . . . . . . . . . . 275
vmm_ms_scenario_gen::unregister_channel() . . . . . . . . . . . 276
vmm_ms_scenario_gen::unregister_channel_by_name() . . . 277
vmm_ms_scenario_gen::register_ms_scenario_gen() . . . . . 278
vmm_ms_scenario_gen::ms_scenario_gen_exists(). . . . . . . 279
vmm_ms_scenario_gen::get_ms_scenario_gen() . . . . . . . . . 280
vmm_ms_scenario_gen::get_ms_scenario_gen_name() . . . 281
vmm_ms_scenario_gen::get_names_by_ms_scenario_gen() 282
9
vmm_ms_scenario_gen::get_all_ms_scenario_gen_names() 283
vmm_ms_scenario_gen::replace_ms_scenario_gen() . . . . . 284
vmm_ms_scenario_gen::unregister_ms_scenario_gen() . . . 285
vmm_ms_scenario_gen::unregister_ms_scenario_gen_by_name()
286
vmm_xactor_iter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
vmm_xactor_iter::new() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
vmm_xactor_iter::first() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
vmm_xactor_iter::xactor() . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
vmm_xactor_iter::next() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
‘foreach_vmm_xactor() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
vmm_log::catch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
vmm_test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
vmm_test::log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
vmm_test::new() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
vmm_test::get_name() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
vmm_test::get_doc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
vmm_test::run() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
vmm_test_begin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
vmm_test_end() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
vmm_ms_scenario::get_channel(). . . . . . . . . . . . . . . . . . . . . 304
vmm_channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
vmm_channel::record() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
vmm_channel::playback() . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
vmm_ral_block_or_sys Base Class Additions. . . . . . . . . . . . . . . 311
10
vmm_ral_block_or_sys::set_offset() . . . . . . . . . . . . . . . . . . . 312
vmm_ral_block_or_sys::get_reg_by_offset() . . . . . . . . . . . . . 313
11
11. URG Enhancements
New URG Features and Changes. . . . . . . . . . . . . . . . . . . . . . . . 339
Improved HTML Page Format . . . . . . . . . . . . . . . . . . . . . . . . 340
Incompleteness Checks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Omitting Filtered Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Dumping User Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Predictable Page Naming Convention . . . . . . . . . . . . . . . . . . 343
Add New Hyperlinks from group bin and group instance. . . . 343
New –show hvpprob Command for Problem Reports . . . . . . 344
Test Metric Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
License Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Platform Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
12
1
VCS SystemVerilog Features 1
This chapter contains the following topics:
• “SystemVerilog Enhancements”
• “New SystemVerilog Features”
• “Extension to SystemVerilog $readmemb/$readmemh”
SystemVerilog Enhancements
• Strings in structs
• Queues in unpacked structs
• “Parameterized Mailboxes”
• “String Casting”
• “Array Literals”
• “SystemVerilog Linked Lists”
Parameterized Mailboxes
The default mailbox has no type. A mailbox can send and receive
any type of data. This can result in runtime errors due to type
mismatches between a message and the type of the variable to
which the message gets assigned. When a mailbox is used to
transfer a particular message type, it is useful to detect type
mismatches at compile time. For a parameterized mailbox, the
Syntax
mailbox #(type = dynamic_type)
Example
You declare a parameterized mailbox of a particular type by
specifying the type as in the following example.
• num()
• new()
• get()
• peek()
• put()
String Casting
Example
program rb;
initial
begin
logic [39:0] StringLogic = "hello";
string realstring;
realstring = string'(StringLogic);
$display("%s -- %s\n", StringLogic, realstring);
end
endprogram
Array Literals
Any unpacked array can be written one entry at a time, or all the
array contents can be replaced using an array literal. See
“Limitations on Variable-Sized Arrays” for restrictions on this feature.
The VCS Users Guide provides details of how to use this feature.
interface Bus;
function void Read_data(logic [31:0] data);
$display("Data Received = %0d", data);
endfunction
endinterface
module Cpu_process;
logic [31:0] rdata = 256;
Bus b();
program test;
virtual Bus vB = Cpu_process.b;
initial begin
vB.Read_data(Cpu_process.rdata);
end
endprogram
Syntax
$typename (expression | data_type)
class process;
enum state { FINISHED, RUNNING, WAITING, SUSPENDED,
KILLED };
static function process self();
function state status();
task kill();
task await();
task suspend();
task resume();
endclass
You cannot use new to create an object of the process class. An error
is issued if this is attempted.
Example
process p;
...
fork
thread_1
state/status()
process p;
process::state estate;
...
fork
thread_1
tf_1
tf_2
p = process::self
#10;
...
thread_2
join_none
#1;
estate = p.status(); // WAITING
...
kill()
The kill() task terminates the process and all its child
processes, just like disable. A process can be killed if it is not
already finished. Process status is marked as KILLED.
Example
process p;
process::state estate;
...
fork
thread_1
tf_1
tf_2
p = process::self
#10;
$display("I was killed");
thread_2
join_none
#1;
await()
The await() task blocks the current thread. It unblocks once the
awaited process has finished execution normally. If the awaited
process is killed, await() will never unblock. Calling await()
on the current process is a runtime error. (A process cannot wait
for its own completion.) If the process has already finished
execution, then await() does not block.
Example
process p;
process::state estate;
...
fork
thread_1
tf_1
tf_2
p = process::self
#10;
...
thread_2
join_none
...
#1
p.await();
$display("I’m waiting for thread_1 to finish");
...
suspend()/ resume()
- Waiting on delay
If a process gets suspended while waiting for a delay to
mature, then, upon resumption, the process waits for the
remaining delay time.
Example
process p;
process::state estate;
...
fork
- Waiting on @(SV_event)
If a process gets suspended while waiting for a SystemVerilog
event, and that event triggers while the process is suspended,
then the process will unblock from waiting but it will not continue
executing until its resume() task is called.
- Waiting on @(static_variable) or
wait(static_expression)
- Waiting on @(dynamic_variable) or
wait(dynamic_expression)
A dynamic variable or expression is one that contains a dynamic
type such as a class handle, dynamic array, or associative array,
or a class reference using any of those.
srandom()
Limitations
• The process::self.srandom() syntax is not supported
• Debug is not supported
• DPI calls are not supported
Example
module top;
typedef enum {ON, OFF} switch_e;
typedef enum {switch10, switch20} switch_s;
typedef struct packed {switch_e sw; switch_s s;} pair_t;
initial begin
$display("va[int] = %p;",va);
$display("va[int] = %0p;",va);
$display("va[10].s = %p;", va[10].s);
end
endmodule : top
Syntax
alias net-expr|bit-expr = alias-expr [ = alias-expr ...];
Example
alias net_a = net_b = net_c = net_d;
The members of an alias list are signals whose bits are on the same
physical nets. Each member must be the same size and the nets
must be of compatible types. For example, it is an error to use an
alias statement to connect a wand net to a wor net.
Note:
Standard SystemVerilog restrictions on hierarchical references in
alias statements and on aliasing a net or signal to itself do not
apply in the VCS implementation.
Like modules, classes are scopes and can nest. Nesting allows
hiding of local names and local allocation of resources. This is often
desirable when a new type is needed as part of the implementation
of a class. Declaring types within a class helps prevent name
collisions and the cluttering of the outer scope with symbols that are
used only by that class. Type declarations nested inside a class
scope are public and can be accessed outside the class.
$readmemb and $readmemh are system tasks that allow you to load
memory from a file on the disk, for use in simulating memories at
runtime. $readmemb reads in binary and $readmemh reads in
hexadecimal numbers.
Syntax
$readmemb ("file_name", memory_name [, start_addr
[, finish_addr]]);
Note:
The real data type is not supported with these system tasks.
Dynamic Arrays
A dynamic array is any dimension of an unpacked array whose size
can be set or changed at runtime. The space for dynamic array
doesn’t exist until the array is explicitly created at runtime
data_type array_name[];
Smart Queues
A queue is a variable-size, ordered collection of homogeneous
elements. A queue supports constant-time access to all its elements
as well as constant-time insertion and removal at the beginning or
Queues are declared using the same syntax as unpacked arrays, but
specifying $ as the array size. The maximum size of a queue can be
limited by specifying its optional right bound (last index).
Associative Arrays
Dynamic arrays are useful for dealing with contiguous collections of
variables whose number changes dynamically.
where:
Assertions
39
“Local Variable Initialization and Input”
Use Model
You must use the –assert svaext compile time option for all the
new SVA features .
Note:
The –assert svaext option must be used at analysis phase
(vlogan) for the UUM flow.
You can use the operators ##0, |->, if … else, and #-# in
multiclock environments.
Assertions
40
Either clk 1 and clk2 (resp. clk3) may occur in the same time step, or
it may occur in a future time step after clk1
always_comb begin : b1
def_final_check: assert #0 (not_a != a);
end
Assertions
41
Immediate assertions can an also be used in non-procedural context
(implicit always_comb).
module def_assert_ex;
logic a,b;
module def_assert_ex;
logic a,b;
always_comb begin
equiv_def_assert: assert #0 (a == b);
end
endmodule : def_assert_ex
Property Operators
weak (sequence_expr)
Assertions
42
A success occurs if there is a match or incomplete evaluation
when the simulation finishes.
strong (sequence_expr)
Success requires a match during simulation; otherwise a
mismatch results.
Assertions
43
until Operator
Weak versions
Assertions
44
nexttime Operator
always Operator
Assertions
45
Example
This property sets an assumption that once reset is HIGH for 5
continuous clocks, it remains low forever. The followed-by operator
#=# is discussed in LRM and also below in this document.
eventually Operator
followed-by Operator
• seq #-# prop is the same as not (seq |-> not prop)
Assertions
46
• seq #=# prop is the same as not (seq |=> not prop)
seq must have at least one match followed by a success of prop.
Assertions
47
"unfinished evaluation attempt", rather than success or failure.
Depending on the property, the user may then decide the effective
outcome.
Assertions
48
Example
assert property (@(clk)
go ##1 get[*2] |->
reject_on(stop) put[->2]);
$inferred_clock
Returns the expression of the inferred clocking event. There must
be a current resolved event expression when $inferred_clock is
encountered or an error is issued.
$inferred_disable
Returns the inferred disable expression.
$inferred_enable
Returns the inferred enable condition. $inferred_enable is a
VCS extension to the Inferred functions and not a standard LRM
feature.
Assertions
49
Recursive Properties
Example
property prop_always(p);
p and (1'b1 |=> prop_always(p));
endproperty
property p1(s,p);
s |=> prop_always(p);
endproperty
Assertions
50
• Allow initialization of local variables in the declaration.
• Assign initial values in the order of the local variable declarations.
• Can initialize by actual argument and preceding local variables in
an expression.
property p();
int a = 1;
int b = a+2;
…
endproperty
A local variable argument:
Assertions
51
Support for use of local variables with property operators is an
update in conformance with IEEE Std 1800™-2005 Standard for
SystemVerilog — Unified Hardware Design, Specification, and
Verification Language.
Global Clocking
Use the global clocking system functions to access past and future
shifted sampled value at the global clock tick that immediately
precedes or follows the timestep at which the function is called. They
may be used only if global clocking is defined. The following
functions are provided:
Assertions
52
Sampling Past Value Functions
Global clocking past sampled value functions report the past shifted
times. The functions are:
$past_gclk(expression)
$rose_gclk(expression)
$fell_gclk(expression)
$stable_gclk(expression)
$changed_gclk(expression)
Where:
$past_gclk (expression)
Returns sampled value of expression at the previous global
clocking tick.
$rose_gclk(expression)
Returns true if the sampled value of expression changed to 1
from its sampled value at the previous global clocking tick.
Otherwise, it returns false.
$fell_gclk(expression)
Returns true if the sampled value of expression changed to 0
from its sampled value at the previous global clocking tick.
Otherwise, it returns false.
$stable_gclk(expression)
Returns true if the sampled value of expression did not change
at the previous global clocking tick. Otherwise, it returns false.
Assertions
53
$changed_gclk(expression)
Returns true if the sampled value of expression changed at the
previous global clocking tick. Otherwise, it returns false.
$future_gclk(expression)
$rising_gclk(expression)
$falling_gclk(expression)
$steady_gclk(expression)
$changing_gclk(expression)
Where:
$future_gclk (expression)
Returns sampled value of expression at the next global clocking
tick.
$rising_gclk(expression)
Returns true if the sampled value of expression changes to 1
from its sampled value at the next global clocking tick. Otherwise,
it returns false.
$falling_gclk(expression)
Returns true if the sampled value of expression changes to 0
from its sampled value at the next global clocking tick. Otherwise,
it returns false.
$steady_gclk(expression)
Returns true if the sampled value of expression does not
change at the next global clocking tick. Otherwise, it returns false.
Assertions
54
$changing_gclk(expression)
Returns true if the sampled value of expression changes at the
next global clocking tick. Otherwise, it returns false.
let Operator
Limitations
Assertions
55
Note on Cross Features
Assertions
56
4
Coverage Enhancements 1
This chapter provides details on the following coverage
enhancements:
63
• “Unified Coverage Reporting Enhancements” on page 79
- “Reporting Only Uncovered Objects” on page 79
- “Understanding Covergroup Page Splitting” on page 90
• “DVE Coverage Enhancements” on page 92
- “Branch Coverage and Implied Branches” on page 92
- “DVE Coverage Source / Database File Relocation” on page 92
- “Container Exclusion State Markers” on page 94
cover_cross ::=
[ cover_point_identifier : ] cross list_of_coverpoints [ iff (
expression ) ] select_bins_or_empty
list_of_coverpoints ::= cross_item , cross_item { , cross_item
}
64
cross_item ::=
cover_point_identifier
| variable_identifier
select_bins_or_empty ::=
{ { bins_selection_or_option ; } }
| ;
bins_selection_or_option ::=
{ attribute_instance } coverage_option
| { attribute_instance } bins_selection
bins_selection ::= [ wildcard ] bins_keyword bin_identifier =
select_expression [ iff ( expression ) ]
select_expression ::=
select_condition
| ! select_condition
| select_expression && select_expression
| select_expression || select_expression
| ( select_expression )
select_condition ::= binsof ( bins_expression ) [ intersect {
open_range_list } ]
bins_expression ::=
variable_identifier
| cover_point_identifier [ . bins_identifier ]
open_range_list ::= open_value_range { , open_value_range }
open_value_range ::= value_range
65
Only bins of x whose associated values intersect values between 12
and 16 are included:
66
The example above defines a coverage group named cg that
samples its coverage points on the positive edge of signal clk (not
shown). The coverage group includes two coverage points, one for
each of the two 4-bit variables, a and b.
Coverage point b (associated with variable v_b) defines four bins for
each possible value of variable v_b.
• a1,b1
• a1,b2
• a1,b3
• a1,b4
• ...
• a4,b1
• a4,b2
• a4,b3
• a4,b4
67
The first user-defined cross bin, c1, specifies that c1 should include
only cross products of coverage point a that intersect the value range
of 1100 to 1111. This select expression excludes bins a1, a2, and
a3. Thus, c1 will cover only four cross products of
• a4,b1
• a4,b2
• a4,b3
• a4,b4
This is similar to the behavior of following code:
The second user-defined cross bin, c2, specifies that bin c2 should
include only cross products of coverage point b that do not intersect
the value range of 1000 to 1001 and 1100 to 1101. This select
expression excludes bins b2 and b3. Thus, c2 covers only four
cross products of
• a1,b1
• a1,b4
• a2,b1
• a2,b4
• a3,b1
• a3,b4
• a4,b1
• a4,b4
68
Wildcard Array Bins
Wildcard array bins are useful if you want to express array bin ranges
as wildcard patterns.
You can use any of the following symbols as a wildcard: “?”, “x”, or
“z”.
For example, in the first example, four bins are created for each of
the following values:
• 4’b0100
• 4’b0101
• 4’b0110
• 4’b0111
You can also constrain bins in the following fashion:
69
The syntax example above has a total of 64 transitions. The first and
second bins contain 64/3 = 21 transitions, and the third bin contains
21 + 1 = 22 transitions.
The syntax for specifying transition bins has been extended to allow
state bin names to be used as individual states of a transition
sequence.
Note:
These extensions are allowed for both SystemVerilog and
OpenVera testbenches. However, the SV extensions are not
compliant with the standard SystemVerilog Language Reference
Manual.
With this new syntax, the hit count for the transition bin is
incremented only if the hit counts of the state bins in the sequences
were incremented in the prior occurences of the sampling event.
70
state_bin_name
Represents a state bin.
The following example illustrates the use of thes state bin name
syntax:
int cp ;
covergroup gc @ (posedge clk);
coverpoint cp {
bins s0 = {[0:7]} iff (x > 0);
bins s1 = {[16:20]} iff (y < 3);
bins newt1 = (s0=>s1);
}
endgroup
trans trans_bin_name(state_bin_name
[repeated_transition_values] -> state_bin_name
[repeated_transition_values] -> …) [conditional];
trans_bin_name
Represents the name of the transition bin.
state_bin_name
Represents the name of a state bin defined in the same sample
construct. This name must be a user-defined state bin name. It
cannot be the name of bad_state bin, m_state bin,
m_bad_state bin or “all” state bin.
71
repeated_transition_values (optional)
Specifies the number of times a particular value is to be repeated
in a transition sequence. Use the following constructs:
[*constant] | [*min_constant:max_constant]
The following example illustrates the use of the state bin name
syntax:
coverage_group COV1
{
sample x {
state s1(1);
state s2(2);
trans t0sbn(s1->s2);
}
sample_event = wait_var(x) async;
}
72
OpenVera Language Enhancement
wildcard
73
Treats the x or z values as wildcards in the state declarations.
state
Can be state, ignored, or bad_state.
state_name
Represents a user-specified name for the cross bin.
select_expression
Represents a subset of bins_expression. See the OpenVera
Language Reference Manual: Native Testbench for details on
bins_expression.
logical_operator
Represents && or ||.
Note:
Here wildcard essentially means either 1 or 0 at the specified
location.
coverage_group cg {
sample_event = @(posedge CLOCK);
sample v_a {
state a1 (0:3);
state a2 (4:7);
74
state a3 (8:11);
state a4 (12:15);
}
sample v_b {
state b1 (0);
state b2 (1:8);
state b3 (9:13);
state b4 (14:15);
}
cross c (v_a, v_b) {
wildcard state c1 (binsof(v_a) intersect {4'b11zx});
wildcard state c2 (!binsof(v_b) intersect {4'b1x0x});
}
}
Sample v_a defines four equal-sized bins for each possible value of
variable v_a.
Sample v_b defines four bins for each possible value of variable
v_b.
• a1,b1
• a1,b2
75
• a1,b3
• a1,b4
• ...
• a4, b1
• a4,b2
• a4,b3
• a4,b4
The first user-defined cross bin, c1, specifies that c1 should include
only cross products of sample v_a that intersect the value range of
1100 to 1111. This select expression excludes bins a1, a2, and a3.
Thus, c1 will cover only four cross products of
• a4,b1
• a4,b2
• a4,b3
• a4,b4
This is similar to the behavior of the following code:
The second user-defined cross bin, c2, specifies that bin c2 should
include only cross products of samples v_b that do not intersect the
value range of 1000 to 1001 and 1100 to 1101. This select
expression excludes bins b2 and b3. Thus, c2 covers only four
cross products of
• a1,b1
76
• a1,b4
• a2,b1
• a2,b4
• a3,b1
• a3,b4
• a4,b1
• a4,b4
Toggle coverage monitors each net and register for any value
transition from 0 to 1 and 1 to 0. Such monitoring provides an
indication of the amount of activity on each element.
reg [1:0] p;
p = 2’b10;
#1 p = 2’b01;
In this simulation, p[0] has a 0-to-1 transition and p[1] has a 1-to-
0 transition. Full-toggle exclusion for a signal p[1] gives a coverage
toggle report of 50%, which can be broken down as follows:
77
p[0] 0->1 Covered
p[0] 1->0 Not covered
p[1] 0->1 Excluded (not counted)
p[1] 1->0 Excluded (not counted)
INSTANCE: top
Toggle y[0]
Toggle 1to0 x [0]
Toggle res[3]
Toggle res[4]
Toggle res[5]
78
Unified Coverage Reporting Enhancements
This section describes how URG allows you to create reports only for
uncovered objects (instead of creating reports for all coverable
objects).
Command-Line Access
URG supports a command-line option that causes only uncovered
objects to be shown in the report:
You can use this option in combination with text mode to generate a
brief text report:
Report Changes
This section describes how each report section changes when you
use the -show brief option.
Dashboard
The dashboard report does not change. The total coverage
summary for the design is still shown, as well as the summary for
each top-level instance.
79
Module List
Only modules with an overall coverage score less than 100% are
shown. Modules with no coverable objects in them (for any reported
metric) are not listed.
For example, assume the module list report looks like this:
In brief mode the module list report would only show the following
modules:
Hierarchy
The hierarchy report omits any instances that have no coverable
objects in their subtree or whose entire subtree has a score of 100%
(for all reported metrics). URG does not produce a comment or other
indication that such an instance has been omitted.
80
In other words, the only parts of the hierarchy that will be deleted
from the report are those entire subtrees that have coverage scores
of 100%, or that have no coverable objects in them at all.
In brief mode, the report would show only the following modules:
81
Groups
The groups report omits any groups that have a 100% score.
Tests
The tests report does not change.
HVP
The HVP format omits any features whose subtrees are either 100%
covered or which have no coverable measures in them. Like the
hierarchy, only entire subtrees are omitted (if any).
Assertions Report
URG lists in any of the tables only assertions that are not covered or
that failed. Only covers and assertions that are not covered are
listed.
Module Header
URG lists the same header for modules, including all self-
instances—even those self-instances that have 100% coverage.
However, the self-instances with 100% coverage do not link to any
82
report because their reports are not generated. URG shows all self-
instances because you can see how URG computed the scores for
the module.
If a module is hidden from the module list page, but its instances are
reported, the module header still appears at the top of the module
page because the module header contains useful information for the
whole page.
Instance Header
URG shows the same instance header, including a list of all
subtrees.
For example, if a module has 100% line coverage and 50% condition
coverage, URG generates a detailed report for condition coverage
but no detailed report for line coverage. Note also that the condition
coverage report only shows uncovered objects.
83
URG shows the entire summary table for a metric it reports. For
example, the following summary table for toggle coverage would not
omit the “1 -> 0” rows even though they are all at 100%:
However, if the module had 100% toggle coverage in all rows, URG
would not provide either this table or any toggle coverage details.
Line Coverage
For line coverage reports (which provide annotated source code that
shows coverable objects and which objects are not covered), URG
shows only the lines that contain uncovered statements (“uncovered
lines”), along with two lines of context before and after each
uncovered line.
84
if (some condition)
if (some other condition)
a <= (b ? c :
( d ? e :
( f ? g :
( h ? i :
( j ? k : l )))));
if (some condition)
if (some other condition)
a <= (b ? c :
( d ? e :
( f ? g :
If several uncovered lines are grouped together, they are all grouped
together in the report. For example:
if (some condition)
begin
if (some other condition)
begin
a <= b;
if (yet another condition)
begin
x <= y;
end
end
end
The report for the above example would show the following text,
rather than reporting the information in two separate sections:
85
x <= y;
end
end
Condition Coverage
If a condition and all of its subconditions are completely covered (all
vectors), then URG omits the report for it and its subconditions.
86
For example, consider the following report:
87
The brief report would appear as follows:
Note that URG shows the first condition because its subcondition
(the second) is not fully covered. The condition at line 505 is omitted
in the brief report because the condition was fully covered, with no
(uncovered) subconditions.
The brief report shows both the condition on line 510 and its
subcondition—even though the condition itself is fully covered—
because one vector of the subcondition is not covered.
88
Toggle Coverage
In the detailed table, URG lists only signals that are not fully covered.
For example, consider the following full report:
89
FSM Coverage
URG omits from the report any FSMs that are fully covered (all states
and transitions). However, these FSMs are shown in the FSM
summary table—with only the FSM name and its score.
If an FSM is fully covered except for its sequences, URG omits the
FSM it will be omitted (even if the sequence score is less than 100).
If an FSM is not fully covered, URG lists all of the FSM’s states, and
only its uncovered transitions and sequences.
Assertion Coverage
URG list only assertions that have failed or are not covered. Only
uncovered “covers” are listed.
Group Report
Inside a group report, URG lists only bins that are not covered.
Important:
The page-splitting functionality applies only to HTML reports,
not text reports.
Note the following page-splitting guidelines for covergroup reports:
90
• Instance splitting: URG splitting behavior for covergroup
instances resembles code coverage splitting for module
instances. When URG generates a report for any group instance,
URG checks the size of the current page and creates a new page
if the report exceeds the value you defined with -split N.
URG never splits a group report.
• Bin table splitting: If the bin table is so large that the previous
splitting strategy is not enough to make the page fit in the page
size limit, URG splits the bin table across several pages. In this
situation, the covergroup page displays a note alerting you to the
multiple-page splitting that URG has performed. The covergroup
page also contains links to the various pages.
Each page that is split contains a summary table of coverage
information.
91
Subpage 1:
Group instance a2
Group instance a3
Subpage 2:
Group instance a4
92
After you provide DVE with the new location of the file, DVE
subsequently uses both the built-in location and the new location
information you have provided.
For example, assume that the location of a file foo.v (as specified
in the coverage database) is as follows:
/A/B/C/foo.v
But assume that you moved the file to this location, which you
provided to DVE:
/X/Y/C/foo.v
/X/Y
Assume now that DVE performs a search for the following file, based
on database information:
/A/B/E/bar.v
/X/Y/E/bar.v
If DVE cannot find the file using the default location, then DVE
displays a dialog asking for the correct location of the file.
93
DVE can only remember one root location directory at a time. DVE
replaces any earlier root location directory with whichever new
location you specify.
Note:
In this discussion of “Attempted” state markers, be aware that
DVE displays the “Attempted” state marker only in strict mode,
that is, when you use the -excl_strict switch. When DVE
marks a container as “Attempted” in strict mode, this means that
the item was already covered and cannot be excluded.
Partially Excluded
state marker
94
• Partially Excluded and Attempted—When some of the items in a
container are excluded, and some have been marked as
attempted, the container is marked with the “Partially Excluded”
and “Attempted” state markers:
Partially Excluded
marker
95
The following illustration shows how the Attempted state marker
appears in the DVE GUI in relation to the container:
96
5
Coverage Convergence Technology 1
This document describes the coverage convergence technology.
You need a special license for both compile-time and runtime usage.
This chapter describes all coverage-convergence-specific options.
This chapter also includes coding guidelines that allow you to get the
most out of the coverage convergence technology. Some common
user flows are also provided.
Compile-Time Options
This section describes the options you use to enable the coverage
convergence technology when using the VCS compiler. Note that
using these options does not guarantee that coverage convergence
will occur. For coverage convergence to occur, the constraints and
coverage model need to meet certain requirements.
-ntb_opts cct
Ensures that the required coverage-convergence-related
processing is done for all relevant coverage points.
-ntb_opts cct_cov_gen
Generates a coverage model for a stimulus object—that is, for a
class that contains random variables and/or constraints.
The names of the files created (and the names of the coverage
groups themselves) depend on the names of the classes and
constraints blocks in the source file.
Example:
-cct_enable
Enables coverage convergence at runtime.
-cct_enable=on_start
Tells coverage convergence to target coverage holes from the
very first call to randomize. By default, the targeting of holes does
not start until coverage convergence determines that merely
running pure random stimulus (based on constraints) is no longer
resulting in increasing coverage.
You can use this option when few randomize calls occurring in
the test so each randomize call can be coverage-aware. This
option is also enabled automatically when you use bias file
options.
-cct_bias_file=<file_name>
Specifies the bias file to be used for the test run. The bias file
specifies the coverage holes that the test should target in the
current run. Different runs of the test can use different bias files
as input. Although it is possible to create a bias file manually, we
recommend that you generate the bias file using the URG utility.
See “URG Options for Bias File Generation ” on page 93 for more
details.
For the bias file to have any effect, you must enable other options
(such as -cct_enable). When you specify the
-cct_bias_file option, the -cct_enable=on_start option
is automatically enabled.
Coverage Groups
Cover Points
Variable Coverage
Each rand variable will have a cover point associated with it, except
for variables that have an unguarded set membership constraint at
the top-level, in any of the constraint blocks of the class. For
example:
Here, a cover point will be inferred for p, but not for x or prevp. Note
that a set membership cover point will be inferred for x.
The cover point expression will be just the variable. The following
rules apply to the creation of bins:
rand bit[7:0] x;
rand PktType p;
rand bit[31:0] y;
if (p) {
if (q) {
x == y;
}
}
The comment for the cover point will have the expression string.
if (p || (q && r)) {
...
}
if (p in {0:4, 7}) {
...
}
Here the cover point expression will be p, and the bins 0, 1–3, 4, 7
will be created.
The comment for the cover point will have the expression string.
x in {0:5};
x in {0:5, 7};
In the above example, a cover point with expression x and four bins,
0, 1–4, 5, 7 will be created.
• A cover point with three Boolean cover bins will be created for
each of the ranges as follows:
- A bin with the expression (range_low_expression).
- A bin with the expression (range_low_expression + 1 :
range_high_expression -1).
- A bin with the expression (range_high_expression).
For example:
x in {a:5, b};
Crosses
Combinations of control variables in the class, will be used to
generate crosses.
If more control variables still remain after previous step, then a new
cross will be created.
if (p || (q && r)) {
x in {0:5, 7};
}
In the above example, cover points for x will be generated from the
set membership constraint. Cover points for the condition expression
will be generated. A cross for the two cover points will be generated.
Sampling Event
A special built-in sample event called @(randomize) will be used
to determine the sampling for the generated coverage groups.
It is expected that the user will first create a coverage model using
the auto_gen option. Then the user will include the coverage model
into their testbench (using `include or #include directives) and
then make sure the coverage model is instantiated in the new task
for the enclosing class (that is, the class where the constraints and
random variables are specified). The user is encouraged to view the
autogenerated coverage model and make changes if required.
The VCS compiler does not compile the design when cct_cov_gen
is specified (that is, no simv is created).
Motivation
What Is a “Test”?
The bias file approach described below works best with tests using
an open set of constraints and a full coverage model. Thus any
invocation of the simulation executable can target any of the existing
valid coverage holes.
The utility will enumerate all the coverage bins in the input database
files and will create N random partitions of the holes where N is
supplied by the users using the num_bias_files argument. It is an
error if N is greater than the number of coverage bins in the coverage
database. The bias files will be written out in the ${PWD}/
cctBiasConfigs directory as config0, config1, config(N-1).
Other URG options (such as –format) can also be used
simultaneously to process the coverage data. Since the coverage
convergence bias file represents coverage bins at a coverage group
definition level, it will be assumed that there is only one shape for
The bias files generated by URG can then be used as input to tests
being run in parallel.
Usage Scenarios
status = transObj.randomize();
or
repeat (1000) {
transObj = new;
status = transObj.randomize();
}
In this scenario, you use the bias file generation utility to bias inputs
for different parallel test runs.
5. Run the second batch of 100 tests with each test using a different
bias file as an input:
$SIM -cct_enable -cct_bias_file=<bias_filename>
coverage_group MyCov;
5. Make the cover group instantiation the last statement of the new
task. If the new task does not exist, then you must add the task
to the cover group instantiation.
6. Because the name of the autogenerated cover group is
deterministic, the declaration and instantiation can be done once
during testbench development phase.
When all the tests being executed in parallel have exactly the same
coverage space and the same legal stimulus space (that is, the
constraints are exactly the same for all the tests), then the coverage
convergence bias file approach can be used to achieve high
efficiency test runs. Each test should have its own bias file. The input
In this scenario, tests have test specific test constraints which further
constrain the legal stimulus space and thus also reduce the hittable
coverage bins. (Coverage bins whose value ranges lie outside the
space of the test constraints cannot be hit). A bias file can be created
for every category of tests. The bias file should be such that all the
coverage bins in the file are hittable given the test constraints for that
category. Each test within this category can use the same bias file
but with a different random seed. The URG bias generation utility can
be used to generate a bias file template. (Note that the URG does
not look at test constraints when generating the bias files). The test
writer can then modify this template to include the hittable coverage
bins. As in the previous scenario, assuming test constraints remain
constant across regression runs, then the bias files have to be
generated once and can be used for multiple regression runs. Even
if all the bins in a bias file are not hittable, all it causes is less efficient
utilization of resources. Coverage convergence may use some
cycles in the test run to try to target unhittable bins, but remaining
cycles will still target hittable coverage bins. In this scenario too, the
DVE Features
117
Back Tracing
• Remove the steady state and zero delay restriction for usage
• Reduce the number of drivers identified as causes for an X value
• Interactively drive the tracing process
Back Tracing in DVE is performed by Back Trace Schematic view.
You can invoke the Back Trace Schematic view from any of the
following windows:
• Waveform
• Schematic
• Path Schematic
• Data Pane
The Back Trace Schematic consists of two panes - a Wave View
pane and a Path Schematic pane. The Path Schematic pane is the
main structural view. The Wave view provides a temporal view and
provides information to decide which signals need further tracing.
You can close the Wave view if not needed.
DVE Features
118
The database is loaded in the Hierarchy pane.
3. Select the Reset signal in the Data Pane, right-click and select
Back Trace Schematic.
The Back Trace Schematic view opens.
4. Select the Fetch signal in the Data pane, right-click and select
Back Trace to fetch signal for further back tracing.
The traced signal "fetch" is added to the Wave view and its drivers
are added to the Schematic view. The first transitions are added
to the inputs to the drivers. Also, the current simulation time is
moved to the earliest time over all driver inputs.
Note:
Only one-level can be expanded for non-X signals.
DVE Features
119
Setting the Back Trace Properties
DVE Features
120
Using the Back Trace Schematic Toolbar
You can edit the bus bit range by simply changing either the MSB
(most significant bit) or the LSB (least significant bit) of the bus.
1. Select the bus in the Data pane or from the Wave view signal pane
and select Signal > Set Bus from the menu.
The Bus/Expression dialog box appears. You can also drag and
drop the signal in the Bus/Expression dialog.
2. Double-click the signal and edit the range.
DVE Features
121
For example, define a signal ias a[0:7], change the bit range to
a[7:6], and click on create/update. A bus will be created/updated
with the selected 2 bits as a[7], a[6].
If you enter a wrong range, a warning message is displayed and
the text color of the signal becomes red. You need to enter the
correct format to save the bit range.
3. Select the signal and click the “+” icon to expand.
The signal is expanded in the same order as specified in the name.
For example, a[1:3] signal will expand to a[1],a[2],a[3].
You can perform all the toolbar operations on the expanded
signals.
You can create counter signal to count the value transitions for
expression or signal. Counter is treated as a special expression and
you can create or update counter in the same way as you create an
expression in the Bus/Expression dialog box.
1. Select a signal in the Data pane and select Signal > Set
Expressions from the menu.
The Bus/Expressions dialog box is displayed.
DVE Features
122
2. Click the Expression tab, then drag and drop the signal that you
want to create for expression counter from the Wave view or
Source view under the Expression area.
3. Type a counter name in the Name field.
For example, EXP:mycount.
4. Select the checkbox Expression is used as a counter (counting
for non-zero results) to create a signal that represents the value
transitions of the expression.
DVE Features
123
The Counter Edge radio buttons get enabled.
DVE Features
124
- Rising - (Default) This option is only for bit type signals.
Whenever the expression/signal changes from low to high,
counter signal counts the transaction.
- Falling - This option is only for bit type signals. Whenever the
expression/signal changes from high to low, counter signal
counts the transaction.
6. Click Create.
The newly created expression counter is displayed in the Bus/
Expressions dialog box. You can also view the count results in the
Wave view.
7. Drag and drop the counter in the Bus/Expression dialog box to
update it.
For example, you can update the counter edge from “Rising” to
“Any Value”.
8. Click the Update button.
The counter is updated. You can view the count results in the
Wave view.
When you delete a signal from the Wave view, it will be deleted
globally. If the same signal is present in few other views, and you
want to delete it, a warning message is displayed. You can either
select to delete or hide the signal.
Once you select to delete the signal, it would be deleted globally
from all views. If you select to hide the signal, it will be hidden in
the current view.
DVE Features
125
If the signal groups are deleted, save session will not have the
deleted signal groups. If you hide the signal, it will be hidden when
you are saving or reloading the session.
When you add the scopes to the waves, lists, or groups from the
Hierarchy pane, the signal groups will be created based on their
respective scopes.
While debugging a design, you can visualize the X value in the Wave
view at all zoom levels.
To visualize X value
DVE Features
126
The waveform is refreshed in the Wave view and X values are
displayed as red color lines for all the zoom levels.
Using Filters
DVE Features
127
-Wildcards - Input the wildcard pattern to filter items. The default
string is “*”.
-Simple - Input the regular expression pattern to filter items.
The default string is ““.
-Regular Expressions - Input the simple string to filter items.
The default string is “.*”.
DVE Features
128
The interface/modport port and its type is displayed in the Data
pane. The tooltip shows the interface/modport used.
3. Click the “+” button under the Variable column in the Data pane
to expand the interface/modport port.
The signals under the interface/modport port are displayed.
4. Right-click the interface/modport port in the Data pane and select
Show Source.
The source of interface/modport is shown in the Source viewer.
You can also drag and drop the interface/modport from the Data
pane to the Source viewer.
5. Use the Text filter or Type filter drop-down and select the Interface/
Modport port filter to filter the signals.
DVE Features
129
6. Select the interface/modport port in the Data pane and select
Signal > Show Definition from the menu or right-click the signal
and select Show Definition.
The definition is shown in the Hierarchy pane, signals of interface/
modport port in the Data pane, and the definition location is shown
in the Source viewer.
7. Drag and drop the interface/modport port from the Data pane to
the Wave view or right-click and select Add to Waves.
Limitations
DVE Features
130
• Driver/Load, schematic/path schematic operations do not support
interface port and signals of interface port. A warning message is
displayed when you perform these operations.
• Follow signal doesn't work for interface port and signals of
interface port.
• Modport clocking port is not shown in the Data pane.
DVE Features
131
DVE Features
132
7
Viewing values in Symbolic format 1
You can view the values of signals/variables in the same radix as
specified in the source code. In addition to existing radixes decimal,
hexadecimal, binary, and octal, UCLI supports the symbolic radix
that will enable you to view the values in the same radix. The default
radix will hence be symbolic.
If the default radix is changed to any other, you can still view the
values with the default symbolic radix by passing symbolic argument
to –radix.
-radix symbolic
“Constraints Features”
137
- “Methodology for Using Unidirectional Constraints” on page
152
- “Constraint Solver Search Space and Solution Space” on page
154
- “Search Space Reduction And Random Assignment” on page
155
- “Using the Constraint Solver Diagnostics” on page 156
- “Classes of Constraint Diagnostics” on page 159
• fixed-size arrays
“Constraints Features”
138
• associative arrays
• dynamic arrays
• multidimensional arrays
• smart queues
Note:
VCS does not support multidimensional, variable-sized arrays.
• class XMRs
• package XMRs
• interface XMRs
• module XMRs
• static variable XMRs
• any combination of the above
You can use arrays, array elements, and XMRs as arguments to
std::randomize().
Syntax
integer fa[3];
success= std::randomize(fa);
success= std::randomize(fa[2]);
success= std::randomize(pkg::xmr);
“Constraints Features”
139
Example
module test;
integer i, success;
integer fa[3];
initial
begin
foreach(fa[i]) $display("%d %d\n", i, fa[i]);
success = std::randomize(fa);
foreach(fa[i]) $display("%d %d\n", i, fa[i]);
end
endmodule
Error Conditions
If you specify an argument to a std::randomize() array element
which is outside the range of the array, VCS prints the following error
message:
“Constraints Features”
140
XMR Support in Constraints
You can use XMRs in class constraints and inlined constraints. You
can refer to XMR variables directly or by specifying the full
hierarchical name, where appropriate. You can use XMRs for all data
types, including scalars, enums, arrays, and class objects.
• class XMRs
• package XMRs
• interface XMRs
• module XMRs
• static variable XMRs
• any combination of the above
Syntax
constraint general
{
varxmr1 == 3;
pkg::varxmr2 == 4;
}
Examples
Here is an example of a module XMR:
“Constraints Features”
141
rand int i2;
constraint constr
{
foreach(i1[a]) i1[a] == mod1.x;
}
endclass
cls1 c1 = new();
initial
begin
c1.randomize() with {i2 == mod1.x + 5;};
end
endmodule
package pkg;
typedef enum {WEAK,STRONG} STRENGTH;
class C;
static rand STRENGTH stren;
endclass
module test;
import pkg::*;
initial
begin
inst.randomize() with {pkg::C::stren == STRONG;};
$display("%d", pkg::C::stren);
end
endmodule
Functional Clarifications
XMR resolution in constraints (that is, choosing to which variable
VCS binds an XMR variable) is consistent with XMR resolution in
procedural SystemVerilog code. VCS first tries to resolve an XMR
“Constraints Features”
142
reference in the local scope. If the variable is not found in the local
scope, VCS searches for it in the immediate upper enclosing scope,
and so on, until it finds the variable.
“Constraints Features”
143
Constraint Debugging and Profiling
You can use VCS constraint profiling reports to find out how much
runtime and memory is spent on each randomize call in your
testbench. Profiling reports also show cumulative statistics and allow
you to cross-probe into the hierarchical constraint debugger reports.
To run your simulation with constraint profiling on, use the following
runtime switch:
% ./simv +NTB_CSTR_DEBUG_PROFILE=1
% firefox $cwd/cstr_html/profile.xml
“Constraints Features”
144
Figure 8-1 on page 146 shows some sample profiler results,
including randomize calls that are consuming the most time and
memory. Note that this illustration shows just the top of the report.
From the report, you can click the randomize call identifier or the
partition identifier to cross-probe to its corresponding constraint
hierarchical debug (trace) section.
“Constraints Features”
145
Figure 8-1 VCS Constraint Profiling Example
“Constraints Features”
146
Using the Hierarchical Constraint Debugger Report
% ./simv +NTB_ENABLE_XML_SOLVER_TRACE=1
% firefox $cwd/cstr_html/trace.xml
Note:
VCS uses SystemVerilog syntax instead of OpenVera syntax
when printing constraints in the trace.
“Constraints Features”
147
Figure 8-2 VCS Hierarchical Constraint Debugger Report
When you first bring up the HTML randomizer report, all the items
are collapsed. Click a specific item to make it expand. For each
obj.randomize()call, VCS prints the:
“Constraints Features”
148
• Visit count, incremented each time the same randomize() call
occurs. For example, a randomize() call inside a for loop has
test.sv:20@1, test.sv:20@2, and so on. This visit count is
also referenced in the profiling tables (see Figure 8-1 on
page 146).
• File name and line number for each variable to point to the place
where it is defined.
• File name and line number of the class where each variable is
defined.
• Runtime and memory usage for each partition, and for each full
randomize call.
“Constraints Features”
149
{
( x < 1 ) ;
( x in { 3 , 5 , 7 : 11 } ) ;
}
“Constraints Features”
150
In reactive mode, VCS issues diagnostic messages for actual
constraints applied to a specific randomize() call. The diagnostic
report displays:
Solver Overview
“Constraints Features”
151
partitioning of constraints by the solver, a common problem in other
industry solvers. As a result, the solver does not over-constrain
random variables or create spurious failures.
“Constraints Features”
152
constraint c1 {
x > 0;
}
endclass: C
class D;
rand C c[$];
typedef enum { T1, T2 } trans;
rand trans opcode;
constraint d1 {
foreach (c [i]) {
if (opcode == T1) {
c[i].x == 1;
} else if (opcode == T2) {
c[i].x == 2;
}
}
}
endclass: D
In Example 8-1, opcode is a control variable you can solve for first
to break the solver problem into smaller subsets. To do this, you can
use the $void() function:
foreach (c [i]) {
if ($void(opcode) == T1) {
c[i].x == 1;
} else if (opcode == T2) {
c[i].x == 2;
}
}
or use the solve-before-hard directive:
foreach (c [i]) {
if (opcode == T1) {
c[i].x == 1;
} else if (opcode == T2) {
c[i].x == 2;
“Constraints Features”
153
}
solve opcode before c[i].x hard;
}
{0 ,232-1}
The initial search space of a partition is the composite range that all
random variables of the partition can fall into. For example, the initial
search space for a partition with five unsigned 32-bit variables is:
(232)5 = 2160
However, the set of values that actually meets the constraints you
specify is typically much smaller than the search space. This set of
values (the solution space), is determined by the constraints on the
random variables.
To see how this works, consider Example 8-2. Here, the initial search
space for varA has 232 values. However, the solution space is
limited to the 16 values specified by the inside constraint.
“Constraints Features”
154
Example 8-2 Search Space Reduced by “in” Constraint
class B;
rand bit[31:0] varA;
constraint varA_range {
varA inside {[0:15]};
}
endclass: B
In the first phase, the solver narrows down the search space to
match the solution space as closely as possible, while not removing
any element of the solution space from the search space. This
ensures that if a valid solution exists, it is reached without being
prematurely eliminated from consideration.
“Constraints Features”
155
Using the Constraint Solver Diagnostics
Enabling Diagnostics
You enable the constraint solver diagnostic feature using a set of
runtime options or by passing a macro argument to randomize()
on a per-call basis.
ntb_enable_solver_diagnostics
The +ntb_enable_solver_diagnostics=value option
enables the constraint solver diagnostics. You use the value
argument to specify the desired diagnostic mode. This option
enables display for the entire simulation.
“Constraints Features”
156
Syntax
+ntb_enable_solver_diagnostics=value
Note:
Solver diagnostic output is verbose. It is a good idea to run a short
simulation with few randomize() calls when using this feature.
ntb_enable_solver_diagnostics_on_failure
The +ntb_enable_solver_diagnostics_on_failure option
enables the constraint solver diagnostics and reports diagnostic
information only when the solver times out.
“Constraints Features”
157
Syntax
+ntb_enable_solver_diagnostics_on_failure=value
Syntax
+ntb_solver_diagnostics_filename=filename
“Constraints Features”
158
In the report, the diagnostic information reported for each constraint
is organized and displayed in the following four sections:
• Diagnostic message
• Variables (random and non-random) involved in the reported
constraint
• Reported constraint
• Search space for random variables involved in the current partition
“Constraints Features”
159
Operator that Splits Value Ranges Resulting in Sparse
Solution Set
In Example 8-3, the result of the modulus operation is constrained to
a singleton value. The divisor is large (621), and the size of the
resulting range is small {{0:0}}. The probability of finding a
solution is very low (1/621). This causes a solver timeout.
Diagnostics Report
MSG 3: There is a low probability of a successful assignment based
on the existing values of the operand.
“Constraints Features”
160
Changing the Size of a Divisor
In Example 8-4, either decrease the size of the divisor or expand the
options in the RHS to increase the probability of finding a solution.
constraint residue {
base % 621 == res;
}
endclass: B
This can happen when VCS solves for random variables in the
RHSExp before it solves for the random variables in the multiplication
operator, or if the RHSExp is a constant. Consider this next example
(Example 8-5).
constraint factorization {
varA * varB == varC;
varA > varB;
//solve varA before varC;
“Constraints Features”
161
//solve varB before varC;
}
endclass: A
In, Example 8-5, the probability of finding a solution for the constraint
varA*varB == varC is exceedingly low. In this case if you add the
solve-before constraints, the constraint solver solves the two
operands of the multiplier (varA and varB) before varC. In the
absence of the solve-before constraints, this situation causes a
solver timeout.
Diagnostic Report
MSG 14: The expression with the multi-node causes problems.
“Constraints Features”
162
constraint factorization {
varA * varB == varC;
varA > varB;
solve varA, varB before varC;
}
endclass: B
constraint use_window_params {
(window_size > 0);
(window_shift > 4);
((window_shift+window_size) < 30);
mask == (((1<<window_size)-1) << window_shift);
//solve window_size,window_shift before mask;
}
“Constraints Features”
163
In Example 8-7, the last constraint combines random shift operations
to match a random mask. If a random selection for the mask value
results in only one digit set to 1, the probability of finding a solution
is 23/229 (almost zero).
Diagnostics Report
MSG 19: The shift node fans out arithmetic/relational operators
which may have a low probability of success.
“Constraints Features”
164
In Example 8-8, the solve-before directive specifies that the shift
amount be solved before the mask. This ensures that the value of
mask is calculated rather than randomly assigned.
“Constraints Features”
165
“Constraints Features”
166
9
Parallel VCS 1
Parallel VCS (PVCS) takes advantage of the computing power of
multiple processors in one machine to improve simulation
turnaround time
Parallel VCS
165
Parallel VCS Options
design=FILENAME
Enables all parallel VCS options and specifies the name of the
partition configuration file. Note: this option is available at compile-
time only.
fc[=NCONS]
Enables Parallel Functional Coverage and with NCONS
specifying the number of PFC consumers.
profile
Enables design and assertion level profiling.
profile_value
Enables value-based design level profiling.
show_features
Shows enabled PVCS features.
sva[=NCONS]
Enables Parallel SVA and with NCONS specifying the number of
parallel SVA consumers..
tgl[=NCONS]
Enables Parallel Toggle Coverage and specifies the number of
parallel toggle coverage consumers.
vpd[=NCONS]
Enables Parallel VCD+ Dumping and specifies the number of
parallel VCD+ consumers.
Parallel VCS
166
vpd_sidebuf=MULT
Sets the size of PVPD side buffer to MULT times the size of the
main buffer.
_only
Conserves processor resources by enabling only the processing
of the PVCS option specified. _only must immediately follow the
-parallel VCS option. It can be used with any PVCS option and
any other PVCS options can follow _only. For example, to enable
the design and vpd options enter:
vcs -parallel+design_only=FILENAME+vpd
[-o PVCS_executable_name]
Using the VCS -o option to specify the simulation executable
binary filename allows work on multiple simultaneous PVCS
compiles and runs. PVCS-specific data is stored in a directory
executable_name.pdaidir. The default path name is
simv.pdaidir.
Parallel VCS
167
3. Run parallel compilation, specifying the PVCS configuration file..
See “Design Simulation” on page 9-169.
4. Run parallel simulation. See “Design Simulation” on page 9-169.
If you wish to increase the performance gains from PVCS, additional
steps follow:
5. Run parallel simulation again and this time collect data for the
PVCS profiler.
6. Run the PVCS profiler. See “Profiling a Parallel Simulation” on
page 9-177.
7. Examine the PVCS profiler results. These results could call for
you to reorganize you partitions or your Verilog source code. See
“Examining the PVCS Profiler Results” on page 9-179.
8. After making the changes called for by the results, run parallel
compilation and simulation over again.
Parallel VCS
168
3. Generate coverage result reports.
You can generate results for one of all the following Parallel VCS
options in a simulation:
• Design simulation
• Assertion simulation
• Toggle coverage
• Functional coverage
• VPD file generation
Design Simulation
Parallel VCS
169
1. Compile using the PVCS -parallel option and other PVCS and
VCS options.
vcs filename(s).v -parallel+(design |
design_only)=partition_filename.cfg
parallel_vcs_options vcs_options
Assertion Simulation
Toggle Coverage
tgl[+count]
Report total executed transactions.
Parallel VCS
170
1. Compile using the PVCS -parallel option, coverage option or
options, and other PVCS and VCS options.
vcs filename(s).v -parallel+tgl[=NCONS] -cm tgl
[parallel_vcs_options] [vcs_options]
Example
In this example, toggle coverage results only are generated and the
URG report is produced in the default HTML format.
Parallel VCS
171
Results can then be examined in your default browser.
Functional Coverage
Parallel VCS
172
urg -dir coverage_directory.cm urg_options
Example
In this example, functional coverage results only are generated and
the URG report is produced in the default HTML format.
VPD File
You can enable Parallel VCD+ Dumping and specify the number of
parallel VCD+ consumers using the PVCS vpd option.
Parallel VCS
173
1. Compile using the PVCS -parallel option with the vpd[=NCONS]
option, and other PVCS and VCS options.
Profiling a Simulation
Parallel VCS
174
Profiling a Serial Simulation
The VCS profiler writes its profile information in the vcs.prof file in
the current directory. Look at the INSTANCE VIEW section in this file.
This section, or view, tells you the percentage of CPU time used by
each subhierarchy. Figure 9-1 shows this view.
The subhierarchies that use the most CPU time are good candidates
for PVCS partitions. In Figure 9-1 you would use separate partitions
for the subhierarchies.
Parallel VCS
175
Specifying Partitions
partition {hierarchical_name(module_identifier),...} ;
partition {hierarchical_name(module_identifier),...} ;
partition {hierarchical_name(module_identifier),...} ;
.
.
.
The syntax is as follows:
partition
The keyword that specifies that what follows are the contents of
one partition.
hierarchical_name
The hierarchical name of a Verilog module instance that is the
top-level instance of the subhierarchy that you want to simulate
as a partition.
module_identifier
The name of the module definition that corresponds to the top-
level instance.
All parts of the design not covered in any of the specified partitions
together form an implicitly defined master partition. The user-
specified partitions are called slave partitions.
Parallel VCS
176
partition {top.A1(A1)};
partition {top.A2(A2)};
partition {top.A3(A3)};
Note: You can use the Verilog comment syntax to comment your
partition file. For more information on creating configuration files, see
the VCS User Guide.
Run the simulation by entering a command line with the name of the
master executable (by default named simv) and runtime options. The
syntax for this command line is as follows:
You start the PVCS profiler with the pvcsProfiler command. Its
syntax is as follows:
Parallel VCS
177
pvcsProfiler [profileDumpDir=simvName.pdaidir]
[doTimeProfiling=1|0] [doToggleProfiling=0|1]
[graphImHeight=integer] [graphImWidth=integer]
[graphTnHeight=integer] [graphTnWidth=integer]
[lowerSimTimeBound=float] [runVersion=string]
[toggleCutOff=float] [upperSimTimeBound=float]
[-help]
These arguments and properties are as follows:
profileDumpDir=simvName.pdaidir
The PVCS profiler writes HTML files that display profile
information about the master and slave simulations. By default
the profiler creates the ppResults_0 directory and writes these
files in this directory.
Use profileDumpDir to specify the directory containing the dump
files that the profiler reads. The directory is the name you specified
for the simulation executable binary file with the extenstion
.pdaidir. The default path name is simv.pdaidir.
doTimeProfiling=1|0
Calculate the time accumulation and produce the graphs. The
default argument is 1. If the argument is 0, the profiler does not
make this calculation or produce the graphs.
doToggleProfiling=0|1
Calculate the partition port toggle counts and produce the high
count listing. The default argument is 1.If the argument is 0, the
profiler does not make this calculation.
graphImHeight=integer
Height of the full size graphs in pixels. The default height is 1000.
graphImWidth=integer
Width of the full size graphs in pixels. The default width is 1000.
graphTnHeight=integer
Height of the thumbnails size graphs in pixels. The default height
is 250.
Parallel VCS
178
graphTnWidth=integer
Width of the thumbnails size graphs in pixels. The default width
is 250.
lowerSimTimeBound=float
A floating point number for the simulation time when profiling
starts. The default argument is 0.0.
runVersion=string
By default the profiler creates the ppResults_0 directory in the
current directory and writes its output HTML files in this directory.
If you want a different name for this directory, enter this property.
With this property the profiler creates the ppResultsstring
directory.
toggleCutOff=float
Specifies that the port toggle count cutoff for a partition is equal
to this percentage of highest toggle count. The default argument
is 1.0.
upperSimTimeBound=float
A floating point number for the simulation time when profiling
stops. The default argument is 1e+100.
-help
Displays the valid properties and their definitions.
Parallel VCS
179
Figure 9-1 results.html File
Click
here to
see
how to
read the
graphs
Parallel VCS
180
There is a link to the howtoInterpretGraphs.html file that explains
how to interpret the graphs.
Parallel VCS
181
A delta is a set of events in one or more partitions that cause
subsequent simulation events in other partitions. Figure 9-3 shows
only two deltas, which is good. Delta d0, in which the design
generated the clock signal, and d1, where each partition did its work
in the same delta.
In Figure 9-4 the bars are all to the right, indicating good parallelism.
Parallel VCS
182
Figure 9-4 A Good S1 Balance Distribution Graph
Figure 9-5 shows that the partitions are not doing the same amount
of work. Some partitions, as indicated by the dark color at the top of
their bars, are doing a significant amount of waiting for events in
other partitions.
Parallel VCS
183
Figure 9-5 An Uneven Processor Segment Totals Graph
Figure 9-6 shows a small number of deltas, which is good, but also
indicates that the partitions are doing different amounts of work.
Parallel VCS
184
Figure 9-6 An Uneven Processor Delta Time Totals Graph
Figure 9-7 shows that the bars are more to the left, indicating less
parallelism.
Parallel VCS
185
Figure 9-7 An Uneven S1 Balance Distribution
Parallel VCS
186
Figure 9-8 Shows that the partitions are doing the same amount of
work, but they are spending much of their time waiting for events in
other partitions.
Parallel VCS
187
Figure 9-9 Clock Signal Processor Delta Time Totals Graph
Parallel VCS
188
Figure 9-10 Clock Signal S1 Balance Distribution
Figure 9-11 Shows that the partitions are doing the same amount of
work, but they are spending most of their time waiting for events in
other partitions.
Parallel VCS
189
Figure 9-11 Clock Signals Processor Segment Totals Graph
Figure 9-12 shows that all the work for each partition is done in a
different delta.
Parallel VCS
190
Figure 9-12 Clock Signal Processor Delta Time Totals Graph
Figure 9-13 shows the bars completely to the left, indicating that
there is no parallelism in the design.
Parallel VCS
191
Figure 9-13 Clock Signal S1 Balance Distribution
• A serial run
• A parallel run
Parallel VCS
192
• Profiler runs
- A balanced workload parallel run
- An unbalanced workload parallel run
- A run with a delay in a partition causing one partition not to run
in parallel with the other two partitions
- A run in which a clock is passed from partition to partition
causing non-parallel execution
Please contact VCS Support if you are looking for these examples.
Parallel VCS
193
Tue Oct 10 10:13:42 PDT 2006
Profiler Runs
----------------------------------------------------------
Parallel Runs
+define+BALANCED
This example is the best-case scenario.
Parallel VCS
194
Figure 9-15 Balanced Parallel Run
Partitions receive clocks together. Workloads of the partitions are
balanced and execute in parallel.
In this example:
• On the left, the Processor Segment Totals graph shows that each
partition is doing the same amount of work and the partitions
receive their clocks together.
• In he center, the Processor Delta Time Totals Graph shows two
deltas, d0, in which the design generated the clock signal, and d1,
where each partition did its work in the same delta and has the
same amount of activity.
• On the right, the Balance distribution graph shows that workloads
of the partitions are balanced and execute in parallel.
+define+UNBALANCED
In this parallel run unbalanced workloads hinder performance.
Parallel VCS
195
1. Run the script run_unbalanced_prof.csh.
2. Examine the output is in the ppResults_unbalanced directory by
opening the file results.html as shown in Figure 9-16.
Figure 9-16 Unbalanced Parallel Run
Partitions get clocks together. Partitions run in parallel, but
workloads are unbalanced.
In this example:
• The left chart, the Processor Segment Totals graph shows that
the partitions are not doing the same amount of work. Some
partitions are doing a significant amount of waiting for events in
other partitions.
• The center graph, the Processor Delta Time Totals Graph, shows
uneven processor delta time, indicating uneven work distribution
among the partitions.
• On the right, the Balance distribution graph shows that partitions
execute in parallel, but the workloads are unbalanced.
Parallel VCS
196
+define+BALANCED+DELAY
This is an example of a delay in a partition causing one partition not
to run in parallel with the other two partitions.
In this example:
• The left chart, the Processor Segment Totals graph shows that
each partition is doing the same amount of work but are spends
significant amounts of time waiting for events in other partitions.
Parallel VCS
197
• The center graph, the Processor Delta Time Totals Graph, shows
the partitions have the same amount of activity, but they execute
across two deltas
• On the right, the Balance distribution graph shows that workloads
of the partitions are balanced, but partition A3 does not execute
in parallel with A1 and A2.
+define+BALANCED+CLOCK
This is an example of a clock being passed from partition to partition
causing non-parallel execution. This is the worst-case scenario, and
will be slower than the serial run.
Parallel VCS
198
In this example:
• The left chart, the Processor Segment Totals graph shows that
each partition is doing the same amount of work but are spending
most of the time waiting for events in other partitions.
• The center graph, the Processor Delta Time Totals Graph, shows
the partitions have the same amount of activity, but the work for
each partition is done in a different delta.
• On the right, the Balance distribution graph shows that workloads
of the partitions are balanced, but none of the three partitions
execute in parallel.
Supported Platforms
Current Limitations
+race
+race is not supported
Partial Elab
This flow is not supported.
SystemVerilog
- Use of SV data types logic and bit types are allowed. Certain
dynamic types are not allowed inside slave partitions.
Parallel VCS
199
VCS-MX
• Only Verilog instances can be added as partitions.
• All VHDL will run in the master partition.
For example, VHDL testbench and Verilog gate-level netlist will
work very well.
VMC, SystemC-C, and AMS
These flows are not supported.
Parallel VCS
200
10
VMM Additions and Enhancements 1
New features and functionality in VMM are described in the following
sections:
C + SV ralgen C
Entry Point
There are two kinds of entry points: application entry points and
service entry points. Both use the same interface mechanism. They
only differ in their intent and timing of the invocation.
All entry points must take at least one argument that will receive the
base address of the RAL model to be used by the C code. The RAL
model reference is a size_t on the C side The C-side reference is
then used by the RAL C API to access required fields, registers or
memories, as specified in Appendix C.
program test;
initial
begin
env.start();
fork
appsw(env.ral_model.C_addr_of());
join_none
env.run();
end
endprogram
Execution Timeline
C Code
Accessing Registers
Ideally, registers and memories should be of the same size as the
native data bus size of the target process—typically the int type in the
C code—and thus live at a single physical address (called
"segment"). This allows each register to be accessed or updated
using a single read or write operation. The RAL C interface supports
single-segment as well as multi-segment registers.
Endian Support
The RAL C interface always read multi-segment registers into the
'int' array ('r2' in Example 10-8) in little-endian order, irrespective of
their actual hardware layout as specified in the RALF file. This
means that the segments of a multi-segment register in a big-endian
block or system will be in the reverse order in the C int array. RAL
models that use FIFO ordering are not supported.
Accessing Fields
Individual fields can be accessed using the corresponding
ral_read_<field>_in_<block>_<reg> and
ral_write_<field>_in_<block>_<reg> macros. If the field has a
unique name in its enclosing block, then there will also be macros
named ral_read_<field>_in_<block> and
ral_write_<field>_in_<block> with identical respective functionality
Accessing Memories
Memories can be accessed using the ral_read_<mem>_in_<block>
and ral_write_<mem>_in_<block> macros. Example 10-11 shows
how to read and write a memory location, offset 0x100 of memory 'm'
specified in Example 10-6.
Classes and members that have been added to the VMM Standard
Library are described in the following sections:
• vmm_opts
• vmm_scenario
• vmm_object
• vmm_ms_scenario_gen
• vmm_xactor_iter
• vmm_test
• vmm_channel
Summary
• vmm_opts::get_bit()
• vmm_opts::get_int()
• vmm_opts::get_string()
• vmm_opts::get_help()
SystemVerilog
static function bit get_bit(string name, string doc = "");
Description
Return TRUE if the specified option name was specified. Returns
FALSE otherwise.
SystemVerilog
static function int get_int(string name,
int dflt = 0,
string doc = "");
Description
Returns the integer value specified as the argument of the specified
run-time option. If the run-time option was not supplied, returns the
specified default value. Different calls specifying the same option
may have different default values.
The integer value "5" for run-time option "foo" would be supplied
using the "+vmm_opts+...+foo=5+..." command-line option, or
"+vmm_foo=5" command-line option, or the line "+foo=5" in the
option file.
SystemVerilog
static function string get_string(string name,
string dflt = "",
string doc = "");
Description
Returns the string value specified as the argument of the specified
run-time option. If the run-time option was not supplied, returns the
specified default value. Different calls specifying the same option
may have different default values.
The string value "bar" for run-time option "foo" would be supplied
using the "+vmm_opts+...+foo=bar+..." command-line option, or
"+vmm_foo=bar" command-line option, or the line "+foo=bar" in the
option file.
SystemVerilog
static function void get_help();
Description
Display a human-readable list of all run-time options queried so far.
Examples
Example 10-12
virtual task tb_env::start();
super.start();
if ($test$plusargs("tb_help")) begin
vmm_opts::get_help();
$finish;
end
...
endtask
Base class for all user-defined scenarios. This class extends from
vmm_data.
Summary
• vmm_scenario::stream_id
• vmm_scenario::scenario_id
• vmm_scenario::scenario_kind
• vmm_scenario::length
• vmm_scenario::repeated
• vmm_scenario::repeat_thresh
• vmm_scenario::repetition
• vmm_scenario::define_scenario()
• vmm_scenario::redefine_scenario()
• vmm_scenario::scenario_name()
• vmm_scenario::psdisplay()
• vmm_scenario::set_parent_scenario()
• vmm_scenario::get_parent_scenario()
SystemVerilog
int stream_id
Description
This data member is set by the scenario generator before
randomization to the generator’s stream identifier. This state variable
can be used to specifiy stream-specific constraints or to differentiate
stimulus from different streams in a scoreboard.
SystemVerilog
int scenario_id
Description
This data member is set by the scenario generator before
randomization to the generator’s current scenario counter value.
This state variable can be used to specifiy scenario-specific
constraints or to identify the order of different scenarios within a
stream.
SystemVerilog
rand int unsigned scenario_kind
Description
Used to randomly select one of the scenario kinds defined in this
random scenario descriptor.
SystemVerilog
rand int unsigned length
Description
Random number of transaction descriptor in this random scenario.
Constrained to be less than or equal to the maximum number of
transactions in the selected scenario kind.
SystemVerilog
rand int unsigned repeated
Description
The number of time the entire scenario is repeated. A repetition
value of zero specifies that the scenario will not be repeated, hence
will be applied only once.
SystemVerilog
static int unsigned repeat_thresh
Description
Specifies a threshold value that triggers a warning about possibly
unconstrained “vmm_scenario::repeated”data member. Defaults to
100.
SystemVerilog
constraint repetition {
repeated == 0;
}
Description
The “vmm_scenario::repeated” data member specifies the number
of times a scenario is repeated. It is not often used but, if left
unconstrained, can cause stimulus to be erroneously repeatedly
applied over 2 billion times on average.
Examples
Example 10-13
class many_atomic_scenario
extends eth_frame_atomic_scenario;
constraint repetition {
repeated < 10;
}
endclass
SystemVerilog
function int unsigned define_scenario(string name,
int unsigned max_len);
Description
Defines a new scenario kind included in this scenario descriptor and
return a unique scenario kind identifier. The
“vmm_scenario::scenario_kind”data member will randomly select
one of the defined scenario kinds. The new scenario kind may have
up to the specified number of random transactions.
SystemVerilog
function void redefine_scenario(int unsigned scenario_kind,
string name,
int unsigned max_len);
Description
Redefines an existing scenario kind included in this scenario
descriptor. The scenario kind may be redefined with a different name
or maximum number of random transactions.
SystemVerilog
function string scenario_name(int unsigned scenario_kind);
Description
Return the name of the specified scenario kind, as defined by the
“vmm_scenario::define_scenario()” or
“vmm_scenario::redefine_scenario()” methods.
SystemVerilog
virtual function string psdisplay(string prefix = "")
Description
Create human-readable image of the content of the scenario
descriptor.
SystemVerilog
function void set_parent_scenario(
vmm_scenario parent)
Description
Specify the single stream or multiple-stream scenario that is the
parent of this scenario. This will allow this scenario to grab a channel
that has already been grabbed by the parent scenario.
SystemVerilog
function vmm_scenario get_parent_scenario()
Description
Get the single stream or multiple-stream scenario that was specified
as the parent of this scenario. A scenario with no parent is a top-level
scenario.
% vcs ... \
+define+VMM_PRE_INCLUDE=$VMM_HOME/sv/std_lib/opt/vmm_object.svh \
+define_VMM_POST_INCLUDE=$VMM_HOME/sv/std_lib/opt/vmm_object.sv \
...
% vcs ... \
+define+VMM_PRE_INCLUDE=$VCS_HOME/etc/rvm/sv/std_lib/opt/vmm_object.svh \
+define_VMM_POST_INCLUDE=$VCS_HOME/etc/rvm/sv/std_lib/opt/vmm_object.sv \
...
Summary
• vmm_object::type_e
• vmm_object::new
• vmm_object::set_parent()
• vmm_object::get_parent()
• vmm_object::get_type()
• vmm_object::get_hier_inst_name()
• vmm_object::display()
• vmm_object::psdisplay()
SystemVerilog
typedef enum {
VMM_UNKNOWN, VMM_OBJECT, VMM_DATA, VMM_SCENARIO,
VMM_MS_SCENARIO, VMM_CHANNEL, VMM_NOTIFY, VMM_XACTOR,
VMM_SUBENV, VMM_ENV, VMM_CONSENSUS, VMM_TEST
} type_e
Description
Value returned by the “vmm_object::type_e”method to identify the
type of this vmm_object extension. Once the type is known, a
reference to a vmm_object can be cast into the corresponding class
type.
Constructor.
SystemVerilog
function new(vmm_object parent = NULL);
Description
Optionally specify a parent object to this object when constructing a
vmm_object instance. See “vmm_object::type_e” for more details on
specifying a parent object.
SystemVerilog
function void set_parent(vmm_object parent);
Description
Specify a new parent object to this object. Specifying a NULL parent
breaks the any current parent/child relationship. An object may have
only one parent, but the identity of a parent can be changed
dynamically.
If this object and the parent object are known to contain their own
instance of the message service interface, the vmm_log instance in
the parent is specified as being above the vmm_log instance in the
chil by calling parent.is_above(this). The instance names of the
message service interfaces can then be subsequently made
hierarchical by using the “vmm_log::use_hier_inst_name()” method.
Examples
Example 10-14
this.notify = new(this.log);
Example 10-15
this.notify = new(this.log);
‘VMM_OBJECT_SET_PARENT(this.notify, this)
SystemVerilog
function vmm_object get_parent(
vmm_object::type_e typ = VMM_OBJECT);
Description
Return the parent object of the specified type, if any. Returns NULL
if no such parent is found. Specifying VMM_OBJECT returns the
immediate parent of any type.
SystemVerilog
function vmm_object::type_e get_type();
Description
Return the type of this vmm_object extension.
SystemVerilog
function string get_hier_inst_name();
Description
Return the hierarchical instance name of the object. The instance
name is composed of the dot-separated instance names of the
message service interface of all the parents of the object.
SystemVerilog
virtual function void display(string prefix = "");
Description
Display the image returned by “vmm_object::type_e”to the standard
output.
SystemVerilog
virtual function string psdisplay(string prefix = "");
Description
Creates a human-readable image of the content of the object and
returns it as a string. Each line of the image is prefixed with the
specified prefix. The description should not contain a final newline
character.
The following methods are available. See Xref for guidelines on how
the multi-stream scenario generator can be used and how multi-
stream scenarios—including hierarchical scenarios—are defined
and executed.
Summary
• vmm_ms_scenario_gen::stop_after_n_scenarios
• vmm_ms_scenario_gen::inst_count
• vmm_ms_scenario_gen::scenario_count
• vmm_ms_scenario_gen::inst_count
• vmm_ms_scenario_gen::get_n_scenarios()
• vmm_ms_scenario_gen::get_n_insts()
• vmm_ms_scenario_gen::GENERATED
• vmm_ms_scenario_gen::DONE
• vmm_ms_scenario_gen::register_ms_scenario()
• vmm_ms_scenario_gen::ms_scenario_exists()
• vmm_ms_scenario_gen::get_ms_scenario()
• vmm_ms_scenario_gen::get_ms_scenario_name()
• vmm_ms_scenario_gen::get_ms_scenario_index()
• vmm_ms_scenario_gen::get_names_by_ms_scenario()
• vmm_ms_scenario_gen::get_all_ms_scenario_names()
• vmm_ms_scenario_gen::replace_ms_scenario()
• vmm_ms_scenario_gen::unregister_ms_scenario()
• vmm_ms_scenario_gen::unregister_ms_scenario_by_name()
• vmm_ms_scenario_gen::select_scenario
• vmm_ms_scenario_gen::scenario_set[$]
• vmm_ms_scenario_gen::register_channel()
• vmm_ms_scenario_gen::channel_exists()
• vmm_ms_scenario_gen::get_channel()
• vmm_ms_scenario_gen::get_channel_name()
• vmm_ms_scenario_gen::get_names_by_channel()
• vmm_ms_scenario_gen::get_all_channel_names()
• vmm_ms_scenario_gen::replace_channel()
• vmm_ms_scenario_gen::unregister_channel()
• vmm_ms_scenario_gen::unregister_channel_by_name()
• vmm_ms_scenario_gen::register_ms_scenario_gen()
• vmm_ms_scenario_gen::ms_scenario_gen_exists()
• vmm_ms_scenario_gen::get_ms_scenario_gen()
• vmm_ms_scenario_gen::get_ms_scenario_gen_name()
• vmm_ms_scenario_gen::get_all_ms_scenario_gen_names()
• vmm_ms_scenario_gen::replace_ms_scenario_gen()
• vmm_ms_scenario_gen::unregister_ms_scenario_gen()
• vmm_ms_scenario_gen::unregister_ms_scenario_gen_by_name()
SystemVerilog
int unsigned stop_after_n_scenarios
Description
Automatically stop the multi-stream scenario generator when the
number of generated multi-streams scenarios reaches or surpasses
the specified value. A value of zero specifies an infinite number of
multi-stream scenarios.
SystemVerilog
int unsigned stop_after_n_insts
Description
Automatically stop the multi-stream scenario generator when the
number of generated transaction descriptors reaches or surpasses
the specified value. A value of zero indicates an infinite number of
transaction descriptors.
SystemVerilog
protected int scenario_count;
Description
Current count of the number of top-level multi-stream scenarios
generated the multi-stream scenario generator. When is reaches or
surpasses the value in
vmm_ms_scenario_gen::stop_after_n_scenarios, the generator
stops.
SystemVerilog
protected int inst_count;
Description
Current count of the number of individual transaction descriptor
instances generated by the multi-stream scenario generator. When
is reaches or surpasses the value in
vmm_ms_scenario_gen::stop_after_n_insts, the generator stops.
SystemVerilog
function int unsigned get_n_scenarios()
Description
Return the current value of the
vmm_ms_scenario_gen::scenario_count property.
SystemVerilog
function int unsigned get_n_insts()
Description
Return the current value of the vmm_ms_scenario_gen::inst_count
property.
SystemVerilog
typedef enum int {GENERATED} symbols_e
Description
Notification in vmm_xactor::notify that is indicated every time a new
multi-stream scenario is generated and about to be executed.
SystemVerilog
typedef enum int {DONE} symbols_e
Description
Notification in vmm_xactor::notify that is indicated when the
generation process has completed as specified by the
scenvmm_ms_scenario_gen::stop_after_n_scenarios and
vmm_ms_scenario_gen::stop_after_n_insts class properties.
SystemVerilog
virtual function void register_ms_scenario(string name,
vmm_ms_scenario scenario)
Description
Registers the specified multi-stream scenario under the specified
name. The same scenario may be registered multiple times under
different names, thus creating an alias to the same scenario.
SystemVerilog
virtual function bit ms_scenario_exists(string name)
Description
Returns TRUE if there is a multi-stream scenario registered under
the specified name. Returns FALSE otherwise.
SystemVerilog
virtual function vmm_ms_scenario get_ms_scenario(
string name)
Description
Returns the multi-stream scenario descriptor registered under the
specified name. Issues a warning message and returns NULL if
there are no scenarios registered under that name.
SystemVerilog
virtual function string get_names_by_ms_scenario(
vmm_ms_scenario scenario)
Description
Returns a name under which the specified multi-stream scenario
descriptor is registered. Returns "" if the scenario is not registered.
SystemVerilog
virtual function int get_ms_scenario_index(
vmm_ms_scenario scenario)
Description
Returns the index of the specified scenario descriptor in the
vmm_ms_scenario_gen::scenario_set[$] array. A warning message
is issued and returns -1 if the scenario descriptor is not found in the
scenario set.
SystemVerilog
virtual function int get_names_by_ms_scenario(
vmm_ms_scenario scenario,
ref string name[$])
Description
Appends the names under which the specified multi-stream scenario
descriptor is registered. Returns the number of names that were
added to the array.
SystemVerilog
virtual function int get_all_ms_scenario_names(
ref string name[$])
Description
Appends the names under which a multi-stream scenario descriptor
is registered. Returns the number of names that were added to the
array.
SystemVerilog
virtual function void replace_ms_scenario(string name,
vmm_ms_scenario scenario)
Description
Registers the specified multi-stream scenario under the specified
name, replacing the scenario previously registered under that name
(if any). The same scenario may be registered multiple times under
different names, thus creating an alias to the same scenario.
SystemVerilog
virtual function bit unregister_ms_scenario(
vmm_ms_scenario scenario)
Description
Completely unregisters the specified multi-stream scenario
descriptor and returns TRUE if it exists in the registry. The
unregistered scenario is also removed from the
vmm_ms_scenario_gen::scenario_set[$] array.
SystemVerilog
virtual function vmm_ms_scenario unregister_ms_scenario(
string name)
Description
Unregisters the multi-stream scenario under the specified name and
returns the unregistered scenario descriptor. Returns NULL if there
is no scenario registered under the specified name.
SystemVerilog
vmm_ms_scenario_election select_scenario
Description
Randomly select the next multi-stream scenario to execute from the
vmm_ms_scenario_gen::scenario_set[$] array. The selection is
performed by calling randomize() on this class property then
executing the multi-stream scenario found in the
vmm_ms_scenario_gen::scenario_set[$] array at the index specified
by the vmm_ms_scenario_election::select class property.
SystemVerilog
vmm_ms_scenario scenatio_set[$]
Description
Multi-stream scenarios available for execution by this generator. The
scenario executed next is selected by randomizing the
vmm_ms_scenario_gen::select_scenario class property.
SystemVerilog
virtual function void register_channel(string name,
vmm_channel chan)
Description
Registers the specified output channel under the specified logical
name. The same channel may be registered multiple times under
different names, thus creating an alias to the same channel.
SystemVerilog
virtual function bit channel_exists(string name)
Description
Returns TRUE if there is an output channel registered under the
specified name. Returns FALSE otherwise.
SystemVerilog
virtual function vmm_channel get_channel(
string name)
Description
Returns the output channel registered under the specified name.
Issues a warning message and returns NULL if there are no
channels registered under that name.
SystemVerilog
virtual function string get_names_by_channel(
vmm_channel chan)
Description
Return a names under which the specified channel is registered.
Returns "" if the channel is not registered.
SystemVerilog
virtual function int get_names_by_channel(
vmm_channel chan,
ref string name[$])
Description
Appends the names under which the specified output channel is
registered. Returns the number of names that were added to the
array.
SystemVerilog
virtual function int get_all_channel_names(
ref string name[$])
Description
Appends the names under which an output channel is registered.
Returns the number of names that were added to the array.
SystemVerilog
virtual function void replace_channel(string name,
vmm_channel chan)
Description
Registers the specified output channel under the specified name,
replacing the channel previously registered under that name (if any).
The same channel may be registered multiple times under different
names, thus creating an alias to the same output channel.
SystemVerilog
virtual function bit unregister_channel(
vmm_channel chan)
Description
Completely unregisters the specified output channel and returns
TRUE if it exists in the registry.
SystemVerilog
virtual function vmm_channel unregister_channel(
string name)
Description
Unregisters the output channel under the specified name and returns
the unregistered channel. Returns NULL if there is no channel
registered under the specified name.
Register a sub-generator
SystemVerilog
virtual function void register_ms_scenario_gen(string name,
vmm_ms_scenario_gen gen)
Description
Registers the specified sub-generator under the specified logical
name. The same generator may be registered multiple times under
different names, thus creating an alias to the same generator.
SystemVerilog
virtual function bit ms_scenario_gen_exists(string name)
Description
Returns TRUE if there is a sub-generator registered under the
specified name. Returns FALSE otherwise.
SystemVerilog
virtual function vmm_ms_scenario_gen get_ms_scenario_gen(
string name)
Description
Returns the sub-generator registered under the specified name.
Issues a warning message and returns NULL if there are no
generators registered under that name.
SystemVerilog
virtual function string get_names_by_ms_scenario_gen(
vmm_ms_scenario_gen gen)
Description
Returns a names under which the specified sub-generator is
registered. Returns "" if the generator is not registered.
SystemVerilog
virtual function int get_names_by_ms_scenario_gen(
vmm_ms_scenario_gen gen,
ref string name[$])
Description
Appends the names under which the specified sub-generator is
registered. Returns the number of names that were added to the
array.
SystemVerilog
virtual function int get_all_ms_scenario_gen_names(
ref string name[$])
Description
Appends the names under which a sub-generator is registered.
Returns the number of names that were added to the array.
Replace a sub-generator
SystemVerilog
virtual function void replace_ms_scenario_gen(string name,
vmm_ms_scenario_gen gen)
Description
Registers the specified sub-generator under the specified name,
replacing the generator previously registered under that name (if
any). The same generator may be registered multiple times under
different names, thus creating an alias to the same sub-generator.
Unregister a sub-generator
SystemVerilog
virtual function bit unregister_ms_scenario_gen(
vmm_ms_scenario_gen gen)
Description
Completely unregisters the specified sub-generator and returns
TRUE if it exists in the registry.
Unregister a sub-generator
SystemVerilog
virtual function vmm_ms_scenario_gen
unregister_ms_scenario_gen(
string name)
Description
Unregisters the generator under the specified name and returns the
unregistered generator. Returns NULL if there is no generator
registered under the specified name.
This class can iterate over all known vmm_xactor instances, based
on the names and instance names, regardless of their location in the
class hierarchy.
Summary
• vmm_xactor_iter::new()
• vmm_xactor_iter::first()
• vmm_xactor_iter::xactor()
• vmm_xactor_iter::next()
SystemVerilog
function void new(string name = "/./",
string inst = "/./");
Description
Create a new transactor iterator and initialize it using the specified
name and instance name. If the specified name or instance name is
enclosed between ’/’ characters, their are interpreted as regular
expressions. Otherwise, they are interpreted as the full name or
instance name to match.
Examples
Example 10-16
vmm_xactor_iter iter = new("/AHB/");
while (iter.xactor() != null) begin
ahb_master ahb;
if ($cast(ahb, iter.xactor()) begin
...
end
iter.next();
end
SystemVerilog
function vmm_xactor first();
Description
Reset the iterator to the first transactor matching the name and
instance name patterns specified when the iterator was created
using vmm_xactor_iter::new() and return a reference to it, if found.
SystemVerilog
function vmm_xactor xactor();
Description
Return a reference to a transactor matching the name and instance
name patterns specified when the iterator was created using
vmm_xactor_iter::new().
SystemVerilog
function vmm_xactor next();
Description
Move the iterator to the next transactor matching the name and
instance name patterns specified when the iterator was created
using vmm_xactor_iter::new() and return a reference to it, if found.
SystemVerilog
‘foreach_vmm_xactor(type, name, inst) begin
xact...
end
Description
Short-hand macro to simplify the creating and operation of a
transactor iterator instance, looking for transactors of a specific type,
matching a specific name and instance name. The subsequent
statement is executed for each transactor iterated on.
Examples
Example 10-17 Iterating over all transactors of type "ahb_master"
begin
‘foreach_vmm_xactor(ahb_master, "/./", "/./") begin
xact.register_callback(...);
end
end
SystemVerilog
function int catch(
vmm_log_catcher catcher,
string name = "",
string inst = "",
bit recurse = 0,
int typs = ALL_TYPS,
int severity = ALL_SEVS,
string text = "");
Description
Install the specified message handler to catch any message of the
specified type and severity, issued by the specified message service
interface instances, which contains the specified text. By default,
catches all messages issued by this message service interface
instance. A unique message handler identifier is returned that can be
used to later uninstall the message handler using
vmm_log::uncatch().
Summary
• vmm_test::log
• vmm_test::new()
• vmm_test::get_name()
• vmm_test::get_doc()
• vmm_test::run()
• vmm_test_begin()
• vmm_test_end()
SystemVerilog
vmm_log log;
Description
Message service interface instance that can be used to issue
messages in the vmm_test::run() method.
Create a test.
SystemVerilog
function new(string name, string doc = "");
Description
Create an instance of the testcase, its message service interface
and registers it in the global testcase registry under the specified
name. A short description of the testcase may also be specified.
Examples
Example 10-18
class my_test extends vmm_test;
function new();
super.new("my_test");
endfunction
static my_test this_test = new();
SystemVerilog
function string get_name();
Description
Return the name of the test that was specify in the constructor.
Examples
Example 10-19
class my_test extends vmm_test;
function new();
super.new("my_test");
endfunction
static my_test this_test = new();
SystemVerilog
function string get_doc();
Description
Return the short description of the test that was specify in the
constructor.
Examples
Example 10-20
class my_test extends vmm_test;
function new();
super.new("my_test");
endfunction
static my_test this_test = new();
Run a test.
SystemVerilog
virtual task run(vmm_env env);
Description
The test itself.
Examples
Example 10-21
class my_test extends vmm_test;
...
virtual task run(vmm_env env);
tb_env my_env;
$cast(my_env, env);
my_env.build();
my_env.gen[0].stop_xactor();
my_env.run();
endtask
endclass
SystemVerilog
‘vmm_test_begin(testclassname, envclassname, doc string)
Description
Short-hand macro that may be used to define a user-defined
testcase implemented using a class based on the vmm_test class.
The first argument is the name of the testcase class and will also be
used as the name of the testcase in the global testcase registry. The
second argument is the name of the environment class that will be
used to execute the testcase. A data member of that type named
"env" will be defined and assigned, ready to be used. The third
argument is a string documenting the purpose of the test.
Examples
This example shows how the testcase from Example 2-72 and
Example 2-75 can be implemented using short-hand macros
Example 10-22
import tb_env_pkg::*;
SystemVerilog
‘vmm_test_end(testclassname)
Description
Short-hand macro that may be used to define a user-defined
testcase implemented using a class based on the vmm_test class.
The first argument must be the same name specified as the first
argument of the vmm_test_begin() macro.
This macro can be used to end the testcase class, including the
implementation of the vmm_test::run() method.
Examples
This example shows how the testcase from Example 2-72 and
Example 2-75 can be implemented using short-hand macros
Example 10-23
‘vmm_test_begin(my_test, tb_env)
this.env.build();
this.env.gen[0].stop_xactor();
this.env.run();
‘vmm_test_end(my_test)
SystemVerilog
function vmm_channel get_channel(string name)
Description
Get the output channel registered under the specified logical name
in the multi-stream generator where the multi-stream scenario
generator is registered. Returns NULL of no such channel exists.
• vmm_channel::record()
• vmm_channel::playback()
Syntax
function bit record(string filename);
Description
Starts recording the flow of transaction descriptors through the
channel instance in the specified file. The
vmm_data::byte_pack() or vmm_data::save() method must
be implemented for the flowing transaction descriptors. A transaction
descriptor is recorded when it is injected into the channel by the
vmm_channel::put() or vmm_channel::sneak() method.
Recording is also done when an attempt is made to
vmm_channel::unput() a transaction descriptor from the
channel.
Syntax
task playback(output bit success,
input string filename,
input vmm_data factory,
input bit metered = 0);
Description
This task executes the recorded transaction operations (put/unput/
sneak), in the same sequence in which they were recorded, into the
channel instance. It acts as a producer for the channel instance.
Playback does not have to happen in the same simulation run as
recording: it can be executed in a different simulation run. The
vmm_data::byte_unpack() or vmm_data::load() method,
must be implemented for the transaction descriptor, passed to the
factory argument. You must provide a non-null factory argument,
of the same transaction descriptor type as that with which recording
was done. The transaction descriptors are played back one by one
in the order specified in the file. If the metered argument is TRUE,
the transaction descriptors are played back (that is, by sneak/put/
unput) to the channel in the same relative simulation time interval
as the one in which they were originally recorded.
Example
Example 10-24
string filename = "./record.dat";
class packet_env extends vmm_env;
string filename = "./record.dat";
bit success;
vmm_channel
bit metered;
data_packet factory;
…
function new();
…
factory = new;
metered = 1’b1; // Playback with same timing as
recording
endfunction
task start();
// Other start code …
`ifndef PLAY_DATA
this.generator.start_xactor();
`else
fork
begin
//Start playback this.xactor.in_chan.playback(
//this.success,this.filename,this.factory,
//this.metered);
if(!this.success)
`vmm_error(this.log,"vmm_channel::playback()
function failed");
• “vmm_ral_block_or_sys::set_offset()”
• “vmm_ral_block_or_sys::get_reg_by_offset()”
SystemVerilog
virtual function bit set_offset(bit [63:0] offset,
string domain = "")
Description
Dynamically relocate the base address of the specified domain in the
block or subsystem in the address space of the immediately
instantiating system. The new address range for the block or
subsystem must not be occupied by another block or subsystem.
Note that after using this method, the behavior of the RAL model will
be different from the RALF specification.
SystemVerilog
virtual function vmm_ral_reg get_reg_by_offset(
bit [63:0] offset,
string domain = "")
Description
Finds the register located at the specified offset within the block or
system address space in the specified domain and returns its
descriptor. If no register is found at the specified offset, returns
NULL.
The entire register may occupy more than one offset within the
address space of the block or system if it is wider than the physical
interface. In such cases, this function looks for the start (lowest)
address of the register’s address space.
This function has a default version and a faster version, which takes
more memory than the default version.
Note:
Unlike the VMM Planner Spreadsheet annotator flow, the Word
Doc flow does not currently support OpenOffice input.
Introduction
External Debugging
Doc Plan XML .hvp Files
External External
Doc XML
Synopsys
Unified Annotated
hvp annotate External
Coverage Doc XML
Database
HVP
User Data
License Model
linux
amd64
suse32
suse64
sparc64
sparcOS5
Syntax
hvp annotate -plan planfile
[-h]
[-mod hvpfiles]
[-plan_out annfile]
[-feature "hierarchies"|-featurefile txtfile]
[-dir covdbpath|-f txtfile]
[-userdata vedata|-userdatafile txtfile]
[-userdata_out outvedata]
Options
-plan planfile
Spreadsheet, doc XML or HVP file for your verification plan. This
switch is mandatory.
-h
Show this help message and exit.
-mod hvpfiles
Filter or override files in HVP language format multiple files can
be specified. They are applied in the order in which they are
entered.
-plan_out annfile
Specify the name for the output annotated spreadsheet or doc
XML file. If -plan_out is not entered, a file with the original
filename and .ann.xml extension is generated.
-featurefile txtfile
A text file that contains list of hierarchical filters.
-dir covdbpath
Specify the path to a Synopsys coverage database (cm, vdb).
Multiple paths can be entered, separated by commas.
-f txtfile
Specify a text file that contains list of covdb coverage database
paths.
-userdata vedata
Specify a ve.data file path. Multiple paths can be entered,
separated by commas.
-userdatafile txtfile
Specify a text file that contains a list of user database file paths.
-userdata_out outvedata
Dump an annotated score of all measures into the specified
outvedata user data file.
-metric_prefix prefix
The given prefix is used to change a metric name in the output
user database file used by -userdata_out.
-show_ratio
Display ratio type scores in a ratio form instead of a percent.
-show_incomplete
Indicate incomplete scores with [inc].
-v
Verbose mode: Show progress status messages.
-q
Quiet mode: Turn off all warning messages.
Built-In Styles
In the Doc XML plan template, there are predefined styles that are
prefixed with “HVP”. VMM Planner extracts the contents and their
styles to establish the HVP hierarchy. A template document
Since VMM Planner does not allow the same instance name in the
same node, you must add one more feature level to instantiate
multiple subplans with the same plan, as shown in the following
example.
Table Keyword
When a table is found, VMM Planner looks at the contents in the first
cell of the table, and determines whether the table needs to be
interpreted as part of the HVP hierarchy. The following keywords are
reserved:
HVP Assignment
phase 2
owner Snps
Note:
Although the HVP language is case sensitive, VMM Planner
searches for the names of attributes, annotations, and metrics in
its definition tables with case-insensitive matching, because Word
sometimes capitalizes the first character of a word.
After the source row, append one or more two-column rows, with a
metric name in the left cell of each of those rows. Leave the right cell
empty. The annotation process fills each empty cell with its score.
HVP Measure m1
source group instance:
memsys_test_top.testbench::cpu::cpu_cov.my_cpu0
Group
HVP Measure
source group: memsys_test_top
source group: memsys_test_top2
Group
HVP Measure
source group: memsys_test_top, group: memsys_test_top2
Group
Assert
Aggregator can be one of: sum, average, max, min. Not all entries
are available for all types. See “Using the HVP Language” for
more information.
Other Contents
All other content such as text, images, and charts, that is neither in
a predefined HVP style nor in a table with a predefined keyword, is
ignored during the annotation process, and appears in the annotated
plan exactly as it appears in the original plan document. Formatting
is limited to the formatting features that are allowed in Microsoft
Word 2003 XML .doc format.
To find where Group1 was used, you can open the file named
memsys_wordplan.dbg.xml and search for the ERR001 string.
ERR001 is a unique string in the filename.dbg.xml file, so you
can easily find the location of the error. Then you can open the
original plan and edit it to fix the error.
In the measure score table, the score cell is colored using the same
scheme as the “Plan/Feature Score Summary”. If no score is
available, then the cell contains “N/A”.
URG Enhancements
327
• “Dumping User Data” on page 330
• “Predictable Page Naming Convention” on page 331
• “Add New Hyperlinks from group bin and group instance” on page
331
• “New –show hvpprob Command for Problem Reports” on page
332
• “Test Metric Coloring” on page 332
The hvp*.html page format has been changed to the more compact
format used by the hierarchy.html page. This allows for more
information to be displayed per page, which reduces the amount of
scrolling necessary to read the report. Also, linear tables on the
feature*.html pages can be sorted by column. With these changes,
the HVP pages are more consistent with other URG data pages.
URG Enhancements
328
Figure 12-1 hvp*.html page format
Incompleteness Checks
You can bind HVP features to coverage regions via the measure
statement of the HVP file. Other HVP applications that load both the
.hvp plan and the coverage database can compare those measure
sources against the database and highlight problems where no
match is found, enabling the user to identify and correct those
problems.
Use Model
The user runs URG and observes warning messages about
unbound source statements, then determines the cause of the
warnings. After fixing the code and the plan, the user runs URG
again. This is repeated if there are more incompletness warnings.
URG Enhancements
329
Omitting Filtered Features
Use Model
The user can enter the –mod command line argument to supply a
filter modifier. For multiple filtered reports of the same master
design, the user can invoke multiple URG runs.
HVP allows you to extend the set of metrics measured by the plan.
Use Model
When questions arise about how top level scores are reported, the
user can use the hyperlinks pointing from the feature*.html pages to
drill down to the raw ve.data listings.
URG Enhancements
330
The –userdata runtime option specifies user-defined data sources
Use Model
To reference HVP results from external documents, the user must
know the absolute path in terms of feature names to reach the
feature that they seek. For example, to produce an external
document containing the results for feature A.B.C, you could form a
URL like feature named, A.B.C.html. After URG is run, the urgReport
would contain a file with that name.
URG Enhancements
331
Use Model
Hyperlinks can be used to drill down to raw functional coverage
information.
When a user has a very large plan that is nearing tapeout, it might
be helpful to view a report that contains only problems. The -show
hvpprob option produces a report that omits all non-problem
features. A problem is defined as a feature that fails the goals set for
one or more of its metrics.
Use Model
When the –show hvpprob option is used, the default hvp*.html
report shows only the problems.
This feature computes that percentage and then applies the default
red-yellow-green spectrum of colors that are used for other URG
metrics.
If the user overrides the default test metric goal then coloring reverts
to the binary red/green cell coloring.
URG Enhancements
332
License Model
The –lca command line flag is required to invoke any HVP feature
within URG.
Platform Support
linux
amd64
suse32
suse64
sparc64
sparcOS5
aix
URG Enhancements
333
URG Enhancements
334
12
Run Command 1
This chapter describes the options added in the run command in
this release.
run Command
Syntax
run [0]
run [-delta]
run [-nba]
[0]
Run Command
347
Runs all of the deltas of a particular simulation time and stops just
before the end of that simulation time. The simulation stops after
signal update phase, before process execution for the last delta.
If UCLI generates more events by forces or release etc., all such
events are processed until things stabilizes at the end of current
time.
[-delta]
Runs one set of deltas at a time and stops before the next delta.
The simulation advances to the next delta and return to UCLI soon
after the signal update phase (before process execution). You can
inspect values of newly deposited signals/variables at that time.
If there are no more events, the simulation advances to the next
time step and stops at the end of the first delta of the new time step.
[-nba]
Runs all deltas and stops before a new NBA (non-blocking
assignments). The simulation goes into interactive mode right
before the NBA queue starts executing during SemiLER queue
execution.
This ensures all deltas (sched0 queues) are executed and all
blocking assignments are completed.
Run Command
348