Trying to generate leap year using SV constraints. Does the below approach look correct?
class sample;
rand bit [32:0] leap_year;
constraint leap{
leap_year inside {[1000:2100]};
leap_year%4==0;
leap_year%100==0 -> leap_year%400==0;
}
endclass
module tb;
sample s = new();
initial begin
s.randomize();
$display("%d",s.leap_year);
end
endmodule