Feeds:
Posts
Comments

Posts Tagged ‘MacOS’

Installing GHDL on a Mac

GHDL is a popular open-source compiler and simulator for VHDL. Precompiled binaries are available for Windows, Gnu/Linux and MacOS-X (PowerPC), but unfortunately, not for MacOS-X (Intel). In order to run GHDL on an Intel-based Macbook Pro, compiling GHDL from source is one option, and various packages (including ADA) need to first be installed. Another option is to use the WINE software layer to run an existing GHDL binary compiled for Windows or Gnu/Linux.

WINE is available for installation through the MacPorts project. Installation instructions for MacPorts can be found here, if needed. Before installing anything through MacPorts, it’s a good idea to update the dependencies and the MacPorts installation by using the ‘selfupdate’ option. WINE can then be installed using the ‘install’ option:

# update the MacPorts installation
sudo port selfupdate
# install software using the official project name
sudo port install wine

Periodic maintenance and updates through MacPorts can be achieved by running the ‘upgrade’ option, and the following command updates all software installed through MacPorts, if anything is out-of-date.

# upgrade any outdated installations
sudo port upgrade outdated

The next step is to download and install the precompiled binary from here. Here’s the direct download link to GHDL-0.26-2008Apr07.dmg. Once downloaded, double-clicking the file will mount the disk image ‘GHDL-0.26’. Navigate down to the sub-folder called ‘wine’, in which two items will be found: a sub-folder called ‘GHDL’ and a bundle called ‘Wine.bundle’. Copy the ‘GHDL’ folder to your home-directory and rename it to ‘.wine’ (make sure a .wine folder doesn’t already exist in your home directory). This places the executable ‘ghdl.exe’ in the WINE search path.

# change directory to the sub-folder
cd /Volumes/GHDL-0.26/wine/.
# copy and rename the executable folder
cp GHDL ~/.wine

As an example, if your top-level design is called ‘mydesign’ and the VHDL source code is placed in the file ‘mycode.vhd’, the following sequence of commands will compile and run your code. The compilation command can be run as many times as necessary to compile all source files. The elaboration command is for linking/loading and creating the final binary, which is executed when the simulation is run.

# compile the design
wine ghdl.exe -a mycode.vhd
# elaborate the design
wine ghdl.exe -e mydesign
# run the simulation
wine ghdl.exe -r mydesign

For more details on other GHDL options, use the ‘–help’ argument. Useful options include ‘-work’ for specifying the work library, ‘–ieee=synopsys’ for specifying the use of a particular version of the IEEE standard VHDL libraries, and ‘–vcd=FILENAME’ for specifying the name of the VCD waveform dump file.

# compile the design
wine ghdl.exe --help
Advertisements

Read Full Post »

Ever since the Apple Mac operating system switched to its Unix-based underpinnings with Mac OS X, one of the most useful tools for Mac users has been the Fink Project. Their stated aims to “bring the full world of Unix open source software to Darwin and Mac OS X” has been wildly successful for those of us still reliant on Unix tools despite having guiltily moved on to one of the major commercial operating systems.

Some of the software tools available through Fink include Gnu/Emacs (which I had admittedly already installed on my powerbook from source), the Xfig drawing program, and the teTeX distribution of the TeX document preparation system invented by Donald Knuth. The totality of these three tools comprise all that I need in order to write and publish papers in my preferred format of TeX.

The Fink Project homepage has a link to a binary installer for the PowerPC version of Mac OS (as well as the newer Intel architecture). Once Fink has been installed, the shell paths need to be updated to use the specific fink directory paths. The Fink Project decided to use entirely separate Unix System Resources (/usr/) and binary (/bin/) locations as the main Unix installation by Mac OS. These are located in the seemingly arbitrarily named directory of /sw/. I agree with this setup decision because it minimizes the potential for interference between the Mac system Unix installation and the Fink project installation, especially during future updates.

Based on the Debian package management system (apt-get, etc), fink keeps a list of package dependencies in order to maintain all software within its purview. This tree of dependencies is used to ensure that all software libraries are installed or updated before any dependent updates take place. In this way, your open source software always remains in full working order without the problems that accompany out-of-date libraries.

Not all packages are available in binary format, and need to be built from source. This can be done by first installing the Apple Xcode developer tools (available from http://developer.apple.com/), which includes versions of the Gnu Compiler Collection (gcc). Finally, many older graphics-oriented tools such as xv and tgif require the X window system, or X11. Although X11 is available through Fink, there is also a version available directly from Apple. Fink allows either to be in use by its applications, and this can easily be configured.

Read Full Post »