class B;
randc int q[5];
bit [15:0] b;
constraint INDEX {
foreach(q[i])
{
q[i] inside { [0:15] }
};
}
constraint UNIQUE_5_Index {
foreach(q[i])
{
foreach(q[k])
{
if ( i != k )
q[i] != q[k];
}
}
}
function void post_randomize();
int i;
$display("%p ",q);
// Why is Below Code Not Working ??
i = q.size();
repeat(i)
begin
i = q.pop_front();
b[i] = 1;
end
endfunction
endclass
module Randomize_16Bit_To_Generate_Exactly_5_Ones;
B b1;
initial
begin
b1 = new;
if( !b1.randomize() )
$display(" Randomization Failure for b ");
$display("%b",b1.b);
end
endmodule
I get an Error :
i = q.size();
|
ncvlog: *E,QAANBI (Randomize_16Bit_To_Generate_Exactly_5_Ones.sv,42|13): This is not a valid built in method name for this object. [SystemVerilog].
i = q.size();
|
ncvlog: *E,NOTFXX (Randomize_16Bit_To_Generate_Exactly_5_Ones.sv,42|13): Expecting a function name [10.3.3(IEEE)].
i = q.pop_front();
|
ncvlog: *E,QAANBI (Randomize_16Bit_To_Generate_Exactly_5_Ones.sv,46|18): This is not a valid built in method name for this object. [SystemVerilog].
i = q.pop_front();
|
ncvlog: *E,NOTFXX (Randomize_16Bit_To_Generate_Exactly_5_Ones.sv,46|18): Expecting a function name [10.3.3(IEEE)].