Using Lattice Modelsim on Windows and Linux , 01 Jan 2022

I am a supporter of open source and have benefitted greatly from using open tools like verilator and Yosys. However, there are many times when its simply not possible to use these tools with a simulator like verilator since the the FPGA vendors provide IP that are encrypted for either FPGA hard macros such as the Serdes or higher level blocks like MIPI. Component vendors also provide encrypted models of their parts like memories assuming one of the closed simulators.

These encrypted IP cannot be simulated on an open source toolchain. Language support also was lacking for some System Verilog constructs I liked to code with at the time (packed struct).

I tend to use Lattice FPGA’s quite a bit it in my work, on things like the [UPduino][the-upduino]. This blog demonstrates how to setup your environment assuming you have already installed the Lattice Semiconductor Radiant toolchain. The Radiant tolchain is relatively small and not bloatware like the Xilinx toolchain and since it works on both Linux and Windows, enables a developer to now have access to a commercial simulation environment with minimal overhead.

Setup

I prefer to use command line tools such as make for all my work and detest GUI’s as they are not automatable and require documentation to run properly and even then, subject to user errors. As such, I like to install git bash on my windows machine. Now, its possible to setup WSL2 as well and that should work fine too.

The isntructions are pretty similar for Linux and can be modified slightly where required.

$ vlog

Model Technology ModelSim - Lattice FPGA Edition vlog 2020.3 Compiler 2021.02 Feb 11 2021