Associative array handle copy, coherency issue

Hi VA,

Found an issue in my verification testbench.

Created an associative array in my env class in build_phase.
Array was initialized with 2048 items using the keys of the associative array.


    class custome_env extends uvm_env;
         ....
         custome_ref_model   ref_model;
         bit[512-1:0]        cache_image[int];
         ...
         function void build_cache_image();
             for (int unsigned ii=0; ii < 2048; ii++) begin
                cache_image[addr] = {16{ii}};
                addr += 64; //addr in byte resolution.
             end
         endfunction
    endclass

Later in connect_phase of my custome_env class linked this array to same array type and name in my ref_model class:


    class custome_env extends uvm_env;
        function void connect_phase(uvm_phase phase); 
            ref_model.cache_image  = this.cache_image;
        endfunction
    endclass

    class custome_ref_model extends uvm_component;
        ....
        bit[512-1:0]   cache_image[int];
        ....
    endclass

During the test run, the associative array was modified many times in the ref_model class.

Unfortunately found in the check_phase of the test that the associative array in ref_model class is different than the one defined in the custome_env class.
How is it possible?
Why the items of associative array in the custome_env class was not being modified during the test run?

Thanks,
Michael

In reply to Michael54:

The arrays are not linked by an assignment; the array assignment creates a copy.

You might want to look at the class uvm_pool which essentially wraps an associative array in a class object. Then you can share the object handles.