2

I am getting a Can't open include file error with yosys. Is there a command line argument to define include directories and/or is there a default directory it is looking for include files in?

1 Answer 1

4

Include directories can be passed as arguments to read_verilog:

read_verilog -Ipath/to/includes rtl/main.v
read_verilog -Ipath/to/includes rtl/stuff.v

Alternatively the command verilog_defaults can be used to set options for all subsequent calls to read_verilog. For example:

verilog_defaults -add -Ipath/to/includes
read_verilog rtl/main.v
read_verilog rtl/stuff.v

By default, read_verilog is looking for include files in the current working directory and in the directory that contains the verilog file with the `include statement.


Edit re. the comments:

I have created the following example:

$ cat a.v 
`include "b.v"
module test;
initial $display(`message);
endmodule

$ cat b.v 
`define message "Hello World!"

I can successfully run this with yosys -p "read_verilog a.v" as well as with yosys a.v. Please edit the question so it includes an example where processing of the include files fails.

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

5 Comments

the file was in the current directory that yosys was run and all the files, will try these suggestions and see what that does, thanks!
okay I think between your comments and different command line examples that has it. was doing the thing from the hackaday example yosys -p "synth_ice40 -blif out.blif" a.v b.v c.v and that had the include problem, but if you yosys -p "read_verilog a.v; read_verilog b.v; read_verilog c.v; synth_ice40 -blif out.blif" then no problems it finds the include file.
hmm, replacing always @(stuff) with always @* was the problem, going back to always @(stuff) the design builds completely, with the include, thanks!
@dwelch hmm... please include an example for that in the question. always @(stuff) and always @* should do the same (when stuff does not contain any posedge/negedge), and it certainly should not interfere with the processing of include files..
there were posedges in a couple and that is likely the issue. was hacking and slashing to see if I could mess with resource usage or play with opt, I suspect I just broke the design is all...

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.