Question on constraint randomizing an array in system verilog

Status
Not open for further replies.

sujithad

Newbie level 2
Joined
Jun 24, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Hi

I have an array of 512 entries each entry being 1024 bits size.

rand bit [1023:0] entry_rand [512];

I want to constraint randomize such that each entry is non-zero but only few bits in the entry are set.

Eg: Out of 1024 bit, I need only 5 bits be set to 1 & others be 0.

Can anyone help me how to write constraint for this?

constraint entry_rand_c {
foreach (entry_rand) {
}
}

Thanks
=sd
 


Re: Question on constraint randomizing an array in systemverilog

Thanks. But when run on IUS, I get this error
*E: A 'system task/function call' cannot be used within a constraint expression.

Is there a workaround for this?

Read **broken link removed** that is down for SQL maintenance at the moment. One can only hope they are upgrading to MariaDB.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…