1

I've come across some code that does something like:

`include "./some_path/some_file.svh"

Is this equivalent to:

`include "some_path/some_file.svh"

?

The LRM states that relative paths are considered as starting from either the compiler's current working directory or from user specified locations, so I would expect '.' to be substitutable for any of these paths.

I'm guessing the intention was to specify a path that is relative to the including file's location and someone didn't really understand what they were doing.

2
  • 1
    Not a specification answer, but if you want to see how your compiler is resolving that file name, you could start the compile with strace -f -o strace.log [rest of the compile command or top level script/makefile/whatever command ... ] After the compile runs, you can grep strace.log for some_path/some_file.svh. Running strace will make the compile take a lot longer. You'll see file open system commands that show the compiler's internal mechanism. Anyways, not an LRM answer, but may be useful in dealing with your specific compiler. Commented Jan 17, 2018 at 19:02
  • Cool. Thanks a lot for the tip. Commented Jan 17, 2018 at 20:29

1 Answer 1

2

This is going to be OS dependent and not part of the SystemVerilog LRM. ./ usually means search the current working directory only and not the reast of the search path.

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

2 Comments

The second part, regarding searching from the including file location is, I would assume, impossible, right?
I'm not sure. There might be a tool specific way of getting this behavior.

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.