I have 10000-bit random variable inside a class. After randomization I want to print sequence like 9,99,999,… so on.
I have tried with below code while calling the display function, value is not printing.
// Code your testbench here
// or browse Examples
class a;
rand bit [9999:0] abc;
int q1[$] = {0};
int k1; int k2;
function void post_randomize();
int ab = 9;
k1 = q1.pop_back();
k2 = (k1*10)+ab;
q1.push_front(k2);
$display("POST_RANDOMIZATION::value=%d",k2);
endfunction
constraint c1 {abc == k2;}
function void display();
$display("Display value::abc=%d",abc);
endfunction
endclass
module top;
initial begin
a h1;
h1 = new();
repeat(10) begin
h1.randomize();
h1.display();
end
end
endmodule