In reply to cgales:
Hi cgales,
In order to overcome that issue I used ovm_object type to get the instance and then did casting to config_class handle, and it worked fine. But while getting same handle in driver I used config_class type so there is no need of casting and it worked fine. Can i know why? Below i am sending you snippet of my code.
class config_class extends ovm_object;
`ovm_object_utils(config_class)
function new(string name = "config_class");
.....
endfunction
endclass
class env extends ovm_env;
`ovm_component_utils(env)
config_class cfg;
function new(string name = "env", ovm_component parent);
.....
endfunction
function void build();
cfg = config_class::type_id::create("cfg");
set_config_object("*","config_class",cfg,0);
endfunction
endclass: env
class intr_driver extends ovm_driver #(seq_item);
`ovm_component_utils(intr_driver)
config_class cfg;
function new(string name = "intr_driver", ovm_component parent = null);
super.new(name, parent);
endfunction
function void build();
super.build();
get_config_object("config_class",cfg,0);
endfunction
endclass: intr_driver
class intr_monitor extends ovm_monitor;
`ovm_component_utils(intr_monitor)
config_class cfg;
function new(string name = "intr_monitor", ovm_component parent = null);
super.new(name, parent);
ap=new("ovm_analysis_port",this);
endfunction
// Earlier Implementaion without casting
/* function void build();
super.build(); // Tthis impleentation has throwm error
get_config_object("config_class",cfg,0)
endfunction */
// Later implementation
function void build();
ovm_object temp;
super.build();
if(!get_config_object("config_class",temp,0)) // This worked fine
$display("Cannot get config handle");
if(!$cast(cfg,temp))
$display("Casting failed");
endfunction
endclass:intr_monitor
Please let me know why it didn't throw any error in case of driver?
Thank you,
Mohanish