I have env called testenv #(`a) extends uvm_env this is created inside agentenv and agentenv is created inside pkgenv and pkgenv is created inside socenv,
here I want to typcast testenv to another class of type uvm_env I am trying it as bellow but getting runtime typecast error
I guess your testenv is extended from uvm_component. Right?
And the type testenv is parameterized with a parameter `a, i.e testenv is parameterized but uvm_component is not parameterzied. This causes the cast error.
If that fails, then you have incompatible types that cannot be cast.
Yes, here it is failing
We need to see the code used to declare and construct “testenv” inside your agent. The parameter types need to match coming from the same package).
parameters are matching too. if packages are different is that matters here ?
Thanks, for the information, I think issue is because of same class present as part of package and in agent we are using same package to create but when it comes to the testenv #(`a) test, it is using different class instead from package let me try and get back on this.