I am trying to cast an object in a build phase as shown below.
$cast(m_cpu_config, name); // where as the "name" is a type string and it holds the design hierarchy "top.a1.b2.c3.dv.rim.get_config_object()"
from the above hierarchy path "top.a1.b2.c3" is variable and "dv.rim.get_config_object()" is fixed while building the environment.
the environment gets the variable path from configdb while building it so i was doing it as shown below.
name = $psprintf("%s.dv.rim.get_config_object()", get_hier_from_cfgdb()); //get_hier_from_cfgdb() returns the path top.a1.b2.c3
$cast(m_cpu_config , name);
doing so i am facing the below failure.
# ** Error: (vsim-3971) $cast to type 'class libbdv.cpu_pkg::cpu_cfg_c' from 'string'
can someone please help me out.