Is it possible to determine if a componet is under a certain hierarchy?

Hi

I have a an uvm component. i know i can get the full name using get_full_name. I am not able to determine how to find if the component is present under a certain hierarchy?

Is reg ex matching the only option?

In reply to justrajdeep:

It depends on from which context you want to ask this question. If you are in the child component, you could repeatedly call get_parent and then see if get_parent().get_name() matches what you are looking for.

However, the UVM tries to avoid dependencies that rely on hierarchical references. If lower level component want to make a decision based on which hierarchy it sits in, a better option might be to have the higher level component make a setting in the config_db for the lower level component to retrieve.

In reply to dave_59:

Hi Dave,

I would have preferred doing a config_db call. But that pertains to extending the already existing agents.

My requirement is to take a decision on my sequence based on which sequencer it is running on.

  • rajdeep

In reply to justrajdeep:

You didn’t mention anything about a sequence in your original question. You said you had a component; that is a completely different context.

You can use get_sequencer() from the running sequence and then use the config_db from the sequencer handle.

You may also want to look at Config/ConfiguringSequences | Verification Academy

In reply to dave_59:

Thanks Dave this helps. I was doing the same in a more roundabout way. doing a get_sequencer() call and then trying to determine the hierarchy of the sequencer component.