I need your valuable suggestion on this error.
Im trying to pass a variable from one sequence to another within a test.
class seq2;
bit [6:0] var;
task body()
uvm_config_db#(bit [6:0])::get(this,"*","var", var);
endtask
endclass
class seq1;
rand bit [6:0] var;
task body()
assert(this.randomize());
endtask
endclass
class test extend base_test;
task run_phase
seq1.start();
uvm_config_db #(bit [6:0])::set(this,"*","var",seq1.var );
seq2.start();
endtask : run_phase
endclass
====================================
Error
ncvlog: *E,TYCMPAT (/test.sv,88|42): formal and actual do not have assignment compatible data types (expecting datatype compatible with ‘class uvm_pkg::uvm_component’ but found ‘class test_pkg::seq2’ instead).
//It can be done without using config db
class test extend base_test;
task run_phase
seq1.start();
//uvm_config_db #(bit [6:0])::set(this,"*","var",seq1.var );
seq2.var = seq1.var; // OR ser2.randomize() with { var == seq1.var; };
seq2.start();
endtask : run_phase
endclass
Thanks for you response, I did consider the method you mentioned, but its more hardline code, I want something robust.
Reason being, I have to move common sequences to base test and run them by default.
I want to set certain variables in my extended tests and retrieve in sub/parent/child/nested sequences as and when required.
Generally set/get get should do the job, I do not understand the error message, why are they type incompatible.
The first argument to uvm_config_db: get/get must be derived from uvm_component which uvm_sequence is not. That argument represents the highest level of the component hierarchy where the setting applies. You could use the sequencer handle if these are all sequences running on the same sequencer. But using null representing the root/top of the hierarchy might be better if you do not want to restrict the setting to a single sequencer.
The problem with uvm_config_db has been that it contributes to a significant slow-down of TB.
Chris Spear recommends same approach as RahulPatel by using OOP-style.
Hi RahulPatel,
Here you have set uninitialized my_var in build_phase of test.
Will my_var in my_sequencer get updated by seq1.my_var as u are assigning my_var=seq1.my_var in run phase of test?