In order to install LegUp on an EECG Machine, you must have already sent your machine's public key to LegUp's repository.
After transmission, the following dependencies must be satisfied:
ModelSim allows for timing and functional simulation of a given hardware description (Verilog is used in LegUp). On the EECG machines, ModelSim behaves incorrectly due to an old FreeType package. Without modifying the FreeType package, you will more than likely encounter this error:
$ vsim ** Fatal: Read failure in vlm process (0,0) Segmentation fault $
To combat this issue, run the following commands:
$ cd ~/ $ mkdir freetype/ $ cd freetype/ $ wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2 $ tar -jxvf freetype-2.4.12.tar.bz2 $ cd freetype-2.4.12 $ ./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"\ --prefix=$HOME/freetype $ make -j8
You'll also need to reflect PATH changes:
$ nano ~/.cshrc ### ADD THIS LINE TO BOTTOM. setenv LD_LIBRARY_PATH $HOME/freetype/freetype-2.4.12/objs/.libs ### EXIT EDITOR $ source ~/.cshrc
This should alleviate the issue.
LLVM is the main machinery in place with LegUp's HLS process. LLVM is used as a way to represent code in a contextually independent form (i.e. a generic assembly-like fashion). LegUp operates on this representation. Hence, LLVM needs to be installed. Unfortunately, EECG's GCC version (which is Version 4.7.x) is out of date. According to LegUp, GCC-4.7 should be fine for compilation. However, after testing, this is not true (on the EECG machines). Hence, we will install a local copy of GCC, and have our PATH reflect this change, such that LegUp will utilize this.
To install GCC locally, enter the following commands:
$ cd ~/ $ mkdir toolchains $ cd toolchains $ wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 $ wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2.sig $ wget https://ftp.gnu.org/gnu/gnu-keyring.gpg $ signature_invalid=`gpg --verify --no-default-keyring --keyring\ ./gnu-keyring.gpg gcc-4.8.2.tar.bz2.sig` $ if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi $ tar -xvjf gcc-4.8.2.tar.bz2 $ cd gcc-4.8.2 $ ./contrib/download_prerequisites $ cd .. $ mkdir gcc-4.8.2-build $ cd gcc-4.8.2-build $ $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++ $ make -j$(nproc) $ make install
You will also want to reflect PATH changes:
$ nano ~/.cshrc ### ADD THIS LINE TO BOTTOM. set path = ($path ~/toolchains/bin) ### EXIT EDITOR $ source ~/.cshrc
You'll also want to create a local alias of GCC, and G++ from this version.
$ nano ~/.u_alias ### ADD THESE LINES TO ALIAS alias gcc ~/toolchains/bin/./gcc alias g++ ~/toolchains/bin/./g++ alias gcc-4.8 ~/toolchains/bin/./gcc ### EXIT EDITOR $ nano ~/.cshrc ### ADD THIS LINE TO CSHRC FILE source ~/.u_alias ### EXIT EDITOR $ source ~/.cshrc
To Install LLVM, follow this procedure:
$ cd ~/ $ mkdir llvm; cd llvm/; $ wget http://releases.llvm.org/3.5.1/llvm-3.5.1.src.tar.xz $ tar -xvfJ llvm-3.5.1.src.tar.xz $ cd llvm-3.5.1.src/ $ mkdir build/ $ cd build/ $ setenv CC ~/toolchains/bin/gcc $ setenv CXX ~/toolchains/bin/g++ $ cmake .. -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$HOME/toolchains/lib64 -L$HOME/toolchains/lib64"
Lastly, we must modify some path variables (since our local installation will be used).
You must allow the shell path to be able to refer to LLVM, Quartus, and Quartus's SoPC software libraries, hence we can add the following to the path:
$ nano ~/.cshrc ### ADD THIS TO END OF FILE set path = ($path /pkgs/altera/quartus/quartus13.1/linux/quartus/bin) set path = ($path /pkgs/altera/quartus/quartus13.1/linux/modelsim_ase/bin) set path = ($path ~/llvm/llvm-3.5.1.src/build/bin) set path = ($path /pkgs/altera/quartus/quartus13.1/linux/quartus/sopc_builder/bin) ### EXIT EDITOR $ source ~/.cshrc
We also will need to modify LegUp's makefile to reflect one change (due to the local GCC installation).
### MODIFY Makefile ### CHANGE THIS: $(MAKE) -C dragonegg GCC=$(DRAGONEGG_GCC_VERSION) LLVM_CONFIG=../llvm/$(LLVM_BUILD)/bin/llvm-config ### TO THIS: #$(MAKE) -C dragonegg GCC=$(DRAGONEGG_GCC_VERSION) LLVM_CONFIG=../llvm/$(LLVM_BUILD)/bin/llvm-config $(MAKE) -C dragonegg GCC=~/toolchains/bin/./gcc LLVM_CONFIG=../llvm/$(LLVM_BUILD)/bin/llvm-config ### END MODIFY
You can now install LegUp on the EECG machine.