Structs are the basis building blocks for any e language based testbenches. This are similar to class in C++ and thus are used for constructing compound data structures. Like in C++ and C, we can use this compound data structures in all the places like, it Can be used as regular data types in any context where a type is required. The default value for a struct is NULL . Struct can be passed to/from methods just as in C methods. Struct Can be used in another struct as normal data type . You can also define a variable using a struct type.
EXAMPLE: <'
struct data {
addr : uint (bits :32);
data : uint (bytes:8);
rdwr : bit; };
extend sys {
d : data; run()isalso{ gen d; print d; gen d; print d; }; };
'>
RESULT
d = data-@0: data
@11
0 addr: 1956082095
1 data: 5743609808327112738
2 rdwr: 0
d = data-@1: data
@11
0 addr: 3861093091
1 data: 8956857106270623639
2 rdwr: 0