Table of Contents

Virtual Machine

There are different virtual machine environments.

VMWare

VMWare® provides a commercial version VMWare Fusion for Mac OS®. This has a very good integration in MacOS and I use it with MacOS 10.13.6 (High Sierra). It is not free. For Windows® there is the VMWare Player. The VMWare Player is free. I have not tested it.

VirtualBox

VirtualBox® is available for Windows, Linux and Mac OS. It is free. From my experience with MacOS it is not as good integrated as VMWare Fusion. If you want to use this, then download and install the the virtual machine software from https://www.virtualbox.org

Get the Lubuntu 18.04 install image

Download the ISO file for the 64 Bit Lubuntu 18.04.4 LTS Desktop version. You can download the image from here:

http://cdimage.ubuntu.com/lubuntu/releases/18.04.4/release/lubuntu-18.04.4-desktop-amd64.iso

Install the Lubuntu machine

This depends on the virtualization environment that you use.

VMWare

Create a new virtual machine with minimum 20GB hard disk. The hard disk will result in a file on the host operating system (Here MacOs) but the file size on the host will be dynamic, i.e. it will depend on the actual usage in the virtual machine. I have selected 300GB. Use the username “caeuser” with password “caeuser” because that is the setting in the lab and all descriptions are based on this. The name of your computer shall be “vcae”.

You need to install the guest additions. Without the guest additions, the interaction with the host system is not working (file sharing / Clipboard). Run “Virtuelle Maschine → VMWare Tools installieren” in the VMWare menu. Then run the following:

cd
mkdir vmware
cp /media/caeuser/VMwareTools-<versionnumber> vmware
cd vmware
tar -xvzf VMwareTools-<versionnumber>
cd vmware-tools-distrib
sudo ./vmware-install.pl 

Say “yes” to all questions…

Virtualbox

to be done

Install Quartus 13.0sp1 and Modelsim

The following steps will install

These versions are required for the Altera DE1 board which is used in the digital design lab and is available in the library. This Quartus version is the last version that supports the Altera Cyclone II FPGA which is on that board. So do not install a later version if you want to use that board.

Install the software at “/opt/altera/13.0sp1”. Create the altera directory and change the owner to the caeuser username.

sudo mkdir /opt/altera
sudo chown caeuser:caeuser /opt/altera

Install 32Bit Libraries

Quartus and Modelsim require 32Bit Libraries which are not installed by default.

Enable multiple architectures (32 Bit / 64 Bit)

sudo dpkg --add-architecture i386
sudo apt-get update

Install the 32Bit libraries

sudo apt-get install libc6:i386 libpng16-16:i386 libfreetype6:i386 libsm6:i386 libxrender1:i386 libfontconfig1:i386 libxext6:i386 libxft2:i386 libncurses5:i386

Missing libpng12

The quartus software requires the libpng12 library but Lubuntu 18.04 comes with libpng16. If you do not install libpng12, then the following error will occur:

fritz@vcae:~$ quartus
quartus: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
caeuser@vcae:~$ 

The following check shows that libpng16 is installed but quartus needs libpng12.

fritz@vcae:~$ dpkg -l | grep png
ii  libpng16-16:amd64                     1.6.34-1ubuntu0.18.04.1             amd64        PNG library - runtime (version 1.6)
caeuser@vcae:~$

So download, compile and copy the libpng12 library to the quartus install directory. You have to install both, the 32bit and the 64bit versions.

cd
cd cae
sudo apt install build-essential gcc-multilib zlib1g-dev:i386
wget https://www.hs-augsburg.de/homes/beckmanf/public/libpng-1.2.59.tar.gz
tar -xvzf libpng-1.2.59.tar.gz
cd libpng-1.2.59
CFLAGS='-m32' ./configure --libdir=/usr/lib/i386-linux-gnu
make
sudo make install
make clean
./configure --libdir=/usr/lib/x86_64-linux-gnu
make
sudo make install

