print the prime number 0 to 500 by using constraint
module test();
class packet;
rand bit [15:0] a;
constraint a { a inside {[0:500];}
constraint a2 { foreach(a[i])
if(i>1)
a[i]==prime(i);}
endclass
packet p1=new();
assert(p1.randomize());
$display("the value is = %p", p1.a);
endmodule
Comments
Post a Comment