149 std::vector<int> vPis;
150 std::vector<int> vPos;
151 std::list<int> vObjs;
152 std::vector<std::vector<int> > vvFis;
153 std::vector<std::vector<int> > vvFos;
154 std::vector<int> vLevels;
155 std::vector<int> vSlacks;
156 std::vector<std::vector<int> > vvFiSlacks;
157 std::vector<lit> vFs;
158 std::vector<lit> vGs;
159 std::vector<std::vector<lit> > vvCs;
160 std::vector<bool> vUpdates;
161 std::vector<bool> vPfUpdates;
162 std::vector<bool> vFoConeShared;
163 std::vector<lit> vPoFs;
169 inline bool AllFalse(std::vector<bool>
const &v)
const {
170 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++)
182 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++)
183 count += vvFis[*it].size();
191 for(
unsigned i = 0; i < vPos.size(); i++)
192 count = std::max(count, vLevels[vvFis[vPos[i]][0] >> 1]);
195 inline void Print(std::string str,
bool nl)
const {
197 std::cout <<
"\33[2K\r";
200 std::cout << std::endl;
202 std::cout << std::flush;
204 inline void PrintStats(std::string prefix,
bool nl,
int prefix_size = 0)
const {
206 prefix_size = prefix.size();
207 std::stringstream ss;
208 ss << std::left << std::setw(prefix_size) << prefix <<
": " << std::right;
209 ss <<
"#nodes = " << std::setw(5) <<
CountNodes();
211 ss <<
", #level = " << std::setw(5) <<
CountLevels();
212 ss <<
", elapsed = " << std::setprecision(2) << std::fixed << std::setw(8) << 1.0 * (Abc_Clock() - startclk) / CLOCKS_PER_SEC <<
"s";
216 std::stringstream ss;
217 ss <<
"\t\t" << prefix;
219 ss <<
" (blocking Wire " << block_i0 <<
" -> " << block <<
")";
221 ss <<
" (blocking Gate " << block <<
")";
222 Print(ss.str(),
true);
226 void SortObjs_rec(std::list<int>::iterator
const &it) {
227 for(
unsigned j = 0; j < vvFis[*it].size(); j++) {
228 int i0 = vvFis[*it][j] >> 1;
229 if(!vvFis[i0].empty()) {
230 std::list<int>::iterator it_i0 = std::find(it, vObjs.end(), i0);
231 if(it_i0 != vObjs.end()) {
235 it_i0 = vObjs.insert(it, i0);
241 inline void Connect(
int i,
int f,
bool fSort =
false,
bool fUpdate =
true,
lit c = LitMax) {
244 std::stringstream ss;
245 ss <<
"\t\t\t\t\tadd Wire " << std::setw(5) << i0 <<
"(" << (f & 1) <<
")"
246 <<
" -> " << std::setw(5) << i;
247 Print(ss.str(),
true);
249 assert(std::find(vvFis[i].begin(), vvFis[i].end(), f) == vvFis[i].end());
250 vvFis[i].push_back(f);
251 vvFos[i0].push_back(i);
255 vvCs[i].push_back(c);
256 if(fSort && !vvFos[i].empty() && !vvFis[i0].empty()) {
257 std::list<int>::iterator it = find(vObjs.begin(), vObjs.end(), i);
258 std::list<int>::iterator it_i0 = find(it, vObjs.end(), i0);
259 if(it_i0 != vObjs.end()) {
263 it_i0 = vObjs.insert(it, i0);
268 inline void Disconnect(
int i,
int i0,
unsigned j,
bool fUpdate =
true,
bool fPfUpdate =
true) {
270 std::stringstream ss;
271 ss <<
"\t\t\t\t\tremove Wire " << std::setw(5) << i0 <<
"(" << (vvFis[i][j] & 1) <<
")"
272 <<
" -> " << std::setw(5) << i;
273 Print(ss.str(),
true);
275 vvFos[i0].erase(std::find(vvFos[i0].begin(), vvFos[i0].end(), i));
276 vvFis[i].erase(vvFis[i].begin() + j);
277 this->DecRef(vvCs[i][j]);
278 vvCs[i].erase(vvCs[i].begin() + j);
282 vPfUpdates[i0] =
true;
284 inline int Remove(
int i,
bool fPfUpdate =
true) {
286 std::stringstream ss;
287 ss <<
"\t\t\t\t\tremove Gate " << std::setw(5) << i;
288 Print(ss.str(),
true);
291 for(
unsigned j = 0; j < vvFis[i].size(); j++) {
292 int i0 = vvFis[i][j] >> 1;
293 vvFos[i0].erase(std::find(vvFos[i0].begin(), vvFos[i0].end(), i));
295 vPfUpdates[i0] =
true;
297 int count = vvFis[i].size();
299 this->DecRef(vFs[i]);
300 this->DecRef(vGs[i]);
301 vFs[i] = vGs[i] = LitMax;
302 this->DelVec(vvCs[i]);
303 vUpdates[i] = vPfUpdates[i] =
false;
306 inline int FindFi(
int i,
int i0)
const {
307 for(
unsigned j = 0; j < vvFis[i].size(); j++)
308 if((vvFis[i][j] >> 1) == i0)
312 inline int Replace(
int i,
int f,
bool fUpdate =
true) {
314 std::stringstream ss;
315 ss <<
"\t\t\t\treplace Gate " << std::setw(5) << i
316 <<
" by Node " << std::setw(5) << (f >> 1) <<
"(" << (f & 1) <<
")";
317 Print(ss.str(),
true);
321 for(
unsigned j = 0; j < vvFos[i].size(); j++) {
323 int l = FindFi(k, i);
325 int fc = f ^ (vvFis[k][l] & 1);
326 if(find(vvFis[k].begin(), vvFis[k].end(), fc) != vvFis[k].end()) {
327 this->DecRef(vvCs[k][l]);
328 vvCs[k].erase(vvCs[k].begin() + l);
329 vvFis[k].erase(vvFis[k].begin() + l);
332 vvFis[k][l] = f ^ (vvFis[k][l] & 1);
333 vvFos[f >> 1].push_back(k);
339 vPfUpdates[f >> 1] =
true;
340 return count + Remove(i);
342 int ReplaceByConst(
int i,
bool c) {
344 std::stringstream ss;
345 ss <<
"\t\t\t\treplace Gate " << std::setw(5) << i <<
" by Const " << c;
346 Print(ss.str(),
true);
349 for(
unsigned j = 0; j < vvFos[i].size(); j++) {
351 int l = FindFi(k, i);
353 bool fc = c ^ (vvFis[k][l] & 1);
354 this->DecRef(vvCs[k][l]);
355 vvCs[k].erase(vvCs[k].begin() + l);
356 vvFis[k].erase(vvFis[k].begin() + l);
358 if(vvFis[k].
size() == 1)
359 count += Replace(k, vvFis[k][0]);
363 count += ReplaceByConst(k, 0);
365 count += vvFos[i].size();
367 return count + Remove(i);
369 inline void NewGate(
int &
pos) {
370 while(
pos != nObjsAlloc && (!vvFis[
pos].empty() || !vvFos[
pos].empty()))
373 std::stringstream ss;
374 ss <<
"\t\t\t\t\tcreate Gate " << std::setw(5) <<
pos;
375 Print(ss.str(),
true);
377 if(
pos == nObjsAlloc) {
379 vvFis.resize(nObjsAlloc);
380 vvFos.resize(nObjsAlloc);
382 vLevels.resize(nObjsAlloc);
383 vSlacks.resize(nObjsAlloc);
384 vvFiSlacks.resize(nObjsAlloc);
386 vFs.resize(nObjsAlloc, LitMax);
387 vGs.resize(nObjsAlloc, LitMax);
388 vvCs.resize(nObjsAlloc);
389 vUpdates.resize(nObjsAlloc);
390 vPfUpdates.resize(nObjsAlloc);
393 void MarkFiCone_rec(std::vector<bool> &vMarks,
int i)
const {
397 for(
unsigned j = 0; j < vvFis[i].size(); j++)
398 MarkFiCone_rec(vMarks, vvFis[i][j] >> 1);
400 void MarkFoCone_rec(std::vector<bool> &vMarks,
int i)
const {
404 for(
unsigned j = 0; j < vvFos[i].size(); j++)
405 MarkFoCone_rec(vMarks, vvFos[i][j]);
407 bool IsFoConeShared_rec(std::vector<int> &vVisits,
int i,
int visitor)
const {
408 if(vVisits[i] == visitor)
412 vVisits[i] = visitor;
413 for(
unsigned j = 0; j < vvFos[i].size(); j++)
414 if(IsFoConeShared_rec(vVisits, vvFos[i][j], visitor))
418 inline bool IsFoConeShared(
int i)
const {
419 std::vector<int> vVisits(nObjsAlloc);
420 for(
unsigned j = 0; j < vvFos[i].size(); j++)
421 if(IsFoConeShared_rec(vVisits, vvFos[i][j], j + 1))
427 inline void add(std::vector<bool> &a,
unsigned i) {
433 for(; i < a.size() && a[i]; i++)
439 inline bool balanced(std::vector<bool>
const &a) {
440 for(
unsigned i = 0; i < a.size() - 1; i++)
445 inline bool noexcess(std::vector<bool>
const &a,
unsigned i) {
448 for(
unsigned j = i; j < a.size(); j++)
451 for(
unsigned j = 0; j < i; j++)
456 inline void ComputeLevel() {
457 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++) {
458 if(vvFis[*it].
size() == 2)
459 vLevels[*it] = std::max(vLevels[vvFis[*it][0] >> 1], vLevels[vvFis[*it][1] >> 1]) + 1;
461 std::vector<bool> lev;
462 for(
unsigned j = 0; j < vvFis[*it].size(); j++)
463 add(lev, vLevels[vvFis[*it][j] >> 1]);
465 vLevels[*it] = (int)lev.size() - 1;
467 vLevels[*it] = (int)lev.size();
471 nMaxLevels = CountLevels();
472 for(
unsigned i = 0; i < vPos.size(); i++) {
473 vvFiSlacks[vPos[i]].resize(1);
474 vvFiSlacks[vPos[i]][0] = nMaxLevels - vLevels[vvFis[vPos[i]][0] >> 1];
476 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend(); it++) {
477 vSlacks[*it] = nMaxLevels;
478 for(
unsigned j = 0; j < vvFos[*it].size(); j++) {
479 int k = vvFos[*it][j];
480 int l = FindFi(k, *it);
482 vSlacks[*it] = std::min(vSlacks[*it], vvFiSlacks[k][l]);
484 vvFiSlacks[*it].resize(vvFis[*it].
size());
485 for(
unsigned j = 0; j < vvFis[*it].size(); j++)
486 vvFiSlacks[*it][j] = vSlacks[*it] + vLevels[*it] - 1 - vLevels[vvFis[*it][j] >> 1];
491 inline void ShufflePis(
int seed) {
493 for(
int i = (
int)vPis.size() - 1; i > 0; i--)
494 std::swap(vPis[i], vPis[rand() % (i + 1)]);
496 inline bool CostCompare(
int a,
int b)
const {
499 if(vvFis[
a0].empty() && vvFis[
b0].empty())
500 return std::find(find(vPis.begin(), vPis.end(),
a0), vPis.end(),
b0) != vPis.end();
501 if(vvFis[
a0].empty() && !vvFis[
b0].empty())
503 if(!vvFis[
a0].empty() && vvFis[
b0].empty())
513 return std::find(find(vObjs.begin(), vObjs.end(),
a0), vObjs.end(),
b0) == vObjs.end();
515 return this->man->OneCount(this->man->LitNotCond(vFs[
a0], ac)) < this->man->OneCount(this->man->LitNotCond(vFs[
b0], bc));
517 return this->man->OneCount(vFs[
a0]) < this->man->OneCount(vFs[
b0]);
519 return this->man->OneCount(this->man->LitNot(vFs[
a0])) < this->man->OneCount(vFs[
b0]);
524 inline bool SortFis(
int i) {
526 std::stringstream ss;
527 ss <<
"\t\t\t\tsort FIs Gate " << std::setw(5) << i;
528 Print(ss.str(),
true);
531 for(
int p = 1;
p < (int)vvFis[i].size();
p++) {
535 for(; q >= 0 && CostCompare(f, vvFis[i][q]); q--) {
536 vvFis[i][q + 1] = vvFis[i][q];
537 vvCs[i][q + 1] = vvCs[i][q];
546 for(
unsigned j = 0; j < vvFis[i].size(); j++) {
547 std::stringstream ss;
548 ss <<
"\t\t\t\t\tFI " << j <<
" = "
549 << std::setw(5) << (vvFis[i][j] >> 1) <<
"(" << (vvFis[i][j] & 1) <<
")";
550 Print(ss.str(),
true);
556 inline lit LitFi(
int i,
int j)
const {
557 int i0 = vvFis[i][j] >> 1;
558 bool c0 = vvFis[i][j] & 1;
559 return this->man->LitNotCond(vFs[i0], c0);
561 inline lit LitFi(
int i,
int j, std::vector<lit>
const &vFs_)
const {
562 int i0 = vvFis[i][j] >> 1;
563 bool c0 = vvFis[i][j] & 1;
564 return this->man->LitNotCond(vFs_[i0], c0);
566 inline void Build(
int i, std::vector<lit> &vFs_)
const {
568 std::stringstream ss;
569 ss <<
"\t\t\t\tbuilding Gate" << std::setw(5) << i;
570 Print(ss.str(), nVerbose > 7);
572 this->Update(vFs_[i], this->man->Const1());
573 for(
unsigned j = 0; j < vvFis[i].size(); j++)
574 this->Update(vFs_[i], this->man->And(vFs_[i], LitFi(i, j, vFs_)));
576 inline void Build(
bool fPfUpdate =
true) {
578 Print(
"\t\t\tBuild",
true);
579 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
585 if(!this->man->LitIsEq(x, vFs[*it]))
586 for(
unsigned j = 0; j < vvFos[*it].size(); j++)
587 vUpdates[vvFos[*it][j]] =
true;
590 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
591 vPfUpdates[*it] = vPfUpdates[*it] || vUpdates[*it];
592 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
593 vUpdates[*it] =
false;
594 assert(AllFalse(vUpdates));
596 void BuildFoConeCompl(
int i, std::vector<lit> &vPoFsCompl)
const {
598 std::stringstream ss;
599 ss <<
"\t\t\tBuild with complemented Gate " << std::setw(5) << i;
600 Print(ss.str(),
true);
602 std::vector<lit> vFsCompl;
603 this->CopyVec(vFsCompl, vFs);
604 vFsCompl[i] = this->man->LitNot(vFs[i]);
605 std::vector<bool> vUpdatesCompl(nObjsAlloc);
606 for(
unsigned j = 0; j < vvFos[i].size(); j++)
607 vUpdatesCompl[vvFos[i][j]] =
true;
608 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++)
609 if(vUpdatesCompl[*it]) {
610 Build(*it, vFsCompl);
611 if(!this->man->LitIsEq(vFsCompl[*it], vFs[*it]))
612 for(
unsigned j = 0; j < vvFos[*it].size(); j++)
613 vUpdatesCompl[vvFos[*it][j]] =
true;
615 for(
unsigned j = 0; j < vPos.size(); j++)
616 this->Update(vPoFsCompl[j], LitFi(vPos[j], 0, vFsCompl));
617 this->DelVec(vFsCompl);
621 inline int RemoveRedundantFis(
int i,
int block_i0 = -1,
unsigned j = 0) {
623 for(; j < vvFis[i].size(); j++) {
624 if(block_i0 == (vvFis[i][j] >> 1))
626 lit x = this->man->Const1();
628 for(
unsigned jj = 0; jj < vvFis[i].size(); jj++)
630 this->Update(x, this->man->And(x, LitFi(i, jj)));
631 this->Update(x, this->man->Or(this->man->LitNot(x), vGs[i]));
632 this->Update(x, this->man->Or(x, LitFi(i, j)));
634 if(this->man->IsConst1(x)) {
635 int i0 = vvFis[i][j] >> 1;
637 std::stringstream ss;
638 ss <<
"\t\t\t\t[Rrfi] remove Wire " << std::setw(5) << i0 <<
"(" << (vvFis[i][j] & 1) <<
")"
639 <<
" -> " << std::setw(5) << i;
640 Print(ss.str(),
true);
642 Disconnect(i, i0, j--);
648 inline void CalcG(
int i) {
649 this->Update(vGs[i], this->man->Const1());
650 for(
unsigned j = 0; j < vvFos[i].size(); j++) {
652 int l = FindFi(k, i);
654 this->Update(vGs[i], this->man->And(vGs[i], vvCs[k][l]));
657 inline int CalcC(
int i) {
659 for(
unsigned j = 0; j < vvFis[i].size(); j++) {
660 lit x = this->man->Const1();
662 for(
unsigned jj = j + 1; jj < vvFis[i].size(); jj++)
663 this->Update(x, this->man->And(x, LitFi(i, jj)));
664 this->Update(x, this->man->Or(this->man->LitNot(x), vGs[i]));
665 int i0 = vvFis[i][j] >> 1;
666 if(this->man->IsConst1(this->man->Or(x, LitFi(i, j)))) {
668 std::stringstream ss;
669 ss <<
"\t\t\t\t[Cspf] remove Wire " << std::setw(5) << i0 <<
"(" << (vvFis[i][j] & 1) <<
")"
670 <<
" -> " << std::setw(5) << i;
671 Print(ss.str(),
true);
673 Disconnect(i, i0, j--);
675 }
else if(!this->man->LitIsEq(vvCs[i][j], x)) {
676 this->Update(vvCs[i][j], x);
677 vPfUpdates[i0] =
true;
683 int Cspf(
bool fSortRemove,
int block = -1,
int block_i0 = -1) {
685 PrintPfHeader(
"Cspf", block, block_i0);
687 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
688 vPfUpdates[*it] =
true;
691 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend();) {
692 if(vvFos[*it].empty()) {
694 std::stringstream ss;
695 ss <<
"\t\t\tremove unused Gate " << std::setw(5) << *it;
696 Print(ss.str(), nVerbose > 4);
698 count += Remove(*it);
699 it = std::list<int>::reverse_iterator(vObjs.erase(--(it.base())));
702 if(!vPfUpdates[*it]) {
707 std::stringstream ss;
708 ss <<
"\t\t\tprocessing Gate " << std::setw(5) << *it
709 <<
" (" << std::setw(5) << std::distance(vObjs.rbegin(), it) + 1
710 <<
"/" << std::setw(5) << vObjs.size() <<
")";
711 Print(ss.str(), nVerbose > 4);
716 SortFis(*it), count += RemoveRedundantFis(*it);
717 else if(block_i0 != -1)
718 count += RemoveRedundantFis(*it, block_i0);
721 vPfUpdates[*it] =
false;
722 assert(!vvFis[*it].empty());
723 if(vvFis[*it].
size() == 1) {
724 count += Replace(*it, vvFis[*it][0]);
725 it = std::list<int>::reverse_iterator(vObjs.erase(--(it.base())));
731 assert(AllFalse(vPfUpdates));
738 inline bool MspfCalcG(
int i) {
741 std::vector<lit> vPoFsCompl(vPos.size(), LitMax);
742 BuildFoConeCompl(i, vPoFsCompl);
743 this->Update(vGs[i], this->man->Const1());
744 for(
unsigned j = 0; j < vPos.size(); j++) {
745 lit x = this->man->LitNot(this->Xor(vPoFs[j], vPoFsCompl[j]));
747 this->Update(x, this->man->Or(x, vvCs[vPos[j]][0]));
748 this->Update(vGs[i], this->man->And(vGs[i], x));
751 this->DelVec(vPoFsCompl);
753 return !this->man->LitIsEq(vGs[i], g);
755 inline int MspfCalcC(
int i,
int block_i0 = -1) {
756 for(
unsigned j = 0; j < vvFis[i].size(); j++) {
757 lit x = this->man->Const1();
759 for(
unsigned jj = 0; jj < vvFis[i].size(); jj++)
761 this->Update(x, this->man->And(x, LitFi(i, jj)));
762 this->Update(x, this->man->Or(this->man->LitNot(x), vGs[i]));
763 int i0 = vvFis[i][j] >> 1;
764 if(i0 != block_i0 && this->man->IsConst1(this->man->Or(x, LitFi(i, j)))) {
766 std::stringstream ss;
767 ss <<
"\t\t\t\t[Mspf] remove Wire " << std::setw(5) << i0 <<
"(" << (vvFis[i][j] & 1) <<
")"
768 <<
" -> " << std::setw(5) << i;
769 Print(ss.str(),
true);
771 Disconnect(i, i0, j);
773 return RemoveRedundantFis(i, block_i0, j) + 1;
774 }
else if(!this->man->LitIsEq(vvCs[i][j], x)) {
775 this->Update(vvCs[i][j], x);
776 vPfUpdates[i0] =
true;
782 int Mspf(
bool fSort,
int block = -1,
int block_i0 = -1) {
784 PrintPfHeader(
"Mspf", block, block_i0);
785 assert(AllFalse(vUpdates));
786 vFoConeShared.resize(nObjsAlloc);
788 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
789 vPfUpdates[*it] =
true;
793 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend();) {
794 if(vvFos[*it].empty()) {
796 std::stringstream ss;
797 ss <<
"\t\t\tremove unused Gate " << std::setw(5) << *it;
798 Print(ss.str(), nVerbose > 4);
800 count += Remove(*it);
801 it = std::list<int>::reverse_iterator(vObjs.erase(--(it.base())));
804 if(!vFoConeShared[*it] && !vPfUpdates[*it] && (vvFos[*it].
size() == 1 || !IsFoConeShared(*it))) {
809 std::stringstream ss;
810 ss <<
"\t\t\tprocessing Gate " << std::setw(5) << *it
811 <<
" (" << std::setw(5) << std::distance(vObjs.rbegin(), it) + 1
812 <<
"/" << std::setw(5) << vObjs.size() <<
")"
813 <<
", #restarts = " << std::setw(3) << restarts;
814 Print(ss.str(), nVerbose > 4);
816 if(vvFos[*it].
size() == 1 || !IsFoConeShared(*it)) {
817 if(vFoConeShared[*it]) {
818 vFoConeShared[*it] =
false;
823 if(g == vGs[*it] && !vPfUpdates[*it]) {
830 vFoConeShared[*it] =
true;
831 if(!MspfCalcG(*it) && !vPfUpdates[*it]) {
835 bool IsConst1 = this->man->IsConst1(this->man->Or(vGs[*it], vFs[*it]));
836 bool IsConst0 = IsConst1?
false: this->man->IsConst1(this->man->Or(vGs[*it], this->man->LitNot(vFs[*it])));
837 if(IsConst1 || IsConst0) {
838 count += ReplaceByConst(*it, (
int)IsConst1);
839 vObjs.erase(--(it.base()));
846 if(fSort && block != *it)
848 if(
int diff = (block == *it)? MspfCalcC(*it, block_i0): MspfCalcC(*it)) {
850 assert(!vvFis[*it].empty());
851 if(vvFis[*it].
size() == 1) {
852 count += Replace(*it, vvFis[*it][0]);
853 vObjs.erase(--(it.base()));
860 vPfUpdates[*it] =
false;
863 assert(AllFalse(vUpdates));
864 assert(AllFalse(vPfUpdates));
871 inline int TrivialMergeOne(
int i) {
873 std::vector<int> vFisOld = vvFis[i];
874 std::vector<lit> vCsOld = vvCs[i];
877 for(
unsigned j = 0; j < vFisOld.size(); j++) {
878 int i0 = vFisOld[j] >> 1;
879 int c0 = vFisOld[j] & 1;
880 if(vvFis[i0].empty() || vvFos[i0].
size() > 1 || c0) {
882 std::stringstream ss;
883 ss <<
"\t\t[TrivialMerge] adding Wire " << std::setw(5) << i0 <<
"(" << c0 <<
")"
884 <<
" -> " << std::setw(5) << i;
885 Print(ss.str(),
true);
887 vvFis[i].push_back(vFisOld[j]);
888 vvCs[i].push_back(vCsOld[j]);
891 vPfUpdates[i] = vPfUpdates[i] | vPfUpdates[i0];
892 vvFos[i0].erase(find(vvFos[i0].begin(), vvFos[i0].end(), i));
894 typename std::vector<int>::iterator itfi = vFisOld.begin() + j;
895 typename std::vector<lit>::iterator itc = vCsOld.begin() + j;
896 for(
unsigned jj = 0; jj < vvFis[i0].size(); jj++) {
897 int f = vvFis[i0][jj];
898 std::vector<int>::iterator it = find(vvFis[i].begin(), vvFis[i].end(), f);
899 if(it == vvFis[i].end()) {
900 vvFos[f >> 1].push_back(i);
901 itfi = vFisOld.insert(itfi, f);
902 itc = vCsOld.insert(itc, vvCs[i0][jj]);
911 count += Remove(i0,
false);
912 vObjs.erase(find(vObjs.begin(), vObjs.end(), i0));
920 inline int TrivialDecomposeOne(std::list<int>::iterator
const &it,
int &
pos) {
922 std::stringstream ss;
923 ss <<
"\tTrivialDecompose Gate " << std::setw(5) << *it;
924 Print(ss.str() , nVerbose > 3);
927 int count = 2 - vvFis[*it].size();
928 while(vvFis[*it].
size() > 2) {
929 int f0 = vvFis[*it].back();
930 lit c0 = vvCs[*it].back();
931 Disconnect(*it, f0 >> 1, vvFis[*it].
size() - 1,
false,
false);
932 int f1 = vvFis[*it].back();
933 lit c1 = vvCs[*it].back();
934 Disconnect(*it, f1 >> 1, vvFis[*it].
size() - 1,
false,
false);
936 Connect(
pos, f1,
false,
false, c1);
937 Connect(
pos, f0,
false,
false, c0);
938 if(!vPfUpdates[*it]) {
940 this->Update(vGs[
pos], vGs[*it]);
941 else if(state ==
mspf) {
942 lit x = this->man->Const1();
944 for(
unsigned j = 0; j < vvFis[*it].size(); j++)
945 this->Update(x, this->man->And(x, LitFi(*it, j)));
946 this->Update(vGs[
pos], this->man->Or(this->man->LitNot(x), vGs[*it]));
950 Connect(*it,
pos << 1,
false,
false, vGs[
pos]);
951 vObjs.insert(it,
pos);
956 inline int BalancedDecomposeOne(std::list<int>::iterator
const &it,
int &
pos) {
958 std::stringstream ss;
959 ss <<
"\tBalancedDecompose Gate " << std::setw(5) << *it;
960 Print(ss.str(), nVerbose > 3);
964 for(
int p = 1;
p < (int)vvFis[*it].size();
p++) {
965 int f = vvFis[*it][
p];
966 lit c = vvCs[*it][
p];
968 for(; q >= 0 && vLevels[f >> 1] > vLevels[vvFis[*it][q] >> 1]; q--) {
969 vvFis[*it][q + 1] = vvFis[*it][q];
970 vvCs[*it][q + 1] = vvCs[*it][q];
973 vvFis[*it][q + 1] = f;
974 vvCs[*it][q + 1] = c;
977 int count = 2 - vvFis[*it].size();
978 while(vvFis[*it].
size() > 2) {
979 int f0 = vvFis[*it].back();
980 lit c0 = vvCs[*it].back();
981 Disconnect(*it, f0 >> 1, vvFis[*it].
size() - 1,
false,
false);
982 int f1 = vvFis[*it].back();
983 lit c1 = vvCs[*it].back();
984 Disconnect(*it, f1 >> 1, vvFis[*it].
size() - 1,
false,
false);
986 Connect(
pos, f1,
false,
false, c1);
987 Connect(
pos, f0,
false,
false, c0);
988 Connect(*it,
pos << 1,
false,
false);
990 vLevels[
pos] = std::max(vLevels[f0 >> 1], vLevels[f1 >> 1]) + 1;
991 vObjs.insert(it,
pos);
992 int f = vvFis[*it].back();
993 lit c = vvCs[*it].back();
994 int q = (int)vvFis[*it].
size() - 2;
995 for(; q >= 0 && vLevels[f >> 1] > vLevels[vvFis[*it][q] >> 1]; q--) {
996 vvFis[*it][q + 1] = vvFis[*it][q];
997 vvCs[*it][q + 1] = vvCs[*it][q];
999 if(q + 1 != (
int)vvFis[*it].
size() - 1) {
1000 vvFis[*it][q + 1] = f;
1001 vvCs[*it][q + 1] = c;
1004 vPfUpdates[*it] =
true;
1011 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend();) {
1012 count += TrivialMergeOne(*it);
1019 int pos = vPis.size() + 1;
1020 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
1021 if(vvFis[*it].size() > 2)
1022 count += TrivialDecomposeOne(it,
pos);
1027 int pos = vPis.size() + 1;
1028 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++) {
1029 std::set<int> s1(vvFis[*it].begin(), vvFis[*it].end());
1030 assert(s1.size() == vvFis[*it].size());
1031 std::list<int>::iterator it2 = it;
1032 for(it2++; it2 != vObjs.end(); it2++) {
1033 std::set<int> s2(vvFis[*it2].begin(), vvFis[*it2].end());
1035 std::set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(s, s.begin()));
1040 std::stringstream ss;
1041 ss <<
"\treplace Gate " << std::setw(5) << *it2
1042 <<
" by Gate " << std::setw(5) << *it;
1043 Print(ss.str() , nVerbose > 3);
1045 count += Replace(*it2, *it << 1,
false);
1046 it2 = vObjs.erase(it2);
1050 std::stringstream ss;
1051 ss <<
"\tdecompose Gate " << std::setw(5) << *it2
1052 <<
" by Gate " << std::setw(5) << *it;
1053 Print(ss.str() , nVerbose > 3);
1055 for(std::set<int>::iterator it3 = s.begin(); it3 != s.end(); it3++) {
1056 unsigned j = find(vvFis[*it2].begin(), vvFis[*it2].end(), *it3) - vvFis[*it2].begin();
1057 Disconnect(*it2, *it3 >> 1, j,
false);
1060 if(std::find(vvFis[*it2].begin(), vvFis[*it2].end(), *it << 1) == vvFis[*it2].end()) {
1061 Connect(*it2, *it << 1,
false,
false);
1064 vPfUpdates[*it2] =
true;
1069 it = vObjs.insert(it, *it2);
1074 std::stringstream ss;
1075 ss <<
"\tdecompose Gate " << std::setw(5) << *it
1076 <<
" and " << std::setw(5) << *it2
1077 <<
" by a new Gate " << std::setw(5) <<
pos;
1078 Print(ss.str() , nVerbose > 3);
1081 std::stringstream ss;
1082 ss <<
"\t\tIntersection:";
1083 for(std::set<int>::iterator it3 = s.begin(); it3 != s.end(); it3++)
1084 ss <<
" " << (*it3 >> 1) <<
"(" << (*it3 & 1) <<
")";
1085 Print(ss.str(),
true);
1087 for(std::set<int>::iterator it3 = s.begin(); it3 != s.end(); it3++)
1088 Connect(
pos, *it3,
false,
false);
1090 it = vObjs.insert(it,
pos);
1092 vPfUpdates[*it] =
true;
1098 if(vvFis[*it].size() > 2)
1099 count += TrivialDecomposeOne(it,
pos);
1107 b.nObjsAlloc = nObjsAlloc;
1112 b.vLevels = vLevels;
1113 b.vSlacks = vSlacks;
1114 b.vvFiSlacks = vvFiSlacks;
1115 this->CopyVec(b.vFs, vFs);
1116 this->CopyVec(b.vGs, vGs);
1117 this->CopyVec(b.vvCs, vvCs);
1118 b.vUpdates = vUpdates;
1119 b.vPfUpdates = vPfUpdates;
1120 b.vFoConeShared = vFoConeShared;
1122 inline void Load(TransductionBackup<Man, lit, LitMax>
const &b) {
1123 nObjsAlloc = b.nObjsAlloc;
1128 vLevels = b.vLevels;
1129 vSlacks = b.vSlacks;
1130 vvFiSlacks = b.vvFiSlacks;
1131 this->CopyVec(vFs, b.vFs);
1132 this->CopyVec(vGs, b.vGs);
1133 this->CopyVec(vvCs, b.vvCs);
1134 vUpdates = b.vUpdates;
1135 vPfUpdates = b.vPfUpdates;
1136 vFoConeShared = b.vFoConeShared;
1140 inline bool TryConnect(
int i,
int i0,
bool c0) {
1141 int f = (i0 << 1) ^ (
int)c0;
1142 if(find(vvFis[i].begin(), vvFis[i].end(), f) == vvFis[i].end()) {
1143 lit x = this->man->Or(this->man->LitNot(vFs[i]), vGs[i]);
1145 if(this->man->IsConst1(this->man->Or(x, this->man->LitNotCond(vFs[i0], c0)))) {
1148 std::stringstream ss;
1149 ss <<
"\t\t[TryConnect] adding Wire " << std::setw(5) << i0 <<
"(" << c0 <<
")"
1150 <<
" -> " << std::setw(5) << i;
1151 Print(ss.str(),
true);
1153 Connect(i, f,
true);
1163 int count = fMspf? Mspf(
true): Cspf(
true);
1168 std::list<int> targets = vObjs;
1169 for(std::list<int>::reverse_iterator it = targets.rbegin(); it != targets.rend(); it++) {
1171 std::stringstream ss;
1172 ss <<
"[Resub] processing Gate " << std::setw(5) << *it
1173 <<
" (" << std::setw(5) << std::distance(targets.rbegin(), it) + 1
1174 <<
"/" << std::setw(5) << targets.size() <<
")";
1177 if(vvFos[*it].empty())
1179 count += TrivialMergeOne(*it);
1180 std::vector<bool> lev;
1182 for(
unsigned j = 0; j < vvFis[*it].size(); j++)
1183 add(lev, vLevels[vvFis[*it][j] >> 1]);
1184 if((
int)lev.size() > vLevels[*it] + vSlacks[*it]) {
1189 lev.resize(vLevels[*it] + vSlacks[*it]);
1191 bool fConnect =
false;
1192 std::vector<bool> vMarks(nObjsAlloc);
1193 MarkFoCone_rec(vMarks, *it);
1194 std::list<int> targets2 = vObjs;
1195 for(std::list<int>::iterator it2 = targets2.begin(); it2 != targets2.end(); it2++) {
1196 if(fLevel && (
int)lev.size() > vLevels[*it] + vSlacks[*it])
1198 if(!vMarks[*it2] && !vvFos[*it2].empty())
1199 if(!fLevel || noexcess(lev, vLevels[*it2]))
1200 if(TryConnect(*it, *it2,
false) || TryConnect(*it, *it2,
true)) {
1204 add(lev, vLevels[*it2]);
1210 count += Mspf(
true, *it);
1212 vPfUpdates[*it] =
true;
1213 count += Cspf(
true, *it);
1215 if(!vvFos[*it].empty()) {
1216 vPfUpdates[*it] =
true;
1217 count += fMspf? Mspf(
true): Cspf(
true);
1225 if(!vvFos[*it].empty() && vvFis[*it].size() > 2) {
1226 std::list<int>::iterator it2 = find(vObjs.begin(), vObjs.end(), *it);
1227 int pos = nObjsAlloc;
1229 count += BalancedDecomposeOne(it2,
pos) + (fMspf? Mspf(
true): Cspf(
true));
1231 count += TrivialDecomposeOne(it2,
pos);
1242 int count = fMspf? Mspf(
true): Cspf(
true);
1243 std::list<int> targets = vObjs;
1244 for(std::list<int>::reverse_iterator it = targets.rbegin(); it != targets.rend(); it++) {
1246 std::stringstream ss;
1247 ss <<
"[ResubMono] processing Gate " << std::setw(5) << *it
1248 <<
" (" << std::setw(5) << std::distance(targets.rbegin(), it) + 1
1249 <<
"/" << std::setw(5) << targets.size() <<
")";
1252 if(vvFos[*it].empty())
1254 count += TrivialMergeOne(*it);
1258 for(
unsigned i = 0; i < vPis.size(); i++) {
1259 if(vvFos[*it].empty())
1262 std::stringstream ss;
1263 ss <<
"\ttrying a new fanin PI " << std::setw(2) << i;
1266 if(TryConnect(*it, vPis[i],
false) || TryConnect(*it, vPis[i],
true)) {
1271 diff = Mspf(
true, *it, vPis[i]);
1273 vPfUpdates[*it] =
true;
1274 diff = Cspf(
true, *it, vPis[i]);
1278 if(!vvFos[*it].empty()) {
1279 vPfUpdates[*it] =
true;
1280 count += fMspf? Mspf(
true): Cspf(
true);
1295 if(vvFos[*it].empty())
1297 std::vector<bool> vMarks(nObjsAlloc);
1298 MarkFoCone_rec(vMarks, *it);
1299 std::list<int> targets2 = vObjs;
1300 for(std::list<int>::iterator it2 = targets2.begin(); it2 != targets2.end(); it2++) {
1301 if(vvFos[*it].empty())
1304 std::stringstream ss;
1305 ss <<
"\ttrying a new fanin Gate " << std::setw(5) << *it2
1306 <<
" (" << std::setw(5) << std::distance(targets2.begin(), it2) + 1
1307 <<
"/" << std::setw(5) << targets2.size() <<
")";
1310 if(!vMarks[*it2] && !vvFos[*it2].empty())
1311 if(TryConnect(*it, *it2,
false) || TryConnect(*it, *it2,
true)) {
1316 diff = Mspf(
true, *it, *it2);
1318 vPfUpdates[*it] =
true;
1319 diff = Cspf(
true, *it, *it2);
1323 if(!vvFos[*it].empty()) {
1324 vPfUpdates[*it] =
true;
1325 count += fMspf? Mspf(
true): Cspf(
true);
1340 if(vvFos[*it].empty())
1342 if(vvFis[*it].size() > 2) {
1343 std::list<int>::iterator it2 = find(vObjs.begin(), vObjs.end(), *it);
1344 int pos = nObjsAlloc;
1346 count += BalancedDecomposeOne(it2,
pos) + (fMspf? Mspf(
true): Cspf(
true));
1348 count += TrivialDecomposeOne(it2,
pos);
1356 int count = fMspf? Mspf(
true): Cspf(
true);
1357 std::list<int> targets = vObjs;
1358 for(std::list<int>::reverse_iterator it = targets.rbegin(); it != targets.rend(); it++) {
1360 std::stringstream ss;
1361 ss <<
"[ResubShared] processing Gate " << std::setw(5) << *it
1362 <<
" (" << std::setw(5) << std::distance(targets.rbegin(), it) + 1
1363 <<
"/" << std::setw(5) << targets.size() <<
")";
1366 if(vvFos[*it].empty())
1368 count += TrivialMergeOne(*it);
1369 bool fConnect =
false;
1370 for(
unsigned i = 0; i < vPis.size(); i++)
1371 if(TryConnect(*it, vPis[i],
false) || TryConnect(*it, vPis[i],
true)) {
1375 std::vector<bool> vMarks(nObjsAlloc);
1376 MarkFoCone_rec(vMarks, *it);
1377 for(std::list<int>::iterator it2 = targets.begin(); it2 != targets.end(); it2++)
1378 if(!vMarks[*it2] && !vvFos[*it2].empty())
1379 if(TryConnect(*it, *it2,
false) || TryConnect(*it, *it2,
true)) {
1386 count += Mspf(
true, *it);
1388 vPfUpdates[*it] =
true;
1389 count += Cspf(
true, *it);
1391 if(!vvFos[*it].empty()) {
1392 vPfUpdates[*it] =
true;
1393 count += fMspf? Mspf(
true): Cspf(
true);
1428 int RepeatAll(
bool fFirstMerge,
bool fMspfMerge,
bool fMspfResub,
bool fInner,
bool fOuter) {
1467 nObjsAlloc = Gia_ManObjNum(pGia);
1468 vvFis.resize(nObjsAlloc);
1469 vvFos.resize(nObjsAlloc);
1471 vLevels.resize(nObjsAlloc);
1472 vSlacks.resize(nObjsAlloc);
1473 vvFiSlacks.resize(nObjsAlloc);
1475 vFs.resize(nObjsAlloc, LitMax);
1476 vGs.resize(nObjsAlloc, LitMax);
1477 vvCs.resize(nObjsAlloc);
1478 vUpdates.resize(nObjsAlloc);
1479 vPfUpdates.resize(nObjsAlloc);
1480 std::vector<int> v(Gia_ManObjNum(pGia), -1);
1482 v[Gia_ObjId(pGia, Gia_ManConst0(pGia))] = nObjs << 1;
1485 v[Gia_ObjId(pGia, pObj)] = nObjs << 1;
1486 vPis.push_back(nObjs);
1490 int id = Gia_ObjId(pGia, pObj);
1492 std::stringstream ss;
1493 ss <<
"\t\t\t\timport Gate " << std::setw(5) << id;
1494 Print(ss.str(),
true);
1496 int i0 = Gia_ObjId(pGia, Gia_ObjFanin0(pObj));
1497 int i1 = Gia_ObjId(pGia, Gia_ObjFanin1(pObj));
1498 int c0 = Gia_ObjFaninC0(pObj);
1499 int c1 = Gia_ObjFaninC1(pObj);
1506 Connect(nObjs , v[i0] ^ c0);
1507 Connect(nObjs, v[i1] ^ c1);
1509 vObjs.push_back(nObjs);
1515 std::stringstream ss;
1516 ss <<
"\t\t\t\timport PO " << std::setw(2) << i;
1517 Print(ss.str(),
true);
1519 int i0 = Gia_ObjId(pGia, Gia_ObjFanin0(pObj));
1520 int c0 = Gia_ObjFaninC0(pObj);
1521 Connect(nObjs, v[i0] ^ c0);
1522 vPos.push_back(nObjs);
1526 void Aig2Bdd(
Gia_Man_t *pGia, std::vector<lit> &vNodes) {
1528 Print(
"\t\t\tBuild Exdc",
true);
1531 std::vector<int> vCounts(pGia->
nObjs);
1534 vCounts[Gia_ObjId(pGia, pObj)] = Gia_ObjFanoutNum(pGia, pObj);
1536 std::vector<lit> nodes(pGia->
nObjs);
1537 nodes[Gia_ObjId(pGia, Gia_ManConst0(pGia))] = this->man->Const0();
1539 nodes[Gia_ObjId(pGia, pObj)] = this->man->IthVar(i);
1541 int id = Gia_ObjId(pGia, pObj);
1543 std::stringstream ss;
1544 ss <<
"\t\t\t\tbuilding Exdc (" << i <<
" / " << Gia_ManAndNum(pGia) <<
")";
1545 Print(ss.str(), nVerbose > 7);
1547 int i0 = Gia_ObjId(pGia, Gia_ObjFanin0(pObj));
1548 int i1 = Gia_ObjId(pGia, Gia_ObjFanin1(pObj));
1549 bool c0 = Gia_ObjFaninC0(pObj);
1550 bool c1 = Gia_ObjFaninC1(pObj);
1551 nodes[id] = this->man->And(this->man->LitNotCond(nodes[i0], c0), this->man->LitNotCond(nodes[i1], c1));
1552 this->IncRef(nodes[
id]);
1555 this->DecRef(nodes[i0]);
1558 this->DecRef(nodes[i1]);
1561 int i0 = Gia_ObjId(pGia, Gia_ObjFanin0(pObj));
1562 bool c0 = Gia_ObjFaninC0(pObj);
1563 vNodes.push_back(this->man->LitNotCond(nodes[i0], c0));
1566 void RemoveConstOutputs() {
1567 bool fRemoved =
false;
1568 for(
unsigned i = 0; i < vPos.size(); i++) {
1569 int i0 = vvFis[vPos[i]][0] >> 1;
1570 lit c = vvCs[vPos[i]][0];
1572 if(this->man->IsConst1(this->man->Or(LitFi(vPos[i], 0), c))) {
1574 std::stringstream ss;
1575 ss <<
"\t\tPO " << std::setw(2) << i <<
" is Const 1";
1576 Print(ss.str(),
true);
1578 Disconnect(vPos[i], i0, 0,
false,
false);
1579 Connect(vPos[i], 1,
false,
false, c);
1580 fRemoved |= vvFos[i0].empty();
1581 }
else if(this->man->IsConst1(this->man->Or(this->man->LitNot(LitFi(vPos[i], 0)), c))) {
1583 std::stringstream ss;
1584 ss <<
"\t\tPO " << std::setw(2) << i <<
" is Const 0";
1585 Print(ss.str(),
true);
1587 Disconnect(vPos[i], i0, 0,
false,
false);
1588 Connect(vPos[i], 0,
false,
false, c);
1589 fRemoved |= vvFos[i0].empty();
1594 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend();) {
1595 if(vvFos[*it].empty()) {
1597 std::stringstream ss;
1598 ss <<
"\t\tremove unused Gate " << std::setw(5) << *it;
1599 Print(ss.str(),
true);
1602 it = std::list<int>::reverse_iterator(vObjs.erase(--(it.base())));
1611 Transduction(
Gia_Man_t *pGia,
int nVerbose,
bool fNewLine,
int nSortType,
int nPiShuffle,
bool fLevel,
Gia_Man_t *pExdc, Param &
p): nVerbose(nVerbose), nSortType(nSortType), fLevel(fLevel), fNewLine(fNewLine) {
1612 startclk = Abc_Clock();
1615 if(nSortType && nSortType < 4)
1616 p.fCountOnes =
true;
1617 this->
man =
new Man(Gia_ManCiNum(pGia),
p);
1619 this->
Update(vFs[0], this->
man->Const0());
1620 for(
unsigned i = 0; i < vPis.size(); i++)
1621 this->
Update(vFs[i + 1], this->
man->IthVar(i));
1624 this->
man->Reorder();
1625 this->
man->TurnOffReo();
1627 std::vector<lit> vExdc;
1628 Aig2Bdd(pExdc, vExdc);
1629 for(
unsigned i = 0; i < vPos.size(); i++)
1630 vvCs[vPos[i]][0] = vExdc.size() == 1? vExdc[0]: vExdc[i];
1632 for(
unsigned i = 0; i < vPos.size(); i++)
1633 this->
Update(vvCs[vPos[i]][0], this->
man->Const0());
1634 RemoveConstOutputs();
1635 vPoFs.resize(vPos.size(), LitMax);
1636 for(
unsigned i = 0; i < vPos.size(); i++)
1637 this->
Update(vPoFs[i], LitFi(vPos[i], 0));
1640 ShufflePis(nPiShuffle);
1663 std::vector<int> values(nObjsAlloc);
1664 values[0] = Gia_ManConst0Lit();
1665 for(
unsigned i = 0; i < vPis.size(); i++)
1666 values[i + 1] = Gia_ManAppendCi(pGia);
1667 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++) {
1668 assert(vvFis[*it].size() > 1);
1669 int i0 = vvFis[*it][0] >> 1;
1670 int i1 = vvFis[*it][1] >> 1;
1671 int c0 = vvFis[*it][0] & 1;
1672 int c1 = vvFis[*it][1] & 1;
1673 int r =
Gia_ManHashAnd(pGia, Abc_LitNotCond(values[i0], c0), Abc_LitNotCond(values[i1], c1));
1674 for(
unsigned i = 2; i < vvFis[*it].size(); i++) {
1675 int ii = vvFis[*it][i] >> 1;
1676 int ci = vvFis[*it][i] & 1;
1681 for(
unsigned i = 0; i < vPos.size(); i++) {
1682 int i0 = vvFis[vPos[i]][0] >> 1;
1683 int c0 = vvFis[vPos[i]][0] & 1;
1684 Gia_ManAppendCo(pGia, Abc_LitNotCond(values[i0], c0));
1696 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
1697 vUpdates[*it] =
true;
1698 std::vector<lit> vFsOld;
1706 std::vector<lit> vGsOld;
1708 std::vector<std::vector<lit> > vvCsOld;
1718 std::vector<lit> vGsOld;
1720 std::vector<std::vector<lit> > vvCsOld;
1730 for(
unsigned j = 0; j < vPos.size(); j++) {
1731 lit x = this->
Xor(LitFi(vPos[j], 0), vPoFs[j]);
1733 this->
Update(x, this->
man->And(x, this->man->LitNot(vvCs[vPos[j]][0])));
1735 if(!this->
man->IsConst0(x))
1741 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++) {
1742 std::cout <<
"Gate " << *it <<
":";
1744 std::cout <<
" Level = " << vLevels[*it] <<
", Slack = " << vSlacks[*it];
1745 std::cout << std::endl;
1746 std::string delim =
"";
1747 std::cout <<
"\tFis: ";
1748 for(
unsigned j = 0; j < vvFis[*it].size(); j++) {
1749 std::cout << delim << (vvFis[*it][j] >> 1) <<
"(" << (vvFis[*it][j] & 1) <<
")";
1752 std::cout << std::endl;
1754 std::cout <<
"\tFos: ";
1755 for(
unsigned j = 0; j < vvFos[*it].size(); j++) {
1756 std::cout << delim << vvFos[*it][j];
1759 std::cout << std::endl;