Download and install Quartus 13.0sp1 (incl. Modelsim)

cd
mkdir cae
cd cae
wget http://www.hs-augsburg.de/~beckmanf/public/Quartus-web-13.0.1.232-linux.tar
tar -xvf Quartus-web-13.0.1.232-linux.tar
./setup.sh

The installation directory is /opt/altera/13.0sp1. You do not need to install the Arria, Cyclone V and MAX device support. Choose the ModelSim-Altera Starter Edition (Free). The Help files are optional.

adapt .profile for PATH

First add a symbolic link to the current version of the quartus software

cd /opt/altera
ln -s 13.0sp1 version
cd

In order to be able to start the binaries from the commandline, the path for the binaries has to be in the PATH environment variable. For that you have to modify the .profile file in your home directory. Append the following snippet to the .profile file with vi.

.profile
# Include the ALTERA fpga software
PATH="$PATH:/opt/altera/version/quartus/bin"
# Include the ALTERA Modelsim VHDL simulator
PATH="$PATH:/opt/altera/version/modelsim_ase/bin"

Then you have to logout and login again to make the changes active.

Fix linux_rh60 vco script problem

When you run modelsim and see:

caeuser@vcae:~/cae$ vsim
Error: cannot find /opt/altera/13.0sp1/modelsim_ase/bin/../linux_rh60/vsim
caeuser@vcae:~/cae$

then, you have to fix the vco script. First change the permissions such that you can modify the script.

cd /opt/altera/13.0sp1/modelsim_ase
chmod u+w vco

Open the vco with

vi vco

and find the following section

      else
        case $utype in
          2.4.[7-9]*)       vco="linux" ;;
          2.4.[1-9][0-9]*)  vco="linux" ;;
          2.[5-9]*)         vco="linux" ;;
          2.[1-9][0-9]*)    vco="linux" ;;
          3.[0-9]*)             vco="linux" ;;
          *)                vco="linux_rh60" ;;

And change the “linux_rh60” entry to “linux”.

Fix the libfreetype problem

If you see

caeuser@ADLab-Tools-OS:~$ vsim
Error in startup script:
Initialization problem, exiting.

Initialization problem, exiting.

    while executing
"InitializeINIFile quietly"
    invoked from within
"ncFyP12 -+"
    (file "/mtitcl/vsim/vsim" line 1)
** Fatal: Read failure in vlm process (0,0)
caeuser@ADLab-Tools-OS:~$

then you have to install an old version or differently configured version of libfreetype. Enable the deb-src packages in the /etc/apt/sources.list file to make the build dependencies work. It should look like this:

#deb cdrom:[Lubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main multiverse restricted universe

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

Now install the build dependencies and compile and install the old libfreetype version.

cd
cd cae
sudo apt update
sudo apt build-dep -a i386 libfreetype6
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.8.1.tar.gz
tar -xvzf freetype-2.8.1.tar.gz
cd freetype-2.8.1
CFLAGS='-m32' ./configure --without-png
make -j8

It is important to configure the freetype library with “–without-png”. Copy the libfreetype library files to the modelsim directory.

mkdir /opt/altera/13.0sp1/modelsim_ase/lib32
cp objs/.libs/libfreetype.so* /opt/altera/13.0sp1/modelsim_ase/lib32/

Now you have to change modelsim /opt/altera/13.0sp1/modelsim_ase/vco file and find the location:

dir=`dirname "$arg0"`

After that line add

export LD_LIBRARY_PATH=/opt/altera/13.0sp1/modelsim_ase/lib32

USB Settings

For the USB programming via the USB Blaster™, the port permissions have to be set correctly. For that you have to create and add the file “51-usbblaster.rules” to the directory “/etc/udev/rules.d” and reboot.

/etc/udev/rules.d/51-usbblaster.rules

The file should contain the following rules for the Altera DE1 board.

