(Synopsys) VMM Scoreboard Guide (2008)
(Synopsys) VMM Scoreboard Guide (2008)
(Synopsys) VMM Scoreboard Guide (2008)
User Guide
December 2008
VMM SB Package Version 1.3 (Synopsys)
Disclaimer
SYNOPSYS, INC., AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH
REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Registered Trademarks ()
Synopsys, AMPS, Cadabra, CATS, CRITIC, CSim, Design Compiler, DesignPower, DesignWare, EPIC, Formality, HSIM,
HSPICE, iN-Phase, in-Sync, Leda, MAST, ModelTools, NanoSim, OpenVera, PathMill, Photolynx, Physical Compiler,
PrimeTime, SiVL, SNUG, SolvNet, System Compiler, TetraMAX, VCS, Vera, and YIELDirector are registered trademarks of
Synopsys, Inc.
Trademarks ()
AFGen, Apollo, Astro, Astro-Rail, Astro-Xtalk, Aurora, AvanWaves, Columbia, Columbia-CE, Cosmos,
CosmosEnterprise, CosmosLE, CosmosScope, CosmosSE, DC Expert, DC Professional, DC Ultra, Design Analyzer,
Design Vision, DesignerHDL, Direct Silicon Access, Discovery, Encore, Galaxy, HANEX, HDL Compiler, Hercules,
Hierarchical Optimization Technology, HSIMplus, HSPICE-Link, iN-Tandem, i-Virtual Stepper, Jupiter, Jupiter-DP,
JupiterXT, JupiterXT-ASIC, Liberty, Libra-Passport, Library Compiler, Magellan, Mars, Mars-Xtalk, Milkyway,
ModelSource, Module Compiler, Planet, Planet-PL, Polaris, Power Compiler, Raphael, Raphael-NES, Saturn, Scirocco, Sciroccoi, Star-RCXT, Star-SimXT, Taurus, TSUPREM-4, VCS Express, VCSi, VHDL Compiler, VirSim, and VMC are trademarks of
Synopsys, Inc.
ii
Contents
1
Introduction
Data Streams
What is a stream?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Logical stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Packets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Single stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
In-order stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Out-of-order stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Multiple streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Multiple expected stream, single input stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Single expected stream, multiple input stream. . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Multiple input and expected streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
One-to-one transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
One-to-many transformation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Many-to-one transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
User-defined behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Locating a packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Inserting a packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Discarding a packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Integrating Scoreboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Integrating with callback extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Integrating with extended vmm_xactor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Integrating with vmm_channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Integrating with vmm_notify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Class Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
vmm_sb_ds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
vmm_sb_ds::new() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
vmm_sb_ds::log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
vmm_sb_ds::notify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
vmm_sb_ds::kind_e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
vmm_sb_ds::stream_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
vmm_sb_ds::define_stream() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
vmm_sb_ds::insert() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
vmm_sb_ds::remove() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
vmm_sb_ds::transform(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
vmm_sb_ds::match() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
vmm_sb_ds::quick_compare() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
vmm_sb_ds::compare() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
vmm_sb_ds::expect_in_order() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
vmm_sb_ds::expect_with losses() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
vmm_sb_ds::expect_out_of_order(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
vmm_sb_ds::flush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
vmm_sb_ds::new_sb_iter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
vmm_sb_ds::new_stream_iter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
vmm_sb_ds::prepend_callback() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
vmm_sb_ds::append_callback(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
vmm_sb_ds::unregister_callback(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
vmm_sb_ds::get_n_inserted() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
vmm_sb_ds::get_n_pending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
vmm_sb_ds::get_n_matched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
vmm_sb_ds::get_n_mismatched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
vmm_sb_ds::get_n_dropped() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
vmm_sb_ds::get_n_not_found(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
vmm_sb_ds::get_n_orphaned() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
vmm_sb_ds::report() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
vmm_sb_ds::describe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
vmm_sb_ds::display(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
vmm_sb_ds_iter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
vmm_sb_ds_iter::first() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
vmm_sb_ds_iter::is_ok() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
vmm_sb_ds_iter::next() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
vmm_sb_ds_iter::last() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
vmm_sb_ds_iter::prev() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
vmm_sb_ds_iter::length() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
vmm_sb_ds_iter::pos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
vmm_sb_ds_iter::inp_stream_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
vmm_sb_ds_iter::exp_stream_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
vmm_sb_ds_iter::describe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
vmm_sb_ds_iter::get_n_inserted() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
vmm_sb_ds_iter::get_n_pending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
vmm_sb_ds_iter::get_n_matched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
vmm_sb_ds_iter::get_n_mismatched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
vmm_sb_ds_iter::get_n_dropped(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
vmm_sb_ds_iter::get_n_not_found() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
vmm_sb_ds_iter::get_n_orphaned(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
vmm_sb_ds_iter::incr_n_inserted() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
vmm_sb_ds_iter::incr_n_matched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
vmm_sb_ds_iter::incr_n_mismatched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
vmm_sb_ds_iter::incr_n_dropped() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
vmm_sb_ds_iter::incr_n_not_found() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
vmm_sb_ds_iter::copy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
vmm_sb_ds_iter::stream_iter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
vmm_sb_ds_iter::new_stream_iter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
vmm_sb_ds_iter::delete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
vmm_sb_ds_iter::display() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
vmm_sb_ds_stream_iter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
VMM Scoreboarding User Guide
v
vmm_sb_ds_stream_iter::first() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
vmm_sb_ds_stream_iter::is_ok() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
vmm_sb_ds_stream_iter::next() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
vmm_sb_ds_stream_iter::last() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
vmm_sb_ds_stream_iter::prev(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
vmm_sb_ds_stream_iter::inp_stream_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
vmm_sb_ds_stream_iter::exp_stream_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
vmm_sb_ds_stream_iter::describe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
vmm_sb_ds_stream_iter::length() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
vmm_sb_ds_stream_iter::data(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
vmm_sb_ds_stream_iter::pos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
vmm_sb_ds_stream_iter::find() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
vmm_sb_ds_stream_iter::prepend(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
vmm_sb_ds_stream_iter::append() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
vmm_sb_ds_stream_iter::delete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
vmm_sb_ds_stream_iter::flush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
vmm_sb_ds_stream_iter::preflush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
vmm_sb_ds_stream_iter::postflush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
vmm_sb_ds_stream_iter::copy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
vmm_sb_ds_callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
vmm_sb_ds_callbacks::pre_insert() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
vmm_sb_ds_callbacks::post_insert() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
vmm_sb_ds_callbacks::matched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
vmm_sb_ds_callbacks::mismatched() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
vmm_sb_ds_callbacks::dropped() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
vmm_sb_ds_callbacks::not_found() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
vmm_sb_ds_callbacks::orphaned() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
vmm_sb_ds_pkts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
vmm_sb_ds_pkts::pkts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
vmm_sb_ds_pkts::kind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
vmm_sb_ds_pkts::inp_stream_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
vmm_sb_ds_pkts::exp_stream_id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
vmm_channel, vmm_notify, vmm_xactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
vmm_channel::register_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
vmm_channel::unregister_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_notify::register_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_notify::unregister_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_xactor::inp_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_xactor::exp_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_xactor::register_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vmm_xactor::unregister_vmm_sb_ds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
150
151
152
153
154
155
156
1
Introduction
Data Streams
Data stream applications involve the transmission, multiplexing,
prioritization or transformation of data items. Data stream
applications includebut are not limited tobusses, bridges,
codecs, switches, routers and network processors.
2
Data Streams
imply that these guidelines and foundation class are only applicable
to packet-based systems. They are applicable to any data streamoriented system, whether they process packets, frames, segments,
cycles, digitized samples, etc...
What is a stream?
A stream is a sequence of packets, as illustrated by Figure 2-1. The
stream may have an implied order. Packets in a stream may arrive
at different intervals.
Figure 2-1
Data Stream
Time
Streams are usually composed of packets of the same or compatible
type.
In VMM, a stream is usually composed of transaction descriptors,
based on the vmm_data class. Therefore, a vmm_channel can be
used to transport a data stream between two transactors.
Logical stream
A stream of packets flowing between two transactors through a
vmm_channel instance or to the DUT through a physical interface
is a structural stream. Through multiplexing, it may be composed of
packets from different input streams or destined to different output
streams. If there is a way to identify the original input stream a packet
Packets
Packets must be based on the vmm_data base class to be usable
with the vmm_sb_ds foundation class. It is especially important that
the vmm_data::compare() and vmm_data::psdisplay()
method be appropriately implemented for the packet class. Although
required for VMM compliance, the other vmm_data methods need
not be implemented.
Single stream
This section shows how to use the vmm_sb_ds foundation class to
implement self-checking structures for a single data stream. The
single-stream application is the simplest one to use as it requires no
extensions to the foundation class. Single stream applications need
not worry about stream identifiers.
The techniques shown here can be combined with the techniques
dealing with multiple streams, transformations and user-defined
behavior illustrated in the following sections in this chapter to
implement a self-checking structure that matches the functionality of
your design.
insert( 7 )
In-order stream
An in-order stream scoreboard is a simple FIFO, as illustrated in
Figure 2-3. It is defined as in-order by the absolute ordering
expected in the observed response. In an in-order data stream, the
observed packets must be in the exact same order they were sent to
the DUT: the next observed output packet must match the expected
packet located at the front of the scoreboard. Whether or not an
observed response matches or does not match the packet at the
front of the scoreboard, as illustrated in Figure 2-4, the expected
expect_in_order( 4 )
Figure 2-4
expect_in_order( Y )
Figure 2-5
eth_rx
rx;
vmm_sb_ds sb;
...
virtual function void build();
super.build();
...
this.sb = new("Ethernet Frame Stream");
...
endfunction: build
...
virtual task start();
super.start();
...
fork
forever begin
eth_frame fr;
this.tx.notify.wait_for(eth_tx::TXED);
fr = this.tx.notify.status(eth_tx::TXED);
this.sb.insert(fr);
end
forever begin
eth_frame fr;
this.rx.notify.wait_for(eth_tx::RXED);
fr = this.rx.notify.status(eth_tx::RXED);
this.sb.expect_in_order(fr);
end
join_none
...
endtask: start
...
endclass: my_env
Losses
A strict in-order stream scoreboarding strategy may be difficult to
implement in the presence of packet losses. If it is possible to predict
the exact packets that will be lost, they (or their corresponding
expected output packets) can be removed from the scoreboard by
using the vmm_sb_ds::remove() method.
However, predicting the exact packets that will be lost may be almost
impossible without duplicating the detailed RTL architecture of the
design or snooping into the design. An alternative is to accept that
"some" packets will be lost without trying to predict exactly which
ones. If lost packets are acceptable, the vmm_sb_ds::expect_with
losses() method is used. As illustrated in Figure 2-6, it looks for an
expected packet matching the supplied observed packet and, when
found, assumes that all expected packets in front of the matching
packet were lost. The final state of the scoreboard is shown in
Figure 2-7.
Figure 2-6
expect_in_order( 5 )
Figure 2-7
endclass: my_env
Out-of-order stream
If the order in which packets will be observed is unpredictable, the
vmm_sb_ds::expect_out_of_order() method is used. As illustrated
in Figure 2-8, it looks for an expected packet matching the supplied
observed packet and, when found, removes itand only itfrom the
scoreboard. The final state of the scoreboard is shown in Figure 2-9.
Figure 2-8
expect_in_order( 5 )
Figure 2-9
Example 2-3 shows an example of using an out-of-order singlestream scoreboarding approach. The matching of the observed
packet and the expected packet is performed by the
vmm_sb_ds::compare(), which by default calls the
packet::compare() method.
Example 2-3
vmm_sb_ds sb;
...
virtual function void build();
super.build();
...
this.sb = new("Ethernet Frame Stream");
...
endfunction: build
...
virtual task start();
super.start();
...
fork
forever begin
eth_frame fr;
this.tx.notify.wait_for(eth_tx::TXED);
fr = this.tx.notify.status(eth_tx::TXED);
this.insert(fr);
end
forever begin
eth_frame fr;
eth_frame lost;
this.rx.notify.wait_for(eth_tx::RXED);
fr = this.rx.notify.status(eth_tx::RXED);
this.expect_out_of_order(fr);
end
join_none
...
endtask: start
...
endclass: my_env
Multiple streams
Designs often have to deal with multiple streams. Multiple input
streams can be combined into a single expected stream. An input
stream can be divided into multiple expected streams. Multiple input
streams can be combined and divided into one or more expected
streams.
An input stream is assumed to flow into the design under test and
thus into the scoreboard. An input stream is a stream of stimulus
packets. An expected stream is assumed to flow out of the design
under test. An expected stream is a stream of expected or observed
packets.
The VMM data stream scoreboard foundation class handles multiple
input and expected streams. Each input stream is identified by a
user-defined unique non-negative integer identifier. Each expected
stream is similarly identified by a user-defined non-negative integer
identifier. The input stream identifiers are kept separate from the
expected stream identifiers and need not be mutually unique.
Streams can be explicitly identified or they can be identified by the
vmm_sb_ds::stream_id() method. By default, if a stream identifier
is not explicitly specified, the vmm_sb_ds::stream_id() is used to
determine the input or expected stream identifier for a specific
packet. By default, the vmm_sb_ds::stream_id() method always
returns the value of "0". Thus, without any modifications to the
scoreboard foundation class, only one input stream and one
expected stream can be used. This method can be user-extended to
identify the input or expected stream a packet belongs to. The user
code implements the mapping from the content of the packet to the
corresponding stream identifier.
As illustrated in Figure 2-10, an INPUT packet is part of an input
stream. It is added to the scoreboard using the
vmm_sb_ds::insert() method. An EXPECT packet is part of an
expected stream. It is added to the scoreboard as an expected
output (after transforming an input packet into the corresponding
packet via the vmm_sb_ds::transform() method) or as an observed
insert( X )
OUT
OUT
XFORM
IN
expect_...( 4 )
endfunction: stream_id
endclass: multi_stream_eth_sb
Figure 2-11 illustrates how the incoming packets are stored then
later compared against observed packets in the vmm_sb_ds class.
There is a queue for each expected stream. Queues are dynamically
created when a new expected stream identifier is seen, unless
streams have been predefined using the
vmm_sb_ds::define_stream() method. Incoming packets are
appended to the queue corresponding to the expected stream
identifer they are mapped to (in this illustration by the
vmm_sb_ds::stream_id() method because an expected stream
identifier has not been explicitly specified) and stored in order of
arrival. Observed packets are compared against the packets found
in the queue corresponding to the expected stream identifier the
observed packet is mapped to (in this illustration through the
vmm_sb_ds::stream_id() method).
Figure 2-11
9 2 1
[0]
i = stream_id( X , EXPECT)
[i] X 7 6 3
[n]
8 5 4
n = stream_id( 4 , EXPECT)
expect...( 4 )
Figure 2-11 illustrates how the incoming packets are stored then
later compared against observed packets in the vmm_sb_ds class.
There is a queue for each input stream. Queues are dynamically
created when a new input stream identifier is seen, unless streams
have been predefined using the vmm_sb_ds::define_stream()
method. Incoming packets are appended to the queue
corresponding to the input stream identifer they are mapped to (in
this illustration by the vmm_sb_ds::stream_id() method because
an input stream identifier has not been explicitly specified) and
stored in order of arrival. Observed packets are compared against
the packets found in the queue corresponding to the input stream
identifier the observed packet is mapped to (in this illustration
through the vmm_sb_ds::stream_id() method).
Figure 2-12 MISE Stream Scoreboard
insert( X )
9 2 1
[0]
i = stream_id( X , INPUT)
[i] X 7 6 3
[n]
8 5 4
n = stream_id( 4 , INPUT)
expect...( 4 )
If the input stream of an observed packet cannot be determined, it
will be necessary to search all of the queues in the scoreboard to
check if the observed packet is expected. Example 2-8 shows how
[i]
[n]
P O A
1 7 6 N
V Q D
i = stream_id( X , INPUT)
Z Y W
[0]
j = stream_id( X , EXPECT)
[j]
[i] X T C B
[m]
[n]
U M H
[0]
S L E
[i]
2 R G F
[n]
K J
n = stream_id( 4 , INPUT)
m = stream_id( 4 , EXPECT)
expect...( 4 )
Transformations
So far, inputs were assumed to be simply moved from an input to an
output. But designs often transform the data flowing through them.
Input packets are transformed into output packets. Input values are
used to compute output values.
This section deals with how input packets are transformed into
expected packets through a user-defined transfer function. All
examples in this section assume a single-input, single-expected
stream of packets. The concepts and examples shown in this section
can be combined with the concepts and techniques shown in other
sectionssuch as multiple streamsto create a scoreboard that
matches your design.
The VMM data stream scoreboard foundation class handles arbitrary
transformation of input packets into expected packets. A single input
packet can be transformed into none, one or many expected
packets. For example, a DSP function would produce one expected
response for each input packet. A segmentation function would
produce many expected packets for each input packet. And a
reassembly function would produce an expected packet only every
few input packets.
As illustrated in Figure 2-10, the transformation of input packets into
expected packets is defined by the vmm_sb_ds::transform()
method. By default, this method does not modify the input packet
and the expected packet is identical to the input packet. This method
can be user-extended to model the transformation of input packets
P O A
insert( X )
[0] [i]
i = stream_id( X , INPUT)
[n]
1 7 6 N
V Q D
transform( X , $ )
Z Y W
[0]
j = stream_id( $ , EXPECT)
[j]
[i] $ T C B
[m]
[n]
U M H
[0]
S L E
[i]
2 R G F
[n]
K J
n = stream_id( 4 , INPUT)
m = stream_id( 4 , EXPECT)
expect...( 4 )
The expected packets need not be of the same type as the input
packets.
Other than providing a transformation algorithm from an input stream
into one or more expected streams, transformation scoreboards
operate and are used in the exact same way as single-stream or
multiple-stream scoreboards.
One-to-one transformation
A one-to-one transformation device takes individual input packets
and transforms them into individual expected packets. Checking the
response of such a design involves making sure that proper packets
were observed. Whether or not the ordering of the packets is
maintained by the design or how packets are assigned to specific
expected streams are separate questions answered by using the
appropriate response checking method, as described in section
titled "Single stream" on page 2-5 and identifying the proper streams
a packet belongs to as described in section titled "Multiple streams"
on page 2-12.
Example 2-10 shows an example of transforming input samples into
expected samples using a digital filter. It is important to ensure that
the proper state information is maintained between invocation of the
vmm_sb_ds::transform() method. Static configuration information
should be provided through the scoreboard constructor or via a
"reconfigure()" method.
Example 2-10
One-to-many transformation
A one-to-many transformation device takes individual input packets
and transforms them into multiple expected packets. Checking the
response of such a design involves making sure that the proper
out_pkts[n++] = seg;
end
return 1;
endfunction: transform
endclass: ip_seg_sb
Many-to-one transformation
A many-to-one transformation device combines multiple input
packetspossibly received out of orderand combines them into a
single expected packet. Checking the response of such a design
involves making sure that the proper combined packets were
observed. Whether or not the ordering of the packets is maintained
by the design or how packets are assigned to specific expected
streams are separate questions answered by using the appropriate
response checking method, as described in section titled "Single
stream" on page 2-5 and identifying the proper streams a packet
belongs to as described in section titled "Multiple streams" on
page 2-12.
Example 2-12 shows an example of decapsulating HDLC frames
from a stream of ATM cells. Any state information that must be saved
across inpust packets must be kept in local data members.
Example 2-12
if (b == 8h7E) begin
hdlc_frame hdlc = new;
hdlc.byte_unpack(bytes);
out_pkts = new [1] ({hdlc});
bytes.delete();
return 1;
end
if (b == 8h7D) begin
escape = 1;
continue;
end
if (escape)
case (b)
8h5E: b
7h5D: b
endcase
escape =
end
begin
= 8h7E;
= 8h7D;
0;
User-defined behavior
The functionality of the data stream scoreboard described so far
supports relatively simple expectation functions. Should a different
expectation function be necessary, the data stream scoreboard
foundation classes provide functionality that enables any userdefined expectation function to be written.
Also, the functionality described so far only supports singledestination for input streams, with no predictive data loss. Some
designs require that an expected packet be expected on multiple
expected streams. Others require that an expected packet be
removed from an expected stream. The foundation classes provide
the necessary functionality to match the requirements of the design
under verification.
Iterators
The actual data structure used to implement the data stream
scoreboard is not detailed in this users guide. In fact, it is entirely
private to the implementation of the foundation classes. This allows
the user interface to be removed from the scoreboard
implementation.
However, implementing user-defined functionality requires that the
entire content of the scoreboard be made available so it can be
searched and modified. This can be done without exposing the
underlying implementation through iterators.
Iterators are objects that know how to traverse and navigate the
implementation of the scoreboard. They provide high-level methods
for moving through the scoreboard and modifying its content at the
location of the iterator.
There are two kinds of iterators: scoreboard iteratorsthe
vmm_sb_ds_iter classthat move from one stream of expected
packets to another, and stream iteratorsthe
[0]
[j]
[m]
[i]
P O A
1 7 6 N
[n]
V Q D
[0]
Z Y W
[i]
$ T C B
[n]
U M H
[0]
S L E
[i]
2 R G F
[n]
K J
vmm_sb_ds_iter
[0]
vmm_sb_ds_stream_iter
The constructors for the iterators are not documented because they
cannot be created on their own. They have to be created by a
scoreboard using the vmm_sb_ds::new_sb_iter() or
vmm_sb_ds::new_stream_iter() methods or an scoreboard iterator
Locating a packet
The complexity of locating a packet depends on the a priori
restrictions you can impose on its whereabouts. The more you can
assume about the location of a packet, the easier and more efficient
it will be to find it.
Locating a packet always requires using two iterators: one to locate
the appropriate stream, the other to locate the packet within the
stream. Example 2-13 shows how these "nested" iterators are used
to locate a specific packet in the scoreboard.
Example 2-13
Inserting a packet
A packet can be inserted before or after the current position of an
iterator using the vmm_sb_ds_stream_iter::prepend() or
vmm_sb_ds_stream_iter::append() methods respectively. "Before"
refers to "earlier" in the stream whereas "after" refers to "later" in the
stream. An earlier packet will be expected before a later packet.
Example 2-15 shows how an input packet can be multicasted on all
expected streams. Notice how the extension of the
vmm_sb_ds::transform() method never returns an expected packet
Discarding a packet
The packet an interator is currently located on can be deleted using
the vmm_sb_ds_stream_iter::delete() method. Alternatively, all
packets located before or after the current position of the iterator can
be deleted by using the vmm_sb_ds_stream_iter::preflush() or
vmm_sb_ds_stream_iter::postflush() methods respectively.
"Before" refers to "earlier" in the stream whereas "after" refers to
"later" in the stream. An earlier packet will be expected before a later
packet. Example 2-16 shows how all packets after a packet to be
found of greater priority are deleted for a specific output streams.
Example 2-16
Integrating Scoreboards
Stimulus and observed response packets must be reported to the
scoreboard for prediction and comparison against expectations.
There are various ways this can be accomplished.
The advantage of using the VMM scoreboarding foundation classes
is that they can take advantage of predefined scoreboard integration
points in the VMM infrastructure.
In all cases, it is important to understand if a reported packet
instance can be directly added to the scoreboard or if a copy mut first
be done. If an instance is added directly, it is possible that it may be
modified by other transactors in the verification environmnt or reused
to describe subsequent packets unrelated to the first one.
All the examples in the section will copy the packets prior to
submission to the scoreboard. Although safe, copying packets
increases run-time and memory consumption. If using instances
directly is acceptable, simply remove the copy operation.
begin
ahb_to_sb cb = new(this.sb);
this.ahb.append_callback(cb);
end
endfunction: build
endclass
this.in_chan.activate(tr);
...
vmm_callback(ahb_master_callbacks, post_tr(this,
tr));
inp_vmm_sb_ds(tr);
end
endtask
endclass: ahb_master
Example 2-20
this.sb = new();
this.ahb = new(...);
this.ahb.notify.register_vmm_sb_ds(ahb_monitor::OBSERVED,
this.sb, vmm_sb_ds::EXPECT,
vmm_sb_ds::IN_ORDER);
endfunction: build
endclass
A
Scoreboarding Support Classes
Class Summary
vmm_sb_ds
This class implements a generic data stream scoreboard. A single
instance of this class is used to check the proper transformation,
multiplexing and ordering of multiple data streams.
For guidelines on using and extending this class to match a specific
application, see the section titled Data Streams on page 2-3.
The documentation for this class uses the term "packet" to describe
a data item to be inserted or checked in the scoreboard. The term is
used for as a convenience as does not imply that the class is limited
to data streams composed of packets. It is suitable for any stream of
data, composed of frames, fragments, bus cycles, transfers, etc...
Summary
vmm_sb_ds::new() .....................................
vmm_sb_ds::log .......................................
vmm_sb_ds::notify ....................................
vmm_sb_ds::kind_e ....................................
vmm_sb_ds::stream_id() ...............................
vmm_sb_ds::stream_id() ...............................
vmm_sb_ds::define_stream() ...........................
vmm_sb_ds::insert() ..................................
vmm_sb_ds::remove() ..................................
vmm_sb_ds::transform() ...............................
vmm_sb_ds::match() ...................................
vmm_sb_ds::quick_compare() ...........................
vmm_sb_ds::compare() .................................
vmm_sb_ds::expect_in_order() .........................
vmm_sb_ds::expect_with losses() ......................
vmm_sb_ds::expect_out_of_order() .....................
vmm_sb_ds::flush() ...................................
vmm_sb_ds::new_sb_iter() .............................
vmm_sb_ds::new_stream_iter() .........................
vmm_sb_ds::prepend_callback() ........................
vmm_sb_ds::append_callback() .........................
vmm_sb_ds::unregister_callback() .....................
vmm_sb_ds::get_n_inserted() ..........................
vmm_sb_ds::get_n_pending() ...........................
vmm_sb_ds::get_n_matched() ...........................
vmm_sb_ds::get_n_mismatched() ........................
vmm_sb_ds::get_n_dropped() ...........................
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
48
49
50
53
54
54
55
56
58
60
61
62
63
64
65
67
68
69
70
71
72
73
74
75
76
77
78
vmm_sb_ds::get_n_not_found() .........................
vmm_sb_ds::get_n_orphaned() ..........................
vmm_sb_ds::report() ..................................
vmm_sb_ds::describe() ................................
vmm_sb_ds::display() .................................
page
page
page
page
page
79
80
81
82
83
vmm_sb_ds::new()
Create a new instance of a data stream scoreboard.
SystemVerilog
function new(string name);
Description
Create an instance of a data stream scoreboard with the specified
name.
The specified name is used as the instance name of the message
interface found in the vmm_sb_ds::log class property.
Examples
Example A-1
TBD
vmm_sb_ds::log
Message service interface for the data stream scoreboard.
SystemVerilog
vmm_log log;
Description
Message service interface used to issue messages from this data
stream scoreboard. The name of the interface is hardcoded as "Data
Stream Scoreboard". The instance name of the interface is the name
of the scoreboard specified in the constructor. These names may be
modified afterward using the vmm_log::set_name() or
vmm_log::set_instance() methods.
Examples
Example A-2
TBD
vmm_sb_ds::notify
Notification service interface for the data stream scoreboard.
SystemVerilog
vmm_notify notify;
Description
Notification service interface used to indicate notifications from this
data stream scoreboard. Notifications are indicated after any
callback methods.
A scoreboard normally operates in zero-time. it is thus possible that
notifications may be indicated multiple times during the same
timestep if the corresponding methods are called multiple times
within the same timestep. If it is important that each and every
indication be caught, it is necessary to use an extension of the
vmm_notify_callbacks::indicated() method registered with this
notification service interface. See the VMM Standard Library Users
Guide for more details.
The following notifications are indicated under the specified
circumstances:
vmm_sb_ds::INSERTED
An expected packet has been inserted in the scoreboard. The
status is an instance of vmm_sb_ds_pkts, describing the inserted
packet. This notification is indicated only if the
vmm_sb_ds::insert() method is used. It is not indicated if a packet
is inserted directly into a stream using the
vmm_sb_ds_stream_iter::prepend() or
vmm_sb_ds_stream_iter::append() methods.
vmm_sb_ds::EMPTY
An ON/OFF indication indicating whether the scoreboard is empty
or not. When indicated, the scoreboard is empty.
vmm_sb_ds::MATCHED
An expected packet has been matched and removed from the
scoreboard. The status is an instance of vmm_sb_ds_pkts,
describing the matched packet.
vmm_sb_ds::MISMATCHED
An expected packet has been mis-matched by the
vmm_sb_ds::expect_with losses() method and removed from the
scoreboard. The status is an instance of vmm_sb_ds_pkts,
describing the mis-matched observed (pkts[0]) and (pkts[1])
expected packet.
vmm_sb_ds::DROPPED
One or more expected packets have been assumed lost by the
vmm_sb_ds::expect_with losses() method and removed from the
scoreboard. The status is an instance of vmm_sb_ds_pkts,
describing the dropped packet(s).
vmm_sb_ds::NOT_FOUND
An observed packet has not been found in the scoreboard. The
status is an instance of vmm_sb_ds_pkts, describing the packet
not found.
vmm_sb_ds::ORPHANED
One or more expected packets are left over in the scoreboard. This
notification is indicated only the first time the
vmm_sb_ds::get_n_orphaned() method is used. The status is an
instance of vmm_sb_ds_pkts, describing the orphaned packet(s).
Because orphaned packets can be from different streams, the input
and expected stream identifiers are invalid. Use the
vmm_sb_ds_callbacks::orphaned() method if it is necessary to
know orphaned packets on a per-stream basis.
Examples
Example A-3
TBD
vmm_sb_ds::kind_e
Symbolic values for packet kind.
SystemVerilog
typedef enum {EITHER, INPUT, EXPECT} kind_e;
Description
These symbols are used to specify the kind or purpose of a packet
to the scoreboard functionality.
vmm_sb_ds::EITHER
Specify that the direction of the packet is not relevant for the
operation.
vmm_sb_ds::INPUT
Specify that the packet is an input packet going into the design
under verification and a corresponding response is to be expected.
vmm_sb_ds::EXPECT
Specify that the packet is an expected response packet coming out
of the design under verification and has been observed or is to be
expected.
Examples
Example A-4
TBD
vmm_sb_ds::stream_id()
Return a stream identifier for a packet.
SystemVerilog
virtual function int stream_id(vmm_data pkt,
kind_e
kind = EITHER)
Description
Return a non-negative stream identifier corresponding to the
specified packet and the specified packet kind. This method can be
used to determine the stream a packet belongs to based on the
packets content, such as a source or destination address.
By default, the direction is ignored and the value 0 is returned.
Examples
Example A-5
TBD
vmm_sb_ds::define_stream()
Pre-define a packet stream.
SystemVerilog
function void define_stream(int
string descr = ""
kind_e kind = EITHER)
stream_id,
Description
Pre-define a data stream and associate the optional description with
the specified stream. The identifier must be a non-negative number.
Use this method to pre-defined stream identifiers. Any subsequently
specified stream identifier that has not been pre-defined will be
considered invalid. If streams are defined as "EITHER" kind, then
they must all be defined as "EITHER" and each expected stream has
one and only one input stream.
If this method is never used, streams will be dynamically created as
needed whenever a new stream identifier is observed.
Examples
Example A-6
TBD
vmm_sb_ds::insert()
Insert a packet into the scoreboard
SystemVerilog
virtual function bit insert(vmm_data pkt,
kind_e
kind
= INPUT,
int
exp_stream_id = -1,
int
inp_stream_id = -1)
Description
Insert the specified packet into the scoreboard and returns TRUE if
the insertion was succesful.
If the specified kind is "INPUT", the packet is considered a stimulus
packet and will be first transformed by calling the
vmm_sb_ds::transform() method then the resulting expected
packet(s) inserted in the scoreboard, using the
vmm_sb_ds::insert() method with an "EXPECT" kind.
If the specified direction is "EXPECT", the packet is considered an
expected response packet. It will be appended, as-is, to the
expected packet queue corresponding to the input stream identifier
(if an input stream identifier is not specified, it will be determined by
calling the vmm_sb_ds::stream_id() with an "INPUT" direction) in
the group of queues corresponding to the expected stream identifier
(if an expected stream identifier is not specified, it will be determined
by calling the vmm_sb_ds::stream_id() with an "EXPECT"
direction).
It is invalid to call this method with a kind specified as "EITHER".
The effect on existing iterators is unspecified.
Examples
Example A-7
TBD
vmm_sb_ds::remove()
Remove a packet from the scoreboard
SystemVerilog
virtual function bit remove(vmm_data pkt,
kind_e
kind
= INPUT,
int
exp_stream_id = -1,
int
inp_stream_id = -1)
Description
Remove the specified packet from the scoreboard and returns TRUE
if the corresponding packets were succesfully found in the
scoreboard then removed.
If the specified direction is "INPUT", the packet is considered a
stimulus packet and will be first transformed by calling the
vmm_sb_ds::transform() method then the resulting expected
packet(s) removed from the scoreboard, using the
vmm_sb_ds::remove() method with an "EXPECT" direction. If an
input packet is transformed into multiple expected packets, TRUE is
returned if all expected packets were successfully removed. If one or
more expected packets where not removed, FALSE is returned and
whatever expected packets that could be removed are removed.
If the specified direction is "EXPECT", the packet is considered an
expected response packet. The first packet that compares to the
specified packet in the expected packet queue corresponding to the
specified input stream identifier (if not specified, it will be determined
by calling the vmm_sb_ds::stream_id() with an "INPUT" direction)
in the group of queues corresponding to the specified expected
stream identifier (if not specified, it will be determined by calling the
Examples
Example A-8
TBD
vmm_sb_ds::transform()
Transform an input packet into an expected response.
SystemVerilog
virtual function bit transform(input
output vmm_data exp_pkts[])
vmm_data inp_pkt,
Description
Transform the specified stimulus packet into the corresponding
response and returns TRUE if the transformation was succesful. A
valid response can be composed of zero, one or several packets.
By default, returns the input packet, unmodified.
Examples
Example A-9
TBD
vmm_sb_ds::match()
Match two packets.
SystemVerilog
virtual function bit match(vmm_data actual,
vmm_data expected)
Description
Match the two specified packets and return TRUE if they match and
FALSE if they definitely do not match.
By default, calls vmm_sb_ds::quick_compare().
Examples
Example A-10
TBD
vmm_sb_ds::quick_compare()
Quickly compare two packets.
SystemVerilog
virtual function bit quick_compare(vmm_data actual,
vmm_data expected)
Description
Do a quick comparison of the two specified packets and return TRUE
if they potentially match and FALSE if they definitely do not match.
By default, returns TRUE.
Examples
Example A-11
TBD
vmm_sb_ds::compare()
Compare two packets.
SystemVerilog
virtual function bit compare(vmm_data actual,
vmm_data expected)
Description
Compare the two specified packets and return TRUE if they
definitively match and return FALSE otherwise.
By default, calls vmm_sb_ds::quick_compare() followed by
"actual.compare(expected)" if the quick comparison succeeded.
Examples
Example A-12
TBD
vmm_sb_ds::expect_in_order()
Check a packet against the next expected packet.
SystemVerilog
virtual function vmm_data expect_in_order(vmm_data pkt,
int
exp_stream_id = -1,
int
inp_stream_id = -1,
bit
silent = 0)
Description
Check if a the specified packet compares to the packet at the front of
the queue that corresponds to the specified input stream of the
packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "INPUT" direction) in the
group of queues corresponding to the specified expected stream of
the packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "EXPECT" direction).
If the comparison is successful, the packet at the front of the queue
is removed and returned. Otherwise, NULL is returned. The
scoreboard statistics are updated based on the result.
If the "silent" parameter is TRUE, no error message is issued and the
scoreboard statistics are not updated.
The effect on existing iterators is undefined.
Examples
Example A-13
TBD
vmm_sb_ds::expect_with losses()
Check a packet against the expected packet sequence.
SystemVerilog
virtual function bit
input vmm_data
output vmm_data
output vmm_data
input int
input int
input bit
expect_with_losses(
pkt,
matched,
lost[],
exp_stream_id = -1,
inp_stream_id = -1,
silent
= 0)
Description
Important: This method requires that the
vmm_sb_ds::quick_compare() method be properly overloaded to
function properly. The default implementation will cause the first
packet in the stream to always be matched.
Check if a the specified packet quickly compares (using the
vmm_sb_ds::quick_compare()vmm_sb_ds::match() method) to a
packet in the queue that corresponds to the specified input stream of
the packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "INPUT" direction) in the
group of queues corresponding to the specified expected stream of
the packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "EXPECT" direction).
If no quick-matching packet is found, the number of packets not
found is incremented.
If the quick comparison is successful, the matching packet is
returned in the "matched" argument. All expected packets in the
queue located in front of the matching packet are then removed from
VMM Scoreboarding User Guide
65
Examples
Example A-14
TBD
vmm_sb_ds::expect_out_of_order()
Check a packet against the expected packet stream.
SystemVerilog
virtual function vmm_data expect_out_of_order(
vmm_data pkt,
int
exp_stream_id = -1,
int
inp_stream_id = -1,
bit
silent
= 0)
Description
Check if a the specified packet compares to a packet anywhere in
the queue that corresponds to the specified input stream of the
packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "INPUT" direction) in the
group of queues corresponding to the specified expected stream of
the packet (if not specified, it will be determined by the
vmm_sb_ds::stream_id() method with an "EXPECT" direction).
If the comparison is successful, the matching packet is removed and
returned. Otherwise, NULL is returned. The scoreboard statistics are
updated based on the result.
If the "silent" parameter is TRUE, no error message is issued and the
scoreboard statistics are not updated.
The effect on existing iterators is undefined.
Examples
Example A-15
TBD
vmm_sb_ds::flush()
Reset the scoreboard.
SystemVerilog
virtual function void flush()
Description
Flush the entire content of the scoreboard and reset the scoreboard
statistics.
The effect on existing iterators is undefined.
Examples
Example A-16
TBD
vmm_sb_ds::new_sb_iter()
Create a scoreboard iterator.
SystemVerilog
function vmm_sb_ds_iter new_sb_iter(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Create and return a scoreboard iterator object that can iterate over
all of the currently-defined streams of expected packets in the
scoreboard.
If an expected stream identifier is specified, only the streams (one
per input stream, if any) of expected packets for that expected
stream identifier are iterated on.
If an input stream identifier is specified, only the streams (one per
expected stream, if any) of expected packets for that input stream
identifier are iterated on.
Examples
Example A-17
TBD
vmm_sb_ds::new_stream_iter()
Create a stream iterator.
SystemVerilog
function vmm_sb_ds_stream_iter new_stream_iter(int
exp_stream_id = -1,
int inp_stream_id = -1)
Description
Create and return a stream iterator object that can iterate over all of
the expected packet in the specified stream.
If there is only one stream of expected packets, the expected stream
identifier need not be specified.
If there is only one input stream of expected packets for the specified
expected stream, the input stream identifier need not be specified.
Examples
Example A-18
TBD
vmm_sb_ds::prepend_callback()
Prepends a callback extension instance.
SystemVerilog
function void prepend_callback(vmm_sb_ds_callbacks sb)
Description
Prepends the specified callback extension instance to the registered
callbacks for this scoreboard. Callbacks are invoked in the order of
registration.
Examples
Example A-19
TBD
vmm_sb_ds::append_callback()
Appends a callback extension instance.
SystemVerilog
function void append_callback(vmm_sb_ds_callbacks sb)
Description
Appends the specified callback extension instance to the registered
callbacks for this scoreboard. Callbacks are invoked in the order of
registration.
Examples
Example A-20
TBD
vmm_sb_ds::unregister_callback()
Removes a callback extension instance.
SystemVerilog
function void unregister_callback(vmm_sb_ds_callbacks sb)
Description
Removes the specified callback extension instance from the
registered callbacks for this scoreboard. A warning message is
issued if the callback instance has not been previously registered.
Examples
Example A-21
TBD
vmm_sb_ds::get_n_inserted()
Total number of inserted EXPECT packets.
SystemVerilog
function int get_n_inserted(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of expected packets that have been inserted
in the scoreboard.
If an expected stream identifier is specified, returns the total number
of inserted expected packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
inserted expected packets for that input stream.
Examples
Example A-22
TBD
vmm_sb_ds::get_n_pending()
Total number of EXPECT packets still in the scoreboard.
SystemVerilog
function int get_n_pending(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of expected packets still in the scoreboard.
If an expected stream identifier is specified, returns the total number
of pending expected packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
pending expected packets for that input stream.
Examples
Example A-23
TBD
vmm_sb_ds::get_n_matched()
Total number of matched packets.
SystemVerilog
function int get_n_matched(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of matched expected packets.
If an expected stream identifier is specified, returns the total number
of matched expected packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
matched expected packets for that input stream.
Examples
Example A-24
TBD
vmm_sb_ds::get_n_mismatched()
Total number of mis-matched packets.
SystemVerilog
function int get_n_mismatched(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of mismatched expected packets as
identified by the vmm_sb_ds::expect_with losses() method.
If an expected stream identifier is specified, returns the total number
of mismatched expected packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
mismatched expected packets for that input stream.
Examples
Example A-25
TBD
vmm_sb_ds::get_n_dropped()
Total number of dropped packets.
SystemVerilog
function int get_n_dropped(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of packets assumed dropped.
If an expected stream identifier is specified, returns the total number
of dropped packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
dropped packets for that input stream.
Examples
Example A-26
TBD
vmm_sb_ds::get_n_not_found()
Total number of unexpected packets.
SystemVerilog
function int get_n_not_found(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of packets that were not found in the
scoreboard and thus assumed to be unexpected.
If an expected stream identifier is specified, returns the total number
of unexpected packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
unexpected packets for that input stream.
Examples
Example A-27
TBD
vmm_sb_ds::get_n_orphaned()
Total number of leftover packets.
SystemVerilog
function int get_n_orphaned(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Return the total number of expected packets remaining in the
scoreboard.
If an expected stream identifier is specified, returns the total number
of orphaned packeds for that expected stream.
If an input stream identifier is specified, returns the total number of
orphaned packets for that input stream.
Examples
Example A-28
TBD
vmm_sb_ds::report()
Report scoreboard statistics.
SystemVerilog
virtual function void report(int exp_stream_id = -1,
int inp_stream_id = -1)
Description
Report the statistics recorded by the scoreboard. By default, reports
the total number of transactions matched, mismatched, dropped, not
found and orphaned.
If an expected stream identifier is specified, report for that expected
stream.
If an input stream identifier is specified, report for that input stream.
The total number of packets reported as not found may be greater
than the sum of the packets reported as not found for the individual
streams. These additional packets were not found because the
specified stream did not exist.
Examples
Example A-29
TBD
vmm_sb_ds::describe()
List and describe all streams.
SystemVerilog
function void describe();
Description
Display the list of defined streams in the scoreboard along with any
description previously provided via the
vmm_sb_ds::define_stream() method.
To be displayed, a stream must exists and therefore must have seen
at least one packet. If a stream has never had any traffic, it is not
displayed. Simply defining a stream using
vmm_sb_ds::define_stream() is not sufficient to include it in the
description.
Examples
Example A-30
TBD
vmm_sb_ds::display()
Dump the scoreboard content.
SystemVerilog
virtual function void display(string prefix = "")
Description
Dump the content of the entire scoreboard on the standard output in
a human-readable format.
Examples
Example A-31
TBD
vmm_sb_ds_iter
This class implements an iterator that will iterate over all input
streams in the scoreboard.
This class is used in combination with the vmm_sb_ds_stream_iter
class to walk the content of the scoreboard to perform a user-defined
checking operation.
Instances of this class are created by the
vmm_sb_ds::new_sb_iter() method. This method defines which
set of input streams will be iterated on. Iterators are created in the
invalid state.
Streams are iterated on in increasing input stream identifiers first,
then increasing expected stream identifiers second.
Summary
vmm_sb_ds_iter::first()
Reset the iterator to the first stream.
SystemVerilog
function bit first();
Description
Reset the iterator to the first applicable input stream. Returns TRUE
if at least one such stream exists. Returns FALSE if no such stream
exists.
Examples
Example A-32
TBD
vmm_sb_ds_iter::is_ok()
Check if the iterator is on a valid stream.
SystemVerilog
function bit is_ok();
Description
Returns TRUE if the iterator is currently positioned on a valid stream.
Returns FALSE if the iterator has be moved beyond the streams or
no streams exist.
Examples
Example A-33
vmm_sb_ds_iter scan = sb.new_sb_iter();
for (scan.first(); scan.is_ok(); scan.next()) begin
...
end
vmm_sb_ds_iter::next()
Move the iterator to the next applicable stream.
SystemVerilog
function bit next();
Description
Move the iterator to the next applicable stream. Returns TRUE if a
subsequent stream exists. If no subsequent stream exists, the
iterator is invalidated and FALSE is returned.
If the iterator was invalid, this method is identical to calling
vmm_sb_ds_iter::first().
Examples
Example A-34
TBD
vmm_sb_ds_iter::last()
Reset the iterator to the last stream.
SystemVerilog
function bit last();
Description
Reset the iterator to the last applicable input stream. Returns TRUE
if at least one such stream exists. Returns FALSE if no such stream
exists.
Examples
Example A-35
TBD
vmm_sb_ds_iter::prev()
Move the iterator to the previous applicable stream.
SystemVerilog
function bit prev();
Description
Move the iterator to the previous applicable stream. Returns TRUE
if a previous stream exists. If no previous stream exists, the iterator
is invalidated and FALSE is returned.
If the iterator was invalid, this method is identical to calling
vmm_sb_ds_iter::last().
Examples
Example A-36
TBD
vmm_sb_ds_iter::length()
Number of streams.
SystemVerilog
function int length();
Description
Return the number of streams that can be iterated on.
Examples
Example A-37
TBD
vmm_sb_ds_iter::pos()
Position of the iterator.
SystemVerilog
function int pos();
Description
Return the current position of the iterator. Returns -1 if the iterator is
currently invalid.
Examples
Example A-38
TBD
vmm_sb_ds_iter::inp_stream_id()
Input stream identifier of the current stream.
SystemVerilog
function int inp_stream_id();
Description
Return the input stream identifier of the stream currently iterated on.
Returns -1 if there is no applicable streams available to iterate on.
Examples
Example A-39
TBD
vmm_sb_ds_iter::exp_stream_id()
Expected stream identifier of the current stream.
SystemVerilog
function int exp_stream_id();
Description
Return the expected stream identifier of the stream currently iterated
on. Returns -1 if there is no applicable streams available to iterate
on.
Examples
Example A-40
TBD
vmm_sb_ds_iter::describe()
Stream description of the current stream.
SystemVerilog
function string describe();
Description
Return the description of the stream of expected packets currently
iterated on.
The description depends on how the input and expected streams
were defined. If they were defined as separate streams, the
description will be the combination of both descriptions, as a stream
of expected packet is a point-to-point packet flow. If they were
defined using EITHER, a single description is returned.
If no description has been previously provided via the
vmm_sb_ds::define_stream() method, an empty string is returned.
Examples
Example A-41
TBD
vmm_sb_ds_iter::get_n_inserted()
Total number of inserted EXPECT packets.
SystemVerilog
function int get_n_inserted()
Description
Return the total number of expected packets that have been inserted
in the stream.
Examples
Example A-42
TBD
vmm_sb_ds_iter::get_n_pending()
Total number of pending packets.
SystemVerilog
function int get_n_pending()
Description
Return the total number of pending expected packets still in the
stream.
Examples
Example A-43
TBD
vmm_sb_ds_iter::get_n_matched()
Total number of matched packets.
SystemVerilog
function int get_n_matched()
Description
Return the total number of matched expected packets in the stream.
Examples
Example A-44
TBD
vmm_sb_ds_iter::get_n_mismatched()
Total number of mis-matched packets.
SystemVerilog
function int get_n_mismatched()
Description
Return the total number of mismatched expected packets as
identified by the vmm_sb_ds::expect_with losses() method.
Examples
Example A-45
TBD
vmm_sb_ds_iter::get_n_dropped()
Total number of dropped packets.
SystemVerilog
function int get_n_dropped()
Description
Return the total number of packets assumed dropped.
Examples
Example A-46
TBD
vmm_sb_ds_iter::get_n_not_found()
Total number of unexpected packets.
SystemVerilog
function int get_n_not_found()
Description
Return the total number of packets that were not found in the stream
and thus assumed to be unexpected.
Examples
Example A-47
TBD
vmm_sb_ds_iter::get_n_orphaned()
Total number of leftover packets.
SystemVerilog
function int get_n_orphaned()
Description
Return the total number of expected packets remaining in the
stream.
Examples
Example A-48
TBD
vmm_sb_ds_iter::incr_n_inserted()
Adjust the total number of inserted EXPECT packets.
SystemVerilog
function int incr_n_inserted(int delta)
Description
Adjust and return the total number of expected packets that have
been inserted in the stream by the specified value. Specify a
negative adjustment value to decrease the total number. The final
adjusted value cannot be less than zero.
Examples
Example A-49
TBD
vmm_sb_ds_iter::incr_n_matched()
Adjust the total number of matched packets.
SystemVerilog
function int incr_n_matched(int delta)
Description
Adjust and return the total number of matched expected packets in
the stream. Specify a negative adjustment value to decrease the
total number. The final adjusted value cannot be less than zero.
Examples
Example A-50
TBD
vmm_sb_ds_iter::incr_n_mismatched()
Adjust the total number of mis-matched packets.
SystemVerilog
function int incr_n_mismatched(int delta)
Description
Adjust and return the total number of mismatched expected packets
as identified by the vmm_sb_ds::expect_with losses() method.
Specify a negative adjustment value to decrease the total number.
The final adjusted value cannot be less than zero.
Examples
Example A-51
TBD
vmm_sb_ds_iter::incr_n_dropped()
Adjust the total number of dropped packets.
SystemVerilog
function int incr_n_dropped(int delta)
Description
Adjust and return the total number of packets assumed dropped.
Specify a negative adjustment value to decrease the total number.
The final adjusted value cannot be less than zero.
Examples
Example A-52
TBD
vmm_sb_ds_iter::incr_n_not_found()
Adjust the total number of unexpected packets.
SystemVerilog
function int incr_n_not_found(int delta)
Description
Adjust and return the total number of packets that were not found in
the stream and thus assumed to be unexpected. Specify a negative
adjustment value to decrease the total number. The final adjusted
value cannot be less than zero.
Examples
Example A-53
TBD
vmm_sb_ds_iter::copy()
Create a copy of this iterator.
SystemVerilog
function vmm_sb_ds_iter copy();
Description
Return a copy of this iterator positioned on the same stream and with
the same applicable stream configuration.
Examples
Example A-54
TBD
vmm_sb_ds_iter::stream_iter
Stream iterator.
SystemVerilog
vmm_sb_ds_stream_iter stream_iter;
Description
Pre-existing stream iterator to iterate on the packets in the stream
this scoreboard iterator is currently on.
The stream iterator is invalidated every time the scoreboard iterator
is moved.
Examples
Example A-55
for (scan_sb.first(); scan_sb.is_ok(); scan_sb.next())
begin
if (scan_sb.exp_stream_id() < 10)
scan_sb.stream_iter.flush();
end
vmm_sb_ds_iter::new_stream_iter()
Create a stream iterator.
SystemVerilog
function vmm_sb_ds_stream_iter new_stream_iter();
Description
Create and return a stream iterator on the stream being iterated on
by this scoreboard iterator. Returns NULL of this scoreboard iterator
is not currently on a valid stream.
Examples
Example A-56
TBD
vmm_sb_ds_iter::delete()
Delete the stream.
SystemVerilog
function int delete();
Description
Flush the content of the stream being iterated on by this iterator and
remove the stream from the list of known streams. Use
vmm_sb_ds::define_stream() to create (or re-create) a stream.
Returns the number of packets that were flushed and moves the
iterator to the next stream. Returns -1 if the iterator is not on a valid
stream.
The effect on other existing iterators is undefined.
Examples
Example A-57
TBD
vmm_sb_ds_iter::display()
Dump the content of the stream.
SystemVerilog
function void display(string prefix = "");
Description
Dump the content of the stream iterated on the standard output in a
human-readable format.
Examples
Example A-58
TBD
vmm_sb_ds_stream_iter
This class implements an iterator that will iterate over all pending
expected packets in a stream.
This class is used in combination with the vmm_sb_ds_iter class to
walk the content of the scoreboard to perform a user-defined
checking operation.
Instances of this class are created by the
vmm_sb_ds::new_stream_iter() or
vmm_sb_ds_iter::new_stream_iter() method. Iterators are created
in the invalid state.
Packets are iterated on from first inserted to most-recently inserted.
Summary
vmm_sb_ds_stream_iter::first() ......................
vmm_sb_ds_stream_iter::is_ok() ......................
vmm_sb_ds_stream_iter::next() .......................
vmm_sb_ds_stream_iter::last() .......................
vmm_sb_ds_stream_iter::last() .......................
vmm_sb_ds_stream_iter::prev() .......................
vmm_sb_ds_stream_iter::inp_stream_id() ..............
vmm_sb_ds_stream_iter::exp_stream_id() ..............
vmm_sb_ds_stream_iter::describe() ...................
vmm_sb_ds_stream_iter::length() .....................
vmm_sb_ds_stream_iter::data() .......................
vmm_sb_ds_stream_iter::pos() ........................
vmm_sb_ds_stream_iter::find() .......................
vmm_sb_ds_stream_iter::prepend() ....................
vmm_sb_ds_stream_iter::append() .....................
vmm_sb_ds_stream_iter::delete() .....................
vmm_sb_ds_stream_iter::flush() ......................
vmm_sb_ds_stream_iter::preflush() ...................
vmm_sb_ds_stream_iter::postflush() ..................
vmm_sb_ds_stream_iter::copy() .......................
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
page
114
115
116
117
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
vmm_sb_ds_stream_iter::first()
Reset the iterator to the first packet.
SystemVerilog
function bit first();
Description
Reset the iterator to the first packet in the stream. Returns TRUE if
at least one such packet exists. Returns FALSE if no such packet
exists.
Examples
Example A-59
TBD
vmm_sb_ds_stream_iter::is_ok()
Check if iterator is on a valid expected packet.
SystemVerilog
function bit is_ok();
Description
Returns TRUE if the iterator is currently positioned on a valid
expected packet. Returns FALSE if the iterator has be moved
beyond the packets or no packets exist.
Examples
Example A-60
TBD
vmm_sb_ds_stream_iter::next()
Move the iterator to the next packet in the stream.
SystemVerilog
function bit next();
Description
Move the iterator to the next packet in the stream. Returns TRUE if
a subsequent packet exists. If no subsequent packet exists, the
iterator is not moved and FALSE is returned.
If the iterator was invalid, this method is identical to calling
vmm_sb_ds_stream_iter::first().
Examples
Example A-61
TBD
vmm_sb_ds_stream_iter::last()
Reset the iterator to the last packet.
SystemVerilog
function bit last();
Description
Reset the iterator to the last packet in the stream. Returns TRUE if
at least one such packet exists. Returns FALSE if no such packet
exists.
Examples
Example A-62
TBD
vmm_sb_ds_stream_iter::prev()
Move the iterator to the previous packet.
SystemVerilog
function bit prev();
Description
Move the iterator to the previous packet in the stream. Returns
TRUE if a previous packet exists. If no previous packet exists, the
iterator is invalidated and FALSE is returned.
If the iterator was invalid, this method is identical to calling
vmm_sb_ds_stream_iter::first().
Examples
Example A-63
TBD
vmm_sb_ds_stream_iter::inp_stream_id()
Input stream identifier of the stream.
SystemVerilog
function int inp_stream_id();
Description
Return the input stream identifier of the stream.
Examples
Example A-64
TBD
vmm_sb_ds_stream_iter::exp_stream_id()
Expected stream identifier of the stream.
SystemVerilog
function int exp_stream_id();
Description
Return the expected stream identifier of the stream.
Examples
Example A-65
TBD
vmm_sb_ds_stream_iter::describe()
Stream description of the stream.
SystemVerilog
function string describe();
Description
Return the description of the stream. If no description has been
previously provided via the vmm_sb_ds::define_stream() method,
an empty string is returned.
Examples
Example A-66
TBD
vmm_sb_ds_stream_iter::length()
Number of pending expected packets in the stream.
SystemVerilog
function int length();
Description
Return the number of packets in the stream.
Examples
Example A-67
TBD
vmm_sb_ds_stream_iter::data()
The packet currently iterated on.
SystemVerilog
function vmm_data data();
Description
Return the packet in the stream currently iterated on. Returns NULL
if the iterator is not on a valid packet.
Examples
Example A-68
TBD
vmm_sb_ds_stream_iter::pos()
Position of the iterator in the stream.
SystemVerilog
function int pos();
Description
Return the position of the iterator in the stream. Returns 0 if it is on
the first packet on the stream. Returns
vmm_sb_ds_stream_iter::length()-1 if it is on the last packet in the
stream. Returns -1 if the stream does not contain any packets.
Examples
Example A-69
TBD
vmm_sb_ds_stream_iter::find()
Find a packet in the stream.
SystemVerilog
function bit find(vmm_data pkt);
Description
Locate the next packet matching the specified packet upward in the
stream, starting with the packet currently iterated on. Returns TRUE
if a matching packet exists and reposition the iterator on that packet.
Returns FALSE and do not move the iterator otherwise.
Examples
Example A-70
TBD
vmm_sb_ds_stream_iter::prepend()
Prepend a packet in the stream.
SystemVerilog
function void prepend(vmm_data pkt);
Description
Insert the specified packet before the packet currently being iterated
on. The position of the iterator is not modified.
If the iterator is in an invalid state, the packet is inserted at the
beginning of the stream.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-71
TBD
vmm_sb_ds_stream_iter::append()
Append a packet in the stream.
SystemVerilog
function void append(vmm_data pkt);
Description
Insert the specified packet after the packet currently being iterated
on. The position of the iterator is not modified.
If the iterator is in an invalid state, the packet is added at the end of
the stream.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-72
TBD
vmm_sb_ds_stream_iter::delete()
Delete the packet currently iterated on.
SystemVerilog
function vmm_data delete();
Description
Remove the packet currently iterated on and return it. The iterator is
then moved to the next packet in the stream. Returns NULL if the
iterator is not on a valid packet.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-73
TBD
vmm_sb_ds_stream_iter::flush()
Flush the stream.
SystemVerilog
function int flush();
Description
Flush the content of the stream. Returns the number of packets that
were flushed.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-74
TBD
vmm_sb_ds_stream_iter::preflush()
Flush previous packets.
SystemVerilog
function int preflush();
Description
Flush the packets that are before the packet currently iterated on in
the stream. Returns the number of packets that were flushed.
Returns -1 if the iterator is not on a valid packet.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-75
TBD
vmm_sb_ds_stream_iter::postflush()
Flush subsequent packets.
SystemVerilog
function int postflush();
Description
Flush the packets that are after the packet currently iterated on in the
stream. Returns the number of packets that were flushed. Returns 1 if the iterator is not on a valid packet.
The effect on existing iterators on the same stream is undefined.
Examples
Example A-76
TBD
vmm_sb_ds_stream_iter::copy()
Create a copy of this iterator.
SystemVerilog
function vmm_sb_ds_stream_iter copy();
Description
Return a copy of this iterator positioned on the same packet in the
stream.
Examples
Example A-77
TBD
vmm_sb_ds_callbacks
This class is the facade for the callback methods available in the
vmm_sb_ds class.
The documentation for this class uses the term "packet" to describe
a data item inserted or checked in the scoreboard. The term is used
for as a convenience as does not imply that the class is limited to
data streams composed of packets. It is suitable for any stream of
data, composed of frames, fragments, bus cycles, transfers, etc...
Summary
vmm_sb_ds_callbacks::pre_insert() ...................
vmm_sb_ds_callbacks::post_insert() ..................
vmm_sb_ds_callbacks::matched() ......................
vmm_sb_ds_callbacks::mismatched() ...................
vmm_sb_ds_callbacks::dropped() ......................
vmm_sb_ds_callbacks::not_found() ....................
vmm_sb_ds_callbacks::orphaned() .....................
page
page
page
page
page
page
page
134
136
137
138
139
140
141
vmm_sb_ds_callbacks::pre_insert()
Pre-insertion callback method.
SystemVerilog
function void pre_insert(input vmm_sb_ds
input vmm_data
pkt,
input vmm_sb_ds::kind_e kind,
ref
int
exp_stream_id,
ref
int
inp_stream_id,
ref
bit
drop);
sb,
Description
This callback method is called whenever a packet is inserted in the
scoreboard. For an "INPUT" packet, this method is called before the
packet is transformed into an expected packet and the value of
"exp_stream_id" is invalid (-1). For an "EXPECT" packet, this
method is called before the packet is actually inserted in the
appropriate queue of expected packets.
Modifying the input or expected stream identifiers will cause the
packet to be inserted in a different queue of expected packets. The
value of "drop" is initialized to FALSE. If it is set to TRUE by a
callback extension, the insertion process is aborted.
For "INPUT" packets, this method will be called twice: once as in
"INPUT" packet and a second time as an "EXPECT" packet after the
input packet has been transformed.
This callback method is called only if the vmm_sb_ds::insert()
method is used. It is not called if a packet is inserted directly into a
stream using the vmm_sb_ds_stream_iter::prepend() or
vmm_sb_ds_stream_iter::append() methods.
Examples
Example A-78
TBD
vmm_sb_ds_callbacks::post_insert()
Post-insertion callback method.
SystemVerilog
function void
vmm_data
int
int
post_insert(vmm_sb_ds sb,
pkt,
exp_stream_id,
inp_stream_id);
Description
This callback method is called after an expected packet has been
inserted in the scoreboard.
This callback method is called only if the vmm_sb_ds::insert()
method is used. It is not called if a packet is inserted directly into a
stream using the vmm_sb_ds_stream_iter::prepend() or
vmm_sb_ds_stream_iter::append() methods.
Examples
Example A-79
TBD
vmm_sb_ds_callbacks::matched()
Matched packet callback method.
SystemVerilog
function void matched(input vmm_sb_ds sb,
input vmm_data pkt,
input int
exp_stream_id,
input int
inp_stream_id,
ref
int
count);
Description
This callback method is called after a packet has been matched and
removed from the scoreboard.
The value of "count" is initialized to 1. Its final value, once the
callback methods have been called, is used to increment the
matched packet counter.
This callback method is called only if one of the
vmm_sb_ds::expect_in_order(), vmm_sb_ds::expect_with
losses() or vmm_sb_ds::expect_out_of_order() methods is used.
Any user-defined expect function should also invoke this callback
method explicitly when a matching packet is found and removed.
Examples
Example A-80
TBD
vmm_sb_ds_callbacks::mismatched()
Mismatched packet callback method.
SystemVerilog
function void mismatched(input vmm_sb_ds sb,
input vmm_data pkt,
input int
exp_stream_id,
input int
inp_stream_id,
ref
int
count);
Description
This callback method is called after a packet has been mismatched
and removed from the scoreboard.
The value of "count" is initialized to 1. Its final value, once the
callback methods have been called, is used to increment the
mismatched packet counter.
This callback method is called only if the vmm_sb_ds::expect_with
losses() method is used. Any user-defined expect function should
also invoke this callback method explicitly when a mismatching
packet is found and removed.
Examples
Example A-81
TBD
vmm_sb_ds_callbacks::dropped()
Dropped packet(s) callback method.
SystemVerilog
function void matched(input vmm_sb_ds sb,
input vmm_data pkts[],
input int
exp_stream_id,
input int
inp_stream_id,
ref
int
count);
Description
This callback method is called after one more packets have been
assumed lost and removed from the scoreboard. This method is not
called if no packets are assumed lost.
The value of "count" is initialized to the number of lost packets. Its
final value once the callback methods have been called is used to
increment the lost packet counter.
This callback method is called only if the vmm_sb_ds::expect_with
losses() method is used. Any user-defined expect function should
also invoke this callback method explicitly when packets are
assumed to have been lost.
Examples
Example A-82
TBD
vmm_sb_ds_callbacks::not_found()
Packet not found callback method.
SystemVerilog
function void not_found(input vmm_sb_ds sb,
input vmm_data pkt,
input int
exp_stream_id,
input int
inp_stream_id,
ref
int
count);
Description
This callback method is called after an observed packet has not been
found in the scoreboard.
The value of "count" is initialized to 1. Its final value once the callback
methods have been called is used to increment the packet not found
counter.
This callback method is called only if one of the
vmm_sb_ds::expect_in_order(), vmm_sb_ds::expect_with
losses() or vmm_sb_ds::expect_out_of_order() methods is used.
Any user-defined expect function should also invoke this callback
method explicitly when an observed packet is not found.
Examples
Example A-83
TBD
vmm_sb_ds_callbacks::orphaned()
Orphaned packet(s) callback method.
SystemVerilog
function void orphaned(input vmm_sb_ds sb,
input vmm_data pkts[],
input int
exp_stream_id,
input int
inp_stream_id,
ref
int
count);
Description
This callback method is called for each expected packet queue
where one more packets have been left over in the scoreboard. This
method is not called if no packets are orphaned.
The value of "count" is initialized to the number of orphaned packets.
Its final value once the callback methods have been called is used to
increment the orphaned packet counter.
This callback method is called only the first time the
vmm_sb_ds::get_n_orphaned() method is used.
Examples
Example A-84
TBD
vmm_sb_ds_pkts
This class is used to describe one or more packets. Instances of this
class are used as status information in notifications indicated
through the vmm_sb_ds::notify property.
The documentation for this class uses the term "packet" to describe
a data item inserted or checked in the scoreboard. The term is used
for as a convenience as does not imply that the class is limited to
data streams composed of packets. It is suitable for any stream of
data, composed of frames, fragments, bus cycles, transfers, etc...
Summary
vmm_sb_ds_pkts::pkts ................................
vmm_sb_ds_pkts::kind ................................
vmm_sb_ds_pkts::inp_stream_id .......................
vmm_sb_ds_pkts::exp_stream_id .......................
page
page
page
page
143
144
145
146
vmm_sb_ds_pkts::pkts
The packet(s) in question.
SystemVerilog
vmm_data pkts[$];
Description
The packet(s) that caused the notification to be indicated.
Examples
Example A-85
TBD
vmm_sb_ds_pkts::kind
The kind of packet(s) in question.
SystemVerilog
vmm_sb_ds::kind_e kind;
Description
The kind of packet(s) that caused the notification to be indicated.
Examples
Example A-86
TBD
vmm_sb_ds_pkts::inp_stream_id
The input stream identifier of the packet(s) in question.
SystemVerilog
int inp_stream_id;
Description
The input stream identifier of the packet(s) that caused the
notification to be indicated.
Examples
Example A-87
TBD
vmm_sb_ds_pkts::exp_stream_id
The expected stream identifier of the packet(s) in question.
SystemVerilog
int exp_stream_id;
Description
The expected stream identifier of the packet(s) that caused the
notification to be indicated.
Examples
Example A-88
TBD
Summary
vmm_channel::register_vmm_sb_ds() ...................
vmm_channel::unregister_vmm_sb_ds() .................
vmm_notify::register_vmm_sb_ds() ....................
vmm_notify::unregister_vmm_sb_ds() ..................
vmm_xactor::inp_vmm_sb_ds() .........................
vmm_xactor::exp_vmm_sb_ds() .........................
vmm_xactor::register_vmm_sb_ds() ....................
vmm_xactor::unregister_vmm_sb_ds() ..................
page
page
page
page
page
page
page
page
148
150
151
152
153
154
155
156
vmm_channel::register_vmm_sb_ds()
Register a data stream scoreboarde with a channel instance.
SystemVerilog
function void register_vmm_sb_ds(
vmm_sb_ds
sb,
vmm_sb_ds::kind_e
kind,
vmm_sb_ds::ordering_e order = IN_ORDER);
Description
Register a data stream scoreboard with a channel instance with the
specified direction and ordering. Transactions are automatically
forwarded to all registered scoreboards when they are removed from
the channel.
If direction is specified as vmm_sb_ds::INPUT, transactions will be
automatically forwarded to the scoreboard by the channel using the
vmm_sb_ds::insert() method.
If direction is specified as vmm_sb_ds::EXPECT, transactions will
be automatically forwarded to the scoreboard using the method and
the value specified for order, as shown in Table A-1:
Table A-1
Ordering
Method Called
vmm_sb_ds::IN_ORDER
vmm_sb_ds::expect_in_order()
vmm_sb_ds::WITH_LOSSES
vmm_sb_ds::expect_with losses()
vmm_sb_ds::OUT_ORDER
vmm_sb_ds::expect_out_of_order()
Example
Example A-1
TBD
vmm_channel::unregister_vmm_sb_ds()
Unregister a data stream scoreboard.
SystemVerilog
function void unregister_vmm_sb_ds(vmm_sb_ds sb);
Description
Unregister the specified data stream scoreboard from the channel.
An error is issued if the scoreboard was not previously registered
with the channel.
Example
Example A-2
TBD
vmm_notify::register_vmm_sb_ds()
Register a data stream scoreboard with a notification.
SystemVerilog
function void register_vmm_sb_ds(
int
notification_id,
vmm_sb_ds
sb,
vmm_sb_ds::kind_e
kind,
vmm_sb_ds::ordering_e order = IN_ORDER);
Description
Register a data stream scoreboard with the notification service
interface for the specified notification with the specified direction and
ordering. The status descriptor specified in the
vmm_notify::indicate() method is automatically forwarded to
all registered scoreboard when the notification is indicated.
If direction is specified as vmm_sb_ds::INPUT, the status
descriptor will be automatically forwarded to the scoreboard by the
channel using the vmm_sb_ds::insert() method.
If direction is specified as vmm_sb_ds::EXPECT, the status
information will be automatically forwarded to the scoreboard using
method specified in Table A-1, according to the value specified for
order.
Example
Example A-3
TBD
vmm_notify::unregister_vmm_sb_ds()
Unregister a data stream scoreboard.
SystemVerilog
function void unregister_vmm_sb_ds(int notification_id,
vmm_sb_ds sb);
Description
Unregister the specified data stream scoreboard from the notification
service interface for the specified notification. An error is issued if the
scoreboard was not previously registered with the specified
notification.
Example
Example A-4
TBD
vmm_xactor::inp_vmm_sb_ds()
Add input transaction to data stream scoreboards.
SystemVerilog
protected function void inp_vmm_sb_ds(vmm_data tr);
Description
Inject the specified transaction descriptor as an input transaction in
all input data stream scoreboards, that have been previously
registered with this transactor. Input data scoreboards are
registered using the vmm_xactor::register_vmm_sb_ds()
method using the vmm_sb_ds::INPUT or vmm_sb_ds::EITHER
direction.
This method may be called by a transactor at a judicious point in the
execution of the transaction, usually after completion of all callback
methods.
Example
Example A-5
class ahb_master extends vmm_xactor;
...
`vmm_callback(ahb_master_cb,
post_tr(this, tr));
this.inp_vmm_sb_ds(tr);
in_chan.complete();
...
endclass
vmm_xactor::exp_vmm_sb_ds()
Check output transaction against data stream scoreboards.
SystemVerilog
protected function void exp_vmm_sb_ds(vmm_data tr);
Description
Check the specified transaction descriptor against the expected
transaction in all expected data stream scoreboards, that have been
previously registered with this transactor. Expected data
scoreboards are registered using the
vmm_xactor::register_vmm_sb_ds() method using the
vmm_sb_ds::EXPECT or vmm_sb_ds::EITHER direction.
Table A-1 specifies the expect method that is called depending on
the order specified when registering the scoreboard.
This method may be called by a transactor at a judicious point in the
execution of the transaction, usually after completion of all callback
methods.
Example
Example A-6
class ahb_mon extends vmm_xactor;
...
`vmm_callback(ahb_master_cb,
post_tr(this, tr));
this.exp_vmm_sb_ds(tr);
out_chan.sneak(tr);
...
endclass
vmm_xactor::register_vmm_sb_ds()
Register a data stream scoreboard.
SystemVerilog
function void register_vmm_sb_ds(
vmm_sb_ds
sb,
vmm_sb_ds::kind_e
kind,
vmm_sb_ds::ordering_e order = IN_ORDER);
Description
Register a data stream scoreboard with the transactor and with the
specified direction and ordering.
If direction is specified as vmm_sb_ds::INPUT or
vmm_sb_ds::EITHER, input transactions will be automatically
forwarded to the scoreboard by the transactor if it calls the
vmm_xactor::inp_vmm_sb_ds() method.
If direction is specified as vmm_sb_ds::EXPECT or
vmm_sb_ds::EITHER, observed or received transactions will be
automatically forwarded to the scoreboard by the transactor if it calls
the vmm_xactor::exp_vmm_sb_ds() method.
Example
Example A-7
TBD
vmm_xactor::unregister_vmm_sb_ds()
Unregister a data stream scoreboard.
SystemVerilog
function void unregister_vmm_sb_ds(vmm_sb_ds sb);
Description
Unregister the specified data stream scoreboard from the transactor.
An error is issued if the scoreboard was not previously registered
with the transactor.
Example
Example A-8
TBD