as i am randomizing handle for 5 times 5 different address are generated but when displaying the queue it is printing the same address value genetared at that transaction.push back is not working …
class demo;
rand bit[3:0] addr;
bit [2:0] index=2;
endclass
class memory;
demo mem[int][$];
endclass
module top;
memory mem_h;
demo d1,d2;
initial begin
mem_h= new();
d1=new();
d2=new();
repeat(5)
begin
assert (d2.randomize());
mem_h.mem[d1.index].push_back(d2);
$display("value of q=%p,mem_address =%d",mem_h.mem,mem_h);
end
end
endmodule
output
value of q='{2:'{'{addr:2, index:2}}},mem_address = 139819985821116
# KERNEL: value of q='{2:'{'{addr:5, index:2}, '{addr:5, index:2}}},mem_address = 139819985821116
# KERNEL: value of q='{2:'{'{addr:10, index:2}, '{addr:10, index:2}, '{addr:10, index:2}}},mem_address = 139819985821116
# KERNEL: value of q='{2:'{'{addr:4, index:2}, '{addr:4, index:2}, '{addr:4, index:2}, '{addr:4, index:2}}},mem_address = 139819985821116
# KERNEL: value of q='{2:'{'{addr:2, index:2}, '{addr:2, index:2}, '{addr:2, index:2}, '{addr:2, index:2}, '{addr:2, index:2}}},mem_address =