Sei sulla pagina 1di 19

Vineeth Babu S S

Emp Code : 3110


SBU
3
1
1
0

The SystemC Verification Standard uses data
introspection to enable the manipulation of arbitrary
data types.
It allows a library routine to extract information from
data objects of arbitrary types.
This facility includes the following classes and
templates:
scv_extensions_if
scv_extensions
scv_shared_ptr
scv_smart_ptr

3
1
1
0

The scv_extensions_if abstract interface:
This abstract interface enables the manipulation of
arbitrary data types without compile-time type
information.
The scv_extensions template:
Data objects are extended to support the abstract
interface through partial template specialization of this
template

3
1
1
0

The scv_shared_ptr template:
This template enables sharing of data objects among
multiple threads by implementing the necessary memory
management.
The scv_smart_ptr template:
This template combines scv_extensions and
scv_shared_ptr to implement dynamic extensions that
require instance-specific auxiliary data, such as
randomization and callback handling.

3
1
1
0


The component interfaces which in turn provide
the methods to manipulate data are
util : Basic utility methods
type : Methods to extract type information
rw : Methods to read and write to data object,
its fields, its array elements
rand : Methods for randomization-related
operations
callback : Methods for callback registration

3
1
1
0


Data objects of arbitrary data types can be
randomized through the use of scv_smart_ptr.
SCV provides following methods in randomization
Randomization can be turned on and off using the
methods enable_randomization() and
disable_randomization(). The default is on.
The method reset_distribution() can be used to
remove the existing distribution from a data object. If the
mode before this call is DISTRIBUTION, it is changed to
RANDOM.

3
1
1
0


scv_smart_ptr <packet> pkt;
pkt->next(); //create random value for address and data

pkt->address.disable_randomization();
pkt->next();
3
1
1
0


The features of randomization offered by
SystemC Verification Extension standard are
Constrained Randomization
Weighted Randomization
Seed Management
3
1
1
0


Before generating a random number some global configuration
parameters can be used. They are
Algorithm
Mode
enum value_generation_algorithm {
RAND,
RAND32
RAND48, //default
CUSTOM //requires further configuration setup
}
Example :-
scv_smart_ptr<int> data;
data->set_default_algorithm(scv_extensions_if :: RAND)


3
1
1
0


enum mode_t {
RANDOM //uniform distribution(default)
SCAN
RANDOM_AVOID_DUPLICATE
DISTRIBUTION // according to constraints
}
Example
scv_smart_ptr<int> data;
data->set_mode(scv_extensions_if : : SCAN);
3
1
1
0


Constrained randomization restricts the random generated
stream by specifying allowable regions or values.
SCV provides a constraint class scv_constraint_base,
with convenient macros to specify each constraint rule.
SCV_CONSTRAINT_CTOR
SCV_CONSTRAINT
SCV_SOFT_CONSTRAINT
SCV_BASE_CONSTRAINT
3
1
1
0


The basic components of an expression can be created
from scv_smart_ptr objects through operator(), which
can then be composed into more complicated expressions
by using the following operators:
Arithmetic operators +, -, *
Relational operators ==, !=, >, >=, <, <=
Logical operators !, &&, ||
To select a particular constraint from multiple constraints,
use_constraint() method is used.
3
1
1
0


class Pkt_constraint : virtual public scv_constraint_base
{
public:
scv_smart_ptr<Packet> pPkt;
SCV_CONSTRAINT_CTOR(Pkt_constraint)
{
// define constraints
SCV_CONSTRAINT((pPkt->address() != 0x00000000)
&&
(pPkt->address() < 0x00000800)
);
SCV_CONSTRAINT(pPkt->data() >= 0x00001000);
}
};
3
1
1
0


keep_only : This constraint is used for specifying range
in which the random value should be generated.
keep_out : This constraint is used for specifying range in
which the random value should not be generated.

scv_smart_ptr<Packet> pPkt;
pPkt->address.keep_only(1,9999);
pPkt->data.keep_out(0);
pPkt->data.keep_out(20,80);
3
1
1
0


Weighted randomizations are used to define
frequency of certain generated values.
Weighted randomization is done with class
scv_bag. It contains following methods
remove() : This method removes one or all of the
objects with the same value as the argument.
add() : This method adds one specified value to the bag.
push() : This method adds the specified number of
objects with the specified value to the bag.
set_mode() : This method is used for assigning the bag
to the data to be randomized
"scv_bag <pair <int, int> > variable is used for
creating range based weighted distribution.

3
1
1
0


// define a bag
scv_bag<int> intBag;

intBag.add(0, 25); //add 25 objects of value 0 to bag
intBag.add(1, 25); //add 25 objects of value 1 to bag
intBag.add(2, 50); //add 50 objects of value 2 to bag

scv_smart_ptr<int> smart_int;
smart_int->set_mode(intBag); //set smart_int distribution
3
1
1
0


scv_smart_ptr<int> data;

scv_bag<pair <int, int> > field_dist;

field_dist.add( pair<int,int>(0,10), 20);
field_dist.add( pair<int,int>(11,20), 20);
field_dist.add( pair<int,int>(61,80), 30);
field_dist.add( pair<int,int>(81,90), 30);

data->set_mode(field_dist);
3
1
1
0


SCV provides support for Global Seed Setting and
Unique seed setting for each thread.
When no seed setting is done, then default seed 1
is assumed.
scv_random :: set_global_seed()
scv_random :: set_current_seed()

3
1
1
0

3
1
1
0

Potrebbero piacerti anche