BitRot | VHDL development on Mac

VHDL development on Mac

on

I took a course this semester on FPGA development using VHDL, where the ongoing project is to build a MIPS CPU from scratch. I primarily use Mac at home, so I set out the weekend before the semester started to find tools that would run on Mac. I’ll also include at the end some generic VHDL resources.

Nothing runs on Mac

The two recommended environments for VHDL in the course were ModelSim and ISIM. In the end, I installed ISE on a Windows VM, and used that for “last-mile” building.

Enter GHDL

GHDL is the GNU VHDL environment/simulator. Luckily for us, it also runs under mac. They recommend use of GTKWave, which also runs on mac. GTKWave requires the Switch module, which I installed with cpan install Switch.

Sublime Text

Sublime-VHDL is the plugin I used to enable syntax highlighting, although I had some trouble because it sets the path to /usr/local/bin, and gcc is installed under /usr/bin. So I wrote my own build system that passes in the correct path (and added a few options to shorten my write-build-test loop). I’ve opened a pull request to fix this, given that gcc is under /usr/bin on both OSX and Ubuntu by default.

Compiling code with GHDL

When I tried to compile an example testbench provided by the professor in the course, I immediately hit my first hurdle. It seems that GHDL provides a strict interpretation of the IEEE standard, which doesn’t include the arithmetic extensions. Fortunately, it does come bundled with the Synopsys (or compatible, not 100% sure) implementation:

ghdl -a --ieee=synopsys *.vhd

We discovered after that he also is fond of using the ieee.std_logic_arith package, which was deprecated a long time ago and replaced by ieee.numeric_std. The earliest reference I could easily find that recommended the deprecation of numeric_std was from 2003.

The last hiccup we ran into was that GHDL is somewhat more pedantic (or lacks the “customized” libraries that come with ISE), and so it fails when trying to compare std_logic_vectors with =. Working around that gave me my one liner (that I also included in the build system):

ghdl -a --ieee=synopsys -fexplicit *.vhd

Building and installing the code onto an FPGA

I’m not certain if GHDL is capable of building a firmware image for loading into a dev board, so I ended up installing ISE onto a Windows VM, which works ok, but isn’t anywhere near as streamlined as my personal dev environment, so I end up switching back and forth when fixing errors that arise in actual synthesis.

We used Digilent boards, so we used their Adept package to actually load the design onto the boards. The USB connector worked without too much trouble (needed to replug the USB once or twice for it to recognize the USB cable).