ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Transduction::Transduction< Man, Param, lit, LitMax > Class Template Reference

#include <giaTransduction.h>

Inheritance diagram for Transduction::Transduction< Man, Param, lit, LitMax >:
Collaboration diagram for Transduction::Transduction< Man, Param, lit, LitMax >:

Public Member Functions

int CountGates () const
 
int CountWires () const
 
int CountNodes () const
 
int CountLevels () const
 
void Print (std::string str, bool nl) const
 
void PrintStats (std::string prefix, bool nl, int prefix_size=0) const
 
void PrintPfHeader (std::string prefix, int block, int block_i0)
 
int TrivialMerge ()
 
int TrivialDecompose ()
 
int Decompose ()
 
int Resub (bool fMspf)
 
int ResubMono (bool fMspf)
 
int ResubShared (bool fMspf)
 
int RepeatResub (bool fMono, bool fMspf)
 
int RepeatInner (bool fMspf, bool fInner)
 
int RepeatOuter (bool fMspf, bool fInner, bool fOuter)
 
int RepeatAll (bool fFirstMerge, bool fMspfMerge, bool fMspfResub, bool fInner, bool fOuter)
 
int Cspf ()
 
int Mspf ()
 
 Transduction (Gia_Man_t *pGia, int nVerbose, bool fNewLine, int nSortType, int nPiShuffle, bool fLevel, Gia_Man_t *pExdc, Param &p)
 
 ~Transduction ()
 
Gia_Man_tGenerateAig () const
 
PfState State () const
 
bool BuildDebug ()
 
bool CspfDebug ()
 
bool MspfDebug ()
 
bool Verify () const
 
void PrintObjs () const
 

Detailed Description

template<class Man, class Param, class lit, lit LitMax>
class Transduction::Transduction< Man, Param, lit, LitMax >

Definition at line 141 of file giaTransduction.h.

Constructor & Destructor Documentation

◆ Transduction()

template<class Man, class Param, class lit, lit LitMax>
Transduction::Transduction< Man, Param, lit, LitMax >::Transduction ( Gia_Man_t * pGia,
int nVerbose,
bool fNewLine,
int nSortType,
int nPiShuffle,
bool fLevel,
Gia_Man_t * pExdc,
Param & p )
inline

Definition at line 1611 of file giaTransduction.h.

1611 : nVerbose(nVerbose), nSortType(nSortType), fLevel(fLevel), fNewLine(fNewLine) {
1612 startclk = Abc_Clock();
1613 p.nGbc = 1;
1614 p.nReo = 4000;
1615 if(nSortType && nSortType < 4)
1616 p.fCountOnes = true;
1617 this->man = new Man(Gia_ManCiNum(pGia), p);
1618 ImportAig(pGia);
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));
1622 nMaxLevels = -1;
1623 Build(false);
1624 this->man->Reorder();
1625 this->man->TurnOffReo();
1626 if(pExdc) {
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];
1631 } else
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));
1638 state = none;
1639 if(nPiShuffle)
1640 ShufflePis(nPiShuffle);
1641 if(fLevel)
1642 ComputeLevel();
1643 if(nVerbose)
1644 PrintStats("Init", true, 11);
1645 }
void Update(lit &x, lit y) const
void PrintStats(std::string prefix, bool nl, int prefix_size=0) const
Here is the call graph for this function:

◆ ~Transduction()

template<class Man, class Param, class lit, lit LitMax>
Transduction::Transduction< Man, Param, lit, LitMax >::~Transduction ( )
inline

Definition at line 1646 of file giaTransduction.h.

1646 {
1647 if(nVerbose)
1648 PrintStats("End", true, 11);
1649 this->DelVec(vFs);
1650 this->DelVec(vGs);
1651 this->DelVec(vvCs);
1652 this->DelVec(vPoFs);
1653 //assert(this->man->CountNodes() == (int)vPis.size() + 1);
1654 //assert(!this->man->Ref(this->man->Const0()));
1655 delete this->man;
1656 }
void DelVec(std::vector< lit > &v) const
Here is the call graph for this function:

Member Function Documentation

◆ BuildDebug()

template<class Man, class Param, class lit, lit LitMax>
bool Transduction::Transduction< Man, Param, lit, LitMax >::BuildDebug ( )
inline

Definition at line 1695 of file giaTransduction.h.

1695 {
1696 for(std::list<int>::iterator it = vObjs.begin(); it != vObjs.end(); it++)
1697 vUpdates[*it] = true;
1699 CopyVec(vFsOld, vFs);
1700 Build(false);
1701 bool r = LitVecIsEq(vFsOld, vFs);
1702 DelVec(vFsOld);
1703 return r;
1704 }
void CopyVec(std::vector< lit > &v, std::vector< lit > const &u) const
bool LitVecIsEq(std::vector< lit > const &v, std::vector< lit > const &u) const
Here is the call graph for this function:

◆ CountGates()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::CountGates ( ) const
inline

Definition at line 177 of file giaTransduction.h.

177 {
178 return vObjs.size();
179 }
Here is the caller graph for this function:

◆ CountLevels()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::CountLevels ( ) const
inline

Definition at line 189 of file giaTransduction.h.

189 {
190 int count = 0;
191 for(unsigned i = 0; i < vPos.size(); i++)
192 count = std::max(count, vLevels[vvFis[vPos[i]][0] >> 1]);
193 return count;
194 }
Here is the caller graph for this function:

◆ CountNodes()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::CountNodes ( ) const
inline

Definition at line 186 of file giaTransduction.h.

186 {
187 return CountWires() - CountGates();
188 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CountWires()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::CountWires ( ) const
inline

Definition at line 180 of file giaTransduction.h.

180 {
181 int count = 0;
182 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++)
183 count += vvFis[*it].size();
184 return count;
185 }
Here is the caller graph for this function:

◆ Cspf()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::Cspf ( )
inline

Definition at line 1456 of file giaTransduction.h.

1456 {
1457 return Cspf(true);
1458 }

◆ CspfDebug()

template<class Man, class Param, class lit, lit LitMax>
bool Transduction::Transduction< Man, Param, lit, LitMax >::CspfDebug ( )
inline

Definition at line 1705 of file giaTransduction.h.

1705 {
1707 this->CopyVec(vGsOld, vGs);
1709 this->CopyVec(vvCsOld, vvCs);
1710 state = none;
1711 Cspf(false);
1712 bool r = this->LitVecIsEq(vGsOld, vGs) && this->LitVecIsEq(vvCsOld, vvCs);
1713 this->DelVec(vGsOld);
1714 this->DelVec(vvCsOld);
1715 return r;
1716 }
Here is the call graph for this function:

◆ Decompose()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::Decompose ( )
inline

Definition at line 1025 of file giaTransduction.h.

1025 {
1026 int count = 0;
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());
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()));
1036 if(s.size() > 1) {
1037 if(s == s1) {
1038 if(s == s2) {
1039 if(nVerbose > 2) {
1041 ss << "\treplace Gate " << std::setw(5) << *it2
1042 << " by Gate " << std::setw(5) << *it;
1043 Print(ss.str() , nVerbose > 3);
1044 }
1045 count += Replace(*it2, *it << 1, false);
1046 it2 = vObjs.erase(it2);
1047 it2--;
1048 } else {
1049 if(nVerbose > 2) {
1051 ss << "\tdecompose Gate " << std::setw(5) << *it2
1052 << " by Gate " << std::setw(5) << *it;
1053 Print(ss.str() , nVerbose > 3);
1054 }
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);
1058 }
1059 count += s.size();
1060 if(std::find(vvFis[*it2].begin(), vvFis[*it2].end(), *it << 1) == vvFis[*it2].end()) {
1061 Connect(*it2, *it << 1, false, false);
1062 count--;
1063 }
1064 vPfUpdates[*it2] = true;
1065 }
1066 continue;
1067 }
1068 if(s == s2) {
1069 it = vObjs.insert(it, *it2);
1070 vObjs.erase(it2);
1071 } else {
1072 NewGate(pos);
1073 if(nVerbose > 2) {
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);
1079 }
1080 if(nVerbose > 4) {
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);
1086 }
1087 for(std::set<int>::iterator it3 = s.begin(); it3 != s.end(); it3++)
1088 Connect(pos, *it3, false, false);
1089 count -= s.size();
1090 it = vObjs.insert(it, pos);
1091 Build(pos, vFs);
1092 vPfUpdates[*it] = true;
1093 }
1094 s1 = s;
1095 it2 = it;
1096 }
1097 }
1098 if(vvFis[*it].size() > 2)
1099 count += TrivialDecomposeOne(it, pos);
1100 }
1101 return count;
1102 }
void Print(std::string str, bool nl) const
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GenerateAig()

template<class Man, class Param, class lit, lit LitMax>
Gia_Man_t * Transduction::Transduction< Man, Param, lit, LitMax >::GenerateAig ( ) const
inline

Definition at line 1659 of file giaTransduction.h.

1659 {
1660 Gia_Man_t * pGia, *pTemp;
1661 pGia = Gia_ManStart(1 + vPis.size() + CountNodes() + vPos.size());
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;
1674 for(unsigned i = 2; i < vvFis[*it].size(); i++) {
1675 int ii = vvFis[*it][i] >> 1;
1676 int ci = vvFis[*it][i] & 1;
1678 }
1679 values[*it] = r;
1680 }
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;
1685 }
1688 return pGia;
1689 }
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mspf()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::Mspf ( )
inline

Definition at line 1459 of file giaTransduction.h.

1459 {
1460 return Mspf(true);
1461 }

◆ MspfDebug()

template<class Man, class Param, class lit, lit LitMax>
bool Transduction::Transduction< Man, Param, lit, LitMax >::MspfDebug ( )
inline

Definition at line 1717 of file giaTransduction.h.

1717 {
1719 this->CopyVec(vGsOld, vGs);
1721 this->CopyVec(vvCsOld, vvCs);
1722 state = none;
1723 Mspf(false);
1724 bool r = this->LitVecIsEq(vGsOld, vGs) && this->LitVecIsEq(vvCsOld, vvCs);
1725 this->DelVec(vGsOld);
1726 this->DelVec(vvCsOld);
1727 return r;
1728 }
Here is the call graph for this function:

◆ Print()

template<class Man, class Param, class lit, lit LitMax>
void Transduction::Transduction< Man, Param, lit, LitMax >::Print ( std::string str,
bool nl ) const
inline

Definition at line 195 of file giaTransduction.h.

195 {
196 if(!fNewLine)
197 std::cout << "\33[2K\r";
198 std::cout << str;
199 if(fNewLine || nl)
201 else
203 }
Here is the caller graph for this function:

◆ PrintObjs()

template<class Man, class Param, class lit, lit LitMax>
void Transduction::Transduction< Man, Param, lit, LitMax >::PrintObjs ( ) const
inline

Definition at line 1740 of file giaTransduction.h.

1740 {
1741 for(std::list<int>::const_iterator it = vObjs.begin(); it != vObjs.end(); it++) {
1742 std::cout << "Gate " << *it << ":";
1743 if(fLevel)
1744 std::cout << " Level = " << vLevels[*it] << ", Slack = " << vSlacks[*it];
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) << ")";
1750 delim = ", ";
1751 }
1753 delim = "";
1754 std::cout << "\tFos: ";
1755 for(unsigned j = 0; j < vvFos[*it].size(); j++) {
1756 std::cout << delim << vvFos[*it][j];
1757 delim = ", ";
1758 }
1760 }
1761 }

◆ PrintPfHeader()

template<class Man, class Param, class lit, lit LitMax>
void Transduction::Transduction< Man, Param, lit, LitMax >::PrintPfHeader ( std::string prefix,
int block,
int block_i0 )
inline

Definition at line 215 of file giaTransduction.h.

215 {
217 ss << "\t\t" << prefix;
218 if(block_i0 != -1)
219 ss << " (blocking Wire " << block_i0 << " -> " << block << ")";
220 else if(block != -1)
221 ss << " (blocking Gate " << block << ")";
222 Print(ss.str(), true);
223 }
Here is the call graph for this function:

◆ PrintStats()

template<class Man, class Param, class lit, lit LitMax>
void Transduction::Transduction< Man, Param, lit, LitMax >::PrintStats ( std::string prefix,
bool nl,
int prefix_size = 0 ) const
inline

Definition at line 204 of file giaTransduction.h.

204 {
205 if(!prefix_size)
206 prefix_size = prefix.size();
208 ss << std::left << std::setw(prefix_size) << prefix << ": " << std::right;
209 ss << "#nodes = " << std::setw(5) << CountNodes();
210 if(fLevel)
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";
213 Print(ss.str(), nl);
214 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RepeatAll()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::RepeatAll ( bool fFirstMerge,
bool fMspfMerge,
bool fMspfResub,
bool fInner,
bool fOuter )
inline

Definition at line 1428 of file giaTransduction.h.

1428 {
1430 Save(b);
1431 int count = 0;
1432 int diff = 0;
1433 if(fFirstMerge)
1436 if(diff > 0) {
1437 count = diff;
1438 Save(b);
1439 diff = 0;
1440 }
1441 while(true) {
1443 if(diff > 0) {
1444 count += diff;
1445 Save(b);
1446 diff = 0;
1447 } else {
1448 Load(b);
1449 break;
1450 }
1451 }
1452 return count;
1453 }
int RepeatOuter(bool fMspf, bool fInner, bool fOuter)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RepeatInner()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::RepeatInner ( bool fMspf,
bool fInner )
inline

Definition at line 1410 of file giaTransduction.h.

1410 {
1411 int count = 0;
1412 while(int diff = RepeatResub(true, fMspf) + RepeatResub(false, fMspf)) {
1413 count += diff;
1414 if(!fInner)
1415 break;
1416 }
1417 return count;
1418 }
int RepeatResub(bool fMono, bool fMspf)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RepeatOuter()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::RepeatOuter ( bool fMspf,
bool fInner,
bool fOuter )
inline

Definition at line 1419 of file giaTransduction.h.

1419 {
1420 int count = 0;
1421 while(int diff = fMspf? RepeatInner(false, fInner) + RepeatInner(true, fInner): RepeatInner(false, fInner)) {
1422 count += diff;
1423 if(!fOuter)
1424 break;
1425 }
1426 return count;
1427 }
int RepeatInner(bool fMspf, bool fInner)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RepeatResub()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::RepeatResub ( bool fMono,
bool fMspf )
inline

Definition at line 1404 of file giaTransduction.h.

1404 {
1405 int count = 0;
1406 while(int diff = fMono? ResubMono(fMspf): Resub(fMspf))
1407 count += diff;
1408 return count;
1409 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Resub()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::Resub ( bool fMspf)
inline

Definition at line 1162 of file giaTransduction.h.

1162 {
1163 int count = fMspf? Mspf(true): Cspf(true);
1164 int nodes = CountNodes();
1166 Save(b);
1167 int count_ = count;
1168 std::list<int> targets = vObjs;
1169 for(std::list<int>::reverse_iterator it = targets.rbegin(); it != targets.rend(); it++) {
1170 if(nVerbose > 1) {
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() << ")";
1175 PrintStats(ss.str(), nVerbose > 2);
1176 }
1177 if(vvFos[*it].empty())
1178 continue;
1179 count += TrivialMergeOne(*it);
1181 if(fLevel) {
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]) {
1185 Load(b);
1186 count = count_;
1187 continue;
1188 }
1189 lev.resize(vLevels[*it] + vSlacks[*it]);
1190 }
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])
1197 break;
1198 if(!vMarks[*it2] && !vvFos[*it2].empty())
1199 if(!fLevel || noexcess(lev, vLevels[*it2]))
1200 if(TryConnect(*it, *it2, false) || TryConnect(*it, *it2, true)) {
1201 fConnect = true;
1202 count--;
1203 if(fLevel)
1204 add(lev, vLevels[*it2]);
1205 }
1206 }
1207 if(fConnect) {
1208 if(fMspf) {
1209 Build();
1210 count += Mspf(true, *it);
1211 } else {
1212 vPfUpdates[*it] = true;
1213 count += Cspf(true, *it);
1214 }
1215 if(!vvFos[*it].empty()) {
1216 vPfUpdates[*it] = true;
1217 count += fMspf? Mspf(true): Cspf(true);
1218 }
1219 }
1220 if(nodes < CountNodes()) {
1221 Load(b);
1222 count = count_;
1223 continue;
1224 }
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;
1228 if(fLevel)
1229 count += BalancedDecomposeOne(it2, pos) + (fMspf? Mspf(true): Cspf(true));
1230 else
1231 count += TrivialDecomposeOne(it2, pos);
1232 }
1233 nodes = CountNodes();
1234 Save(b);
1235 count_ = count;
1236 }
1237 if(nVerbose)
1238 PrintStats("Resub", true, 11);
1239 return count;
1240 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResubMono()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::ResubMono ( bool fMspf)
inline

