In reply to dave_59:
Hi Dave,
Could you please elaborate. When I changed shortint to int the results are constrained to as expected while having 'd included. For shortint 'd constraint is not working. Are you telling it is due to tool error?
class tb;
rand int unsigned a[10];
constraint aa{a.sum()<'d1000;}// this 'd while working with shortint
endclass
module rb;
tb A;
initial
begin
A=new();
repeat(10)
begin
A.randomize();
$display(“%p”,A.a);
end
end
endmodule
Result
'{'h0, 'h0, 'h5f, 'h1c, 'h0, 'h0, 'h0, 'h0, 'h0, 'h0}
'{'h0, 'h0, 'h2, 'h0, 'h221, 'h0, 'h0, 'h0, 'h0, 'h1be}
'{'he, 'h0, 'h2f, 'h0, 'hf, 'h0, 'h0, 'h14a, 'h0, 'h0}
'{'h17, 'h0, 'h1e2, 'h0, 'h9e, 'h54, 'h2, 'h33, 'h5, 'h0}
'{'h0, 'h0, 'h20e, 'h0, 'h3, 'h1f, 'h0, 'h0, 'h0, 'h0}
'{'h0, 'h0, 'h1b6, 'h0, 'hb1, 'h0, 'hb3, 'h0, 'h0, 'h0}
'{'h0, 'h270, 'h3, 'h0, 'h0, 'h0, 'h0, 'h116, 'h0, 'h29}
'{'h1, 'h21, 'h0, 'h0, 'h8e, 'h0, 'h0, 'h8, 'h0, 'h213}
'{'h0, 'h0, 'h5, 'h0, 'h0, 'h17, 'h0, 'h0, 'h0, 'h2b7}
'{'h0, 'h0, 'h3, 'h3, 'h8, 'h0, 'hda, 'h9, 'h244, 'h0}