Set object A into root scope, then get A to object B. If I change item in A, will item in B change meanwhile?

If I set object A in root scope, then I get the object in somewhere else, and cast it to B.
Then, if I change the item in A, will the item in B change meanwhile ? Or if I change the item in B, will item in A change ?

Above is for UVM.

BTW, if I config an interface in root scope, then I get the interface in somewhere else. The change in interface will occur at the same time.
BTW again, I remember in OVM, when we get_config_xxx, there is a parameter in get_config_xxx function, ‘.clone’, the default value for clone is 0, which mean I only get a handler, and I think in OVM the change will happen in both side (set/get). But I search the code in uvm_config_db.svh, seems like it’s different ?

In reply to shanshan:

The uvm_config_db is much simpler in some regards than OVM’s set/get_config. In the UVM, you are just setting/getting the contents of a variable, and the config_db does not care what type that variable is. So I assume you setting a class handle, then getting the handle. There is only one class object. It’s up to the user to clone the object if needed.

If by root scope you mean the top-level module with an initial block that calls run_test() and another initial block that calls uvm_config_db#(classA)::set(), the UVM guarantees a “delta” cycle before any of the uvm_component phases being executing. So the set() will always come before the get().

In reply to dave_59:

In reply to shanshan:
The uvm_config_db is much simpler in some regards than OVM’s set/get_config. In the UVM, you are just setting/getting the contents of a variable, and the config_db does not care what type that variable is. So I assume you setting a class handle, then getting the handle. There is only one class object. It’s up to the user to clone the object if needed.
If by root scope you mean the top-level module with an initial block that calls run_test() and another initial block that calls uvm_config_db#(classA)::set(), the UVM guarantees a “delta” cycle before any of the uvm_component phases being executing. So the set() will always come before the get().

Thanks Dave,

uvm_config_db#(class A_TYPE)::set(uvm_root::get(), “*”, “A”, A);
uvm_config_db#(class A_TYPE)::get(uvm_root::get(), “”, “A”, B);

According to your reply, do you mean in above code. If I change item in A, the item in B will not change ?

And if I use the below code, the item in A change will make the item in B change, too, right?
set_config_object(“*”, “A”, A, 0);
get_config_object(“A”, B, 0);

So, how what should I do if I want to the change in A also happen in B in UVM ? How to clone?

In reply to shanshan:

You do not want cloning. And you do not seem to understand the difference between class objects and class handles. Please see this post and substitute your A/B for my ClassVar1/2.

In reply to dave_59:

In reply to shanshan:
You do not want cloning. And you do not seem to understand the difference between class objects and class handles. Please see this post and substitute your A/B for my ClassVar1/2.

Hi Dave,

Do you mean if I change item ‘a’ in A, then item ‘a’ in B also change in UVM. (if so, that’s what I expect, because I assume B is only a handler pointing to A)

In reply to shanshan:

yes

In reply to dave_59:

In reply to shanshan:
yes

Thanks Dave.
Then, I need to check my code. Because I found the change in A did not happen in B in my code. A little confusion