SYSTEM VERILOG Randomization queries

N

NARESH SAMBHNANI

Guest
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 ??
 
On 7/18/2012 1:21 AM, NARESH SAMBHNANI wrote:
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 ??
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.
 
NARESH SAMBHNANI <naresh.the.one@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
 

Welcome to EDABoard.com

Sponsor

Back
Top