SystemVerilog: Connect interface to pure Verilog modules

SystemVerilog interfaces gives us a very good tool to make the code cleaner and less error prone. If you have a group of ports that go together, you can group them into a single interface and reduce huge amount of code.

Thats great. But if you have a pure verilog module and want it to stay that way. How should we connect the interface to the pure Verilog module? Its easy as well. Just create an instance of a module and an instance of the interface. When you instantiate the verilog module use the interface’s members as module’s ports. Now you can drive your module through the interface or connect the module to another SystemVerilog module that accepts the same interface.

Crack and install Modelsim on linux

Note: Piracy is crime. Please don’t use or encourage pirated software. If you would like to evaluate Modelsim, try the evaluation version. If you still haven’t changed your mind, read on :P.

1) Install the required dependencies

2) Download modelsim 10.1c for linux and its corresponding crack.

3) Mount the downloaded modelsim iso and install modelsim.

mkdir /tmp/modelsim/
mount -o loop path-to-iso /tmp/modelsim
cd /tmp/modelsim

Note:Install modelsim under ~/modelsim/ directory. If you choose another location, please make sure you exchange the default location with your preferred location in the steps below.

4) Execute this script to crack modelsim

Comment the first two lines in the generated license.dat

#SERVER xxxx xxxxxxxxxxxx 27001
#VENDOR mgcld D:FEATURE mgc_s mgcld 2020.00 1-jan-2021 999 0 TS_OK

5) Fix libfreetype problem (Only required if you face this problem)
Try to start vsim

cd ~/modelsim/modeltech/linux_x86_64/

If vsim reports the following error, your distro’s freetype library doesn’t play well with modelsim.

** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)

Use the following script to compile custom freetype

6) Modelsim is ready to use! One last step, add these commands to ~/.bashrc to avoid executing every time you start a new terminal

Linux and Modelsim!!!! Ain’t it fun?

Quartus: Launch test bench in modelsim

To use modelsim as the default simulator in quartus, please follow this blog post.

Step 1: Open settings dialog box by clicking Assignment->Settings menu or by using the keyboard shortcut Ctrl+Shift+E. The settings dialog box should appear.

Step 2: Select EDA Tool Settings->Simulation option in the sidebar.

Step 3: Enable test bench by selecting the option Compile test bench.


Step 4: Click Test Benches… button to create test benches. Test benches dialog should appear.

Step 5: Click New button to create new test bench. New Test Bench Settings dialog should appear.


Step 6: In the New Test Bench Settings dialog, provide the name of your test bench using Test bench name.

Step 7: Add all the necessary test bench and implementation files by clicking File name ellipsis button.


Step 8: Click Ok to create new test bench. Test Benches dialog should now list the test bench you created.

Step 9: Click Ok. Click Apply in Settings dialog box.

Step 10: To launch ModelSim simulator, you have to first Compile your design by clicking the Start compilation icon or by using the Ctrl+L shortcut.

Step 11: After the compilation is successfully completed, launch simulation by clicking RTL Simulation icon.

Quartus: set simulator for already existing project

In this post, I will show you how to change simulation tool for an existing project.

Changing simulation tool

Step 1: Open settings dialog box by clicking Assignment->Settings menu or by using the keyboard shortcut Ctrl+Shift+E. The settings dialog box should appear.

Step 2: Select EDA Tool Settings->Simulation option in the sidebar.

Simulation settings
Step 3: In the simulation settings page, select the required simulation tool using Tool name drop down box.

Setting simulation tool path

Now that you have instructed Quartus to use the simulation tool you wanted, you should also inform Quartus where it can find this tool.

Step 1: Open options dialog box by clicking Tools->Options menu. Options dialog box should open

Step 2: In the option dialog box, select General->EDA Tool options in the sidebar.

Step 3: in the EDA Tool options page, set the path to your desired tool.

EDA Tool options