use of com.rockwellcollins.atc.agree.analysis.AgreeException in project AGREE by loonwerks.
the class LustreAstBuilder method flattenAgreeNode.
protected static AgreeNode flattenAgreeNode(AgreeProgram agreeProgram, AgreeNode agreeNode, String nodePrefix) {
List<AgreeVar> inputs = new ArrayList<>();
List<AgreeVar> outputs = new ArrayList<>();
List<AgreeVar> locals = new ArrayList<>();
List<AgreeStatement> patternProps = new ArrayList<>();
List<AgreeEquation> equations = new ArrayList<>();
List<AgreeStatement> assertions = new ArrayList<>();
Set<AgreeVar> timeEvents = new HashSet<>(agreeNode.eventTimes);
Expr someoneTicks = null;
for (AgreeNode subAgreeNode : agreeNode.subNodes) {
String prefix = subAgreeNode.id + AgreeASTBuilder.dotChar;
Expr clockExpr = getClockExpr(agreeNode, subAgreeNode);
if (someoneTicks == null) {
someoneTicks = clockExpr;
} else {
someoneTicks = new BinaryExpr(someoneTicks, BinaryOp.OR, clockExpr);
}
AgreeNode flatNode = flattenAgreeNode(agreeProgram, subAgreeNode, nodePrefix + subAgreeNode.id + AgreeASTBuilder.dotChar);
Node lustreNode = addSubNodeLustre(agreeProgram, agreeNode, nodePrefix, flatNode);
addInputsAndOutputs(agreeNode, inputs, outputs, patternProps, flatNode, lustreNode, prefix);
addTimeEvents(timeEvents, flatNode, prefix, assertions);
addNodeCall(agreeNode, assertions, prefix, clockExpr, lustreNode);
addHistoricalAssumptionConstraint(agreeNode, prefix, clockExpr, assertions, lustreNode);
}
if (agreeNode.timing == TimingModel.ASYNC) {
if (someoneTicks == null) {
throw new AgreeException("Somehow we generated a clock constraint without any clocks." + " Perhaps none of your subcomponents have an agree annex?");
}
assertions.add(new AgreeStatement("someone ticks", someoneTicks, null));
}
addConnectionConstraints(agreeNode, assertions);
// add any clock constraints
assertions.addAll(agreeNode.assertions);
assertions.add(new AgreeStatement("", agreeNode.clockConstraint, null));
inputs.addAll(agreeNode.inputs);
outputs.addAll(agreeNode.outputs);
locals.addAll(agreeNode.locals);
equations.addAll(agreeNode.localEquations);
patternProps.addAll(agreeNode.patternProps);
AgreeNodeBuilder builder = new AgreeNodeBuilder(agreeNode.id);
builder.addInput(inputs);
builder.addOutput(outputs);
builder.addLocal(locals);
builder.addLocalEquation(equations);
builder.addIvcElements(agreeNode.getivcElements());
builder.addSubNode(agreeNode.subNodes);
builder.addAssertion(assertions);
builder.addAssumption(agreeNode.assumptions);
builder.addGuarantee(agreeNode.guarantees);
builder.addLemma(agreeNode.lemmas);
builder.addPatternProp(patternProps);
builder.setClockConstraint(new BoolExpr(true));
builder.setInitialConstraint(agreeNode.initialConstraint);
builder.setClockVar(agreeNode.clockVar);
builder.setReference(agreeNode.reference);
builder.setTiming(null);
builder.addEventTime(timeEvents);
builder.setCompInst(agreeNode.compInst);
builder.setFaultTreeFlag(agreeNode.faultTreeFlag);
return builder.build();
}
use of com.rockwellcollins.atc.agree.analysis.AgreeException in project AGREE by loonwerks.
the class VerifyHandler method runJob.
@Override
protected final IStatus runJob(Element root, IProgressMonitor monitor) {
handlerService = getWindow().getService(IHandlerService.class);
if (!(root instanceof ComponentImplementation)) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Must select an AADL Component Implementation");
}
if (isRecursive() && AgreeUtils.usingKind2()) {
throw new AgreeException("Kind2 only supports monolithic verification");
}
try {
TcgLinkerFactory factory = new TcgLinkerFactory((ComponentImplementation) root, isMonolithic(), isRecursive());
AnalysisResult result = factory.getAnalysisResult();
linker = factory.getLinker();
queue = factory.getWorkQueue();
showView(result, linker);
return doAnalysis(root, monitor);
} catch (Throwable e) {
String messages = getNestedMessages(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
}
}
Aggregations