Configuration Database Question

Hello guys. I have a question regarding configuration database, and it regards the context field. I was told that you have to set it to null whenever its in a Module, and you set it to “this” whenever it is in a class. Is that true? since I’ve tried to to set a value within the sequence class from testbench top. I used this syntax in test-bench top.

uvm_config_db#(int)::set(uvm_root::get(), “*”, “n_times”,n_times);
and then I put this in pre_start phase in sequence.
uvm_config_db#(int)::get(this,“”,“n_times”,n_times);

It didn’t work,it outputted an error message of incompatible complex type usage, until I edited the configuration statement in sequence and changed it from this to null. then it worked.

In reply to haithamx15:

First, we don’t have any class “uvm_db_config”. Instead of that, we have “uvm_config_db”.
About your question: It’s not always true. You must provide a “component” to get method of uvm_config_db. In your case, you are in a sequence which is an “object”. That’s why you got compile error.

In reply to chris_le:

In reply to haithamx15:
First, we don’t have any class “uvm_db_config”. Instead of that, we have “uvm_config_db”.
About your question: It’s not always true. You must provide a “component” to get method of uvm_config_db. In your case, you are in a sequence which is an “object”. That’s why you got compile error.

fixed the typo.

I was able to call method of uvm_config_db from sequence the error was not calling the method it was “this” context, and it was resolved by replacing it with “null”