简体   繁体   中英

How to include files in icarus verilog?

I know the basic `include "filename.v" command. But, I am trying to include a module which is in another folder. Now, that module further includes other modules present in the same folder. But, when I try to run the module on the most top-level, I am getting an error.

C:\Users\Dell\Desktop\MIPS>iverilog mips.v
./IF/stage_if.v:2: Include file instruction_memory_if.v not found
No top level modules, and no -s option.

Here, I am trying to make a MIPS processor, which is contained in the file "mips.v". The first statement of this file is "`include "IF/stage_if.v". And, in the IF folder, there are numerous files present which I have included in stage_if.v, one of which is "instruction_memory_if.v". Below is the directory level diagram.

-IF
  instruction_memory_if.v
  stage_if.v
+ID
+EX
+MEM
+WB
mips.v

You need to tell iverilog where to look using the -I flag.

In top.v :

`include "foo.v"

program top;
    initial begin
        foo();
    end
endprogram

In foo/foo.v :

task foo;
    $display("This was printed in the foo module");
endtask

Which can be run using the commands:

iverilog -g2012 top.v -I foo/
vvp a.out

>>> This was printed in the foo module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM