Icarus may be installed from source code or from pre-packaged binary distributions.
Installation From Source Edit
Icarus is developed for Unix-like environments but can also be compiled on Windows systems using the Cygwin environment or MinGW compilers. The following instructions are the common steps for obtaining the Icarus Verilog source, compiling and installing. Note that there are precompiled and/or prepackaged versions for a variety of systems, so if you find an appropriate packaged version, then that is the easiest way to install.
Obtaining Snapshots Edit
The ftp site for the latest snapshot is ftp://ftp.icarus.com/pub/eda/verilog/snapshots. Download a tarball with a name such as verilog-version.tar.gz and un-tar it using:
% tar -zxvf verilog-version.tar.gz
This will create a directory, similar to the name of the tarball, such as verilog-version. Change into this directory using:
% cd verilog-version
The source is then compiled and installed in the manner appropriate for your operating system. See below.
Obtaining Source From git Edit
Note: Icarus Verilog uses github to host the source code. If you do not yet have git installed on your system, go to github.com (or see the package repository for your Linux distribution) for current git software.
The source code for Icarus is stored under the git source code control system. You can use git to get the latest development head or the latest of a specific branch. Stable releases are placed on branches, and in particular the v10 stable releases are on the branch "v10-branch" To get the development version of the code follow these steps:
% git config --global user.name "Your Name Goes Here" % git config --global user.email email@example.com % git clone https://github.com/steveicarus/iverilog.git
The first two lines are optional and are used to tell git who you are. This information is important if/when you submit a patch. We suggest that you add this information now so you don't forget to do it later. The clone will create a directory, named iverilog, containing the source tree, and will populate that directory with the most current source from the HEAD of the repository.
Change into this directory using:
% cd iverilog
Normally, this is enough as you are now pointing at the most current development code, and you have implicitly created a branch "master" that tracks the development head. However, If you want to actually be working on the v10-branch (the branch where the latest v10 patches are) then you checkout that branch with the command:
% git checkout --track -b v10-branch origin/v10-branch
This creates a local branch that tracks the v10-branch in the repository, and switches you over to your new v10-branch. The tracking is important as it causes pulls from the repository to re-merge your local branch with the remote v10-branch. You always work on a local branch, then merge only when you push/pull from the remote repository.
- (The v10-branch is the current code for the v10 release series. See the GIT Branch Summary for more about the branches that are available, and more about how to work with branches.)
Now that you've cloned the repository and optionally selected the branch you want to work on, your local source tree may later be synced up with the development source by using the git command:
% git pull
The git system remembers the repository that it was cloned from, so you don't need to re-enter it when you pull.
Finally, configuration files are built by the extra step:
% sh autoconf.sh
The source is then compiled as appropriate for your system. See the specific build instructions below for your operation system for what to do next.
You will need autoconf and gperf installed in order for the script to work. If you get errors such as:
Autoconf in root... autoconf.sh: 10: autoconf: not found Precompiling lexor_keyword.gperf autoconf.sh: 13: gperf: not found.
You will need to install download and install the autoconf and gperf tools.
Icarus Specific Configuration Options Edit
Icarus takes many of the standard configuration options and those will not be described here. The following are specific to Icarus:
This option allows the user to build Icarus with a default suffix or when provided a user defined suffix. Older stable releases have this flag on by default e.g.(V0.8 by default will build with a "-0.8" suffix). All versions have an appropriate default suffix ("-<base_version>").
All programs or directories are tagged with this suffix. e.g.(iverilog-0.8, vvp-0.8, etc.). The output of iverilog will reference the correct run time files and directories. The run time will check that it is running a file with a compatible version e.g.(you can not run a V0.9 file with the V0.8 run time).
This option adds extra memory cleanup code and pool management code to allow better memory leak checking when valgrind is available. This option is not need when checking for basic errors with valgrind.
Compiling on Linux/Unix Edit
(Note: You will need to install bison, flex, g++ and gcc) This is probably the easiest case. Given that you have the source tree from the above instructions, the compile and install is generally as simple as:
% ./configure % make (su to root) # make install
The "make install" typically needs to be done as root so that it can install in directories such as "/usr/local/bin" etc. You can change where you want to install by passing a prefix to the "configure" command:
% ./configure --prefix=/my/special/directory
This will configure the source for eventual installation in the directory that you specify. Note that "rpm" packages of binaries for Linux are typically configured with "--prefix=/usr" per the Linux File System Standard.
Make sure you have the latest version of flex otherwise you will get an error when parsing lexor.lex. To allow configure to pick up your version of flex, set the environment variable $LEX
building on ubuntu 12.xx: "configure: error: C++ preprocessor "/lib/cpp" fails sanity check" then "sudo apt-get install build-essential" and then rerun ./configure
Compiling on Macintosh OS X Edit
Since Mac OS X is a BSD flavor of Unix, you can install Icarus Verilog from source using the procedure described above. You need to install the Xcode software, which includes the C and C++ compilers for Mac OS X. The package is available for free download from Apple's developer site. Once Xcode is installed, you can build Icarus Verilog in a terminal window just like any other Unix install.
Icarus Verilog is also available through the Homebrew package manager.
Compiling on Solaris Edit
Solaris is a form of Unix, so the Unix instructions above generally apply. However, a Solaris user will need to install some other compilation tools:
- gnu make
Solaris includes a BSD-style make, but Icarus Verilog uses some GNU make extensions. It is conventional on a Solaris system to install GNU make as "gmake".
- gcc or SunStudio
As of June, 2010 Icarus stable (V0.9) and development from the git archives can be compiled with the SunStudio compilers. This was tested using OpenSolaris 2009.06 and the 12.1 version of SunStudio.
These tools are gnu replacements for yacc/lex. They are extended versions of their older counterparts.
These tools are commonly available for Solaris. (SUN used to distribute a CD that included these and other GNU tools precompiled and prepackaged. Can anybody confirm that they still have such a disk?)
Compiling on MS Windows (MinGW) Edit
The source as available above can also be compiled on MS Windows systems. The preferred method for compiling on Windows is to use the MinGW-w64 compiler, as described in detail here. Be warned, compiling for Windows is somewhat painful (mainly because you also have to set up a compilation environment), although using the MSYS2 build environment with the appropriate tools allows Icarus to be built like Linux/Unix.
When built using the MinGW-w64 compiler, you can run Icarus Verilog either from a Windows command shell window or from a MinGW shell window.
Note: You will need to start a new shell to pick up any changes you have made to the "PATH" environment variable.
Note: If you use a MinGW shell, be aware that by default MSYS2 uses the mintty terminal emulator, which has the annoying artefact that it fully buffers all output to stdout. You can use the vvp -i option to overcome this when running simulations.
The iverilog.pdf, iverilog-vpi.pdf, and vvp.pdf files document the main commands. View these with Acrobat reader, or any other viewer capable of displaying PDF format files.
Note that because of differences in the MS libraries, some of the test suite tests will fail. These fails can be grouped into the following categories: three vs two digit exponents for real values (%e/%g), infinity/NaN are displayed differently, %#g gives an extra digit for 0.0. These have all been reported to the MinGW developers and for the most part do not change the validity/value of the result.
One of the VPI tests also fails. It appears that stdout/stderr do not behave the same as on other systems. The output for the test is out of order. This problem has not been investigated or reported to the MinGW developers.
Compiling on MS Windows (Cygwin) Edit
Cygwin users should preferably use the Mingw method to compile Icarus Verilog. Programs compiled by Mingw are perfectly usable under Cygwin, like any other Windows binary, so Mingw builds are the preferred distribution form. However, there are practical reasons to compile directly under Cygwin: file path handling and fully compatible test suite output.
Be warned that the Cygwin binary is noticeably slower than the Mingw compiled binary, so there is a trade off of compatibility vs speed of simulation.
In a Cygwin command line follow the instructions for Linux/Unix. The instructions are the same, as Cygwin is an attempt to be Unix under Windows.
In order to compile/install Icarus using Cygwin the following packages must be installed:
binutils, g++, autoconf, automake, make, flex, bison, gperf, libbz2-devel (otherwise system.vpi won't build)
They should all be available via the Cygwin setup program.
The ghostscript package (to get ps2pdf) is optional, but since Cygwin has a working "man" system, the man pages will be installed into a Cygwin system and ps2pdf is not required.
Installation From Premade Packages Edit
The various operation systems and distributions have various package management systems, and there are prepackaged distributions of Icarus Verilog available for some of them. If there is a prepackaged version that is suitable for your system and needs, then prepackaged installs are the easiest.
RPM Based Systems Edit
On systems that use RPM Package Manager (RPM) software packages, Icarus Verilog may be installed from a binary RPM package. If no binary RPM package is available for your system, then one can be easily made from a source RPM package.
Building a Binary RPM Package Edit
Source RPM packages are generally available at the same site where the source tarballs are hosted, and have the suffix ".src.rpm". Once downloaded, a binary RPM package can be built using:
% rpmbuild --rebuild verilog-version.src.rpm
(Older RPM Based Systems that do not have rpmbuild use rpm to build the binary packages.)
This compiles the source RPM package and makes a binary RPM package tailored for your system. The generated package is placed where you configured rpm to place built packages: often "/usr/src/rpm/RPMS". (NOTE: Building packages may require that you include other packages (notably -devel packages) that are not otherwise needed.)
Installing a Binary RPM Package Edit
Binary RPM packages, downloaded or built using the instructions above, can be installed with the following command (run as root):
# rpm -Uvh verilog-version.type.rpm
If you are using yum (Yellow dog Updater) as your RPM package updater/installer/remover, then you can install a downloaded or built binary RPM package with the following command (run as root):
# yum -y localinstall verilog-version.type.rpm
The openSUSE build service has now a web interface that allows to search for packages. To find Icarus Verilog packages go to the web page http://software.opensuse.org/search, select your version of the distribution and enter the search term verilog. Starting with openSUSE 10.3 the distribution supports a 1-Click install feature, allowing to start the installation by selecting the 1-Click link on the web page. The 1-Click install feature will add the repository as to the list of installation sources.
If you have an older version and not the 1-Click install feature installed, you can add the repository manually to your install source by following the instructions at the openSUSE web site.
Stable Version Edit
Prepackaged versions of the Icarus Verilog stable releases are available via the openSUSE build service. Simply browse to software.opensuse.org, search for verilog, and click the install button for the version you wish to install.
Development Snapshot Edit
Any development snapshots available prepackaged for openSUSE should be available at the openSUSE build service site.
This needs testing! See the discussion tab.
The Ubuntu Universe repository has the Icarus Verilog .deb package. To install Icarus Verilog follow the steps below
- Add the Universe repository in /etc/apt/sources.list using your favourite text editor (It would already be there but would have been commented). In Edgy Eft,the line would be something like
deb http://archive.ubuntu.com/ubuntu/ edgy universe deb-src http://archive.ubuntu.com/ubuntu/ edgy universe
- Run sudo apt-get update from terminal.
- Run sudo apt-get install verilog
Installing version 0.9.1 from a launchpad PPA repository on Intrepid and Jaunty Edit
Edit the list of available repositories (sudo access password required)
$ sudo gedit /etc/apt/sources.lst
and add the new repository (change the distribution name as appropriate)
## PPA for Icarus Verilog deb http://ppa.launchpad.net/team-electronics/ppa/ubuntu jaunty main deb-src http://ppa.launchpad.net/team-electronics/ppa/ubuntu jaunty main
Add the repository key to the system to avoid warnings
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7FE97A0D3D7F2EA1
Update the local repository cache
$ sudo apt-get update
Install (update) the Icarus Verilog package
$ sudo apt-get install verilog
Installing version 0.9.x from a PPA on Karmic, Lucid, Maverick, Natty, Oneiric, Precise, ... Edit
Add a new ppa (sudo access password required)
$ sudo add-apt-repository ppa:team-electronics/ppa
Update the local repository cache
$ sudo apt-get update
Install (update) the Icarus Verilog package
$ sudo apt-get install verilog
Optionally install (update) the GTKWave package
$ sudo apt-get install gtkwave
For centos 6 the installation is very easy:
yum install iverilog
and then type "y" when you are asked to confirm
Macintosh OS X Edit
Icarus Verilog can be easily installed on Mac OS using MacPorts, Homebrew or Fink.
% sudo port -v install gtkwave
% brew install icarus-verilog
Icarus Verilog can be used without a problem on FreeBSD-based systems. It is very simple to install and get it working. The fastest way is to use FreeBSD Ports collection.
FreeBSD Ports Edit
FreeBSD Ports collection includes Icarus Verilog as a port of it's base package. FreeBSD Ports collection normally is put under /usr/ports hierarchy.
Installation (as root--unless you've done some customization):
% # cd /usr/ports/cad/iverilog && make install clean
Now, you should be able to use "iverilog". If you use csh(1) shell, remember to type:
In case of having no /usr/ports directory, you'll have to fetch it by yourself. The easiest way is to copy /usr/share/examples/cvsup/ports-supfile to some other location:
% cp /usr/share/examples/cvsup/ports-supfile ~/csup-ports
Edit this file to change "CHANGE_THIS.FreeBSD.org" to appropriate FreeBSD mirror, and start downloading:
# csup -L 2 ~/csup-ports
Windows binaries wrapped in a handy installer are available from Pablo Bleyer Kocik's page "Icarus Verilog for Windows". This page makes available installers mainly for the most recent stable versions. Simply download the version of choice and execute the installer.