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?

toolic
  • 57,801
  • 17
  • 75
  • 117
old_timer
  • 69,149
  • 8
  • 89
  • 168

1 Answers1

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.

CliffordVienna
  • 7,995
  • 1
  • 37
  • 57
  • 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! – old_timer Oct 28 '15 at 13:23
  • 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. – old_timer Oct 28 '15 at 13:47
  • hmm, replacing always @(stuff) with always @* was the problem, going back to always @(stuff) the design builds completely, with the include, thanks! – old_timer Oct 28 '15 at 13:55
  • @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.. – CliffordVienna Oct 28 '15 at 13:59
  • 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... – old_timer Oct 28 '15 at 14:27