Search in sources :

Example 1 with MNSynchronyElement

use of com.rockwellcollins.atc.agree.analysis.MNSynchronyElement in project AGREE by loonwerks.

the class AgreeASTBuilder method getMNSynchConstraint.

private Expr getMNSynchConstraint(MNSynchStatement sync) {
    Set<String> nodeNames = new HashSet<>();
    Expr clockAssertion = new BoolExpr(true);
    for (int i = 0; i < sync.getComp1().size(); i++) {
        Subcomponent maxComp = (Subcomponent) sync.getComp1().get(i);
        Subcomponent minComp = (Subcomponent) sync.getComp2().get(i);
        Expr maxClock = new IdExpr(maxComp.getName() + clockIDSuffix);
        Expr minClock = new IdExpr(minComp.getName() + clockIDSuffix);
        int max = Integer.valueOf(sync.getMax().get(i));
        int min = Integer.valueOf(sync.getMin().get(i));
        MNSynchronyElement elem = new MNSynchronyElement(maxClock, minClock, max, min);
        String nodeName = "__calendar_node_" + elem.max + "_" + elem.min;
        nodeName = getObjectLocationPrefix(sync) + nodeName;
        if (!nodeNames.contains(nodeName)) {
            nodeNames.add(nodeName);
            Node calNode = AgreeCalendarUtils.getMNCalendar(nodeName, elem.max, elem.min);
            addToNodeList(calNode);
        }
        NodeCallExpr nodeCall = new NodeCallExpr(nodeName, elem.maxClock, elem.minClock);
        clockAssertion = LustreExprFactory.makeANDExpr(clockAssertion, nodeCall);
        nodeCall = new NodeCallExpr(nodeName, elem.minClock, elem.maxClock);
        clockAssertion = LustreExprFactory.makeANDExpr(clockAssertion, nodeCall);
    }
    return clockAssertion;
}
Also used : BoolExpr(jkind.lustre.BoolExpr) EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) RecordAccessExpr(jkind.lustre.RecordAccessExpr) FlatmapExpr(com.rockwellcollins.atc.agree.agree.FlatmapExpr) TimeFallExpr(com.rockwellcollins.atc.agree.agree.TimeFallExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) GetPropertyExpr(com.rockwellcollins.atc.agree.agree.GetPropertyExpr) Expr(jkind.lustre.Expr) CastExpr(jkind.lustre.CastExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) RealExpr(jkind.lustre.RealExpr) ArrayExpr(jkind.lustre.ArrayExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) IdExpr(jkind.lustre.IdExpr) TimeExpr(com.rockwellcollins.atc.agree.agree.TimeExpr) FoldRightExpr(com.rockwellcollins.atc.agree.agree.FoldRightExpr) TagExpr(com.rockwellcollins.atc.agree.agree.TagExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) LatchedExpr(com.rockwellcollins.atc.agree.agree.LatchedExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) FunctionCallExpr(jkind.lustre.FunctionCallExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(jkind.lustre.IfThenElseExpr) TupleExpr(jkind.lustre.TupleExpr) UnaryExpr(jkind.lustre.UnaryExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) IntExpr(jkind.lustre.IntExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) ExistsExpr(com.rockwellcollins.atc.agree.agree.ExistsExpr) FoldLeftExpr(com.rockwellcollins.atc.agree.agree.FoldLeftExpr) RecordUpdateExpr(com.rockwellcollins.atc.agree.agree.RecordUpdateExpr) ForallExpr(com.rockwellcollins.atc.agree.agree.ForallExpr) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) ArrayUpdateExpr(com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) NodeBodyExpr(com.rockwellcollins.atc.agree.agree.NodeBodyExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) ArrayLiteralExpr(com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr) IdExpr(jkind.lustre.IdExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) Subcomponent(org.osate.aadl2.Subcomponent) DataSubcomponent(org.osate.aadl2.DataSubcomponent) Node(jkind.lustre.Node) HashSet(java.util.HashSet) MNSynchronyElement(com.rockwellcollins.atc.agree.analysis.MNSynchronyElement)

Aggregations

ArrayLiteralExpr (com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr)1 ArraySubExpr (com.rockwellcollins.atc.agree.agree.ArraySubExpr)1 ArrayUpdateExpr (com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr)1 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)1 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)1 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)1 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)1 ExistsExpr (com.rockwellcollins.atc.agree.agree.ExistsExpr)1 FlatmapExpr (com.rockwellcollins.atc.agree.agree.FlatmapExpr)1 FoldLeftExpr (com.rockwellcollins.atc.agree.agree.FoldLeftExpr)1 FoldRightExpr (com.rockwellcollins.atc.agree.agree.FoldRightExpr)1 ForallExpr (com.rockwellcollins.atc.agree.agree.ForallExpr)1 GetPropertyExpr (com.rockwellcollins.atc.agree.agree.GetPropertyExpr)1 IndicesExpr (com.rockwellcollins.atc.agree.agree.IndicesExpr)1 IntLitExpr (com.rockwellcollins.atc.agree.agree.IntLitExpr)1 LatchedExpr (com.rockwellcollins.atc.agree.agree.LatchedExpr)1 NamedElmExpr (com.rockwellcollins.atc.agree.agree.NamedElmExpr)1 NodeBodyExpr (com.rockwellcollins.atc.agree.agree.NodeBodyExpr)1 PreExpr (com.rockwellcollins.atc.agree.agree.PreExpr)1 PrevExpr (com.rockwellcollins.atc.agree.agree.PrevExpr)1