constraint c_mult_hdr
{
if(gen_mult_audio_hdrs)
{
foreach(data_len_q[i])
{
data_len_q[i] >0;
}
**//num_of_ado_hdrs == 2;**
data_len_q.size() == num_of_ado_hdrs;
len-3 == (num_of_ado_hdrs * ado_hdr_size ) + data_len_q.sum() + ado_cksum_size;
len inside { [9:12] }; //6 is minimum =(3ucom hdr) -2 (aud hdr+chksum) = 1 (data waord)
solve num_of_ado_hdrs before data_len_q.size;
}
}
Hi, I have the above constraint if i dont have the line in bold where i set the num… ==2, i get an randomization error saying illegal attempt to resize dynamic array.
** Error: (vsim-7020) Illegal attempt to resize random dynamic array ‘data_len_q’ to 1554575876 elements. (SolveArrayResizeMax=10000)
Any idea what i am doing wrong?
In reply to CRVAddict :
I have lots of ideas. But please show the declarations of all variables used in your constraints, and maybe I can give you one of them.
In reply to dave_59 :
Here it is,
int gen_mult_audio_hdrs;
int ado_hdr_size=1; //1hdr
int ado_cksum_size=1; //1hdr
rand int unsigned num_of_ado_hdrs;
rand int unsigned data_len_q[$];
rand bit[7:0] rec_type;
In reply to CRVAddict :
Your can use solve size before randomize element
If you don’t have randomized order, it might randomize element before size.
Second solution is that you can have a pre-random function.
In reply to kangrh007 :
I do have that already right?
solve num_of_ado_hdrs before data_len_q.size;
In reply to CRVAddict :
Yes. But it is inside the if statement. Move it out, or use a new constraint block, then it should work
dave_59
February 4, 2020, 12:01am
7
In reply to CRVAddict :
The solve before construct is unnecessary here because there is an implicit ordering when sizing a dynamic array.
The issue here is you need to limit the values to prevent overflow. See http://go.mentor.com/verilog-in-constraints
In reply to dave_59 :
the max value of len is contained to be 12.
(num_of_ado_hdrs * 1 ) + data_len_q.sum() + 1;
so num_of_ado_hdrs + data_lenq.sum == 7 so that i thought that would act as a constraint.
how can data_len_q has more than 10k element and meet the value of 7 when the int’s are unsigned
In reply to CRVAddict :
Making a variable unsigned does not prevent overflow.
(32'hFFFFFFFD + 32'f0000000A) == 32'd7