diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-03-01 21:00:34 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-03-01 21:00:34 +0100 |
commit | d500bd749f84c0b05a8ec96d2a5fc33ace0c5b58 (patch) | |
tree | 90f2dc8cf7195a71ab48c4fea0b9ce1e6e105f71 /libs/ezsat/ezsat.cc | |
parent | 23f0a12c727721478bcb87ec142fb86a329f7cdb (diff) | |
download | yosys-d500bd749f84c0b05a8ec96d2a5fc33ace0c5b58.tar.gz yosys-d500bd749f84c0b05a8ec96d2a5fc33ace0c5b58.tar.bz2 yosys-d500bd749f84c0b05a8ec96d2a5fc33ace0c5b58.zip |
Added ezSAT::eliminated API to help the SAT solver remember eliminated variables
Diffstat (limited to 'libs/ezsat/ezsat.cc')
-rw-r--r-- | libs/ezsat/ezsat.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/ezsat/ezsat.cc b/libs/ezsat/ezsat.cc index cc6301e44..4389c7a62 100644 --- a/libs/ezsat/ezsat.cc +++ b/libs/ezsat/ezsat.cc @@ -348,9 +348,13 @@ void ezSAT::freeze(int) { } -void ezSAT::assume(int id) +bool ezSAT::eliminated(int) { + return false; +} +void ezSAT::assume(int id) +{ if (id < 0) { assert(0 < -id && -id <= int(expressions.size())); @@ -486,7 +490,7 @@ int ezSAT::bind(int id) if (id >= 0) { assert(0 < id && id <= int(literals.size())); cnfLiteralVariables.resize(literals.size()); - if (cnfLiteralVariables[id-1] == 0) { + if (cnfLiteralVariables[id-1] == 0 || eliminated(cnfLiteralVariables[id-1])) { cnfLiteralVariables[id-1] = ++cnfVariableCount; if (id == TRUE) add_clause(+cnfLiteralVariables[id-1]); @@ -499,7 +503,7 @@ int ezSAT::bind(int id) assert(0 < -id && -id <= int(expressions.size())); cnfExpressionVariables.resize(expressions.size()); - if (cnfExpressionVariables[-id-1] == 0) + if (cnfExpressionVariables[-id-1] == 0 || eliminated(cnfExpressionVariables[-id-1])) { OpId op; std::vector<int> args; |