Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SYSTEM VERILOG Randomization queries

116 views
Skip to first unread message

NARESH SAMBHNANI

unread,
Jul 18, 2012, 2:21:51 AM7/18/12
to Naresh Sambhnani
I am facing a problem in randomizing an array. As per my need:-
I have an array of 16 elements having 9 bits each. My need is to set 15 elements to a known value and have to randomize an element. which element has to be randomized is to be choosen randomly. And only one element has to be randomized.

One solution i have seen that randomize the element inside the constraints and map the fixed values in post_randomized task.

Is there any other way to this stuff ??

Robert Miles

unread,
Jul 19, 2012, 10:14:42 AM7/19/12
to
An idea to consider: Set up another array with 9 bits but only one
element. Randomize this new array. Set the 15 elements of the
original array to their known values. Make a random choice of one
of the 15 elements, then copy the contents of the new array into
that element.

Marcus Harnisch

unread,
Jul 30, 2012, 1:11:27 PM7/30/12
to
NARESH SAMBHNANI <naresh....@gmail.com> writes:

> My need is to set 15 elements to a known value and have to randomize
> an element.

Are these known values always the same? Could you provide an example?
From the little we know about the actual requirements, I would probably
not randomize the array itself but use separate rand variables for both
index and value and assign the results in post_randomize, as you
suggested.

Cheers
Marcus
0 new messages