As many of our customer learn during our regular VSV training sessions, System Verilog added `__FILE__ & `__LINE__ macros similar to C language. It is quite handy for debugging remotely developed code for a newcomer especially. Recently at an UVM forum a user asked how to get the relative path vs. absolute path from this macro. Consider the following code:
The SV LRM says;
22.13 `__FILE__ and `__LINE__
`__FILE__ expands to the name of the current input file, in the form of a string literal. This is the path by
which a tool opened the file,
So if you provide the absolute path name during compile command, you are bound to get the FULL PATH.
Questa when run with full path to the file as below:
produces the following output:
And you could get a pretty short output as below if you do a “magic” (Left as exercise to the interested reader :-) )
Enjoy System Verilog and have fun!
4 comments:
What is the use case for this file path and line number return?
John,
Typically users use this feature when taking over projects from other teams/groups/engineers. This is useful as the debug becomes easier once you know where a specific message originates from. It is a very common practice in large projects, and has origin in SW programming, see: http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
HTH
Srini
http://www.cvcblr.com/blog
okay. Thanks Srinivasan.
Borgata Hotel Casino & Spa Review | Dr.MCD
Borgata 속초 출장샵 Hotel Casino & Spa is a beautiful resort 진주 출장샵 on the 전라남도 출장샵 Mystic River in Atlantic City, New Jersey. It's a 이천 출장마사지 highly recommended location 세종특별자치 출장샵 for
Post a Comment