31static void Abc_NtkStrashPerform(
Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkNew,
int fAllNodes,
int fRecord );
56 assert( Abc_NtkIsStrash(pNtk) );
60 printf(
"Warning: The choice nodes in the original AIG are removed by strashing.\n" );
67 Vec_PtrFree( vNodes );
84 printf(
"Abc_NtkStrash: The network check has failed.\n" );
108 if ( Abc_NodeIsTravIdCurrent( pObj ) )
110 Abc_NodeSetTravIdCurrent( pObj );
111 if ( !Abc_ObjIsNode(pObj) )
143 assert( Abc_NtkIsStrash(pNtk) );
146 printf(
"Warning: The choice nodes in the original AIG are removed by strashing.\n" );
150 Abc_NtkIncrementTravId( pNtk );
161 printf(
"Abc_NtkStrash: The network check has failed.\n" );
188 assert( Abc_NtkIsStrash(pNtk) );
192 printf(
"Warning: The choice nodes in the original AIG are removed by strashing.\n" );
198 if ( Abc_LatchIsInitDc(pObj) )
200 else if ( Abc_LatchIsInit1(pObj) )
201 Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
204 printf(
"Converting %d flops from don't-care to zero initial value.\n", Counter );
212 if ( Abc_LatchIsInit1(pObj) )
214 Abc_ObjXorFaninC( Abc_ObjFanin0(pObj), 0 );
224 Abc_LatchSetInit0( pObj );
231 printf(
"Abc_NtkRestrash(): AIG cleanup removed %d nodes (this is a bug).\n", nNodes );
243 printf(
"Abc_NtkStrash: The network check has failed.\n" );
269 assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
271 if ( Abc_NtkIsStrash(pNtk) )
276 printf(
"Converting to AIGs has failed.\n" );
282 Abc_NtkStrashPerform( pNtk, pNtkAig, fAllNodes, fRecord );
300 printf(
"Abc_NtkStrash: The network check has failed.\n" );
326 assert( Abc_NtkIsStrash(pNtk1) );
327 assert( Abc_NtkIsLogic(pNtk2) || Abc_NtkIsStrash(pNtk2) );
330 printf(
"Converting to AIGs has failed.\n" );
336 printf(
"Abc_NtkAppend(): The union of the network PIs is computed (warning).\n" );
340 if ( Abc_NtkIsStrash(pNtk2) )
346 if ( pObj->
pCopy == NULL )
353 printf(
"Warning: Procedure Abc_NtkAppend() added %d new CIs.\n", nNewCis );
355 if ( Abc_NtkIsLogic(pNtk2) )
356 Abc_NtkStrashPerform( pNtk2, pNtk1, 1, 0 );
372 Abc_Obj_t * pObjOld, * pDriverOld, * pDriverNew;
381 pObjOld = Abc_NtkObj( pNtk1, iNodeId );
383 pDriverOld = Abc_ObjChild0( pObjOld );
384 pDriverNew = Abc_ObjChild0Copy( pObj );
386 if ( Abc_ObjRegular(pDriverOld) == Abc_ObjRegular(pDriverNew) )
389 fCompl = Abc_ObjRegular(pDriverOld)->fPhase ^ Abc_ObjRegular(pDriverNew)->fPhase;
390 Abc_ObjPatchFanin( pObjOld, Abc_ObjRegular(pDriverOld), Abc_ObjNotCond(Abc_ObjRegular(pDriverNew), fCompl) );
396 printf(
"Abc_NtkAppend: The network check has failed.\n" );
413void Abc_NtkStrashPerform(
Abc_Ntk_t * pNtkOld,
Abc_Ntk_t * pNtkNew,
int fAllNodes,
int fRecord )
418 assert( Abc_NtkIsLogic(pNtkOld) );
419 assert( Abc_NtkIsStrash(pNtkNew) );
426 if ( Abc_ObjIsBarBuf(pNodeOld) )
427 pNodeOld->
pCopy = Abc_ObjChild0Copy(pNodeOld);
431 Vec_PtrFree( vNodes );
447 assert( !Hop_IsComplement(pObj) );
448 if ( !Hop_ObjIsNode(pObj) || Hop_ObjIsMarkA(pObj) )
453 assert( !Hop_ObjIsMarkA(pObj) );
454 Hop_ObjSetMarkA( pObj );
474 assert( Abc_ObjIsNode(pNodeOld) );
475 assert( Abc_NtkHasAig(pNodeOld->
pNtk) && !Abc_NtkIsStrash(pNodeOld->
pNtk) );
480 if (
Abc_NodeIsConst(pNodeOld) || Hop_Regular(pRoot) == Hop_ManConst1(pMan) )
481 return Abc_ObjNotCond(
Abc_AigConst1(pNtkNew), Hop_IsComplement(pRoot) );
505 return Abc_ObjNotCond( (
Abc_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
527 assert( !Abc_ObjIsComplement(pNode) );
530 if ( pNode->
Level <= (
unsigned)LevelCut )
531 return pNode->
pCopy = Abc_NtkCreatePi( pNtkNew );
553 assert( Abc_NtkIsStrash(pNtk) );
555 LevelCut = Abc_MaxInt( 0,
Abc_AigLevel(pNtk) - nLevels );
565 pObjNew = Abc_ObjNotCond( pObjNew, Abc_ObjFaninC0(pObj) );
575 printf(
"Abc_NtkTopmost: The network check has failed.\n" );
596 assert( !Abc_ObjIsComplement(pNode) );
601 if ( pNode->
Level > (
unsigned)LevelCut )
622 assert( Abc_NtkIsStrash(pNtk) );
631 pObj->
pCopy = Abc_NtkCreatePi( pNtkNew );
636 if ( Abc_ObjFanoutNum(pObjNew) == 0 )
643 printf(
"Abc_NtkBottommost: The network check has failed.\n" );
665 if ( Abc_ObjRegular(*pp1)->Id < Abc_ObjRegular(*pp2)->Id )
667 if ( Abc_ObjRegular(*pp1)->Id > Abc_ObjRegular(*pp2)->Id )
688 assert( Abc_ObjIsNode(pNode) && !Abc_ObjIsComplement(pNode) );
689 vSuper = Vec_PtrAlloc( 100 );
691 vFront = Vec_PtrAlloc( 100 );
692 Vec_PtrPush( vFront, pNode );
695 pFanin = Abc_ObjChild0(pAnd);
696 if ( Abc_ObjIsNode(pFanin) && !Abc_ObjIsComplement(pFanin) && Abc_ObjFanoutNum(pFanin) == 1 )
697 Vec_PtrPush( vFront, pFanin );
699 Vec_PtrPush( vSuper, pFanin );
701 pFanin = Abc_ObjChild1(pAnd);
702 if ( Abc_ObjIsNode(pFanin) && !Abc_ObjIsComplement(pFanin) && Abc_ObjFanoutNum(pFanin) == 1 )
703 Vec_PtrPush( vFront, pFanin );
705 Vec_PtrPush( vSuper, pFanin );
707 Vec_PtrFree( vFront );
709 vFront = Vec_PtrAlloc( Vec_PtrSize(vSuper) );
711 Vec_PtrPush( vFront, pNode );
712 Vec_PtrFree( vSuper );
715 Vec_PtrUniqify( vSuper, (
int (*)(
const void *,
const void *))Vec_CompareNodeIds );
736 assert( Abc_NtkIsStrash(pNtk) );
738 pObjPo = Abc_NtkPo(pNtk, 0);
740 assert( Vec_PtrSize(vNodes) >= 2 );
753 Vec_PtrFree( vOrder );
757 pObjPo = Abc_NtkCreatePo(pNtkAig);
758 pDriver = Abc_ObjNotCond(Abc_ObjRegular(pObj)->pCopy, Abc_ObjIsComplement(pObj));
762 Vec_PtrFree( vNodes );
765 printf(
"Abc_NtkTopAnd(): AIG cleanup removed %d nodes (this is a bug).\n", nNodes );
769 printf(
"Abc_NtkStrash: The network check has failed.\n" );
793 assert( Abc_NtkIsStrash(pNtk) );
794 assert( Abc_NtkLatchNum(pNtk) == 0 );
795 if ( pFileName == NULL )
798 pFile = fopen( pFileName,
"w" );
801 printf(
"Cannot open output file.\n" );
804 vId2Num = Vec_IntAlloc( 2*Abc_NtkObjNumMax(pNtk) );
805 Vec_IntFill( vId2Num, 2*Abc_NtkObjNumMax(pNtk), -1 );
808 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(
Abc_AigConst1(pNtk))+1, iLit++ );
809 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(
Abc_AigConst1(pNtk))+0, iLit++ );
812 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(pObj)+0, iLit++ );
813 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(pObj)+1, iLit++ );
817 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(pObj)+0, iLit++ );
818 Vec_IntWriteEntry( vId2Num, 2*Abc_ObjId(pObj)+1, iLit++ );
820 fprintf( pFile,
"{\n" );
821 fprintf( pFile,
" \"%s\", ", Abc_NtkName(pNtk) );
822 fprintf( pFile,
"// pi=%d po=%d and=%d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkNodeNum(pNtk) );
823 fprintf( pFile,
"\n" );
824 fprintf( pFile,
" { " );
827 fprintf( pFile,
"NULL },\n" );
828 fprintf( pFile,
" { " );
831 fprintf( pFile,
"NULL },\n" );
832 fprintf( pFile,
" { " );
834 fprintf( pFile,
"%d,", Vec_IntEntry(vId2Num, 2*Abc_ObjFaninId0(pObj) + Abc_ObjFaninC0(pObj)) );
835 fprintf( pFile,
"0 },\n" );
836 fprintf( pFile,
" { " );
838 fprintf( pFile,
"%d,", Vec_IntEntry(vId2Num, 2*Abc_ObjFaninId1(pObj) + Abc_ObjFaninC1(pObj)) );
839 fprintf( pFile,
"0 },\n" );
840 fprintf( pFile,
" { " );
842 fprintf( pFile,
"%d,", Vec_IntEntry(vId2Num, 2*Abc_ObjFaninId0(pObj) + Abc_ObjFaninC0(pObj)) );
843 fprintf( pFile,
"0 },\n" );
844 fprintf( pFile,
"},\n" );
845 if ( pFile != stdout )
847 Vec_IntFree( vId2Num );
867 assert( Abc_NtkIsLogic(pNtk) );
868 assert( Abc_NtkIsLogic(pNtk2) );
869 assert( Abc_NtkPoNum(pNtk) == Abc_NtkPiNum(pNtk2) );
888 Vec_PtrFree( vNodes );
891 pObj->
pCopy = Abc_ObjChild0Copy( Abc_NtkPo(pNtk, i) );
900 Vec_PtrFree( vNodes );
908 fprintf( stdout,
"Abc_NtkPutOnTop(): Network check has failed.\n" );
Abc_Obj_t * Abc_NtkBottommost_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int LevelCut)
Abc_Ntk_t * Abc_NtkPutOnTop(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtk2)
Abc_Ntk_t * Abc_NtkRestrash(Abc_Ntk_t *pNtk, int fCleanup)
FUNCTION DEFINITIONS ///.
Abc_Ntk_t * Abc_NtkRestrashZero(Abc_Ntk_t *pNtk, int fCleanup)
void Abc_NtkRestrashRandom_rec(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
Abc_Ntk_t * Abc_NtkTopmost(Abc_Ntk_t *pNtk, int nLevels)
Abc_Ntk_t * Abc_NtkRestrashRandom(Abc_Ntk_t *pNtk)
Vec_Ptr_t * Abc_NodeGetSuper(Abc_Obj_t *pNode)
void Abc_NodeStrash_rec(Abc_Aig_t *pMan, Hop_Obj_t *pObj)
void Abc_NtkWriteAig(Abc_Ntk_t *pNtk, char *pFileName)
Abc_Ntk_t * Abc_NtkTopAnd(Abc_Ntk_t *pNtk)
Abc_Ntk_t * Abc_NtkBottommost(Abc_Ntk_t *pNtk, int nLevels)
int Abc_NtkAppend(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fAddPos)
Abc_Obj_t * Abc_NodeStrash(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNodeOld, int fRecord)
Abc_Obj_t * Abc_NtkTopmost_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int LevelCut)
Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL Abc_Obj_t * Abc_NtkFindCi(Abc_Ntk_t *pNtk, char *pName)
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)
#define Abc_AigForEachAnd(pNtk, pNode, i)
#define Abc_NtkForEachPo(pNtk, pPo, i)
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
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 Vec_Ptr_t * Abc_NtkDfsIterNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
struct Abc_Aig_t_ Abc_Aig_t
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsIter(Abc_Ntk_t *pNtk, int fCollectAll)
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
ABC_DLL void Abc_NtkUpdateNameIds(Abc_Ntk_t *p)
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkTransferNameIds(Abc_Ntk_t *p, Abc_Ntk_t *pNew)
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
#define Abc_NtkForEachPi(pNtk, pPi, i)
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCi(pNtk, pCi, i)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NodeFindCoFanout(Abc_Obj_t *pNode)
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
ABC_DLL int Abc_NtkCompareSignals(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
struct Hop_Obj_t_ Hop_Obj_t
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.