59 pObj->
iTemp = Abc_NtkCiNum(pNtk) + i;
61 pObj->
iTemp = Abc_NtkCiNum(pNtk) + Vec_PtrSize(vNodes) + i;
72 vNodes = Vec_PtrAlloc( Abc_NtkNodeNum(pNtk) );
75 pObj->
iTemp = Abc_NtkCiNum(pNtk) + Vec_PtrSize(vNodes);
76 Vec_PtrPush( vNodes, pObj );
78 assert( Vec_PtrSize(vNodes) == Abc_NtkNodeNum(pNtk) );
80 pObj->
iTemp = Abc_NtkCiNum(pNtk) + Vec_PtrSize(vNodes) + i;
98 Vec_Int_t * vStarts = Vec_IntStart( Abc_NtkObjNum(pNtk) );
101 Vec_IntWriteEntry( vStarts, pObj->
iTemp, Counter );
102 Counter += Abc_Truth6WordNum( Abc_ObjFaninNum(pObj) );
105 Vec_IntWriteEntry( vStarts, pObj->
iTemp, Counter++ );
112 if ( TruthStore[0][0] == 0 )
114 static word Truth6[6] = {
123 int nWordsMax = (1 << 10);
126 for ( i = 0; i < 6; i++ )
127 for ( k = 0; k < nWordsMax; k++ )
128 TruthStore[i][k] = Truth6[i];
129 for ( i = 6; i < nVarsMax; i++ )
130 for ( k = 0; k < nWordsMax; k++ )
131 TruthStore[i][k] = ((k >> (i-6)) & 1) ? ~(
word)0 : 0;
148 word TruthStore[16][1<<10] = {{0}}, * pTruths[16] = {NULL}, pCube[1<<10] = {0};
157 int i, k, nObjs,
nTotal = 0;
159 nObjs = Abc_NtkCiNum(pNtk) + Vec_PtrSize(vNodes) + Abc_NtkCoNum(pNtk);
160 vFanins = Vec_WecStart( nObjs );
161 vFixed = Vec_StrStart( nObjs );
162 vTruths = Vec_WrdStart( nObjs );
164 vTruths2= Vec_WrdStart(
nTotal );
166 for ( i = 0; i < 16; i++ )
167 pTruths[i] = TruthStore[i];
170 if ( Abc_ObjFaninNum(pObj) <= 6 )
173 int Offset = Vec_IntEntry( vStarts, pObj->
iTemp );
174 Vec_WrdWriteEntry( vTruths2, Offset, uTruth );
175 Vec_WrdWriteEntry( vTruths, pObj->
iTemp, uTruth );
176 if ( uTruth == 0 || ~uTruth == 0 )
181 int nWords = Abc_Truth6WordNum( Abc_ObjFaninNum(pObj) );
182 int Offset = Vec_IntEntry( vStarts, pObj->
iTemp );
183 word * pRes = Vec_WrdEntryP( vTruths2, Offset );
185 Vec_WrdWriteEntry( vTruths, pObj->
iTemp, pRes[0] );
187 for ( k = 0; k <
nWords; k++ )
193 for ( k = 0; k <
nWords; k++ )
199 vArray = Vec_WecEntry( vFanins, pObj->
iTemp );
200 Vec_IntGrow( vArray, Abc_ObjFaninNum(pObj) );
202 Vec_IntPush( vArray, pFanin->
iTemp );
207 vArray = Vec_WecEntry( vFanins, pObj->
iTemp );
208 Vec_IntGrow( vArray, Abc_ObjFaninNum(pObj) );
210 Vec_IntPush( vArray, pFanin->
iTemp );
212 Vec_PtrFree( vNodes );
213 for ( i = Abc_NtkCiNum(pNtk); i < Abc_NtkCiNum(pNtk) + nFirstFixed; i++ )
214 Vec_StrWriteEntry( vFixed, i, (
char)1 );
216 assert( nFirstFixed >= 0 && nFirstFixed < Abc_NtkNodeNum(pNtk) );
220 return Sfm_NtkConstruct( vFanins, Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk), vFixed, NULL, vTruths, vStarts, vTruths2 );
224 word TruthStore[16][1<<10] = {{0}}, * pTruths[16] = {NULL}, pCube[1<<10] = {0};
233 int i, k, nObjs,
nTotal = 0;
235 nObjs = Abc_NtkCiNum(pNtk) + Vec_PtrSize(vNodes) + Abc_NtkCoNum(pNtk);
236 vFanins = Vec_WecStart( nObjs );
237 vFixed = Vec_StrStart( nObjs );
238 vTruths = Vec_WrdStart( nObjs );
240 vTruths2= Vec_WrdAlloc(
nTotal );
242 for ( i = 0; i < 16; i++ )
243 pTruths[i] = TruthStore[i];
246 if ( Abc_ObjFaninNum(pObj) <= 6 )
249 Vec_WrdWriteEntry( vTruths, pObj->
iTemp, uTruth );
250 if ( uTruth == 0 || ~uTruth == 0 )
255 int nWords = Abc_Truth6WordNum( Abc_ObjFaninNum(pObj) );
256 int Offset = Vec_IntEntry( vStarts, pObj->
iTemp );
257 word * pRes = Vec_WrdEntryP( vTruths2, Offset );
260 for ( k = 0; k <
nWords; k++ )
266 for ( k = 0; k <
nWords; k++ )
272 vArray = Vec_WecEntry( vFanins, pObj->
iTemp );
273 Vec_IntGrow( vArray, Abc_ObjFaninNum(pObj) );
275 Vec_IntPush( vArray, pFanin->
iTemp );
279 vArray = Vec_WecEntry( vFanins, pObj->
iTemp );
280 Vec_IntGrow( vArray, Abc_ObjFaninNum(pObj) );
282 Vec_IntPush( vArray, pFanin->
iTemp );
284 Vec_PtrFree( vNodes );
288 Vec_StrWriteEntry( vFixed, pObj->
iTemp, (
char)1 );
289 return Sfm_NtkConstruct( vFanins, Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk), vFixed, NULL, vTruths, vStarts, vTruths2 );
310 vMap = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
312 Vec_IntWriteEntry( vMap, pNode->
iTemp, Abc_ObjId(pNode) );
314 if ( pNode->
iTemp > 0 )
315 Vec_IntWriteEntry( vMap, pNode->
iTemp, Abc_ObjId(pNode) );
321 vCover = Vec_IntAlloc( 1 << 16 );
334 Abc_TtFlipVar5( pTruth, Vec_IntSize(vArray) );
342 Vec_IntFree( vCover );
360 int nFaninMax, nNodes;
361 assert( Abc_NtkIsLogic(pNtk) );
365 if ( nFaninMax > 15 )
367 Abc_Print( 1,
"Currently \"mfs\" cannot process the network containing nodes with more than 15 fanins.\n" );
370 if ( !Abc_NtkHasSop(pNtk) )
373 printf(
"Conversion to SOP has failed due to low resource limit.\n" );
388 Abc_Print( 1,
"The network has %d nodes changed by \"mfs\".\n", nNodes );
413 assert( nFramesAdd >= 0 );
415 assert( Vec_IntSize(vFlops) == Abc_NtkLatchNum(
p) );
422 pNode->
pCopy = Abc_NtkCreatePi( pNtk );
425 for ( f = 0; f <= nFrames + nFramesAdd; f++ )
430 pNode->
pCopy = Abc_NtkCreatePi( pNtk );
445 *piPivot = Abc_NtkObjNum(pNtk);
451 Abc_ObjFanout0(pNode)->pCopy = Abc_ObjFanin0(pNode)->pCopy;
453 if ( f > nFramesAdd )
459 pNode = Abc_NtkCo(
p, Abc_NtkPoNum(
p) + i );
464 Vec_PtrFree( vNodes );
470 fprintf( stdout,
"Abc_NtkCreateFromNode(): Network check has failed.\n" );
487 Abc_Obj_t * pNode, * pNodeNew, * pFaninNew;
491 assert( Abc_NtkCiNum(
p) <= Abc_NtkCiNum(pNtk) );
502 Abc_NtkCi(pNtk, i)->pCopy = pNode;
504 assert( Vec_PtrSize(vNodes) + Abc_NtkCiNum(
p) + Abc_NtkPoNum(
p) == iPivot );
507 pNodeNew = Abc_NtkObj( pNtk, Abc_NtkCiNum(
p) + i + 1 );
508 if ( pNodeNew == NULL )
510 pNodeNew->
pCopy = pNode;
515 pNodeNew = Abc_NtkObj( pNtk, Abc_NtkCiNum(
p) + i + 1 );
516 if ( pNodeNew == NULL )
523 Vec_PtrFree( vNodes );
540 int nFaninMax, nNodes;
546 if ( nFaninMax > 15 )
548 Abc_Print( 1,
"Currently \"mfs\" cannot process the network containing nodes with more than 15 fanins.\n" );
551 if ( !Abc_NtkHasSop(
p) )
568 Abc_Print( 1,
"The network has %d nodes changed by \"mfs\".\n", nNodes );
575 if ( !Abc_NtkHasSop(
p) )
int Abc_NtkPerformMfs(Abc_Ntk_t *pNtk, Sfm_Par_t *pPars)
void Abc_NtkInsertMfs(Abc_Ntk_t *pNtk, Sfm_Ntk_t *p)
Vec_Ptr_t * Abc_NtkAssignIDs2(Abc_Ntk_t *pNtk)
Vec_Int_t * Abc_NtkAssignStarts(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes, int *pnTotal)
void Abc_NtkFillTruthStore(word TruthStore[16][1<< 10])
Abc_Ntk_t * Abc_NtkUnrollAndDrop(Abc_Ntk_t *p, int nFrames, int nFramesAdd, Vec_Int_t *vFlops, int *piPivot)
void Abc_NtkReinsertNodes(Abc_Ntk_t *p, Abc_Ntk_t *pNtk, int iPivot)
int Abc_NtkMfsAfterICheck(Abc_Ntk_t *p, int nFrames, int nFramesAdd, Vec_Int_t *vFlops, Sfm_Par_t *pPars)
ABC_NAMESPACE_IMPL_START Vec_Ptr_t * Abc_NtkAssignIDs(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Sfm_Ntk_t * Abc_NtkExtractMfs2(Abc_Ntk_t *pNtk, int iPivot)
Sfm_Ntk_t * Abc_NtkExtractMfs(Abc_Ntk_t *pNtk, int nFirstFixed)
ABC_DLL int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
#define Abc_NtkForEachPo(pNtk, pPo, i)
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_SopCreateFromTruthIsop(Mem_Flex_t *pMan, int nVars, word *pTruth, Vec_Int_t *vCover)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_SopToTruthBig(char *pSop, int nInputs, word **pVars, word *pCube, word *pRes)
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit)
#define Abc_NtkForEachPi(pNtk, pPi, i)
ABC_DLL int Abc_SopGetVarNum(char *pSop)
ABC_DLL void Abc_ObjRemoveFanins(Abc_Obj_t *pObj)
#define Abc_NtkForEachCi(pNtk, pCi, i)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL word Abc_SopToTruth(char *pSop, int nInputs)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, const char *pName)
DECLARATIONS ///.
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
void Io_WriteBlifLogic(Abc_Ntk_t *pNtk, char *pFileName, int fWriteLatches)
FUNCTION DEFINITIONS ///.
unsigned __int64 word
DECLARATIONS ///.
struct Mem_Flex_t_ Mem_Flex_t
int Sfm_NtkPerform(Sfm_Ntk_t *p, Sfm_Par_t *pPars)
void Sfm_NtkFree(Sfm_Ntk_t *p)
int Sfm_NodeReadFixed(Sfm_Ntk_t *p, int i)
struct Sfm_Par_t_ Sfm_Par_t
typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t
INCLUDES ///.
Sfm_Ntk_t * Sfm_NtkConstruct(Vec_Wec_t *vFanins, int nPis, int nPos, Vec_Str_t *vFixed, Vec_Str_t *vEmpty, Vec_Wrd_t *vTruths, Vec_Int_t *vStarts, Vec_Wrd_t *vTruths2)
int Sfm_NodeReadUsed(Sfm_Ntk_t *p, int i)
word * Sfm_NodeReadTruth(Sfm_Ntk_t *p, int i)
Vec_Int_t * Sfm_NodeReadFanins(Sfm_Ntk_t *p, int i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.