I want to generate list in Specman from a limited range and ensure that no two consecutive entries in the list have the same value so these would be OK
[1,0,1,0,1,0,1]
[2,1,3,1,3,2,1]
[100, 22, 50, 62, 100]
but these would not
[1,0,1,1,1,0,1]
[2,3,3,1,3,2,1]
[100, 22, 50, 50, 100]
I've tried to use unique() like so
mylist[mylist_len] : list of uint;
keep mylist.unique(it).size() == mylist.size()
and I can't just keep it using a scalar either
keep mylist.unique(it).size() == mylist_len
I also tried using keep on the entries like so
keep for each (i) in mylist {
if (index > 0) {
keep mylist[index] != mylist[index+1];
};
};
It it matters I'm constraining the entries in the list like so:
keep for each (i) in mylist {
i < mylist_limit;
};
you can use 'prev' in a 'for each'.
keep for each (i) in mylist {
i < mylist_limit;
i != prev;
};