Building of stateconstr.o; prelim. methods for ctx and state BDD enc.
This commit is contained in:
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ CXXFLAGS = -std=c++14 $(CXXFLAGS_SILENT)
|
|||||||
#CXXFLAGS = -std=c++14 -O3 -DPUBLIC_RELEASE -DNDEBUG #-g
|
#CXXFLAGS = -std=c++14 -O3 -DPUBLIC_RELEASE -DNDEBUG #-g
|
||||||
LDLIBS = $(CUDD_INCLUDE)
|
LDLIBS = $(CUDD_INCLUDE)
|
||||||
|
|
||||||
OBJ = rs.o ctx_aut.o symrs.o mc.o rsin_driver.o rsin_parser.o rsin_parser.lex.o formrsctlk.o
|
OBJ = rs.o ctx_aut.o symrs.o mc.o rsin_driver.o rsin_parser.o rsin_parser.lex.o formrsctlk.o stateconstr.o
|
||||||
|
|
||||||
all: reactics
|
all: reactics
|
||||||
|
|
||||||
|
|||||||
@@ -8,71 +8,6 @@
|
|||||||
|
|
||||||
#include "formrsctlk.hh"
|
#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
|
std::string FormRSCTLK::toStr(void) const
|
||||||
{
|
{
|
||||||
if (oper == RSCTLK_PV) {
|
if (oper == RSCTLK_PV) {
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stateconstr.hh"
|
#include "stateconstr.hh"
|
||||||
|
#include "types.hh"
|
||||||
|
#include "cudd.hh"
|
||||||
|
#include "bdd_macro.hh"
|
||||||
|
#include "symrs.hh"
|
||||||
|
|
||||||
std::string StateConstr::toStr(void) const
|
std::string StateConstr::toStr(void) const
|
||||||
{
|
{
|
||||||
@@ -40,7 +44,13 @@ std::string StateConstr::toStr(void) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BDD StateConstr::getBDD(const SymRS *srs) const
|
BDD StateConstr::getBDDforState(const SymRS *srs) const
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
// return BDD_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BDD StateConstr::getBDDforContext(const SymRS *srs) const
|
||||||
{
|
{
|
||||||
if (oper == STC_PV) {
|
if (oper == STC_PV) {
|
||||||
return srs->encActStrEntity(proc_name, entity_name);
|
return srs->encActStrEntity(proc_name, entity_name);
|
||||||
@@ -71,4 +81,3 @@ BDD StateConstr::getBDD(const SymRS *srs) const
|
|||||||
return srs->getBDDfalse();
|
return srs->getBDDfalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "types.hh"
|
#include "types.hh"
|
||||||
|
|
||||||
/* For Boolean contexts: */
|
/* For state constraints: */
|
||||||
#define STC_PV 80
|
#define STC_PV 80
|
||||||
#define STC_AND 81
|
#define STC_AND 81
|
||||||
#define STC_OR 82
|
#define STC_OR 82
|
||||||
@@ -87,7 +87,11 @@ class StateConstr
|
|||||||
|
|
||||||
std::string toStr(void) const;
|
std::string toStr(void) const;
|
||||||
|
|
||||||
BDD getBDD(const SymRS *srs) const;
|
BDD getBDD(const SymRS *srs) const {
|
||||||
|
return getBDDforContext(srs);
|
||||||
|
}
|
||||||
|
BDD getBDDforContext(const SymRS *srs) const;
|
||||||
|
BDD getBDDforState(const SymRS *srs) const;
|
||||||
|
|
||||||
Oper getOper(void) const
|
Oper getOper(void) const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user