Type System for Ptolemy II

Researchers: Yuhong Xiong
Advisor:Edward A. Lee

The objective of this project is to develop a truly polymorphic type system for the Ptolemy II environment. This type system combines static typing with run-time type checking. Compared with earlier implementations of Ptolemy, this system supports the specification and resolution of more sophisticated type constraints, which increases the flexibility of the computation environment. In addition, it supports lossless data type conversion at run-time.

In Ptolemy II, a partially ordered set, a type lattice, is used to model the lossless type conversion relation among different types. In the type lattice, type a can be converted to type b losslessly if a is less than b. For every data transfer path from a source port to a destination port in Ptolemy II, we require that the type of the source port to be less than or equal to the type of the destination port. This guarantees that information will not be lost during data transfer. If the source port has a type lower than the destination type in the type lattice, type conversion is automatically performed by the system during data transfer.

A system component that can accept multiple types on its connections is a polymorphic actor. For example, a polymorphic adder can perform both integer and floating-point addition. Type constraints in the form of inequalities defined over the type lattice are used to specify the type relations on the ports of such an actor. These constraints can be resolved by an efficient algorithm. This type system will reduce the number of required library actors, make the computation environment easier to use.

Future work includes the study of the expressive power of the inequality type constraints, and the exploration of an alternative formulation of type resolution by finding the fixed point of monotonic type refinement functions. We will also look into extending the type system up to the process level to facilitate heterogeneous modeling, in which the notion of type is adapted to encompass signals, events, etc., and the type system is used to regulate the interaction between system components.

Last updated 11/22/98. Send comments to www@ptolemy.eecs.berkeley.edu.