Hello,
I am facing the warnings regarding constraints in my sequence class which is something like below:
Example:
class example_seq;
rand bpp base_a;
constraint in_a_b{base_a inside {bpp_12,bpp_8,bpp_10};}
endclass : example_seq
class conv_seq;
example_seq e_s; // here i am calling one sequence
rand bpp ex_a; // bpp is enum datatype from example_seq class
constraint a_b { ex_a inside {bpp_12,bpp_10};}
task body();
e_s = example_seq::type_id::create("e_s");
void'(this.randomize(ex_a));
`uvm_do_on_with(a_s,a_sequencer,{a_s.base_a == ex_a;})
endtask: body
endclass: conv_seq
Here, i am getting below ncsim error:
ncsim: *W,RNDOCS: These constraints contribute to the set of conflicting constraints:
ncsim: *W,SVRNDFP: The randomize method call failed.
I have tried overriding constraints by using same name and still getting the same warnings.
Please help me here if i am missing something.
Thanks in advance.
In reply to chandnidodiya:
You are doing strange things. It is unclear to me what you want to do.
With
void'(this.randomize(ex_a));
you are randomizing
conv_seq
is this what you want to do?
The class-based randomize method does not accept an argument.
In reply to chr_sue:
I wanted to randomize conv_seq. You are right about class based randomization. My issue is fixed. Thank you for your help.
In reply to chr_sue:
In reply to chandnidodiya:
You are doing strange things. It is unclear to me what you want to do.
With
void'(this.randomize(ex_a));
you are randomizing
conv_seq
is this what you want to do?
The class-based randomize method does not accept an argument.
Hi chr_sue, the class based randomize also accepts multiple arguments.
from SV LRM:
inline_constraint _declaration ::= // not in Annex A
class_variable_identifier . randomize [ ( [ variable_identifier_list | null ] ) ]
with [ ( [ identifier_list ] ) ] constraint_block
randomize_call ::= // from A.1.10
randomize { attribute_instance }
[ ( [ variable_identifier_list | null ] ) ]
[ with [ ( [ identifier_list ] ) ] constraint_block ]38
38) In a randomize_call that is not a method call of an object of class type (i.e., a scope randomize), the optional
parenthesized identifier_list after the keyword with shall be illegal, and the use of null shall be illegal
if a single variable is passed to the method “obj.randomize( variable )”, it will only randomize that variable and it SHOULD honor the constraints.
if null is passed, it does not randomize anything, but only checks constraints for validity based on current values.
@chandidodiya: where is a_s?
`uvm_do_on_with(a_s,a_sequencer,{a_s.base_a == ex_a;})
can you paste the full error?
In reply to chandnidodiya:
If e_s is wrongly typed as a_s here
In that case , if ex_a does not match with bpp_12,bpp_8,bpp_10 then randomization will fail because constraint solver cannot generate any value that satisfies all the constraints.
In reply to sohan_b:
"a_s was the different sequence for i2c write and i was trying to write data in i2c registers. it turns out that i was passing too many arguments like conditional statements in an in-line constraints which was not working that’s why i was getting such error. also i was not giving constraints correctly.
And one more thing if we don’t pass any variable in for an ex. “obj.randomize()”, it will randomize all the variables declared as rand honoring constraints related to those variables."
Thanks for all the important informations.
In reply to Shipra_s:
a_s was a different sequence and i was just using bpp_12,bpp_8,bpp_10 which are randomized from e_s sequence, to control my a_s sequence like some if-else conditions.