GEZEL Installation

From Gezel2

Jump to: navigation, search

Contents

Installation of the Binaries

The latest version of GEZEL (2.4) is distributed as binaries for Ubuntu 9.04. You can find debian packages from the sourceforge download site.

Installing GEZEL using binaries is the preferred method of installation. Use the 'Installation starting from Source Code' procedure only in the following cases:

  • You have a hard platform constraint (Cygwin, solaris, etc).
  • You do intend to do source code development in the GEZEL kernel.
  • You intend to use the SystemC or JAVA cosimulation interfaces.

Install GEZEL

From a Ubuntu prompt, install the GNU multiprecision library

 sudo apt-get install libgmp3c2

Download the gezel packages from GEZEL/sourceforge. Install the GEZEL binaries using

 sudo dpkg -i gezel-2.4.deb

Optionally, install the GEZEL source code using

 sudo dpkg -i gezel-2.4-src.deb

The sudo command requires you to enter the superuser password for your machine. On a Ubuntu single-user installation, this is your own password.

Install support for ARM cosimulation

The ARM ISS used by GEZEL is derived from the SimIt-ARM project (by Wei Qin). Download the ARM ISS and GNU cross compiler from GEZEL/sourceforge. Install the ARM ISS binaries using

 sudo dpkg -i simit-arm-sfu.deb

Install the ARM cross-compiler using

 sudo dpkg -i arm-linux-gcc-3.2.deb

Optionally, install the ARM ISS source code using

 sudo dpkg -i simit-arm-sfu-src.deb

Install support for 8051 cosimulation

The Dalton 8051 ISS (UC Riverside) is built into GEZEL. However, to compile C code, you need the Small Devices C Compiler. Install it using

 sudo apt-get install sdcc-nf

Install support for Picoblaze cosimulation

The Picoblaze ISS (Mark Six) is built into GEZEL. You will need the Picoblaze assembler from Xilinx in order to create the proper 'dec' files.

Installation starting from Source Code

These instructions describe installation of GEZEL starting from Source Code. The latest revision of these notes was made under GEZEL 2.3.

Available Packages

GEZEL can be downloaded as a source-only package. The source package consists of several components.

  • A standalone simulator for GEZEL code.
  • A cosimulator for SystemC 2.0.1
  • A platform simulator for ARM, i8051 and picoblaze
  • A cosimulator for JAVA code and the AVRORA core
  • A test subdirectory with several examples for each cosimulator

After downloading the package, uncompress it using tar:

 >tar xfvz gezel-2.x.tar.gz (On Linux)
 >cd gezel-2.x

Compilation Dependencies

GEZEL is written in C++ and compiles under a standard GNU build environment using the GNU C compiler, GCC. The package has automatic configuration.

Apart from GCC, you will also need the following:

  • GNU Multiprecision Library (http://www.swox.com/gmp/). You can check the presence of this package in your system by looking for libgmp.a (usually installed under /usr/lib/).
  • The Flex/Lex lexical analyzer (http://flex.sourceforge.net/), in case you make modifications to the fdl.ll scanner, or if the installed version of flex is imcompatible with the version installed on the build machine.

A common compilation error is when the C source of the scanner (gezel/fdl.cc) is incompatible with the Flex configuration on the build machine. This looks, for example, like:

   fdl.cc:394: error: no 'int fdlFlexLexer::yywrap()' member function declared in class 'fdlFlexLexer'

If you do see an error in fdl.cc during compilation, you can remove that file. It will be re-generated out of flex.ll. Of course, this will only work if you have flex installed on the build machine.

Platform-Specific Instructions

Standalone tools

The standalone tools include the GEZEL kernel and the simulator, fdlsim. In the directory where you downloaded GEZEL, execute

 >./configure --enable-standalone

If the GNU Multiprecision library is not installed in a standard location, you will need to define CPPFLAGS and LDFLAGS as arguments to configure. For example, assuming the GMP library (libgmp.a/so) is installed under /opt/gmp/lib and the include files for GMP are under /opt/gmp/include, then you would run

 >./configure --enable-standalone CPPFLAGS=-I/opt/gmp/include LDFLAGS=-L/opt/gmp/lib

If you want to select an installation directory, use the --prefix option of configure. The default installation directory is the ./build subdirectory from where you installed the GEZEL source. Use the --help option in configure to see a list of available command line options. Next type:

 >make

followed by

 >make install

The default configuration will create the library, the stand-alone simulator and the code generation. The standalone simulator is call fdlsim. You can test the simulator on one of the examples in the test/ directory. For example, 8 cycles from the Bresenham vector generator application can be simulated using:

 >cd test/gezel
 >../../build/bin/fdlsim bresen.fdl 8
 Cycle: 2 Plot point (5/5,2/1)
 Cycle: 3 Plot point (5/5,1/0)
 Cycle: 4 Plot point (5/5,0/-1)
 Cycle: 5 Plot point (5/5,-1/-2)
 Cycle: 6 Plot point (5/5,-2/-3)
 Cycle: 7 Plot point (5/5,-3/-4)
 Cycle: 8 Plot point (5/5,-4/-5)

GEZEL configure options

The GEZEL autoconfiguration tools support the options of the standard autoconf environment. The following list includes the most popular ones, as well as

General Options
--prefix Installation directory
CPPFLAGS=flags Additional flags for the C compiler
LDFLAGS=flags Additional flags for the linker
GEZEL-specific options
--enable-standalone Build standalone tools (fdlsim)
--enable-gplatform Build gplatform simulator (ARM,8051, and picoblaze)
--enable-simitsfu Include support for SFU and [Simit-ARM-2.1-sfu]
--enable-java Build JAVA cosimulation interface
--enable-systemccosim Build SystemC cosimulation interface
--with-simit=path Path to SimIt-ARM installation
--with-systemc-lib=path Path to SystemC installation


gplatform Cosimulator

GEZEL can be cosimulated with instruction set simulators, using the C++ API on the backend of GEZEL.

Simit-ARM and associated tools

The homepage for SimIt-ARM is http://sourceforge.net/projects/simit-arm/. The cosimulation is written on top of Version 2.0 (or later) of SimIt-ARM. Starting with gezel-2.2, you can also use a SimIt-ARM with additional support for codesign: [Simit-ARM-sfu]. After you have downloaded SimIT-ARM, unpack it.

 >tar zxfv SimIt-ARM-2.x.tgz

SimIT-ARM-2.x has a built-in cosimulation interface, that must be enabled with the macro COSIM_STUB while the packge is configured and installed.

 >cd SimIt-ARM-2.1
 >./configure CPPFLAGS=-'DCOSIM_STUB'
 >make
 >make install

This will install the SimIt-ARM ISS (as stand-alone libraries as well as executables) under SimIt-ARM-2.0/build. If you plan to install the cosimulators in a different location than the standard build subdirectory, use the --prefix command line option with configure:

 >./configure CPPFLAGS=-'DCOSIM_STUB' --prefix=my_target_dir

In particular, it is not a good idea to copy executables from the build directory to a target directory by hand. This is because SimIt-ARM hard-codes the default path to the floating point emulator that it relies on (nwpfe.bin).

To run the armcosim cosimulator, you need to provide a GEZEL file and an ARM-ELF executable. The ARM-ELF executable must be statically linked. These executables can be created using an ARM cross-compiler. This compiler can be downloaded for example from the ARM-Linux FTP site (ftp://ftp.arm.linux.org.uk).

Dalton i8051 and associated tools

The 8051 cosimulator is based on the instruction-set simulator from the Dalton project at UC Riverside (http://www.cs.ucr.edu/~dalton/i8051/). The instruction-set simulator itself is included in the source code, and contains a few small modifications to include the cosimulation interfaces.

The 8051 programs for gezel51 are provided in Intel Hex format. They can be created using the Small Devices C Compiler, available from http://sdcc.sourceforge.net/. Refer to that page for download and installation instructions of the sdcc compiler.

Picoblaze and associated tools

The picoblaze cosimulator is based on the instruction-set simulator from the kpicosim project by Mark Six. The instruction-set simulator itself is included in the source code.

The Picoblaze core reads files in Intel Hex format, produced using the Picoblaze assembler. The assembler may be downloaded from the Xilinx Picoblaze resources website.

Compiling and installing the gplatform cosimulator

Once you have prepared the ARM ISS, you can configure GEZEL to enable compilation of gplatform. Use the --enable-gplatform flag for this. If required, also use the --with-simit flag to indicate the path the the ARM ISS.

 >./configure --enable-gplatform --with-simit=/opt/Simit/build
 >make
 >make install

To test the installation, run one of the examples of gplatform under the test/ directory, for example:

 >make
 >/usr/local/arm-3.3.2/bin/arm-linux-gcc -static  hello.c -o hello
 >make sim
 >../../../build/bin/gplatform  hellomodel.fdl
 armsystem: loading executable [hello]
 armsystem: loading executable [hello]
 Hello: [Jefke] [Piet] [and] [Pol] 
 Hello: [Jefke] [Piet] [and] [Pol] 
 Total Cycles: 43653

SystemC Cosimulator

SystemC adds hardware-oriented constructs as a class library implemented in standard C++. Its use spans design and verification from concept to implementation in hardware and software. SystemC provides an interoperable modeling platform which enables the development and exchange of very fast system-level C++ models. It also provides a stable platform for development of system-level tools. GEZEL blocks can be embedded in a SystemC simulation. SystemC is used as a simulation backbone, but can support modules described in GEZEL FSMD. This is convenient to add hardware 'scripting' to a particular environment. Each time the SystemC simulator starts, it can parse a new GEZEL description. The cosimulation uses SystemC 2.0.1, available from http://www.systemc.org You need to install this package before creating the cosimulator. You can build it as follows

 >tar zxfv systemc-2.0.1.tgz
 >cd systemc-2.0.1
 >configure
 >make
 >make install

The installation is done by default under Systemc-2.0.1. We will assume this location in the following.

The cosimulator in GEZEL is a C++ library with cosimulation interfaces. It is created as follows. We configure GEZEL with the --enable-systemccosim flag. You also need to indicate the location where the SystemC library can be found with the --with-systemc-lib configuration flag. The library path of SystemC is dependent on the host machine type. We assume a Linux machine here. cd gezel

 >./configure --enable-systemccosim \
     --with-systemc-lib=/home/guest/systemc-2.0.1/lib-linux

If you happen to have the GMP library installed in a non-standard location, do not forget to include CPPFLAGS and LDFLAGS for that one as well. For example,

 >./configure --enable-systemccosim \
     --with-systemc-lib=/home/guest/systemc-2.0.1/lib-linux \
     CPPFLAGS='-I/opt/gmp/include' \
     LDFLAGS='-L/opt/gmp/lib'

Next, make and install the cosimulator in GEZEL. This will create a library libgzlsysc.a

 >make
 >make install

The systemc cosimulation can be tested on the examples in test/systemc. Compile the program as for a normal SystemC program. The include path should contain both the SystemC include path as well as the GEZEL include path.

 >g++ -g -O3 -Wall -c \
    -I/home/schaum/systemc-2.0.1/include \
    -I../../../devel/build/include/gezel \
    accum_sc.cxx -o accum_sc.o

After compilation, link with the SystemC library, the GEZEL library, the library with cosimulation interfaces and finally the gmp library.

 >g++ -g accum_sc.o -L../../../devel/build/lib/ \
     -lgzlsysc -lfdl -lgzlsysc \
     -L/home/guest/systemc-2.0.1/lib-linux \
     -lsystemc -lgmp -o systemc_cosim

Note the link order for gzlsysc and fdl. They are cross-dependent and therefore -lgzlsysc is provided twice in the link command.

The cosimulation can then be run as any other SystemC simulation

 >./systemc_cosim
 SystemC 2.0.1 --- Sep 15 2003 14:48:27
 Copyright (c) 1996-2002 by all Contributors
            ALL RIGHTS RESERVED
 systemcsource: set variable var1
 systemcsink: set variable var2
 Sim starts
 data_2 value is 0
 data_2 value is 0
 data_2 value is 1
 data_2 value is 3
 data_2 value is 6
 etc ...

The creation of SystemC cosimulations is discussed in Section 6.0 on page 52.

JAVA Cosimulator

The GEZELkernel is also accessible to JAVA applications through a set of three JAVA classes. You can download a JAVA developer kit from SUN (http://java.sun.com) or IBM (//http://www-106.ibm.com/developerworks/java/jdk/linux140/) if it is not available in the machine you are working on.

The location of the javac and javah tools (which are used to compile the JAVA-gezel link) must be set in the Makefile.am under the java subdirectory of the GEZEL distribution. You have to make this modification before running configure. The default values on this line are:

 JAVAC=/opt/IBMJava2-142/bin/javac
 JAVAH=/opt/IBMJava2-142/bin/javah

After confirming the paths are properly configured, run automake to regenerate the Makefiles. Next, compile the java-GEZEL classes as well as the shared library that links them to the GEZEL kernel, by running configure using the --enable-java flag:

 >./configure --enable-java
 >make
 >make install

To confirm that the JAVA class library works, try one of the examples under test/java. Also here, the path the javac and javah must be provided. This is done in test/java/Makefile.rules.

 >cd test/java/counter1
 >make
 >/opt/IBMJava2-142/bin/javac -classpath ../../../java counter1.java
 >make sim
 >export LD_LIBRARY_PATH=../../../build/lib; \
       /opt/IBMJava2-142/bin/java -classpath  \
       ../../../build/share:. counter1
 counter = 0/1
 counter = 1/2
 counter = 2/3
 counter = 3/4
 counter = 4/5
 counter = 5/6
 counter = 6/7
 counter = 7/8
 counter = 8/9
 counter = 9/a

AVRORA Cosimulator

One application of the JAVA cosimulation interface is a cosimulation with the AVRORA instruction-set simulator. AVRORA simulates the Atmel AVR and is developed by B. Titzer at the compilers group at UCLA (http://compilers.cs.ucla.edu/avrora/).

The examples under test/java/avrora* illustrate an integration between GEZEL and AVRORA based on the Platform class from AVRORA. To run this example, first download and install the AVRORA class library. The path the the AVRORA ISS needs to be indicated in test/java/Makefile.rules

 JAVAC=/opt/IBMJava2-142/bin/javac
 JAVA=/opt/IBMJava2-142/bin/java
 AVRORACLS=/home/schaum/avrora/bin
 GEZELCLS=/home/schaum/gezel/devel/build/share
 GEZELLIB=/home/schaum/gezel/devel/build/lib

In order to run the examples (under test/java/avrorax) you also need to install a cross compiler for the AVR (such as avr-gcc). Then, compile and run the examples in the usual way: make

 >/opt/IBMJava2-142/bin/javac -classpath \
      /home/schaum/avrora/bin:/home/schaum/gezel/devel/build/share hwsw.java
 >make sim
 avr-gcc -mmcu=atmega128 -ggdb simple.c -o app.out
 avr-objdump -zhD app.out >app.od
 export LD_LIBRARY_PATH=/home/schaum/gezel/devel/build/lib; \
       /opt/IBMJava2-142/bin/java -classpath \
       /home/schaum/avrora/bin:.:/home/schaum/gezel/devel/build/share \
       avrora.Main -colors=false -platform=hwsw app.od
 
 Avrora [Beta 1.4.0] - (c) 2003-2005 UCLA Compilers Group
 This simulator and analysis tool is provided with absolutely no warranty, either 
 expressed or implied. It is provided to you with the hope that it be useful for 
 evaluation of and experimentation with microcontroller and sensor network programs. 
 For more information about the license that this software is provided to you under, 
 specify the "license" option.
 
 hwsw platform
 javasource: set variable PA0
javasource: set variable PA1
javasink: set variable PA2
 javasink: set variable PA3
 =={ Simulation events }==============================
 Node       Time   Event
 --------------------------------------------------
 bits 8/7 buf 0/1
 bits 7/6 buf 1/2
 bits 6/5 buf 2/5
 bits 5/4 buf 5/a
 bits 4/3 buf a/15
 bits 3/2 buf 15/2a
 . . .
 Received data aa/aa
 Received data aa/aa
 Received data aa/aa
 Received data aa/aa
 ===============================================
 Simulated time: 1471 cycles
 Time for simulation: 0.024 seconds
 Simulator throughput: 0.061291665 mhz
Personal tools