print the natural numbers by using constraint

 module test();


class packet;

rand bit [7:0] a;


constraint a1 { a inside {10:20]};}

constraint a2 { foreach(a[i])

if(i%2==0)

a[i]==i;}


endclass



packet p1=new();


assert(p1.randomize());

$display("the value is =%p", p1.a);

endmodule


Comments

Popular posts from this blog