2

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
2
  • Usually you want to create a file that lists all RTL files (and paths) used in your design and pass this file to the tool. A quick google search revealed that this is also the case for this tool. Commented Nov 23, 2017 at 10:48
  • have you tried '-h' qualifier for help? if you did, you should have seen -I includedir this, which you could yous on the command line to specify the directories where to search for include files. Commented Nov 23, 2017 at 13:21

1 Answer 1

5

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
Sign up to request clarification or add additional context in comments.

Comments

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.