• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. [SV] Constraint solver issue

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 65
  • Views 18180
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[SV] Constraint solver issue

stanzani
stanzani over 8 years ago

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

  • Cancel
  • TAM1
    TAM1 over 8 years ago

    Good morning.

    Whenever a class_handle.randomize() function returns, the class needs to be in a state where every constraint is satisfied. This is true whether you are randomizing the class object as a whole, or randomizing one or more individual fields in that class. In this instance, you are randomizing the members lo_thre and hi_thre. So the rest of the members are left unchanged. But before the randomize can return, every constraint is examined. From the error message, it looks like the values of men and men_num violate constraint c_men going into the call and thus the call cannot return successfully.

    • You can make sure that the class object is in a legal state before randomizing individual fields.
    • You can use constraint_mode(0) to disable the constraints that aren't currently applicable.
    • You can use the inline (not class based) randomize call to randomize those fields individually. e.g. success = std::randomize(lo_thre with ...);

    TAM

    o_thre,hi_thre
    o_thre,hi_thre
    o_thre,hi_thre
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information