How to randomize the value from an array excluded the one already randomized before.
for example, the content in the array is from 1 to 100.
and first time we randomize from 1 to 100 and get 53.
and second time we still randomize from 1 to 100 but we don’t want 53 anymore. it likes that we randomize from 1 to 52 and 54 to 100. (let it say we get 23)
and third time we don’t want 23 or 53 anymore…
May I know what’s the easiest way to implement it ?
It would help to ask this as a new question. I’m not sure if your question had any relation to the question above.
You build a list of previously used values in a queue
rand bit [7:0] val;
bit [7:0] list[$];
function void post_randomize;
list.push_back(val); // if not in a class, just add this line after calling randomize.
endfunction
Then you can put that list in the constraint
randomize(val) with {!(val inside {8'h2a, 8'h2b, 8'h2c, list}); };