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:
- Go to altera.com and then click on the upper right link "Download Center".
- Under the section Download Individual Components, on Step 1 click on ModelSim-Altera Starter Edition.
- Then on Step 2, click on the latest version 10.0c for Quartus II v11.1.
- Finally, we click on Step 3 View Download.
- We click on Download Option 2: Individual Files (Linux Platform).
- 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 689 Mb file :) We choose to download it at ~/Downloads for example.
- Once downloaded, we untar it. So we open a terminal window:
cd ~/Downloads chmod 755 11.1_modelsim_ase_linux.sh ./11.1_modelsim_ase_linux.sh
It will decompress the file, and start a graphical installation screen. We may get an error about & unexpected. In that case, we have to change the shell used to #!/bin/bash in ./11.1_173_modelsim_ase_linux/setup. Then you can run that file again.
We click on Next >, we click on I agree to the terms and click Next > again, the installation directory should be ~/opt/altera/11.1 and Next >. We select all the components in the list, and Next >, Finally Next >. It'll begin copying files and finishes with a message, we click on OK and then Finish.
Downloading and simulating Zet
- 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.
- Untar the archive with: cd ~; tar xjvf Downloads/Zet-1.2.0.tar.bz2 considering that v1.2.0 is the latest version.
- 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.2.0/cores/zet/tests; make 00_stub.rtlrom; cd ~ and it will assemble the test and place it under the simulation folder.
- Everything is ready now, so we can launch Modelsim by executing: ~/opt/altera/11.1/modelsim_ase/linux/vsim. If you get an error, it may be because you are running it under x86_64 and you probably need to install the ia32-libs package
- 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.2.0/cores/zet/sim do t.do
And if everything goes well, you will have a 10us simulation showing the program behaviour.
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/altera/11.1/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 :)