Definition at line 1241 of file giaTransduction.h.

1241 {
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++) {
1245 if(nVerbose > 1) {
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() << ")";
1250 PrintStats(ss.str(), nVerbose > 2);
1251 }
1252 if(vvFos[*it].empty())
1253 continue;
1254 count += TrivialMergeOne(*it);
1256 Save(b);
1257 int count_ = count;
1258 for(unsigned i = 0; i < vPis.size(); i++) {
1259 if(vvFos[*it].empty())
1260 break;
1261 if(nVerbose > 2) {
1263 ss << "\ttrying a new fanin PI " << std::setw(2) << i;
1264 PrintStats(ss.str(), nVerbose > 3);
1265 }
1266 if(TryConnect(*it, vPis[i], false) || TryConnect(*it, vPis[i], true)) {
1267 count--;
1268 int diff;
1269 if(fMspf) {
1270 Build();
1271 diff = Mspf(true, *it, vPis[i]);
1272 } else {
1273 vPfUpdates[*it] = true;
1274 diff = Cspf(true, *it, vPis[i]);
1275 }
1276 if(diff) {
1277 count += diff;
1278 if(!vvFos[*it].empty()) {
1279 vPfUpdates[*it] = true;
1280 count += fMspf? Mspf(true): Cspf(true);
1281 }
1282 if(fLevel && CountLevels() > nMaxLevels) {
1283 Load(b);
1284 count = count_;
1285 } else {
1286 Save(b);
1287 count_ = count;
1288 }
1289 } else {
1290 Load(b);
1291 count = count_;
1292 }
1293 }
1294 }
1295 if(vvFos[*it].empty())
1296 continue;
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())
1302 break;
1303 if(nVerbose > 2) {
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() << ")";
1308 PrintStats(ss.str(), nVerbose > 3);
1309 }
1310 if(!vMarks[*it2] && !vvFos[*it2].empty())
1311 if(TryConnect(*it, *it2, false) || TryConnect(*it, *it2, true)) {
1312 count--;
1313 int diff;
1314 if(fMspf) {
1315 Build();
1316 diff = Mspf(true, *it, *it2);
1317 } else {
1318 vPfUpdates[*it] = true;
1319 diff = Cspf(true, *it, *it2);
1320 }
1321 if(diff) {
1322 count += diff;
1323 if(!vvFos[*it].empty()) {
1324 vPfUpdates[*it] = true;
1325 count += fMspf? Mspf(true): Cspf(true);
1326 }
1327 if(fLevel && CountLevels() > nMaxLevels) {
1328 Load(b);
1329 count = count_;
1330 } else {
1331 Save(b);
1332 count_ = count;
1333 }
1334 } else {
1335 Load(b);
1336 count = count_;
1337 }
1338 }
1339 }
1340 if(vvFos[*it].empty())
1341 continue;
1342 if(vvFis[*it].size() > 2) {
1343 std::list<int>::iterator it2 = find(vObjs.begin(), vObjs.end(), *it);
1344 int pos = nObjsAlloc;
1345 if(fLevel)
1346 count += BalancedDecomposeOne(it2, pos) + (fMspf? Mspf(true): Cspf(true));
1347 else
1348 count += TrivialDecomposeOne(it2, pos);
1349 }
1350 }
1351 if(nVerbose)
1352 PrintStats("ResubMono", true, 11);
1353 return count;
1354 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResubShared()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::ResubShared ( bool fMspf)
inline

Definition at line 1355 of file giaTransduction.h.

1355 {
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++) {
1359 if(nVerbose > 1) {
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() << ")";
1364 PrintStats(ss.str(), nVerbose > 2);
1365 }
1366 if(vvFos[*it].empty())
1367 continue;
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)) {
1372 fConnect |= true;
1373 count--;
1374 }
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)) {
1380 fConnect |= true;
1381 count--;
1382 }
1383 if(fConnect) {
1384 if(fMspf) {
1385 Build();
1386 count += Mspf(true, *it);
1387 } else {
1388 vPfUpdates[*it] = true;
1389 count += Cspf(true, *it);
1390 }
1391 if(!vvFos[*it].empty()) {
1392 vPfUpdates[*it] = true;
1393 count += fMspf? Mspf(true): Cspf(true);
1394 }
1395 }
1396 }
1397 count += Decompose();
1398 if(nVerbose)
1399 PrintStats("ResubShared", true, 11);
1400 return count;
1401 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ State()

template<class Man, class Param, class lit, lit LitMax>
PfState Transduction::Transduction< Man, Param, lit, LitMax >::State ( ) const
inline

Definition at line 1692 of file giaTransduction.h.

1692 {
1693 return state;
1694 }

◆ TrivialDecompose()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::TrivialDecompose ( )
inline

Definition at line 1017 of file giaTransduction.h.

1017 {
1018 int count = 0;
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);
1023 return count;
1024 }

◆ TrivialMerge()

template<class Man, class Param, class lit, lit LitMax>
int Transduction::Transduction< Man, Param, lit, LitMax >::TrivialMerge ( )
inline

Definition at line 1009 of file giaTransduction.h.

1009 {
1010 int count = 0;
1011 for(std::list<int>::reverse_iterator it = vObjs.rbegin(); it != vObjs.rend();) {
1012 count += TrivialMergeOne(*it);
1013 it++;
1014 }
1015 return count;
1016 }

◆ Verify()

template<class Man, class Param, class lit, lit LitMax>
bool Transduction::Transduction< Man, Param, lit, LitMax >::Verify ( ) const
inline

Definition at line 1729 of file giaTransduction.h.

1729 {
1730 for(unsigned j = 0; j < vPos.size(); j++) {
1731 lit x = this->Xor(LitFi(vPos[j], 0), vPoFs[j]);
1732 this->IncRef(x);
1733 this->Update(x, this->man->And(x, this->man->LitNot(vvCs[vPos[j]][0])));
1734 this->DecRef(x);
1735 if(!this->man->IsConst0(x))
1736 return false;
1737 }
1738 return true;
1739 }
void DecRef(lit x) const
void IncRef(lit x) const
lit Xor(lit x, lit y) const
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: