1
February 23, 2006 Center for Hybrid and Embedded Software Systems http://chess.eecs.berkeley.edu/ Ptalon Ptalon is an ADL with a simple goal: Make it easier for programmers to build large models. It is in the very early stages of development; we are still debating what the core features of the language, like the inheritance and high order mechanisms, should look like. To the left is our first model written in Ptalon. Here the components are defined outside of Ptalon in a Java format compatible with Ptolemy II. This is intentional; Ptalon should only specify the interconnection structure, not define the components, so that it can target many platforms. Our prototype compiler generates code that is launched in Vergil to the right. package ptolemy.actor.ptalon; import ... public class HelloWorld extends TypedCompositeActor { HelloWorld() throws ... { super(); setName("HelloWorld"); SDFDirector director = new SDFDirector(this, "SDF"); Ramp r = new Ramp(this, "r"); Display d = new Display(this, "d"); d.columnsDisplayed.setExpression("50"); TypedIORelation r_output__d_input = new TypedIORelation(this, "r_output__d_input"); r.output.insertLink(0, r_output__d_input); d.input.insertLink(0, r_output__d_input); } public static void main(final String[] args) { ... } } “HelloWorld.java” Motivation As computation becomes increasingly distributed, the architecture description languages (ADLs) developed over the past decade are helping software designers shift focus from lines-of-code to the interconnection structure between components. This is necessary in a world of large-scale distributed systems. Interconnection structure alone will do little to make programming tens of thousands of components manageable. In addition to “standard” ADL features like hierarchical composition and parameterization, we think that supporting “interconnection inheritance” and “high-order interconnections” will be key to the success of ADLs. The ACME ADL already supports limited interconnection inheritance, and high order functions are standard to distributed programmers on the Google File System. Consider a distributed sort example. A high order interconnection structure might be determined by two parameters, a sort component and the number of sort components. A subclass of such a model might add a merge component as a third parameter. A designer need only specify the structural building blocks and a rule for extending the structure, rather than specify thousands of connections manually. model HelloWorld() { actors { r = Ramp(), d = Display(columnsDisplayed = "50") } connections { link r.output to d.input } attributes { actor ptolemy.actor.lib.gui.Display, actor ptolemy.actor.lib.Ramp, director ptolemy.domains.sdf.kernel.SDFDirector } } “HelloWorld.ptln” A First Look at Ptalon Adam Cataldo Thomas Feng Edward Lee Generate a Java file compatible with the Ptolemy II API java PtolemyGenerator.class HelloWorld.ptln java HelloWorld.class Generate a MoML description of the model vergil HelloWorld.xml Open the file in the Vergil editor Apply the Vergil autolayout feature to see the model Run the model to view the results <?xml version="1.0" standalone="no"?> <!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN" "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd"> <entity name="HelloWorld" class="ptolemy.actor.TypedCompositeActor"> ... <property name="SDF" class="ptolemy.domains.sdf.kernel.SDFDirector"> <property name="iterations" class="ptolemy.data.expr.Parameter" value="0"> </property> ... </property> <entity name="r" class="ptolemy.actor.lib.Ramp"> <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="0"> </property> ... </entity> <entity name="d" class="ptolemy.actor.lib.gui.Display"> <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10"> ... </entity> <relation name="r_output__d_input" class="ptolemy.actor.TypedIORelation"> <property name="width" class="ptolemy.data.expr.Parameter" value="1"> </property> </relation> <link port="r.output" relation="r_output__d_input"/> <link port="d.input" relation="r_output__d_input"/> </entity> “HelloWorld.xml” Research Directions In the near future, we plan to identify useful mechanisms for model inheritance and high order models in Ptalon. In this attempt, we hope to find a generic implementation strategy, so we can target multiple output formats, like C and Java.

A First Look at Ptalon

Embed Size (px)

DESCRIPTION

Adam Cataldo Thomas Feng Edward Lee. A First Look at Ptalon. Motivation - PowerPoint PPT Presentation

