I can include Verilog code within a Verilog file (e.g. File1.sv) using the following:
Unfortunately, if I have the above File2.sv file in the Files tree of Project Navigator, Quartus will try and compile it.
How can I add a file to my project so that it will not compile? (I only want it to be included and compiled within File1.sv and I would like to keep File2.sv as a seperate file to make the code easier to manage)
If code in File2.sv is needed for the design, then it needs to be compiled. I'm not sure what you're trying to accomplish. You can select what files are part of the project from Project menu -> Add/remove files in project.
If File2.sv is included in the Project tree, then it will be compiled when File1.sv is compiled (because File1.sv includes File2.sv) and then it will also be individually compiled again as File2.sv by itself which will fail.
I am trying to break down a big module into 2 files for easier navigation. In my case, my module has 2 state machines. To make it easier to work on, I have one state machine inside File2.sv and the other inside File1.sv (they are not really called File1 and Files - these are just example names).
I would like it to also appear on the Project tree so I can easily open it if I want to.
Having said this, I have started to use Notepad++ lately for both Modelsim and Quartus since it provides time-saving features a software developer expects such as keyboard macros.
I don't think there is an option to compile selected files. Quartus will compile all the files in the project navigator. What I can think of is go to File > Open > File2.sv to view the file without adding it into the project navigator.
May I know from your experience in using Notepad++, any keyboard macros that you think is good to have but not currently available in Quartus/Modelsim?
@ShyanYewT_Intel I'm used to using IDEs such as MS Visual Studio and even ancient editors such as Emacs. They have "keyboard macros" which allow you to record a sequence of keystrokes and play them back. (Ctrl-Shift-R to start/stop recording and Ctrl-Shift-P to playback recording). Imagine you have a load of port/variable defiintions nicely vertically aligned and you want to move the second columns of words over by 3 characters. You could do this by frantically pressing the space 3 times, moving left 3 times and then moving down one line and doing it all over again. With keyboard macros you just record the sequence and playback - so you can hold Ctrl-Shift down and press P for 10 times for 10 lines of change. And keyboard macros can also playback copy and pasting actions too.
Another simple thing I miss in both Quartus/Modelsim editors is the abilty to highlight a black and press Tab (or Shift-Tab) to move the entire block of lines a tab to the right or left. I'm so used to using this that I highilght a block of text in Quartus/Modelsim, press Tab and accidentally delete/replace the highlighted code with a tab character. :-)
Something I haven't tried is whether or not Quartus would allow me to include a file with an unknown extension. For example, it would be useful to be able to includes .txt or .doc files in the Project tree - these would be related files but not files you would want to compile. I could do something silly such as renaming my Files2.sv to File2.paulsv and then tell Notepad++ that a .paulsv file should be syntax highlighted the same as Verilog file.
Thanks for the feedback. Very interesting indeed.
For the tab, I think the best way is to click and drag (or shift + up/down arrow) the line number on the left to highlight the required line/block so you would not accidentally delete/replace it. Let me know if it helps.
You can actually add any type of file extension in Quartus by select All Files when you adding a file in the project navigator. I checked and Quartus does not compile it if it does not recognize the file but I don't think there is a syntax highlight feature available in Quartus. I recommend Open the file to view as to keep the correct file extension (you do not need to change it back) and you can still save the changes on the file.
I will feedback on the keyboard macro to the team so to evaluate whether this could be added in the future Quartus release. Hope to get your understanding that this may takes some time as it does not impact most customer thus the priority will be low.
Let me know if you need any further assistance.