I need to generate an array such that all the elements are unique and are from the following list:
{'h200, 'h100, 'h080, 'h040, 'h020, 'h010, 'h008, 'h004, 'h002, 'h001}
Data member: rand [9:0] id_list[4];
I need to generate an array such that all the elements are unique and are from the following list:
{'h200, 'h100, 'h080, 'h040, 'h020, 'h010, 'h008, 'h004, 'h002, 'h001}
Data member: rand [9:0] id_list[4];
In reply to prashantg:
int list[] = {'h200, 'h100, 'h080, 'h040, 'h020, 'h010, 'h008, 'h004, 'h002, 'h001};rand [9:0] rand id_list[4];
constraint unique_in_list {
unique {id_list};
foreach(id_list[ii]) id_list[ii] inside {list};}
}