Citation preview

Page 1: A First Look at Ptalon

February 23, 2006 Center for Hybrid and Embedded Software Systems

http://chess.eecs.berkeley.edu/

Ptalon

Ptalon is an ADL with a simple goal: Make it easier for programmers to build large models. It is in the very early stages of development; we are still debating what the core features of the language, like the inheritance and high order mechanisms, should look like. To the left is our first model written in Ptalon. Here the components are defined outside of Ptalon in a Java format compatible with Ptolemy II. This is intentional; Ptalon should only specify the interconnection structure, not define the components, so that it can target many platforms. Our prototype compiler generates code that is launched in Vergil to the right.

package ptolemy.actor.ptalon;import ...

public class HelloWorld extends TypedCompositeActor { HelloWorld() throws ... { super(); setName("HelloWorld"); SDFDirector director = new SDFDirector(this, "SDF"); Ramp r = new Ramp(this, "r"); Display d = new Display(this, "d"); d.columnsDisplayed.setExpression("50"); TypedIORelation r_output__d_input = new TypedIORelation(this, "r_output__d_input"); r.output.insertLink(0, r_output__d_input); d.input.insertLink(0, r_output__d_input); }

public static void main(final String[] args) { ... }}

“HelloWorld.java”

MotivationAs computation becomes increasingly distributed, the architecture description languages (ADLs) developed over the past decade are helping software designers shift focus from lines-of-code to the interconnection structure between components. This is necessary in a world of large-scale distributed systems. Interconnection structure alone will do little to make programming tens of thousands of components manageable. In addition to “standard” ADL features like hierarchical composition and parameterization, we think that supporting “interconnection inheritance” and “high-order interconnections” will be key to the success of ADLs. The ACME ADL already supports limited interconnection inheritance, and high order functions are standard to distributed programmers on the Google File System.

Consider a distributed sort example. A high order interconnection structure might be determined by two parameters, a sort component and the number of sort components. A subclass of such a model might add a merge component as a third parameter. A designer need only specify the structural building blocks and a rule for extending the structure, rather than specify thousands of connections manually.model HelloWorld() {

actors { r = Ramp(), d = Display(columnsDisplayed = "50") }

connections { link r.output to d.input }

attributes { actor ptolemy.actor.lib.gui.Display, actor ptolemy.actor.lib.Ramp, director ptolemy.domains.sdf.kernel.SDFDirector }

}

“HelloWorld.ptln”

A First Look at Ptalon

Adam Cataldo

Thomas Feng

Edward Lee

Generate a Javafile compatible with thePtolemy II API

java PtolemyGenerator.class HelloWorld.ptln

java HelloWorld.class

Generate a MoMLdescription of the model

vergil HelloWorld.xml

Open the file in the Vergil editor

Apply the Vergil autolayout feature to see the model

Run the model to view the results

<?xml version="1.0" standalone="no"?><!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN" "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd"><entity name="HelloWorld" class="ptolemy.actor.TypedCompositeActor"> ... <property name="SDF" class="ptolemy.domains.sdf.kernel.SDFDirector"> <property name="iterations" class="ptolemy.data.expr.Parameter" value="0"> </property> ... </property> <entity name="r" class="ptolemy.actor.lib.Ramp"> <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="0"> </property> ... </entity> <entity name="d" class="ptolemy.actor.lib.gui.Display"> <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10"> ... </entity> <relation name="r_output__d_input" class="ptolemy.actor.TypedIORelation"> <property name="width" class="ptolemy.data.expr.Parameter" value="1"> </property> </relation> <link port="r.output" relation="r_output__d_input"/> <link port="d.input" relation="r_output__d_input"/></entity>

“HelloWorld.xml”

Research DirectionsIn the near future, we plan to identify useful mechanisms for model inheritance and high order models in Ptalon. In this attempt, we hope to find a generic implementation strategy, so we can target multiple output formats, like C and Java.