[sv-ec] random generator state for shallow copy

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Wed Dec 16 2009 - 05:00:13 PST
How should below case work? Object ponited by c2 is created as a shalow copy
from object pointed by c1. Then both get randomized - should values
randomized for c1 and c2 be the same?

class C;
        rand int i,j;
        function new;
                $display("new");
        endfunction
        function void post_randomize;
                $display(i,j);
        endfunction
endclass

module top;
        C c1,c2;
        initial begin
                c1 = new;
                c1.j.rand_mode(0);
                c1.randomize();
                c2 = new c1; //<<<<<<<<<shalow copy
                c1.randomize(); 
                c2.randomize(); //should c1.i be equal c2.i ?????????????
                c1.randomize();
                c2.randomize(); //should c1.i be equal c2.i ??????????????
        end

endmodule


 
 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Dec 16 05:06:07 2009

This archive was generated by hypermail 2.1.8 : Wed Dec 16 2009 - 05:07:03 PST