vlog -reportprogress 300 -work work C:/lab4/ALU.v
# Model Technology ModelSim ALTERA vlog 10.1b Compiler 2012.04 Apr 27 2012
# -- Compiling module ALU
# ** Error: C:/lab4/IDEX_regs.v(56): Cannot open `include file "Constants.v".
# ** Error: C:/lab4/ALU.v(77): (vlog-2730) Undefined variable: 'constant 1'.
# ** Error: C:/lab4/ALU.v(77): (vlog-2730) Undefined variable: 'constant 2'.
verilog lets you use header files to share constants between modules. the problem was that modelsim couldn't find where my header file / constants file was. my constants file was in my lab4 folder with the rest of my project's files. it was probably looking in the lab4/simulation/modelsim folder, which was the current modelsim folder. how to help modelsim find your header files:
- in ModelSim, click "Compile" -> "Compile Options..."
- click on "Verilog & SystemVerilog" tab
- click "Include Directory..."
- move up a couple directories to get to your main project folder, or whatever folder your header files are in.
- click OK, OK
# Modified C:\Program Files (x86)\altera\modelsim12.1\modelsim_ase\win32aloem/modelsim.ini
but then when i clicked Compile -> Compile Options again, i saw that my changes were lost.
so, i used notepad to open the file: C:\Program Files (x86)\altera\modelsim12.1\modelsim_ase\win32aloem/modelsim.ini
one of the lines of the file said this:
OptionFile = C:/lab2/simulation/modelsim/vlog.opt
that's lab2! it seems modelsim was permanently configured to pull options from one of my old projects. so i changed it to say lab4 and saved.
at this point, you should be able to save changes made in Compiler Options (Compile -> Compile Options).
i used notepad to open the settings file in my lab4 folder: C:/lab4/simulation/modelsim/vlog.opt
the contents should simply be:
+incdir+C:/lab4
hope this helped you!