diff --git a/.bzrignore b/.bzrignore index 563f5df3a4db8ac4a1c6904cf3c2600fc3df39de..ff8939647ef561b4c7c3f87eefcf48ae5076432c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -162,3 +162,4 @@ examples/actors/xdfAST examples/actors/xlimAST examples/actors/new_sdftest.xdf examples/actors/AddOne_0_Double_0_SubOne_0.xlim +examples/actors/AddOne_0_Double_0.xlim diff --git a/examples/actors/AddOne_0.xlim b/examples/actors/AddOne_0.xlim index ad5ad180fb1985dde3731dbb13af7495f54bea5b..81b484be62bd57f17ad3f9edaec68d2b166f983f 100644 --- a/examples/actors/AddOne_0.xlim +++ b/examples/actors/AddOne_0.xlim @@ -2,33 +2,60 @@ <!--Actor AddOne--><design name="AddOne"> <actor-port dir="in" name="In" size="32" typeName="int"/> <actor-port dir="out" name="Out" size="32" typeName="int"/> - <!--Action 0$id$w86ab2--><module autostart="false" kind="action" name="actionAtLine_3"> + <!--Actor state variable tmp--><stateVar name="0$id$w122ab2" sourceName="tmp"> + <initValue size="32" typeName="int" value="1"/> + </stateVar> + <!--Action 0$id$w122ab3--><module autostart="false" kind="action" name="actionAtLine_3"> <note kind="consumptionRates" name="In" value="1"/> <operation kind="pinRead" portName="In" removable="no" style="simple"> - <port dir="out" size="32" source="0$id$w86ab2b1b1" typeName="int"/> + <port dir="out" size="32" source="0$id$w122ab3b1b1" typeName="int"/> </operation> - <!--Expr 0$id$w86ab2b3b1ab1--><operation kind="noop"> - <port dir="in" source="0$id$w86ab2b1b1"/> - <port dir="out" size="32" source="0$id$w86ab2b3b1ab1" typeName="int"/> + <!--Expr 0$id$w122ab3b5b1ab1--><operation kind="noop"> + <port dir="in" source="0$id$w122ab2"/> + <port dir="out" size="32" source="0$id$w122ab3b5b1ab1" typeName="int"/> + </operation> + <!--Expr 2$id$w994ab5b2aab1b1--><operation kind="$literal_Integer" value="1"> + <port dir="out" size="2" source="2$id$w994ab5b2aab1b1" typeName="int"/> + </operation> + <!--Expr 1$id$w560ab4b2aa--><operation kind="$add"> + <port dir="in" source="0$id$w122ab3b5b1ab1"/> + <port dir="in" source="2$id$w994ab5b2aab1b1"/> + <port dir="out" size="33" source="1$id$w560ab4b2aa" typeName="int"/> </operation> - <!--Expr 2$id$w585ab4b3b1ab1b1--><operation kind="$literal_Integer" value="1"> - <port dir="out" size="2" source="2$id$w585ab4b3b1ab1b1" typeName="int"/> + <!--Expr 0$id$w122ab3b5b1--><operation kind="noop"> + <port dir="in" source="1$id$w560ab4b2aa"/> + <port dir="out" size="33" source="0$id$w122ab3b5b1" typeName="int"/> </operation> - <!--Expr 1$id$w336ab3b3b1a--><operation kind="$add"> - <port dir="in" source="0$id$w86ab2b3b1ab1"/> - <port dir="in" source="2$id$w585ab4b3b1ab1b1"/> - <port dir="out" size="33" source="1$id$w336ab3b3b1a" typeName="int"/> + <!--Statement 0$id$w122ab3b5--><operation kind="noop"> + <port dir="in" source="0$id$w122ab3b5b1"/> + <port dir="out" size="32" source="0$id$w122ab3b5" typeName="int"/> </operation> - <!--Expr 0$id$w86ab2b3b1--><operation kind="noop"> - <port dir="in" source="1$id$w336ab3b3b1a"/> - <port dir="out" size="33" source="0$id$w86ab2b3b1" typeName="int"/> + <!--Expr 0$id$w122ab3b3b1ab1--><operation kind="noop"> + <port dir="in" source="0$id$w122ab3b1b1"/> + <port dir="out" size="32" source="0$id$w122ab3b3b1ab1" typeName="int"/> + </operation> + <!--Expr 0$id$w122ab3b3b1ab5--><operation kind="noop"> + <port dir="in" source="0$id$w122ab3b5"/> + <port dir="out" size="32" source="0$id$w122ab3b3b1ab5" typeName="int"/> + </operation> + <!--Expr 1$id$w560ab4b6b1a--><operation kind="$add"> + <port dir="in" source="0$id$w122ab3b3b1ab1"/> + <port dir="in" source="0$id$w122ab3b3b1ab5"/> + <port dir="out" size="33" source="1$id$w560ab4b6b1a" typeName="int"/> + </operation> + <!--Expr 0$id$w122ab3b3b1--><operation kind="noop"> + <port dir="in" source="1$id$w560ab4b6b1a"/> + <port dir="out" size="33" source="0$id$w122ab3b3b1" typeName="int"/> </operation> <operation kind="pinWrite" portName="Out" style="simple"> - <port dir="in" source="0$id$w86ab2b3b1"/> + <port dir="in" source="0$id$w122ab3b3b1"/> </operation> <note kind="productionRates" name="Out" value="1"/> + <!--Write back actor state variable tmp--><operation kind="assign" target="0$id$w122ab2"> + <port dir="in" source="0$id$w122ab3b5"/> + </operation> </module> <stateVar name="currentState"> <initValue size="32" typeName="int" value="1"/> @@ -36,70 +63,71 @@ <module autostart="true" kind="action-scheduler" name="action-scheduler" sourceName="action-scheduler"> <operation kind="$literal_Integer" value="1"> - <port dir="out" size="1" source="0$id$w86a$sched$true" typeName="bool"/> + <port dir="out" size="1" source="0$id$w122a$sched$true" typeName="bool"/> </operation> <module kind="loop"> - <module decision="0$id$w86a$sched$true$loop" kind="test"> + <module decision="0$id$w122a$sched$true$loop" kind="test"> <operation kind="noop"> - <port dir="in" source="0$id$w86a$sched$true"/> - <port dir="out" size="1" source="0$id$w86a$sched$true$loop" typeName="bool"/> + <port dir="in" source="0$id$w122a$sched$true"/> + <port dir="out" size="1" source="0$id$w122a$sched$true$loop" typeName="bool"/> </operation> </module> <module kind="body"> <operation kind="pinAvail" portName="In"> <port dir="out" size="32" source="In$pinAvail" typeName="int"/> </operation> - <!--Input peeks for action 0$id$w86ab2--><operation kind="$literal_Integer" value="1"> - <port dir="out" size="32" source="0$id$w86ab2b1$In$tokenCount" typeName="int"/> + <!--Input peeks for action 0$id$w122ab3--><operation kind="$literal_Integer" value="1"> + <port dir="out" size="32" source="0$id$w122ab3b1$In$tokenCount" typeName="int"/> </operation> <operation kind="$ge"> <port dir="in" source="In$pinAvail"/> - <port dir="in" source="0$id$w86ab2b1$In$tokenCount"/> - <port dir="out" size="1" source="0$id$w86ab2b1$ready" typeName="bool"/> + <port dir="in" source="0$id$w122ab3b1$In$tokenCount"/> + <port dir="out" size="1" source="0$id$w122ab3b1$ready" typeName="bool"/> </operation> <operation kind="$literal_Integer" value="0"> - <port dir="out" size="1" source="0$id$w86ab2b1b1$index$1" typeName="int"/> + <port dir="out" size="1" source="0$id$w122ab3b1b1$index$1" typeName="int"/> </operation> <operation kind="pinPeek" portName="In"> - <port dir="in" source="0$id$w86ab2b1b1$index$1"/> - <port dir="out" size="32" source="0$id$w86ab2b1b1" typeName="int"/> + <port dir="in" source="0$id$w122ab3b1b1$index$1"/> + <port dir="out" size="32" source="0$id$w122ab3b1b1" typeName="int"/> </operation> - <!--Local variables used in guards of action 0$id$w86ab2--><!--Guard for action 0$id$w86ab2--><operation kind="$and"> - <port dir="in" source="0$id$w86ab2b1$ready"/> - <port dir="out" size="1" source="0$id$w86ab2$guard" typeName="bool"/> + <!--Local variables used in guards of action 0$id$w122ab3--><!--Guard for action 0$id$w122ab3--><operation kind="$and"> + <port dir="in" source="0$id$w122ab3b1$ready"/> + <port dir="out" size="1" source="0$id$w122ab3$guard" typeName="bool"/> </operation> <operation kind="pinAvail" portName="Out"> - <port dir="out" size="32" source="0$id$w86ab1$status" typeName="int"/> + <port dir="out" size="32" source="0$id$w122ab1$status" typeName="int"/> </operation> <operation kind="$literal_Integer" value="1"> - <port dir="out" size="32" source="0$id$w86ab2$Out$exprCount" typeName="int"/> + <port dir="out" size="32" source="0$id$w122ab3$Out$exprCount" typeName="int"/> </operation> <operation kind="$ge"> - <port dir="in" source="0$id$w86ab1$status"/> - <port dir="in" source="0$id$w86ab2$Out$exprCount"/> - <port dir="out" size="1" source="0$id$w86ab2$Out" typeName="bool"/> + <port dir="in" source="0$id$w122ab1$status"/> + <port dir="in" source="0$id$w122ab3$Out$exprCount"/> + <port dir="out" size="1" source="0$id$w122ab3$Out" typeName="bool"/> </operation> <operation kind="$literal_Integer" value="1"> - <port dir="out" size="1" source="0$id$w86ab2$true" typeName="bool"/> + <port dir="out" size="1" source="0$id$w122ab3$true" typeName="bool"/> </operation> <operation kind="$and"> - <port dir="in" source="0$id$w86ab2$true"/> - <port dir="in" source="0$id$w86ab2$Out"/> - <port dir="out" size="1" source="0$id$w86ab2$fireable" typeName="bool"/> + <port dir="in" source="0$id$w122ab3$true"/> + <port dir="in" source="0$id$w122ab3$Out"/> + <port dir="out" size="1" source="0$id$w122ab3$fireable" typeName="bool"/> </operation> <module kind="if"> - <module decision="always$state$0$id$w86ab2$guard$read" kind="test"> + <module decision="always$state$0$id$w122ab3$guard$read" kind="test"> <operation kind="noop"> - <port dir="in" source="0$id$w86ab2$guard"/> - <port dir="out" size="1" source="always$state$0$id$w86ab2$guard$read" typeName="bool"/> + <port dir="in" source="0$id$w122ab3$guard"/> + <port dir="out" size="1" source="always$state$0$id$w122ab3$guard$read" + typeName="bool"/> </operation> </module> <module kind="then"> <module kind="if"> - <module decision="always$state$0$id$w86ab2$fireable" kind="test"> + <module decision="always$state$0$id$w122ab3$fireable" kind="test"> <operation kind="noop"> - <port dir="in" source="0$id$w86ab2$fireable"/> - <port dir="out" size="1" source="always$state$0$id$w86ab2$fireable" typeName="bool"/> + <port dir="in" source="0$id$w122ab3$fireable"/> + <port dir="out" size="1" source="always$state$0$id$w122ab3$fireable" typeName="bool"/> </operation> </module> <module kind="then"> diff --git a/examples/actors/sdftest.xdf b/examples/actors/sdftest.xdf index 84f44a09e79247e2bcd547f918092af8a3cb217c..75c0d9d758efb9c0836ba019e2b9332efd3f9b84 100644 --- a/examples/actors/sdftest.xdf +++ b/examples/actors/sdftest.xdf @@ -131,7 +131,7 @@ <Expr kind="Literal" literal-kind="Integer" text-begin-col="15" text-begin-line="2" text-end-col="15" text-end-line="2" - value="0"/> + value="1"/> </Expr> </Decl> <Action text-begin-col="7" text-begin-line="3" text-end-col="4" text-end-line="6"> @@ -157,21 +157,31 @@ </Expr> </Output> <Stmt kind="Assign" name="tmp" text-begin-col="3" text-begin-line="5" - text-end-col="17" + text-end-col="16" text-end-line="5"> <Expr kind="Let"> - <Expr kind="BinOpSeq" text-begin-col="10" text-begin-line="5" text-end-col="16" + <Expr kind="BinOpSeq" text-begin-col="10" text-begin-line="5" text-end-col="15" text-end-line="5"> <Expr kind="Var" name="tmp" text-begin-col="10" text-begin-line="5" text-end-col="10" text-end-line="5"/> <Op name="+"/> - <Expr kind="Var" name="$local$x" text-begin-col="16" text-begin-line="5" - text-end-col="16" - text-end-line="5"/> + <Expr kind="Literal" literal-kind="Integer" text-begin-col="15" text-begin-line="5" + text-end-col="15" + text-end-line="5" + value="1"/> </Expr> </Expr> </Stmt> </Action> + <Action text-begin-col="4" text-begin-line="7" text-end-col="21" text-end-line="7"> + <Output port="Out" text-begin-col="15" text-begin-line="7" text-end-col="19" + text-end-line="7"> + <Expr kind="Let"> + <Expr kind="Var" name="tmp" text-begin-col="16" text-begin-line="7" text-end-col="16" + text-end-line="7"/> + </Expr> + </Output> + </Action> <Note kind="filepath" value="/work/csandersn/actors/example//AddOne.cal"/> </Actor> <Attribute kind="Value" name="clockDomain"> @@ -223,6 +233,139 @@ </Attribute> </Instance> <Instance id="$id_n$3"> + <Note kind="UID" value="SubOne_0"/> + <Note kind="instanceHierarchy"/> + <Class name="SubOne"/> + <Note kind="sourceLoaded" value="true"/> + <Note kind="className" value="SubOne"/> + <Actor name="SubOne"> + <Port kind="Input" name="In"> + <Type name="int"/> + </Port> + <Port kind="Output" name="Out"> + <Type name="int"/> + </Port> + <Action text-begin-col="7" text-begin-line="3" text-end-col="28" text-end-line="3"> + <Input kind="Elements" port="In" text-begin-col="14" text-begin-line="3" + text-end-col="16" + text-end-line="3"> + <Decl kind="Input" name="$local$x"> + <Type name="int"/> + </Decl> + </Input> + <Output port="Out" text-begin-col="22" text-begin-line="3" text-end-col="26" + text-end-line="3"> + <Expr kind="Let"> + <Expr kind="BinOpSeq" text-begin-col="23" text-begin-line="3" text-end-col="25" + text-end-line="3"> + <Expr kind="Var" name="$local$x" text-begin-col="23" text-begin-line="3" + text-end-col="23" + text-end-line="3"/> + <Op name="-"/> + <Expr kind="Literal" literal-kind="Integer" text-begin-col="25" text-begin-line="3" + text-end-col="25" + text-end-line="3" + value="1"/> + </Expr> + </Expr> + </Output> + </Action> + <Note kind="filepath" value="/work/csandersn/actors/example//SubOne.cal"/> + </Actor> + <Attribute kind="Value" name="clockDomain"> + <Expr kind="Literal" literal-kind="String" value="CLK"/> + </Attribute> + </Instance> + <Instance id="$id_n$4"> + <Note kind="UID" value="AddFiveOnce_0"/> + <Note kind="instanceHierarchy"/> + <Class name="AddFiveOnce"/> + <Note kind="sourceLoaded" value="true"/> + <Note kind="className" value="AddFiveOnce"/> + <Actor name="AddFiveOnce"> + <Port kind="Input" name="In"> + <Type name="int"/> + </Port> + <Port kind="Output" name="Out"> + <Type name="int"/> + </Port> + <Action text-begin-col="9" text-begin-line="3" text-end-col="30" text-end-line="3"> + <QID name="init"> + <ID name="init"/> + </QID> + <Input kind="Elements" port="In" text-begin-col="16" text-begin-line="3" + text-end-col="18" + text-end-line="3"> + <Decl kind="Input" name="$local$x"> + <Type name="int"/> + </Decl> + </Input> + <Output port="Out" text-begin-col="24" text-begin-line="3" text-end-col="28" + text-end-line="3"> + <Expr kind="Let"> + <Expr kind="BinOpSeq" text-begin-col="25" text-begin-line="3" text-end-col="27" + text-end-line="3"> + <Expr kind="Var" name="$local$x" text-begin-col="25" text-begin-line="3" + text-end-col="25" + text-end-line="3"/> + <Op name="+"/> + <Expr kind="Literal" literal-kind="Integer" text-begin-col="27" text-begin-line="3" + text-end-col="27" + text-end-line="3" + value="5"/> + </Expr> + </Expr> + </Output> + </Action> + <Action text-begin-col="8" text-begin-line="5" text-end-col="27" text-end-line="5"> + <QID name="run"> + <ID name="run"/> + </QID> + <Input kind="Elements" port="In" text-begin-col="15" text-begin-line="5" + text-end-col="17" + text-end-line="5"> + <Decl kind="Input" name="$local$x"> + <Type name="int"/> + </Decl> + </Input> + <Output port="Out" text-begin-col="23" text-begin-line="5" text-end-col="25" + text-end-line="5"> + <Expr kind="Let"> + <Expr kind="Var" name="$local$x" text-begin-col="24" text-begin-line="5" + text-end-col="24" + text-end-line="5"/> + </Expr> + </Output> + </Action> + <Note kind="filepath" value="/work/csandersn/actors/example//AddFiveOnce.cal"/> + <Schedule initial-state="init" kind="fsm" text-begin-col="3" text-begin-line="7" + text-end-col="3" + text-end-line="10"> + <Transition from="init" text-begin-col="4" text-begin-line="8" text-end-col="23" + text-end-line="8" + to="run"> + <ActionTags text-begin-col="" text-begin-line="" text-end-col="" text-end-line=""> + <QID name="init"> + <ID name="init"/> + </QID> + </ActionTags> + </Transition> + <Transition from="run" text-begin-col="2" text-begin-line="9" text-end-col="19" + text-end-line="9" + to="run"> + <ActionTags text-begin-col="" text-begin-line="" text-end-col="" text-end-line=""> + <QID name="run"> + <ID name="run"/> + </QID> + </ActionTags> + </Transition> + </Schedule> + </Actor> + <Attribute kind="Value" name="clockDomain"> + <Expr kind="Literal" literal-kind="String" value="CLK"/> + </Attribute> + </Instance> + <Instance id="$id_n$5"> <Note kind="UID" value="art_Sink_txt_0"/> <Note kind="instanceHierarchy"/> <Class name="art_Sink_txt"/> @@ -302,6 +445,8 @@ <Connection dst="$id_n$1" dst-port="In" src="$id_n$0" src-port="Out"/> <Connection dst="$id_n$2" dst-port="In" src="$id_n$1" src-port="Out"/> <Connection dst="$id_n$3" dst-port="In" src="$id_n$2" src-port="Out"/> + <Connection dst="$id_n$4" dst-port="In" src="$id_n$3" src-port="Out"/> + <Connection dst="$id_n$5" dst-port="In" src="$id_n$4" src-port="Out"/> <Note kind="Directive" name="default-type-name"> <Expr kind="Literal" literal-kind="String" value="int"/> </Note> diff --git a/examples/actors/xlim/Merge.jrag b/examples/actors/xlim/Merge.jrag index 096b859de8237d8de38ace9533e6276a18b0556d..4495754cca1f10730bd0e9f708a8d64465366405 100644 --- a/examples/actors/xlim/Merge.jrag +++ b/examples/actors/xlim/Merge.jrag @@ -21,9 +21,13 @@ aspect Merge { setName(name()+"_"+dest.name()); List<Element> eList = getElements(); stateVar var = new stateVar(); - initValue init = new initValue(); + initValue init = new initValue(); + init.setAttributeList(new List().add(new size(new AttrValue("\"32\""))). + add(new typeName(new AttrValue("\"int\""))). + add(new value(new AttrValue("\"0\"")))); var.setAttributeList(new List().add(new name(new AttrValue(varName))). add(new sourceName(new AttrValue(varName)))); + var.addElement(init); eList.insertChild(var,0); // Re-set pinWrite with shared variable for (module m : getActions(new HashSet<module>())) { @@ -85,12 +89,16 @@ aspect Actions { void operation.setInVar(String varName, String srcPort) { if (kind().equals("pinRead")) { String src = getElement(0).source(); - setAttributeList(new List().add(new kind(new AttrValue("\"assign\""))). - add(new target(new AttrValue(unfix(src))))); - port newPort = new port(); - newPort.setAttributeList(new List().add(new dir(new AttrValue("\"in\""))). + setAttributeList(new List().add(new kind(new AttrValue("\"noop\"")))); + port newInPort = new port(); + newInPort.setAttributeList(new List().add(new dir(new AttrValue("\"in\""))). add(new source(new AttrValue(varName)))); - setElementList(new List().add(newPort)); +// port newOutPort = new port(); +// newOutPort.setAttributeList(new List().add(new dir(new AttrValue("\"out\""))). +// add(new size(new AttrValue("\"32\""))). +// add(new source(new AttrValue(srcPort)))); + addElement(newInPort); +// setElementList(new List().add(newInPort).add(newOutPort)); } } } diff --git a/examples/actors/xlim/SDF.jrag b/examples/actors/xlim/SDF.jrag index 353d64d156acb18811e84d47bf1b06608e1dde4c..6644e121cc31c23b956d1e56671c9dd846f7b491 100644 --- a/examples/actors/xlim/SDF.jrag +++ b/examples/actors/xlim/SDF.jrag @@ -120,4 +120,5 @@ aspect Fixes { int ASTNode.numChildren() {return jjtGetNumChildren();} int List.getNumNoTransformChild() {return getNumChildNoTransform();} int Opt.getNumChildNoTransfrom() {return getNumChildNoTransform();} + }