Whether you are a fan of Intel (previous Altari) or Xilinx FPGA’s, everyone who’s designed some kind of VHDL for FPGA’s knows the IDE’s provided by both manufacturers (Quartus for Intel FPGA’s and Vivado/ISE for Xilinx FPGA’s) haven’t good text editors on board. In this tutorial I will guide you on how to setup a custom design environment (this is how I personal create my designs for FPGA’s). You’ll see that I do this for Vivado from Xilinx (I work mainly with Xilinx FPGA’s) but it isn’t difficult to do reproduce those steps for Quartus from Intel. A little side node, everything is done on a Windows 10 machine. Enjoy!
The tools I use are the following (download links are provided):
- Xilinx’s Vivado IDE (Xilinx’s Vivado IDE)
- You can get a free webpack edition if you’ve bought a Digilent FPGA or are still a student majoring in electrical engineering. Digilent has a nice blog post on how to obtain that webpack licence (How to Download Xilinx’s Free Vivado: WebPACK Edition).
- Atom text editor (Atom)
- GNU Emacs (GNU Emacs)
- GHDL (GHDL for Windows)
Setting up the environment
I’m not going to cover the details on howto install the previously mentioned programmes, except for Emacs, Atom and GHDL since those have some additionally steps.
Once you’ve downloaded Emacs extract it to a location of your choice (for me this is my devLibs folder in Documents).
Now go to the bin folder and copy that address into your environments variables in windows. When done right you should open a cmd window and type in the command “where emacs” and a response as follow should come (if this is not the case you’ve done something wrong):
For Atom you should do the same. The standard location where the installer puts Atom is under AppData/Local/atom
And if we type in a cmd window the command “where atom” a response as following should come:
For GHDL just run the installer and make shure that (just like the previous two applications) the bin folder is linked into your environments variables in windows.
For this setup we need to install 2 packages which can be found in the installation repository. Use the command “ctrl +comma to open the settings menu or go to File -> settings. Then go to the Install tap and search for the following 2 packages:
- language-vhdl (this package gives atom VHDL language support)
- atom-beautify (this package will autoformat your VHDL code)
- open_in_cmd (this package will be used for checking the syntax of the code)
The language-vhdl package is good to go in it’s default mode, no changes need to be made to it. Atom-beautify in the other hand need a little bit of setup. Go back to the settings menu and go to the Packages tap (from here you can configure all your Atom packages).
Hit the Settings button of the atom-beautify package and scroll down till you come to the VHDL language. The atom-beautify packages makes use of Emacs VHDL beautifier (that’s why we needed Emacs). I always enables “Beautify On Save” so that it auto-formats my code when I save it but that’s of course something personal if you like that. Since we’ve already declared the location of Emacs in our environments variables under Windows there is no need to configure the Emacs script path in atom-beautify.
That was everything for the configuration of Atom, the next thing to do is to let Atom integrate with the Vivado IDE.
Let’s start with the last part of this tutorial. Here we are going to setup Vivado to let it integrate with Atom. Once you’ve started up Vivado, go to the Settings menu, this can be found under Tools -> Settings. Once in the settings menu go to the Text Editor tab and choose from the drop down menu “Custom Editor…”. Then hit the button with the 3 points next to the drop down menu and type in the field the following: “atom.exe [file name]”.
This command will let Vivado search in the environments variables for the atom.exe file. The file name is an option that you can specify for letting the editor know that you want to edit the current file. If you want to edit a certain file in your Vivado project, Atom will pop up and you are ready to edit the file in Atom with auto completion and autoformat functionality. When you save the file in Atom it will get automatically updated in your Vivado project.
For the last part we will talk a bit about GHDL, the only reason I use GHDL is for checking my syntax in a fast way inside the Atom IDE. Since we’ve installed the open_in_cmd package we can right click on the specific VHDL file we want to check for syntax errors and select “Open folder in CMD”. This wil open a CMD window that is directed to the specific folder where the VHDL file is saved. For GHDL there is a small command pallet available, the specific commands can be found on the following link. Since we are only interested in the “check syntax” which will analyze the files but doesn’t generate code and doesn’t update the library. We will type in “ghdl -s name_of_the_file.vhd“, this is shown in the figure beneath:
If everything is alright it wouldn’t give any output back, the reason here why GHDL complains here is because it doesn’t know the specific library which is specific for Xilinx. Keep in mind that GHDL is a handy tool for checking you’re syntax but it only support the 1987, 1993, 2002 of the IEEE 1076 VHDL standard. So be aware if you receive errors from GHDL, always analyse them manually and take them with a grain of salt ;)!