Hi all,
How to pass the value to the variable of uvm_sequence object?
1. use uvm_config_db
2. assign directly
When i use the first way, i found that maybe uvm_config_db::get() can only use in the uvm_component class. Then i use the second way, I cann't pass the value to the variable successfully.
Does anybody know the reason? Thanks in advance.
pieces of code of the first way:
In top:
uvm_config_db#(uvm_bitstream_t)::set(uvm_root::get(), "*", "my_cpu_id", HOST_NUM);
In my_sub_sequence which extends from uvm_sequence:
void'(uvm_config_db#(uvm_bitstream_t)::get(this, "", "my_cpu_id", my_cpu_id));
Result: VCS reports error.
pieces of code of the second way:
In v_sequence:
for (int i = 0; i < host_num; i++) begin
inst_name = $sformatf("sub_seq[%0d]", i);
//sub_seq[i] = my_sub_sequence::type_id::create(inst_name,,get_full_name());
sub_seq[i] = new(inst_name);
sub_seq[i].my_cpu_id = i;
end
In my_sub_sequence:
int my_cpu_id;
...
virtual task body();
...
$display("my_cpu_id = %0d", my_cpu_id);
...
endtask
Result: every my_cpu_id's value display 0, not 0, 1, 2, 3.