hello
below is a class I use for randomize some settings of a ADC controller RTL.
I got the following error
stop -create -name Randomize -randomize
Created stop Randomize
assert ( gpadc_settings0.randomize(lo_thre,hi_thre)); // with c_hilo_thre);
|
ncsim: *W,SVRNDF (./my_task.v,315|41): The randomize method call failed.
Observed simulation time : 22747513300 PS + 0
ncsim: *W,RNDOCS: These constraints contribute to the set of conflicting constraints:
shortint'(men.VBUSOUT ) + shortint'(men.CHPWR ) + shortint'(men.VBUSIN ) + shortint'(men.VSYS ) >= men_num ; (/proj/pm8282d1/wa/stanzani/pm8282d1_des/r1.0.0/digital/top/dig/sim/test_board/tb/gpadc_pkg.sv,761)
ncsim: *W,RNDOCS: These variables contribute to the set of conflicting constraints:
state variables:
men_num (4) [/proj/pm8282d1/wa/stanzani/pm8282d1_des/r1.0.0/digital/top/dig/sim/test_board/tb/gpadc_pkg.sv, 747]
22747513300 PS + 0 (stop Randomize: Randomize failure)
I do not understand where the conflict is. It looks to me than men and *thre are completeely independent variables which are randomized separately but surely there is something I do not understand about the constraint solver operation.
typedef struct packed {
bit M15;
bit M14;
bit M13;
bit TINT; //12
bit IVBUSOUT; //11
bit VBUSOUT; //10
bit PMODE; // 9
bit GPADC0; // 8
bit CHPWR; // 7
bit VSYS; // 6
bit VBATC2; // 5
bit VBATC1; // 4
bit VBATSNSN; // 3
bit VBATSNSP; // 2
bit VBUSIN; // 1
bit M0; // 0 LSB
} t_meas_en_reg;
class cl_gpadc_settings;
rand t_meas_en_reg men;
byte unsigned men_num=4;
randc bit[3:0] slow; // slow down the sampling clock frequency
rand bit [11:0] meas_off;
randc byte unsigned lo_thre[9];
randc byte unsigned hi_thre[9];
rand bit [3:0] stretch; // additional setting time for the acq.phase
constraint c_men {
men.M0==0;
men.M13==0;
men.M14==0;
men.M15==0;
shortint'(men.IVBUSOUT) + shortint'(men.TINT ) + shortint'(men. PMODE ) + shortint'(men.GPADC0 ) +
shortint'(men.VBATC2 ) + shortint'(men.VBATC1) + shortint'(men.VBATSNSN) + shortint'(men.VBATSNSP) +
shortint'(men.VBUSOUT ) + shortint'(men.CHPWR ) + shortint'(men.VBUSIN ) + shortint'(men.VSYS ) >= men_num ;
}
constraint c_hilo_thre
{
foreach(lo_thre[i])
lo_thre[i] inside {[5:64]};
foreach(hi_thre[i])
hi_thre[i] inside {[128:255]};
}
// function new (input shortint unsigned min_meas);
// min_meas_en_num = min_meas;
// endfunction:new
function new ();
endfunction:new