List sizes are specified like:
my_list : list of int;
keep my_list.size() == 4;
You could wrapper such a list in a template struct and constrain the list inside the struct to a number like this:
<'
struct my_struct {
data : int;
};
template struct FourElemWrpr of ( <first'type> ) {
d : list of <first'type>;
keep d.size() == 4;
};
extend sys {
foo() : FourElemWrpr of int is {
gen result;
print result.d;
};
run() is also {
var wrpr := foo();
print wrpr.d;
};
};
'>
When run on Specman 10, this yields:
Welcome to Specman Elite
[...]
Generating the test with Pgen using seed 1...
Starting the test ...
Running the test ...
result.d =
0. -208970122
1. -1768025704
2. -65377588
3. -723567746
wrpr.d =
0. -208970122
1. -1768025704
2. -65377588
3. -723567746
No actual running requested.
Checking the test ...
Checking is complete - 0 DUT errors, 0 DUT warnings.