my need is to use given hierarchy many times based on "lphy_duc_1cc0,lphy_duc_1cc1,lphy_duc_1cc3 .....etc difference will be in hierarchy is only cc number.
reg_block.dl_lphy_duc_1cc0.dl_lphy.dl_lphy_ti
reg_block.dl_lphy_duc_1cc1.dl_lphy.dl_lphy_ti
reg_block.dl_lphy_duc_1cc2.dl_lphy.dl_lphy_ti
reg_block.dl_lphy_duc_1cc3.dl_lphy.dl_lphy_ti
.
.
.
i tried using
string hierarchy = $sformatf("reg_block.dl_lphy_duc_1cc%0d.dl_lphy.dl_lphy_ti",cc_num));
cc_num i'm parsing as per my need. but i'm getting becoz actual hierarchy is not a string.
Option 1:
Depends on what you want to do, you can maybe use HDL paths backdoor access via DPI/PLI interface:
https://www.chipverify.com/uvm/uvm-hdl-access-routines https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.2/html/files/dpi/uvm_hdl-svh.html
Specifically examine
uvm_hdl_force/uvm_hdl_read/uvm_hdl_deposit.All functions accept strings as argument, so you just need to use your
$sformatf()result as an input to the functions.Maybe something like this:
Option 2:
Instead of using strings, you can define text macros for all such variations. But this is not a good and methodological way IMO, since I believe you have a lot of such paths, and you probably must have some indexing capability.
Option 3:
Another option which might work for you, is using the VPI interface, which has capability to access strings as paths. There is some information in the next links:
SystemVerilog: String to Circuit Net
https://en.wikipedia.org/wiki/Verilog_Procedural_Interface
I am not experienced with it, but a quick search online gives some verification forums examples.
Option 4:
One last option, is to convert the HDL paths to array of units.
i.e., instead of instantiating dl_lphy_duc_1cc0, dl_lphy_duc_1cc1, etc., instantiate a single unit, but use array instatiation:
https://besubjects.wordpress.com/2016/08/13/array-of-instances-of-primitives/
Something like:
which will give you the next HDL path (or similar path with indexing capability):
You can then just access it using index, no need for strings:
IMO this is the most methodological and correct option to use. But, it may not be feasible at all in case you can't control the HDL path structure (e.g., 3rd party IP code which you can't change).