Simulate RTL Designs on Mac
2 min read
It is frustrating to see that we just can't compile basic verilog or system verilog designs on our laptops for quick testing. It is just not possible to log onto EDA playground every now and then just to confirm correct syntax. This needs to be looked at and we need a way to get designs to at least compile on our laptops.
The entire RISC-V movement has given a boost to the open-hardware community. The open source tools are now matured enough to support various system verilog constructs. This blog post discusses the steps necessary to get "iverilog" and "gtkwave" working on a MacBook which allow us to compile and simulate basic RTL designs.
The first and foremost requirement is to have "homebrew" installed on your mac. You can do that by following the steps listed at their installation page.
Once homebrew is installed, open up the terminal and follow these steps:
The iverilog package available on homebrew isn't up-to-date and hence we would first need to get the latest iverilog source code from Github and build it on our machine. The command below would fetch the latest iverilog source code:
git clone https://github.com/steveicarus/iverilog.git
We need to install a few dependencies before building iverilog from the source. We would use homebrew to get these dependencies:
brew install autoconf brew install bison (version 3.0 is needed) brew install flex
We can now start building iverilog. Make your way to iverilog folder and follow these:
sh autoconf.sh ./configure make make install
Voila! We should have iverilog ready to be used.
We just need to install gtkwave, after all it is not useful if we just can't debug using waveforms! This is easy as the package is readily available at http://gtkwave.sourceforge.net/gtkwave.zip
Pro tip: Add the unzipped gtkwave directory to your $PATH variable in order to allow the terminal to find it from anywhere. Here is the command:
echo 'export PATH="<unzipped_gtkwave_dir>:$PATH"'
That's it. Time to test your setup using the 100DaysofRTL repository.