4bits of decimal precision

Write a constraint to generate a variable such that the generated random value has 4bits of decimal precision.

In reply to jhagovind:

Decimal and bit are contradictory. Explain what values you are looking for.

In reply to jhagovind:

if it is bits…then no need to add a constraint, just use rand bit[3:0]b;
if it is decimal you are dealing with then


rand int a;
rand int b;
constraint cond {b inside {[1000 : 9999]};}
function void post_randomize();
$display("%0d",a);
$display(".");
$display("%0d",b);
endfunction