Hi All,
I am not able to receive the variable from agent which is registerd from env.
Test :
class my_test extends uvm_test;
`uvm_component_utils(my_test)
my_env my_env_h;
int a;
function new(string name, uvm_component parent);
super.new(name,parent);
endfunction: new
virtual function void build_phase(uvm_phase phase);
uvm_report_info(get_full_name(),“Start of build_phase”, UVM_HIGH);
super.build_phase(phase);
my_env_h = my_env::type_id::create(“my_env_h”,this);
a = 7;
uvm_config_db#(int)::set(this,“*”,“A”,a);
uvm_report_info(get_full_name(),“END of build_phase”, UVM_HIGH);
endfunction: build_phase
endclass : my_test
Env:
class my_env extends uvm_env;
`uvm_component_utils(my_env)
my_agent my_agent_h;
int a;
function new(string name, uvm_component parent);
super.new(name,parent);
endfunction: new
virtual function void build_phase(uvm_phase phase);
uvm_report_info(get_full_name(),“Start of build_phase”, UVM_HIGH);
super.build_phase(phase);
my_agent_h = my_agent::type_id::create(“my_agent_h”, this);
a = 5;
uvm_config_db#(int)::set(this,“*”,“A”,a); //Error - This is causing to not to set the value of a
uvm_report_info(get_full_name(),“End of build_phase”, UVM_HIGH);
endfunction: build_phase
endclass: my_env
AGent:
class my_agent extends uvm_agent;
`uvm_component_utils(my_agent)
int a ;
function new(string name,uvm_component parent);
super.new(name, parent);
endfunction: new
virtual function void build_phase(uvm_phase phase);
uvm_report_info(get_full_name(),“start of build phase”,UVM_HIGH);
super.build_phase(phase);
uvm_report_info(get_full_name(),“end of build phase”,UVM_HIGH);
endfunction: build_phase
virtual task run_phase(uvm_phase phase);
if(!uvm_config_db#(int)::get(null,“*”,“A”,a))
uvm_error("CONFIG_VALUE","Value of a is not available") else
uvm_info(“CONFIG_VALUE”,$sformatf(“Value of a:%d”,a),UVM_LOW);
endtask: run_phase
endclass: my_agent
Top:
import uvm_pkg::*;
include "my_agent.sv";
include “my_env.sv” ;
`include “my_test.sv” ;
module top();
initial begin
run_test(“my_test”);
end
initial begin
#100;
$finish;
end
endmodule: top
Thanks & Regards,
Shriramvaraprasad B.