Hi, I need to pass the hierarchichal path as a string to the task.
For example,
task loadmem (input_file, "top.top1.mem_array)
<< Load top.top1.mem_array with input_file contents>>
endtask
How do I do this in sv?
Hi, I need to pass the hierarchichal path as a string to the task.
For example,
task loadmem (input_file, "top.top1.mem_array)
<< Load top.top1.mem_array with input_file contents>>
endtask
How do I do this in sv?
Can’t be done this way in SystemVerilog. The language has no way to convert strings to hierarchical references; everything must be statically typed in order for the compiler to generate code to execute statements involving expressions. Here are some options:
BTW, you should always use functions instead of tasks for non-time consuming routines. Functions cannot call tasks. (except when forked off)
In reply to dave_59:
So there is no way to store hiercachical path in a variable as object or something and possibly pass them to a function / method?
thanks much
In reply to stanzani:
You might be able to pass a string to a function and use a tool specific function using that string.
We do this sometimes to bypass loading registers…
example using Modelsim…
$signal_force(“/top/dut/register/mode”, $psprintf(“%b”, 4’h0), 0,3,-1,1);
You can store “/top/dut/register/mode” as a string.
In reply to dave_59:
Is there any way to access hierarchy in DPI-C?
In reply to lokeshmahor:
In reply to dave_59:
Thank you dave
We have implemented it with vpi its working for us.