Skip to content

Commit

Permalink
Merge pull request #299 from moonshotxx/test
Browse files Browse the repository at this point in the history
Utility functions in aig/gia
  • Loading branch information
alanminko authored May 24, 2024
2 parents 161963a + 34c2ed7 commit 1e58dc6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
28 changes: 26 additions & 2 deletions src/aig/gia/giaNewBdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,34 @@ namespace NewBdd {
for(size_t i = 0; i < vLits.size(); i++)
IncRef(vLits[i]);
}
void RemoveRefIfUnused() {
if(!nGbc && nReo == BvarMax())
vRefs.clear();
}
void TurnOnReo(int nReo_ = 0, std::vector<lit> const *vLits = NULL) {
if(nReo_)
nReo = nReo_;
else
nReo = nObjs << 1;
if((lit)nReo > (lit)BvarMax())
nReo = BvarMax();
if(vRefs.empty()) {
if(vLits)
SetRef(*vLits);
else
vRefs.resize(nObjsAlloc);
}
}
void TurnOffReo() {
nReo = BvarMax();
if(!nGbc)
vRefs.clear();
}
var GetNumVars() const {
return nVars;
}
void GetOrdering(std::vector<int> &Var2Level_) {
Var2Level_.resize(nVars);
for(var v = 0; v < nVars; v++)
Var2Level_[v] = Var2Level[v];
}
bvar CountNodes() {
bvar count = 1;
Expand Down
7 changes: 6 additions & 1 deletion src/aig/gia/giaNewTt.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace NewTt {
bool fCountOnes;
int nGbc;
int nReo; // dummy
std::vector<int> *pVar2Level; // dummy
Param() {
nObjsAllocLog = 15;
nObjsMaxLog = 20;
Expand Down Expand Up @@ -261,10 +262,14 @@ namespace NewTt {
for(size_t i = 0; i < vLits.size(); i++)
IncRef(vLits[i]);
}
void TurnOffReo() {
void RemoveRefIfUnused() {
if(!nGbc)
vRefs.clear();
}
void TurnOffReo() {}
int GetNumVars() const {
return nVars;
}
void PrintNode(lit x) const {
bvar a = Lit2Bvar(x);
word c = LitIsCompl(x)? one(): 0;
Expand Down

0 comments on commit 1e58dc6

Please sign in to comment.