check the value 12321 is pallindrome or not by using constraint
module test();
class packet;
rand bit [7:0\] a;
constraint a{a inside {[0:4]};}
constraint a2 { foreach(a[i])
{ a[i]==a[(n-1)-i];}}
endclass
packet p1=new();
assert(p1.ramdomize());
$display("the value is =%p", p1.a);
endmodule
Comments
Post a Comment