Merge pull request #299 from moonshotxx/test

Utility functions in aig/gia
This commit is contained in:
alanminko 2024-05-23 17:53:11 -07:00 committed by GitHub
commit 1e58dc6b00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 3 deletions

View File

@ -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;

View File

@ -48,6 +48,7 @@ namespace NewTt {
bool fCountOnes;
int nGbc;
int nReo; // dummy
std::vector<int> *pVar2Level; // dummy
Param() {
nObjsAllocLog = 15;
nObjsMaxLog = 20;
@ -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;