OCPN


An automatic star generator for Ptolemy




Table of contents


Introduction

Ocpn is an automatic star generator for
Ptolemy. The domain of the generated stars is PN (Process Network). A process network, as described by Kahn, is a network of sequential processes connected by FIFO queues. At any given moment while running, each process may write to one of its output queues or read from one of its input queues. For a read, the queue must have sufficient data to satisfy the read, or the read is blocked until the data becomes available.


Description of the ocpn tool

Ocpn takes as input an oc and produces a pl file that contains the code for a PN
Ptolemy star. Oc is the output format of the Esterel and Lustre compilers. More specifically, an oc program is a finite state automaton that performs computations on a finite memory.

In the case of ocpn, the oc source file must be produced by the automatic parallelizer ocrep. Starting from a centralized oc program and distribution specifications, ocrep automatically produces one oc file for each location specified in the distribution. Each of these files contains special procedure calls that allow communication between the oc programs. Communications take place through a fully connected network of FIFO channels. Sending a value to a FIFO channel is never blocking, while receiving a value is blocking. The ocrep tools insures that the parallel program produced never deadlocks and runs in bounded memory. In particular, the FIFO queues are bounded. Finally, the name of each oc file also indicates how many locations are in the distribution, and what is the number of the current location. For instance, in pingpong.2.0.oc, the 2 indicates that there are 2 locations, and the 0 indicates that the current file contains the program of the first location.

The usage is:

ocpn pingpong.2.0.oc
This command produces a PNpingpong_2_0.pl file that contains the code of the Ptolemy star that implements the oc automaton pingpong.2.0.oc.


How to use the stars inside Ptolemy

The file PNpingpong_2_0.pl must then be compiled by the ptlang compiler. The command:
ptlang PNpingpong_2_0_pl
produces the three files: PNpingpong_2_0.cc, PNpingpong_2_0.h, and PNpingpong_2_0.htm. All the files must be placed in the directory $PTOLEMY/src/domains/pn/stars.

For the communications to take place in the Ptolemy PN domain, the file PutGetParticle.h must also be placed in the same directory. This file implements the subclass PutGetParticle of the class Message.

Each star has the following inputs and outputs:

For instance, the star PNpingpong_2_0.pl has the following icon:

where:

Properly connecting the stars PNpingpong_2_0.pl and PNpingpong_2_1.pl will thus look like:




Dedicated stars for input/output

In the example above, there remains to connect the inputs IN0 and IN1 and the outputs OUT0 and OUT1 to some other stars. Both tools
ocrep and ocpn are intended for programming parallel synchronous controllers and embedding them into a Ptolemy application. In such a case, some of the program inputs and outputs will be connected to other stars of the application in order to control their computation. However, some will still be inputs and outputs of the application. We must thus provide stars for interfacing such applications.

The problem of interfacing a synchronous program with its environment is known as the synchronous/asynchronous interface. Indeed, the environment is intrinsically asynchronous. Since the synchronous controller is parallel, this means that one part of the controller can be receiving inputs while at the same time the other part receives nothing. To reflect this behavior, we provide two stars.

The star SDFTkEntry2.pl is an homogeneous SDF actor. It pops up a Tk window with one entry and two buttons, as shown below:

Each time one of the two buttons is pressed, the star fires and produces the following tokens on its outputs:

Intuitively, clock is the clock of output.

The star PNWhen.pl is a PN actor. It implements the when operator of the Lustre synchronous language. Its behavior is the following. Here, "bot" means that no token is produced:

X x0 x1 x2 x3 x4 x5 x6 x7
C false true false true false false true true
X when Cbot x1 bot x3 bot bot x6 x7

Finally, the outputs of the program can be displayed with stars taken from the standard SDF sink library (TkShowValues for instance). As a result, the complete galaxy of the pingpong example is:




Options

The following options are interpreted by ocpn:

-h Print the help message with the usage and the options.
-version Print the version name on the standard error output stream and terminate ignoring all other arguments.
-info Print various informations about the processor compilation on the standard error output stream and terminate, ignoring all other arguments.
-ext Allow external types, procedures, and functions in the source oc code. However, put and get procedures involving external types are not supported.


Getting ocpn

The ocpn tool is available for Unix/Solaris architectures:
The distribution includes the following: Enjoy!


Contributor



Last modification: April 29th 1997