T.raanan
T.raanan

Reputation: 1

changing boolean fields in several structs simultaneously in specman

I want to change one field that is defined in several classes in my specman env (currently these fields are global variables in different classes). I want to have the option to change these fields in the middle of test run, and I want to change all of them simultaneously. Since I don't want to access every class and change locally, I thought of using pointers instead of globals. Does anyone know a way to do it in specman? or maybe another solution?

This is for an environment with many classes, and accessing each one takes a lot of coding and run time

Upvotes: 0

Views: 106

Answers (1)

Rodion Melnikov
Rodion Melnikov

Reputation: 338

Can static field solve your problem? All the instances will see the same value.

struct my_s {
    static b: bool;
};

An alternative can be a wrapper to bool: all the relevant instances will reference the same wrapper, and once the value inside changes, all of them will see the change:

struct bool_wrapper {
    value: bool;
};
struct my_s {
    b: bool_wrapper;
};

There is no such thing as a pointer to a value of primitive type in 'e'.

Upvotes: 0

Related Questions