ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
flags.hpp
Go to the documentation of this file.
1#ifndef _flags_hpp_INCLUDED
2#define _flags_hpp_INCLUDED
3
4#include "global.h"
5
7
8namespace CaDiCaL {
9
10struct Flags { // Variable flags.
11
12 // The first set of flags is related to 'analyze' and 'minimize'.
13 //
14 bool seen : 1; // seen in generating first UIP clause in 'analyze'
15 bool keep : 1; // keep in learned clause in 'minimize'
16 bool poison : 1; // can not be removed in 'minimize'
17 bool removable : 1; // can be removed in 'minimize'
18 bool shrinkable : 1; // can be removed in 'shrink'
19 bool added : 1; // has already been added to lrat_chain (in 'minimize')
20
21 // These three variable flags are used to schedule clauses in subsumption
22 // ('subsume'), variables in bounded variable elimination ('elim') and in
23 // hyper ternary resolution ('ternary').
24 //
25 bool elim : 1; // removed since last 'elim' round (*)
26 bool subsume : 1; // added since last 'subsume' round (*)
27 bool ternary : 1; // added in ternary clause since last 'ternary' (*)
28 bool sweep : 1;
29 bool blockable : 1;
30
31 unsigned char
32 marked_signed : 2; // generate correct LRAT chains in decompose
33 unsigned char factor : 2;
34
35 // These literal flags are used by blocked clause elimination ('block').
36 //
37 unsigned char block : 2; // removed since last 'block' round (*)
38 unsigned char skip : 2; // skip this literal as blocking literal
39
40 // Bits for handling assumptions.
41 //
42 unsigned char assumed : 2;
43 unsigned char failed : 2; // 0 if not part of failure
44 // 1 if positive lit is in failure
45 // 2 if negated lit is in failure
46
47 enum {
48 UNUSED = 0,
49 ACTIVE = 1,
50 FIXED = 2,
53 PURE = 5
54 };
55
56 unsigned char status : 3;
57
58 // Initialized explicitly in 'Internal::init' through this function.
59 //
60 Flags () {
61 seen = keep = poison = removable = shrinkable = added = sweep = false;
62 subsume = elim = ternary = true;
63 block = 3u;
65 status = UNUSED;
66 }
67
68 bool unused () const { return status == UNUSED; }
69 bool active () const { return status == ACTIVE; }
70 bool fixed () const { return status == FIXED; }
71 bool eliminated () const { return status == ELIMINATED; }
72 bool substituted () const { return status == SUBSTITUTED; }
73 bool pure () const { return status == PURE; }
74
75 // The flags marked with '(*)' are copied during 'External::copy_flags',
76 // which in essence means they are reset in the copy if they were clear.
77 // This avoids the effort of fruitless preprocessing the copy.
78
79 void copy (Flags &dst) const {
80 dst.elim = elim;
81 dst.subsume = subsume;
82 dst.ternary = ternary;
83 dst.block = block;
84 }
85};
86
87} // namespace CaDiCaL
88
90
91#endif
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
void copy(Flags &dst) const
Definition flags.hpp:79
bool eliminated() const
Definition flags.hpp:71
bool removable
Definition flags.hpp:17
bool shrinkable
Definition flags.hpp:18
unsigned char marked_signed
Definition flags.hpp:32
unsigned char skip
Definition flags.hpp:38
bool substituted() const
Definition flags.hpp:72
unsigned char failed
Definition flags.hpp:43
bool fixed() const
Definition flags.hpp:70
unsigned char status
Definition flags.hpp:56
bool blockable
Definition flags.hpp:29
unsigned char block
Definition flags.hpp:37
unsigned char assumed
Definition flags.hpp:42
unsigned char factor
Definition flags.hpp:33
bool unused() const
Definition flags.hpp:68
bool pure() const
Definition flags.hpp:73
bool active() const
Definition flags.hpp:69