- Overview, p1
- MATLAB/Simulink to BIP, p2
- C to BIP, p3
- DOL to BIP, p4
- Distribution, p4
- System Requirements, p4
- Installing the Toolchain, p4
- Coding guidelines for process, p4
- Running an example, p4
- Case Studies, p5
DOL to BIP
dol2bip is a tool for the translation of application software described in the DOL (Distributed Operation Layer, ETHZ) framework into an application software model in BIP. The underlying semantic model of DOL is Kahn process networks. The description consists of two parts :
- the process network structure, described in XML
- the process behavior, described in C, one process per file
For each process, there are two particular functions that have to be provided, respectively init and fire. Moreover, processes use specific primitives to communicate (DOL_write/DOL_read to write/read data from the channels). This page provide the links to download the tool as well as documentation about installing and running the tool. Some examples and case studies are also provided.
Distribution
- Download dol2bip for GNU/Linux - x86
The package is bundled with the standard BIP distribution and hence it also includes the BIP compiler and runtime
System Requirements
- Linux
- Java 1.6.
Installing the Toolchain
Extract the archive on your system :
~ $ tar zxf BIP.linux.x86.tar.gz
Point the environment variable BIP2_HOME to this new directory.
for c-shell
~ $ setenv BIP2_HOME $PWD/BIP.linux.x86
for bash
~ $ export BIP2_HOME=$PWD/BIP.linux.x86
The dol2bip translator is invoked by running the $BIP2_HOME/bin/dol2bip executable.
Coding guidelines for process description in C
The C source description for a processes must obey the following :
- No C++ style variable declaration, e.g.,
for (int i = 0; i < ...) ...
Instead, doint i; for (i = 0; i < ...) ...
- The structure that defines the local variables (state) of a process must have the predefined name _local_states.
Running an example
Example source structure : Each example folder must contain the application process network description as an XML file, and a src/ folder containing the C files describing the processes (one C file per process).
Example 1 : Generator-Square-Consumer : This example is adapted from the DOL distribution. The figure below illustrates the process network.
The process network in describes in the file example1.xml.
The behavior of processes generator, consumer and square are described respectively in the files generator.c, consumer.c and square.c. The complete source is here.
To translate the DOL specifiation into BIP and execute the BIP model, do the following steps :
- Step1 : Generate BIP application software model
~ $ $BIP2_HOME/bin/dol2bip -f example1.xml Creating tmp folder... Parsing file : /tmp/DOL2BIP4507904712346052284tmp/libSW.bip Generating model : libSW.timod Generating model : libSW.model Scanning process network ... Process name: generator Scanning source: generator.c ............... Process name: consumer Scanning source: consumer.c ............... Process name: square Scanning source: square.c ............... Finished generation of example1_SWModel.bip Deleting tmp folder
The application software BIP model is generated in the file example1_SWModel.bip. This can be compiled and executed using the BIP compiler and runtime as follows :
- Step2 : Compile
~ $ $BIP2_HOME/bin/bipc -f example1_SWModel.bip --genC-execute BIP Compiler. Version: frontend: trunk@3019, backend:trunk@3018 Parsing file : /local/basu/junk/example1/example1_SWModel.bip Generating model : example1_SWModel.timod Generating model : example1_SWModel.model Parser exiting with no errors. C code generated
- Step3 : Build
~ $ make -f example1_SWModel.bip.mk
- Step4 : Execute
~ $ ./example1_SWModel.bip.x --quiet BIP mono-threaded engine. Version: Engines: trunk@1457 consumer: 0.000000 consumer: 1.000000 consumer: 4.000000 consumer: 9.000000 consumer: 16.000000 consumer: 25.000000 consumer: 36.000000 consumer: 49.000000 consumer: 64.000000 consumer: 81.000000 consumer: 100.000000 consumer: 121.000000 consumer: 144.000000 consumer: 169.000000 consumer: 196.000000 consumer: 225.000000 consumer: 256.000000 consumer: 289.000000 consumer: 324.000000 consumer: 361.000000