Building of stateconstr.o; prelim. methods for ctx and state BDD enc.

This commit is contained in:
Artur Meski
2018-09-22 22:55:00 +01:00
parent a36ed9651f
commit 206996a700
4 changed files with 21 additions and 73 deletions

View File

@@ -8,71 +8,6 @@
#include "formrsctlk.hh"
std::string StateConstr::toStr(void) const
{
if (oper == STC_PV) {
return proc_name + "." + entity_name;
}
else if (oper == STC_TF) {
if (tf) {
return "true";
}
else {
return "false";
}
}
else if (oper == STC_AND) {
return "(" + arg[0]->toStr() + " AND " + arg[1]->toStr() + ")";
}
else if (oper == STC_OR) {
return "(" + arg[0]->toStr() + " OR " + arg[1]->toStr() + ")";
}
else if (oper == STC_XOR) {
return "(" + arg[0]->toStr() + " XOR " + arg[1]->toStr() + ")";
}
else if (oper == STC_NOT) {
return "~" + arg[0]->toStr();
}
else {
return "??";
assert(0);
}
}
BDD StateConstr::getBDD(const SymRS *srs) const
{
if (oper == STC_PV) {
return srs->encActStrEntity(proc_name, entity_name);
}
else if (oper == STC_TF) {
if (tf) {
return srs->getBDDtrue();
}
else {
return srs->getBDDfalse();
}
}
else if (oper == STC_AND) {
return arg[0]->getBDD(srs) * arg[1]->getBDD(srs);
}
else if (oper == STC_OR) {
return arg[0]->getBDD(srs) + arg[1]->getBDD(srs);
}
else if (oper == STC_XOR) {
return arg[0]->getBDD(srs) ^ arg[1]->getBDD(srs);
}
else if (oper == STC_NOT) {
return !arg[0]->getBDD(srs);
}
else {
assert(0);
FERROR("Undefined operator used in Boolean context definition. This should not happen.");
return srs->getBDDfalse();
}
}
std::string FormRSCTLK::toStr(void) const
{
if (oper == RSCTLK_PV) {