51-usbblaster.rules
# Altera USB-Blaster for Quartus FPGA Software
SUBSYSTEMS=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
SUBSYSTEMS=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666"
SUBSYSTEMS=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666"
# USB-Blaster II
SUBSYSTEMS=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666"
SUBSYSTEMS=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="0666"

For the following test you need to attach the Altera Board to your computer. Notice that you have to attach the usb device to the virtual machine (Virtual Box) with Devices→USB Devices→Altera USB-Blaster. Then you should be able to see the device in the usb device list with lsusb.

caeuser@vcae:/etc/udev/rules.d$ lsusb
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 003: ID 09fb:6001 Altera Blaster
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
caeuser@vcae:/etc/udev/rules.d$

You can see the permissions for the devices with ls. See the rw rights for “others” for the device 003 which is the usb blaster. That is a result of the rules file.

caeuser@vcae:/etc/udev/rules.d$ ls -l /dev/bus/usb/001/
insgesamt 0
crw-rw-r-- 1 root root 189, 0 Mai  7 16:35 001
crw-rw-r-- 1 root root 189, 1 Mai  7 16:35 002
crw-rw-rw- 1 root root 189, 2 Mai  7 16:38 003

If your permissions for the usb port are correct, then you should be able to scan the jtag chain with jtagconfig.

caeuser@vcae:/etc/udev/rules.d$ jtagconfig --enum
1) USB-Blaster [1-2]                          
  020B30DD   EP2C(15|20)

fritz@fritz-VirtualBox:/etc/udev/rules.d

Start Modelsim

vsim

Start Quartus

quartus

Only Bachelor ET and ME students: Install qfsm

QFSM ist the state chart editor used in the lab. First you need to install some required packages.

sudo apt-get install cmake qt4-dev-tools libgraphviz-dev

Then you can build and install qfsm.

cd
mkdir qfsm
cd qfsm
wget http://sourceforge.net/projects/qfsm/files/qfsm/qfsm-0.52/qfsm-0.52.0-Source.tar.bz2/download -O qfsm.tar.bz2
bunzip2 qfsm.tar.bz2
tar -xvf qfsm.tar
mkdir build
cd build
cmake ../qfsm-0.52.0-Source
make
sudo make install

Optional: Install Quartus 18.1

You need Quartus 18.1 to program the Altera DE1 Soc board with the Cyclone V fpga. How to install Quartus 18.1

Very Optional: Download and build the mips toolchain

The MIPS Cross Compiler is only needed for the patterson project.

Follow the instructions in MIPS Cross Compiler build

Test the installation

Install git

sudo apt-get install git

Download the “Digitaltechnikpraktikum” from the git server: https://gitlab.elektrotechnik.hs-augsburg.de/beckmanf/digitaltechnikpraktikum

cd
mkdir projects
cd projects
git clone https://gitlab.elektrotechnik.hs-augsburg.de/beckmanf/digitaltechnikpraktikum.git

Now start a Modelsim simulation

cd digitaltechnikpraktikum
cd sim
cd ledcomb
make sim

To run a synthesis

cd digitaltechnikpraktikum
cd pnr
cd ledcomb
make compile
make quartus

If you have a FPGA Board, you can download and test the design.

make prog

Trademarks

MIPS® and MIPS I™ are trademarks of MIPS Technologies Inc.. See Mips Trademark usage

Altera®, Quartus®, Nios®, Cyclone®, USB-Blaster™, SignalTap™ are trademarks of Altera Corporation. See Altera Trademark Usage Guidelines

VMWare® is a trademark of VMWare Inc.

Apple®, Mac OS®, MacBook® and Mac® are trademarks of Apple Inc.

Windows® is a trademark of Microsoft Corporation.

VirtualBox® is a trademark of Oracle Corporation.

ModelSim® is a trademark of Mentor Graphices Corporation

Linux® is a trademark of Linus Torvald

Ubuntu® is a trademark of Canonical Ltd.

This is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by any of these companies.