mirror of
https://github.com/Z3Prover/z3
synced 2025-08-23 03:27:52 +00:00
add don't care option
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e0a41a18c3
commit
9f964be3f4
7 changed files with 201 additions and 98 deletions
|
@ -27,13 +27,20 @@ namespace sat {
|
|||
public:
|
||||
struct stats {
|
||||
unsigned m_num_eqs, m_num_units, m_num_cuts, m_num_xors, m_num_ands, m_num_ites;
|
||||
unsigned m_num_calls;
|
||||
unsigned m_num_calls, m_num_dont_care_reductions;
|
||||
stats() { reset(); }
|
||||
void reset() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
struct config {
|
||||
bool m_full;
|
||||
config():m_full(false) {}
|
||||
bool m_validate;
|
||||
bool m_enable_units;
|
||||
bool m_enable_dont_cares;
|
||||
bool m_add_learned;
|
||||
config():
|
||||
m_validate(false),
|
||||
m_enable_units(false),
|
||||
m_enable_dont_cares(false),
|
||||
m_add_learned(true) {}
|
||||
};
|
||||
private:
|
||||
struct report;
|
||||
|
@ -60,14 +67,16 @@ namespace sat {
|
|||
* Apply the masks on cut sets so to allow detecting
|
||||
* equivalences modulo implications.
|
||||
*/
|
||||
|
||||
enum op_code { pp, pn, np, nn, none };
|
||||
|
||||
struct var_pair {
|
||||
unsigned u, v;
|
||||
uint64_t masks[35];
|
||||
static unsigned size() { return sizeof(uint64_t)*35; }
|
||||
var_pair(unsigned u, unsigned v): u(u), v(v) {
|
||||
op_code op;
|
||||
var_pair(unsigned _u, unsigned _v): u(_u), v(_v), op(none) {
|
||||
if (u > v) std::swap(u, v);
|
||||
}
|
||||
var_pair(): u(UINT_MAX), v(UINT_MAX) {}
|
||||
var_pair(): u(UINT_MAX), v(UINT_MAX), op(none) {}
|
||||
|
||||
struct hash {
|
||||
unsigned operator()(var_pair const& p) const {
|
||||
|
@ -82,10 +91,13 @@ namespace sat {
|
|||
};
|
||||
hashtable<var_pair, var_pair::hash, var_pair::eq> m_pairs;
|
||||
|
||||
void collect_pairs(vector<cut_set> const& cuts);
|
||||
void add_mask(literal u, literal v, var_pair& p);
|
||||
void add_masks_to_pairs();
|
||||
void apply_masks();
|
||||
void add_dont_cares(vector<cut_set> const& cuts);
|
||||
void cuts2pairs(vector<cut_set> const& cuts);
|
||||
void pairs2dont_cares();
|
||||
void dont_cares2cuts(vector<cut_set> const& cuts);
|
||||
bool rewrite_cut(cut const& c, cut& r);
|
||||
uint64_t op2dont_care(unsigned i, unsigned j, var_pair const& p);
|
||||
|
||||
public:
|
||||
aig_simplifier(solver& s);
|
||||
~aig_simplifier();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue