Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.verilog

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-18-2012, 06:21 AM
NARESH SAMBHNANI
Guest
 
Posts: n/a
Default SYSTEM VERILOG Randomization queries

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 ??
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 07-19-2012, 02:14 PM
Robert Miles
Guest
 
Posts: n/a
Default Re: SYSTEM VERILOG Randomization queries

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.
Reply With Quote
  #3 (permalink)  
Old 07-30-2012, 05:11 PM
Marcus Harnisch
Guest
 
Posts: n/a
Default Re: SYSTEM VERILOG Randomization queries

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
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 04:22 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.