void NEventuallyAlways::codeGen(CodeGenerator &c) { if (lhs) { lhs->codeGen(c); } if (rhs) { rhs->codeGen(c); } std::string timeBound1; if (b1) { timeBound1 = intToString(b1->min) + std::string(", ") + intToString(b1->max); } else { timeBound1 = std::string("0, INT_MAX"); } std::string timeBound2; if (b2) { timeBound2 = intToString(b2->min) + std::string(", ") + intToString(b2->max); } else { timeBound2 = std::string("0, INT_MAX"); } std::string childParams = getChildParams(c, lhs, rhs); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_temp_operator_extended_new") + std::string("(") + childParams + std::string("eventually_always_t") + std::string(", ") + timeBound1 + std::string(", ") + timeBound2 + std::string(");"); c.emitLine(line); }
void NAnalog::codeGen(CodeGenerator &c) { std::string childParams = getChildParams(c, NULL, NULL); int channel = c.getChannel(variable); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_analog_operator_new") + std::string("(") + childParams + op + std::string(", ") + intToString(channel) + std::string(");"); c.emitLine(line); }
void NPredicate::codeGen(CodeGenerator &c) { if (lhs) { lhs->codeGen(c); } std::string childParams = getChildParams(c, lhs, NULL); int channel = c.getChannel(variable); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_predicate_new") + std::string("(") + childParams + op + std::string(", ") + intToString(channel) + std::string(", ") + doubleToString(condition) + std::string(");"); c.emitLine(line); }
void NImply::codeGen(CodeGenerator &c) { if (lhs) { lhs->codeGen(c); } if (rhs) { rhs->codeGen(c); } std::string childParams = getChildParams(c, lhs, rhs); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_boolean_operator_new") + std::string("(") + childParams + std::string("imply_t") + std::string(");"); c.emitLine(line); }
void NEvent::codeGen(CodeGenerator &c) { std::string channel; std::string condition; if (lhs) { if (lhs->isBoolAtom()) { Node *lhs_ = c.ast->getNode((static_cast<NBoolAtom*>(lhs))->variable); int channel_ = c.getChannel((static_cast<NPredicate*>(lhs_))->variable); channel = std::string(", ") + intToString(channel_); condition = std::string(", ") + doubleToString((static_cast<NPredicate*>(lhs_))->condition); } } std::string childParams = getChildParams(c, NULL, NULL); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_event_new") + std::string("(") + childParams + operator_subtype_strings[subTypeIndex(subtype)] + channel + condition + std::string(");"); c.emitLine(line); }
void NEventually::codeGen(CodeGenerator &c) { if (lhs) { lhs->codeGen(c); } if (rhs) { rhs->codeGen(c); } std::string timeBound; if (b) { timeBound = intToString(b->min) + std::string(", ") + intToString(b->max); } else { timeBound = std::string("0, INT_MAX"); } std::string childParams = getChildParams(c, lhs, rhs); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_temp_operator_new") + std::string("(") + childParams + std::string("eventually_t") + std::string(", ") + timeBound + std::string(");"); c.emitLine(line); }