Simulation guide

From Zet

Jump to: navigation, search

This guide is a description on how to simulate Zet with Modelsim in Linux, as this is the OS used for Zet development. You don't need to be root at any moment.

Downloading and installing Modelsim

First, we need to get Modelsim for Linux from the Altera website, which is free of charge and doesn't need any license. To do this:

  1. Go to altera.com and then click on the upper right link "Download Center".
  2. Under the section Altera Edition Third-Party Software click on the first ModelSim®-Altera® link.
  3. There, we are going to download the latest version of ModelSim-Altera Starter Edition, the left most column, upper link named 6.5b, which is the latest at this time.
  4. We search for the Linux (ModelSim-Altera Starter Edition) and click on Download Service Pack.
  5. Now, we can create a one-time access, by entering an email address (any address will work) and the download will start. It's a 540 Mb file :) We choose to download it at ~/Downloads for example.
  6. Once downloaded, we untar it. So we open a terminal window:
cd ~/Downloads
tar xvf 91sp2_modelsim_ase_linux.tar
cd modelsim_ase/
./install_st   # we need csh installed to get it running

Now we press intro for accepting the default LINUX installation and we write /home/user/opt/altera9.1sp2 as the default target directory. After a while, the installation will finish. We can delete now the installation files:

cd ..
rm -fR 91sp2_modelsim_ase_linux.tar modelsim_ase/

Downloading and simulating Zet

  1. First download the source for the latest version from the main page. Let's say we take the .tar.bz2 version. Let's place it under the ~/Downloads directory.
  2. Untar the archive with: cd ~; tar xjvf Downloads/Zet-1.1.1.tar.bz2 considering that v1.1.1 is the latest version.
  3. We need to have a working BIOS for simulation. We are going to use a stub test as a BIOS. To do that: cd zet-1.1.1/tests; make 00_stub.de1; cd ~ and it will assemble the test and place it under the simulation folder.
  4. Everything is ready now, so we can launch Modelsim by executing: ~/opt/altera9.1sp2/modelsim_ase/linux/vsim
  5. Now a graphic screen will appear. We can close the welcome dialog. Now to start the simulation, we enter the following commands inside the Transcript window in Modelsim:
cd zet-1.1.1/boards/altera-de1/sim
do t.do

And if everything goes well, you will have a 5us simulation showing the program behaviour.

Notes

To be able to run it from the graphical desktop such as Gnome without opening a terminal, we can create a script like this and place it under /home/user/bin/sim-zet:

#!/bin/bash
cd /home/user/zet/cores/zet/sim
screen -d -m /home/user/opt/altera9.1sp2/modelsim_ase/linux/vsim

And make this scrip executable: chmod 755 /home/user/bin/sim-zet. Now we can create a custom panel launcher with an icon. When clicking the icon, Modelsim will launch automatically inside the Zet simulation folder, so only a do t.do is needed :)

Personal tools