Hi,
I have a piece of code like this:
...
class wol_case;
class rand_pkt;
rand bit [7:0] pkt[];
constraint pkt_c1 {pkt.size() inside {[72:136]};
pkt[0] == 8'h12;
pkt[1] == 8'h34;
};
endclass: rand_pkt
rand_pkt rand_pkt_inst;
function new();
rand_pkt_inst = new;
endfunction
endclass: wol_case
wol_case wol_case_inst;
initial begin
wol_case_inst = new;
#10;
if (~wol_case_inst.rand_pkt_inst.randomize()) $display("DBG: randomize failed!")
end
It is very interesting when I run this piece of code, I always get information that the randomized failed. But If I remove class wol_case and only lef class rand_pkt and run the code again, then the randomize is ok. Does this mean class.randomize could not be run in embedded class? thanks.