0

I wonder if the modules have any visibility into the hierarchy of the ports? Can the port hierarchy be printed out?

For a minimum working example, assume I have this:

module top ();
  
  logic my_sig;

  child ichild (.sig(my_sig));

endmodule : top


module child (input logic sig);
  
  initial $display(/* SystemVerilog-Fu here */)

endmodule : child

I expect the $display to print top.my_sig -- or something that conveys my_sig name instead of just reading out the value. I looked into the DPI guide as well, but it doesn't seem to have any such facility.

Thanks in advance!

1
  • I did try %m -- that only conveys the module name. I needed the signal name instead. Commented May 19, 2022 at 17:01

1 Answer 1

3

The DPI is for behavioral modeling interoperability between SystemVerilog and C. The VPI gives you the introspection you are looking for in from C. Also, many tools have a command line interface (find signals -ports in Modelsim/Questa without having to learn a complicated C API.

Explaining how to do this is too deep a discussion for SO. I suggest you read my DVCon 2016 paper on SystemVerilog introspection with examples here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.