diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
commit | 6130e39b18b5f53902e4eab14f6d5cdde5219563 (patch) | |
tree | 0db0628479a1b750e9af1f66cb8379ebd0913d31 /src/aig/ntl | |
parent | f0e77f6797c0504b0da25a56152b707d3357f386 (diff) | |
download | abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2 abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip |
initial commit of public abc
Diffstat (limited to 'src/aig/ntl')
-rw-r--r-- | src/aig/ntl/ntl.h | 33 | ||||
-rw-r--r-- | src/aig/ntl/ntlCheck.c | 7 | ||||
-rw-r--r-- | src/aig/ntl/ntlCore.c | 32 | ||||
-rw-r--r-- | src/aig/ntl/ntlEc.c | 16 | ||||
-rw-r--r-- | src/aig/ntl/ntlExtract.c | 93 | ||||
-rw-r--r-- | src/aig/ntl/ntlFraig.c | 56 | ||||
-rw-r--r-- | src/aig/ntl/ntlInsert.c | 31 | ||||
-rw-r--r-- | src/aig/ntl/ntlMan.c | 69 | ||||
-rw-r--r-- | src/aig/ntl/ntlMap.c | 21 | ||||
-rw-r--r-- | src/aig/ntl/ntlNames.c | 471 | ||||
-rw-r--r-- | src/aig/ntl/ntlObj.c | 9 | ||||
-rw-r--r-- | src/aig/ntl/ntlReadBlif.c | 412 | ||||
-rw-r--r-- | src/aig/ntl/ntlSweep.c | 5 | ||||
-rw-r--r-- | src/aig/ntl/ntlTable.c | 13 | ||||
-rw-r--r-- | src/aig/ntl/ntlTime.c | 7 | ||||
-rw-r--r-- | src/aig/ntl/ntlUtil.c | 33 | ||||
-rw-r--r-- | src/aig/ntl/ntlWriteBlif.c | 49 | ||||
-rw-r--r-- | src/aig/ntl/ntl_.c | 5 | ||||
-rw-r--r-- | src/aig/ntl/ntlnwk.h | 113 |
19 files changed, 1106 insertions, 369 deletions
diff --git a/src/aig/ntl/ntl.h b/src/aig/ntl/ntl.h index 5407fcf8..c0d701e0 100644 --- a/src/aig/ntl/ntl.h +++ b/src/aig/ntl/ntl.h @@ -21,6 +21,7 @@ #ifndef __NTL_H__ #define __NTL_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -33,15 +34,12 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif +ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// -typedef struct Ntl_Man_t_ Ntl_Man_t; typedef struct Ntl_Mod_t_ Ntl_Mod_t; typedef struct Ntl_Reg_t_ Ntl_Reg_t; typedef struct Ntl_Obj_t_ Ntl_Obj_t; @@ -144,7 +142,7 @@ struct Ntl_Obj_t_ unsigned Id : 28; // object ID int nFanins; // the number of fanins int nFanouts; // the number of fanouts -// int Reset; // reset of the flop + int Reset; // reset of the flop union { // functionality Ntl_Mod_t * pImplem; // model (for boxes) char * pSop; // SOP (for logic nodes) @@ -165,7 +163,7 @@ struct Ntl_Net_t_ union { void * pCopy2; // the copy of this object float dTemp; // other data -// int iTemp; // other data + int iTemp; // other data }; Ntl_Obj_t * pDriver; // driver of the net unsigned NetId : 27; // unique ID of the net @@ -254,16 +252,16 @@ static inline int Ntl_ObjIsSeqRoot( Ntl_Obj_t * p ) { return Ntl_O #define Ntl_ManForEachModel( p, pMod, i ) \ for ( i = 0; (i < Vec_PtrSize(p->vModels)) && (((pMod) = (Ntl_Mod_t*)Vec_PtrEntry(p->vModels, i)), 1); i++ ) #define Ntl_ManForEachCiNet( p, pNet, i ) \ - Vec_PtrForEachEntry( p->vCis, pNet, i ) + Vec_PtrForEachEntry( Ntl_Net_t *, p->vCis, pNet, i ) #define Ntl_ManForEachCoNet( p, pNet, i ) \ - Vec_PtrForEachEntry( p->vCos, pNet, i ) + Vec_PtrForEachEntry( Ntl_Net_t *, p->vCos, pNet, i ) #define Ntl_ModelForEachPi( pNwk, pObj, i ) \ for ( i = 0; (i < Vec_PtrSize(pNwk->vPis)) && (((pObj) = (Ntl_Obj_t*)Vec_PtrEntry(pNwk->vPis, i)), 1); i++ ) #define Ntl_ModelForEachPo( pNwk, pObj, i ) \ for ( i = 0; (i < Vec_PtrSize(pNwk->vPos)) && (((pObj) = (Ntl_Obj_t*)Vec_PtrEntry(pNwk->vPos, i)), 1); i++ ) #define Ntl_ModelForEachNet( pNwk, pNet, i ) \ - Vec_PtrForEachEntry( pNwk->vNets, pNet, i ) \ + Vec_PtrForEachEntry( Ntl_Net_t *, pNwk->vNets, pNet, i ) \ if ( pNet == NULL ) {} else #define Ntl_ModelForEachObj( pNwk, pObj, i ) \ for ( i = 0; (i < Vec_PtrSize(pNwk->vObjs)) && (((pObj) = (Ntl_Obj_t*)Vec_PtrEntry(pNwk->vObjs, i)), 1); i++ ) \ @@ -365,7 +363,7 @@ extern ABC_DLL Ntl_Obj_t * Ntl_ModelCreateBox( Ntl_Mod_t * pModel, int nFani extern ABC_DLL Ntl_Obj_t * Ntl_ModelDupObj( Ntl_Mod_t * pModel, Ntl_Obj_t * pOld ); extern ABC_DLL Ntl_Obj_t * Ntl_ModelCreatePiWithName( Ntl_Mod_t * pModel, char * pName ); extern ABC_DLL char * Ntl_ManStoreName( Ntl_Man_t * p, char * pName ); -extern ABC_DLL char * Ntl_ManStoreSop( Aig_MmFlex_t * pMan, char * pSop ); +extern ABC_DLL char * Ntl_ManStoreSop( Aig_MmFlex_t * pMan, const char * pSop ); extern ABC_DLL char * Ntl_ManStoreFileName( Ntl_Man_t * p, char * pFileName ); extern ABC_DLL int Ntl_ManObjWhichFanout( Ntl_Obj_t * pNode, Ntl_Net_t * pFanout ); /*=== ntlSweep.c ==========================================================*/ @@ -387,11 +385,12 @@ extern ABC_DLL Ntl_Mod_t * Ntl_ManFindModel( Ntl_Man_t * p, const char * pNa /*=== ntlTime.c ==========================================================*/ extern ABC_DLL Tim_Man_t * Ntl_ManCreateTiming( Ntl_Man_t * p ); /*=== ntlReadBlif.c ==========================================================*/ -extern ABC_DLL Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ); +extern ABC_DLL Ntl_Man_t * Ntl_ManReadBlif( char * pFileName, int fCheck ); /*=== ntlWriteBlif.c ==========================================================*/ -extern ABC_DLL void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ); -extern ABC_DLL void Ioa_WriteBlifLogic( Nwk_Man_t * pNtk, Ntl_Man_t * p, char * pFileName ); +extern ABC_DLL void Ntl_ManWriteBlif( Ntl_Man_t * p, char * pFileName ); +extern ABC_DLL void Ntl_WriteBlifLogic( Nwk_Man_t * pNtk, Ntl_Man_t * p, char * pFileName ); /*=== ntlUtil.c ==========================================================*/ +extern ABC_DLL int Ntl_FileIsType( char * pFileName, char * pS1, char * pS2, char * pS3 ); extern ABC_DLL int Ntl_ModelGetFaninMax( Ntl_Mod_t * pRoot ); extern ABC_DLL Ntl_Net_t * Ntl_ModelFindSimpleNet( Ntl_Net_t * pNetCo ); extern ABC_DLL int Ntl_ManCountSimpleCoDrivers( Ntl_Man_t * p ); @@ -413,9 +412,11 @@ extern ABC_DLL int Ntl_ModelCheckNetsAreNotMarked( Ntl_Mod_t * pMode extern ABC_DLL void Ntl_ModelClearNets( Ntl_Mod_t * pModel ); extern ABC_DLL void Ntl_ManRemoveUselessNets( Ntl_Man_t * p ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/aig/ntl/ntlCheck.c b/src/aig/ntl/ntlCheck.c index 82ef388b..7aecf878 100644 --- a/src/aig/ntl/ntlCheck.c +++ b/src/aig/ntl/ntlCheck.c @@ -21,6 +21,9 @@ #include "ntl.h" #include "aig.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -319,7 +322,7 @@ void Ntl_ModelFixNonDrivenNets( Ntl_Mod_t * pModel ) if ( Vec_PtrSize(vNets) > 0 ) { printf( "Warning: Constant-0 drivers added to %d non-driven nets in network \"%s\": ", Vec_PtrSize(vNets), pModel->pName ); - Vec_PtrForEachEntry( vNets, pNet, i ) + Vec_PtrForEachEntry( Ntl_Net_t *, vNets, pNet, i ) { printf( "%s%s", (i? ", ": ""), pNet->pName ); if ( i == 3 ) @@ -372,3 +375,5 @@ void Ntl_ModelTransformLatches( Ntl_Mod_t * pModel ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlCore.c b/src/aig/ntl/ntlCore.c index b170cdad..c09bac0f 100644 --- a/src/aig/ntl/ntlCore.c +++ b/src/aig/ntl/ntlCore.c @@ -20,6 +20,10 @@ #include "ntl.h" #include "dch.h" +#include "dar.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -42,10 +46,11 @@ ***********************************************************************/ Aig_Man_t * Ntl_ManPerformChoicing( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose ) { - extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * pAig, int fUpdateLevel ); - extern Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose ); - extern Aig_Man_t * Dar_ManChoice( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose ); +// extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * pAig, int fUpdateLevel ); +// extern Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose ); +// extern Aig_Man_t * Dar_ManChoice( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose ); Aig_Man_t * pTemp; + // perform synthesis //printf( "Pre-synthesis AIG: " ); //Aig_ManPrintStats( pAig ); @@ -54,6 +59,7 @@ Aig_Man_t * Ntl_ManPerformChoicing( Aig_Man_t * pAig, int fBalance, int fUpdateL pTemp = Dar_ManChoice( pAig, fBalance, fUpdateLevel, fConstruct, nConfMax, nLevelMax, fVerbose ); //printf( "Post-synthesis AIG: " ); //Aig_ManPrintStats( pTemp ); + return pTemp; } @@ -70,8 +76,22 @@ Aig_Man_t * Ntl_ManPerformChoicing( Aig_Man_t * pAig, int fBalance, int fUpdateL ***********************************************************************/ Aig_Man_t * Ntl_ManPerformChoicingNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ) { - extern Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ); - return Dar_ManChoiceNew( pAig, pPars ); +// extern Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ); + Aig_Man_t * pTemp; +/* + Aig_Obj_t * pObj; + int i; + Aig_ManForEachPi( pAig, pObj, i ) + printf( "%d ", pObj->Level ); + printf( "\n" ); +*/ + pTemp = Dar_ManChoiceNew( pAig, pPars ); +/* + Aig_ManForEachPi( pTemp, pObj, i ) + printf( "%d ", pObj->Level ); + printf( "\n" ); +*/ + return pTemp; } /**Function************************************************************* @@ -128,3 +148,5 @@ int Ntl_ManInsertTestIf( Ntl_Man_t * p, Aig_Man_t * pAig ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlEc.c b/src/aig/ntl/ntlEc.c index 0d41006e..d82ac71e 100644 --- a/src/aig/ntl/ntlEc.c +++ b/src/aig/ntl/ntlEc.c @@ -19,6 +19,10 @@ ***********************************************************************/ #include "ntl.h" +#include "saig.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -273,8 +277,8 @@ void Ntl_ManPrepareCec( char * pFileName1, char * pFileName2, Aig_Man_t ** ppAig { Ntl_Man_t * pMan1, * pMan2; // read the netlists - pMan1 = Ioa_ReadBlif( pFileName1, 1 ); - pMan2 = Ioa_ReadBlif( pFileName2, 1 ); + pMan1 = Ntl_ManReadBlif( pFileName1, 1 ); + pMan2 = Ntl_ManReadBlif( pFileName2, 1 ); if ( !pMan1 || !pMan2 ) { if ( pMan1 ) Ntl_ManFree( pMan1 ); @@ -301,14 +305,14 @@ void Ntl_ManPrepareCec( char * pFileName1, char * pFileName2, Aig_Man_t ** ppAig ***********************************************************************/ Aig_Man_t * Ntl_ManPrepareSec( char * pFileName1, char * pFileName2 ) { - extern Aig_Man_t * Saig_ManCreateMiter( Aig_Man_t * p1, Aig_Man_t * p2, int Oper ); +// extern Aig_Man_t * Saig_ManCreateMiter( Aig_Man_t * p1, Aig_Man_t * p2, int Oper ); Aig_Man_t * pAig1, * pAig2, * pAig; Ntl_Man_t * pMan1, * pMan2; Ntl_Mod_t * pModel1, * pModel2; // read the netlists - pMan1 = Ioa_ReadBlif( pFileName1, 1 ); - pMan2 = Ioa_ReadBlif( pFileName2, 1 ); + pMan1 = Ntl_ManReadBlif( pFileName1, 1 ); + pMan2 = Ntl_ManReadBlif( pFileName2, 1 ); if ( !pMan1 || !pMan2 ) { if ( pMan1 ) Ntl_ManFree( pMan1 ); @@ -366,3 +370,5 @@ Aig_Man_t * Ntl_ManPrepareSec( char * pFileName1, char * pFileName2 ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlExtract.c b/src/aig/ntl/ntlExtract.c index ae278585..a6268b2c 100644 --- a/src/aig/ntl/ntlExtract.c +++ b/src/aig/ntl/ntlExtract.c @@ -22,6 +22,9 @@ #include "dec.h" #include "kit.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -59,9 +62,9 @@ Aig_Obj_t * Ntl_ConvertSopToAigInternal( Aig_Man_t * pMan, Ntl_Obj_t * pNode, ch { pNet = Ntl_ObjFanin( pNode, i ); if ( Value == '1' ) - pAnd = Aig_And( pMan, pAnd, pNet->pCopy ); + pAnd = Aig_And( pMan, pAnd, (Aig_Obj_t *)pNet->pCopy ); else if ( Value == '0' ) - pAnd = Aig_And( pMan, pAnd, Aig_Not(pNet->pCopy) ); + pAnd = Aig_And( pMan, pAnd, Aig_Not((Aig_Obj_t *)pNet->pCopy) ); } // add to the sum of cubes pSum = Aig_Or( pMan, pSum, pAnd ); @@ -93,16 +96,16 @@ Aig_Obj_t * Ntl_GraphToNetworkAig( Aig_Man_t * pMan, Dec_Graph_t * pGraph ) return Aig_NotCond( Aig_ManConst1(pMan), Dec_GraphIsComplement(pGraph) ); // check for a literal if ( Dec_GraphIsVar(pGraph) ) - return Aig_NotCond( Dec_GraphVar(pGraph)->pFunc, Dec_GraphIsComplement(pGraph) ); + return Aig_NotCond( (Aig_Obj_t *)Dec_GraphVar(pGraph)->pFunc, Dec_GraphIsComplement(pGraph) ); // build the AIG nodes corresponding to the AND gates of the graph Dec_GraphForEachNode( pGraph, pNode, i ) { - pAnd0 = Aig_NotCond( Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); - pAnd1 = Aig_NotCond( Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); + pAnd0 = Aig_NotCond( (Aig_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); + pAnd1 = Aig_NotCond( (Aig_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); pNode->pFunc = Aig_And( pMan, pAnd0, pAnd1 ); } // complement the result if necessary - return Aig_NotCond( pNode->pFunc, Dec_GraphIsComplement(pGraph) ); + return Aig_NotCond( (Aig_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) ); } /**Function************************************************************* @@ -183,16 +186,16 @@ int Ntl_ManExtract_rec( Ntl_Man_t * p, Ntl_Net_t * pNet ) Vec_IntPush( p->vBox1Cios, Aig_ManPoNum(p->pAig) ); Ntl_ObjForEachFanin( pObj, pNetFanin, i ) { - LevelCur = Aig_ObjLevel( Aig_Regular(pNetFanin->pCopy) ); + LevelCur = Aig_ObjLevel( Aig_Regular((Aig_Obj_t *)pNetFanin->pCopy) ); LevelMax = ABC_MAX( LevelMax, LevelCur ); Vec_PtrPush( p->vCos, pNetFanin ); - Aig_ObjCreatePo( p->pAig, pNetFanin->pCopy ); + Aig_ObjCreatePo( p->pAig, (Aig_Obj_t *)pNetFanin->pCopy ); } Ntl_ObjForEachFanout( pObj, pNetFanin, i ) { Vec_PtrPush( p->vCis, pNetFanin ); pNetFanin->pCopy = Aig_ObjCreatePi( p->pAig ); - Aig_ObjSetLevel( pNetFanin->pCopy, LevelMax + 1 ); + Aig_ObjSetLevel( (Aig_Obj_t *)pNetFanin->pCopy, LevelMax + 1 ); } } Vec_PtrPush( p->vVisNodes, pObj ); @@ -264,7 +267,7 @@ Aig_Man_t * Ntl_ManExtract( Ntl_Man_t * p ) return 0; } Vec_PtrPush( p->vCos, pNet ); - Aig_ObjCreatePo( p->pAig, pNet->pCopy ); + Aig_ObjCreatePo( p->pAig, (Aig_Obj_t *)pNet->pCopy ); } } // visit dangling boxes @@ -306,9 +309,9 @@ Aig_Man_t * Ntl_ManExtract( Ntl_Man_t * p ) SeeAlso [] ***********************************************************************/ -int Ntl_ManCollapseBoxComb_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) +int Ntl_ManCollapseBoxComb_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox ) { - extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq ); + extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet ); Ntl_Mod_t * pModel = pBox->pImplem; Ntl_Obj_t * pObj; Ntl_Net_t * pNet, * pNetBox; @@ -329,7 +332,7 @@ int Ntl_ManCollapseBoxComb_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) Ntl_ModelForEachPo( pModel, pObj, i ) { pNet = Ntl_ObjFanin0(pObj); - if ( !Ntl_ManCollapse_rec( p, pNet, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNet ) ) return 0; pNetBox = Ntl_ObjFanout( pBox, i ); pNetBox->pCopy = pNet->pCopy; @@ -348,9 +351,9 @@ int Ntl_ManCollapseBoxComb_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) SeeAlso [] ***********************************************************************/ -int Ntl_ManCollapseBoxSeq1_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) +int Ntl_ManCollapseBoxSeq1_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox ) { - extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq ); + extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet ); Ntl_Mod_t * pModel = pBox->pImplem; Ntl_Obj_t * pObj; Ntl_Net_t * pNet, * pNetBox; @@ -365,18 +368,18 @@ int Ntl_ManCollapseBoxSeq1_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) { pNet = Ntl_ObjFanout0(pObj); pNet->pCopy = Aig_ObjCreatePi( p->pAig ); - if ( fSeq && Ntl_ObjIsInit1( pObj ) ) - pNet->pCopy = Aig_Not(pNet->pCopy); + if ( Ntl_ObjIsInit1( pObj ) ) + pNet->pCopy = Aig_Not((Aig_Obj_t *)pNet->pCopy); pNet->nVisits = 2; // remember the class of this register Vec_IntPush( p->vRegClasses, p->pNal ? pBox->iTemp : pObj->LatchId.regClass ); -// Vec_IntPush( p->vRstClasses, p->pNal ? pBox->Reset : -1 ); + Vec_IntPush( p->vRstClasses, p->pNal ? pBox->Reset : -1 ); } // compute AIG for the internal nodes Ntl_ModelForEachPo( pModel, pObj, i ) { pNet = Ntl_ObjFanin0(pObj); - if ( !Ntl_ManCollapse_rec( p, pNet, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNet ) ) return 0; pNetBox = Ntl_ObjFanout( pBox, i ); pNetBox->pCopy = pNet->pCopy; @@ -395,9 +398,9 @@ int Ntl_ManCollapseBoxSeq1_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq ) SeeAlso [] ***********************************************************************/ -int Ntl_ManCollapseBoxSeq2_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq, int iFirstPi ) +int Ntl_ManCollapseBoxSeq2_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int iFirstPi ) { - extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq ); + extern int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet ); Ntl_Mod_t * pModel = pBox->pImplem; Ntl_Obj_t * pObj; Ntl_Net_t * pNet, * pNetBox; @@ -420,20 +423,20 @@ int Ntl_ManCollapseBoxSeq2_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq, int i { pNet = Ntl_ObjFanout0(pObj); pNet->pCopy = Aig_ManPi( p->pAig, iFirstPi++ ); - if ( fSeq && Ntl_ObjIsInit1( pObj ) ) - pNet->pCopy = Aig_Not(pNet->pCopy); + if ( Ntl_ObjIsInit1( pObj ) ) + pNet->pCopy = Aig_Not((Aig_Obj_t *)pNet->pCopy); pNet->nVisits = 2; } // compute AIGs for the registers Ntl_ModelForEachLatch( pModel, pObj, i ) { pNet = Ntl_ObjFanin0(pObj); - if ( !Ntl_ManCollapse_rec( p, pNet, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNet ) ) return 0; - if ( fSeq && Ntl_ObjIsInit1( pObj ) ) - Aig_ObjCreatePo( p->pAig, Aig_Not(pNet->pCopy) ); + if ( Ntl_ObjIsInit1( pObj ) ) + Aig_ObjCreatePo( p->pAig, Aig_Not((Aig_Obj_t *)pNet->pCopy) ); else - Aig_ObjCreatePo( p->pAig, pNet->pCopy ); + Aig_ObjCreatePo( p->pAig, (Aig_Obj_t *)pNet->pCopy ); } return 1; } @@ -449,7 +452,7 @@ int Ntl_ManCollapseBoxSeq2_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq, int i SeeAlso [] ***********************************************************************/ -int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq ) +int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet ) { Ntl_Obj_t * pObj; Ntl_Net_t * pNetFanin; @@ -467,13 +470,13 @@ int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq ) assert( Ntl_ObjIsNode(pObj) || Ntl_ObjIsBox(pObj) ); // visit the input nets of the box Ntl_ObjForEachFanin( pObj, pNetFanin, i ) - if ( !Ntl_ManCollapse_rec( p, pNetFanin, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNetFanin ) ) return 0; // add box inputs/outputs to COs/CIs if ( Ntl_ObjIsBox(pObj) ) { assert( Ntl_BoxIsWhite(pObj) && Ntl_BoxIsComb(pObj) ); - if ( !Ntl_ManCollapseBoxComb_rec( p, pObj, fSeq ) ) + if ( !Ntl_ManCollapseBoxComb_rec( p, pObj ) ) return 0; } if ( Ntl_ObjIsNode(pObj) ) @@ -533,7 +536,7 @@ Aig_Man_t * Ntl_ManCollapse( Ntl_Man_t * p, int fSeq ) if ( !(Ntl_BoxIsSeq(pBox) && Ntl_BoxIsWhite(pBox)) ) continue; Vec_IntPush( p->vBox1Cios, Aig_ManPiNum(p->pAig) ); - Ntl_ManCollapseBoxSeq1_rec( p, pBox, fSeq ); + Ntl_ManCollapseBoxSeq1_rec( p, pBox ); Ntl_ObjForEachFanout( pBox, pNet, k ) pNet->nVisits = 2; } @@ -541,12 +544,12 @@ Aig_Man_t * Ntl_ManCollapse( Ntl_Man_t * p, int fSeq ) // derive the outputs Ntl_ManForEachCoNet( p, pNet, i ) { - if ( !Ntl_ManCollapse_rec( p, pNet, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNet ) ) { printf( "Ntl_ManCollapse(): Error: Combinational loop is detected.\n" ); return 0; } - Aig_ObjCreatePo( p->pAig, pNet->pCopy ); + Aig_ObjCreatePo( p->pAig, (Aig_Obj_t *)pNet->pCopy ); } nTruePos = Aig_ManPoNum(p->pAig); // create outputs of seq boxes @@ -556,12 +559,12 @@ Aig_Man_t * Ntl_ManCollapse( Ntl_Man_t * p, int fSeq ) if ( !(Ntl_BoxIsSeq(pBox) && Ntl_BoxIsWhite(pBox)) ) continue; Ntl_ObjForEachFanin( pBox, pNet, k ) - if ( !Ntl_ManCollapse_rec( p, pNet, fSeq ) ) + if ( !Ntl_ManCollapse_rec( p, pNet ) ) { printf( "Ntl_ManCollapse(): Error: Combinational loop is detected.\n" ); return 0; } - Ntl_ManCollapseBoxSeq2_rec( p, pBox, fSeq, Vec_IntEntry(p->vBox1Cios, iBox++) ); + Ntl_ManCollapseBoxSeq2_rec( p, pBox, Vec_IntEntry(p->vBox1Cios, iBox++) ); } } // make sure registers are added correctly @@ -700,13 +703,13 @@ Nwk_Obj_t * Ntl_ManExtractNwk_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, Nwk_Man_t * Nwk_Obj_t * pNode; int i; if ( pNet->fMark ) - return pNet->pCopy2; + return (Nwk_Obj_t *)pNet->pCopy2; pNet->fMark = 1; pNode = Nwk_ManCreateNode( pNtk, Ntl_ObjFaninNum(pNet->pDriver), (int)(long)pNet->pCopy ); Ntl_ObjForEachFanin( pNet->pDriver, pFaninNet, i ) { Ntl_ManExtractNwk_rec( p, pFaninNet, pNtk, vCover, vMemory ); - Nwk_ObjAddFanin( pNode, pFaninNet->pCopy2 ); + Nwk_ObjAddFanin( pNode, (Nwk_Obj_t *)pFaninNet->pCopy2 ); } if ( Ntl_ObjFaninNum(pNet->pDriver) == 0 || Kit_PlaGetVarNum(pNet->pDriver->pSop) == 0 ) pNode->pFunc = Hop_NotCond( Hop_ManConst1(pNtk->pManHop), Kit_PlaIsConst0(pNet->pDriver->pSop) ); @@ -717,7 +720,7 @@ Nwk_Obj_t * Ntl_ManExtractNwk_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, Nwk_Man_t * if ( Kit_PlaIsComplement(pNet->pDriver->pSop) ) pNode->pFunc = Hop_Not(pNode->pFunc); } - return pNet->pCopy2 = pNode; + return (Nwk_Obj_t *)(pNet->pCopy2 = pNode); } /**Function************************************************************* @@ -780,24 +783,24 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig, Tim_Man_t * pMan { if ( Aig_ObjIsPi(pAnd) ) { - pNet = pAnd->pData; + pNet = (Ntl_Net_t *)pAnd->pData; pNet->fMark = 1; pNet->pCopy2 = Nwk_ManCreateCi( pNtk, (int)(long)pNet->pCopy ); } else if ( Aig_ObjIsPo(pAnd) ) { - pNet = pAnd->pData; + pNet = (Ntl_Net_t *)pAnd->pData; pNode = Nwk_ManCreateCo( pNtk ); if ( (pNetSimple = Ntl_ModelFindSimpleNet( pNet )) ) { pNetSimple->pCopy2 = Ntl_ManExtractNwk_rec( p, pNetSimple, pNtk, vCover, vMemory ); - Nwk_ObjAddFanin( pNode, pNetSimple->pCopy2 ); + Nwk_ObjAddFanin( pNode, (Nwk_Obj_t *)pNetSimple->pCopy2 ); pNode->fInvert = Kit_PlaIsInv( pNet->pDriver->pSop ); } else { pNet->pCopy2 = Ntl_ManExtractNwk_rec( p, pNet, pNtk, vCover, vMemory ); - Nwk_ObjAddFanin( pNode, pNet->pCopy2 ); + Nwk_ObjAddFanin( pNode, (Nwk_Obj_t *)pNet->pCopy2 ); pNode->fInvert = (Nwk_ObjFanin0(pNode)->pFunc == Hop_ManConst0(pNtk->pManHop)); // fixed on June 7, 2009 } } @@ -818,7 +821,7 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig, Tim_Man_t * pMan /**Function************************************************************* Synopsis [Extracts logic newtork out of the netlist.] - + Description [] SideEffects [] @@ -831,7 +834,7 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan Nwk_Man_t * pNtk; Ntl_Man_t * pNtl; Ntl_Mod_t * pRoot; - pNtl = Ioa_ReadBlif( pFileName, 1 ); + pNtl = Ntl_ManReadBlif( pFileName, 1 ); if ( pNtl == NULL ) { printf( "Ntl_ManReadNwk(): Reading BLIF has failed.\n" ); @@ -870,3 +873,5 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlFraig.c b/src/aig/ntl/ntlFraig.c index 1d7ac393..34bc81ec 100644 --- a/src/aig/ntl/ntlFraig.c +++ b/src/aig/ntl/ntlFraig.c @@ -23,6 +23,9 @@ #include "ssw.h" #include "dch.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -66,12 +69,12 @@ void Ntl_ManUpdateNoMergeReprs( Aig_Man_t * pAig, Aig_Obj_t ** pReprs ) if ( pRepresNew != NULL ) continue; // get the net of the representative node - pNet = pRepres->pData; + pNet = (Ntl_Net_t *)pRepres->pData; assert( pRepres->pData != NULL ); if ( Ntl_ObjIsBox(pNet->pDriver) && pNet->pDriver->pImplem->attrNoMerge ) { // the net belongs to the no-merge box - pNetObj = pObj->pData; + pNetObj = (Ntl_Net_t *)pObj->pData; if ( Ntl_ObjIsBox(pNetObj->pDriver) && pNetObj->pDriver->pImplem->attrNoMerge ) continue; // the object's net does not belong to the no-merge box @@ -130,7 +133,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ // remember pointers to the nets of pNew Aig_ManForEachObj( pAig, pObj, i ) - pObj->pNext = pObj->pData; + pObj->pNext = (Aig_Obj_t *)pObj->pData; // map the AIG managers Aig_ManForEachObj( pAig, pObj, i ) @@ -139,8 +142,8 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ pObj->pData = Aig_ManConst1(pAigCol); else if ( !Aig_ObjIsPo(pObj) ) { - pNet = pObj->pData; - pObjCol = Aig_Regular(pNet->pCopy); + pNet = (Ntl_Net_t *)pObj->pData; + pObjCol = Aig_Regular((Aig_Obj_t *)pNet->pCopy); pObj->pData = pObjCol; } } @@ -155,7 +158,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ { if ( Aig_ObjIsPo(pObj) ) continue; - pObjCol = pObj->pData; + pObjCol = (Aig_Obj_t *)pObj->pData; if ( pObjCol == NULL ) continue; if ( pMapBack[pObjCol->Id] == NULL ) @@ -170,7 +173,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ if ( Aig_ObjIsPo(pObj) ) continue; // get the collapsed node - pObjCol = pObj->pData; + pObjCol = (Aig_Obj_t *)pObj->pData; if ( pObjCol == NULL ) continue; // get the representative of the collapsed node @@ -230,8 +233,8 @@ void Ntl_ManReduce( Ntl_Man_t * p, Aig_Man_t * pAig ) if ( pObjRepr == NULL ) continue; assert( pObj != pObjRepr ); - pNet = pObj->pData; - pNetRepr = pObjRepr->pData; + pNet = (Ntl_Net_t *)pObj->pData; + pNetRepr = (Ntl_Net_t *)pObjRepr->pData; // consider special cases, when the net should not be reduced if ( Ntl_ObjIsBox(pNet->pDriver) ) { @@ -267,8 +270,8 @@ void Ntl_ManReduce( Ntl_Man_t * p, Aig_Man_t * pAig ) pNetRepr->pCopy = Aig_ManConst1(pAig); } // get the complemented attributes of the nets - fCompl = Aig_IsComplement(pNet->pCopy) ^ Aig_Regular(pNet->pCopy)->fPhase ^ - Aig_IsComplement(pNetRepr->pCopy) ^ Aig_Regular(pNetRepr->pCopy)->fPhase; + fCompl = Aig_IsComplement((Aig_Obj_t *)pNet->pCopy) ^ Aig_Regular((Aig_Obj_t *)pNet->pCopy)->fPhase ^ + Aig_IsComplement((Aig_Obj_t *)pNetRepr->pCopy) ^ Aig_Regular((Aig_Obj_t *)pNetRepr->pCopy)->fPhase; // create interter/buffer driven by the representative net pNode = Ntl_ModelCreateNode( pRoot, 1 ); pNode->pSop = fCompl? Ntl_ManStoreSop( p->pMemSops, "0 1\n" ) : Ntl_ManStoreSop( p->pMemSops, "1 1\n" ); @@ -322,7 +325,7 @@ void Ntl_ManResetComplemented( Ntl_Man_t * p, Aig_Man_t * pAigCol ) { if ( Ntl_ObjIsInit1( pObj ) ) { - pObjCol = Ntl_ObjFanout0(pObj)->pCopy; + pObjCol = (Aig_Obj_t *)Ntl_ObjFanout0(pObj)->pCopy; assert( pObjCol->fPhase == 0 ); pObjCol->fPhase = 1; } @@ -353,7 +356,20 @@ Ntl_Man_t * Ntl_ManFinalize( Ntl_Man_t * pNew, Aig_Man_t * pAig, Aig_Man_t * pAi pAig->nReprsAlloc = Aig_ManObjNumMax(pAig); if ( fVerbose ) printf( "Equivalences: Collapsed = %5d. Extracted = %5d.\n", Aig_ManCountReprs(pAigCol), Aig_ManCountReprs(pAig) ); - +/* +{ + Aig_Obj_t * pObj; + int i; + Aig_ManForEachObj( pAig, pObj, i ) + if ( pAig->pReprs[i] != NULL ) + printf( "%s%d->%s%d ", + (Aig_ObjIsPi(pObj)? "pi": ""), + pObj->Id, + (Aig_ObjIsPi(pAig->pReprs[i])? "pi": ""), + pAig->pReprs[i]->Id ); + printf( "\n" ); +} +*/ // implement equivalence classes and remove dangling nodes Ntl_ManReduce( pNew, pAig ); Ntl_ManSweep( pNew, fVerbose ); @@ -503,7 +519,7 @@ Aig_Man_t * Ntl_ManAigToRst( Ntl_Man_t * pNtl, Aig_Man_t * p ) if ( iRstNum < 0 ) continue; assert( iRstNum < nResets ); - pObj->pData = Aig_And( pNew, pObj->pData, Aig_ManPi(pNew, iRstNum) ); // could be NOT(pi) + pObj->pData = Aig_And( pNew, (Aig_Obj_t *)pObj->pData, Aig_ManPi(pNew, iRstNum) ); // could be NOT(pi) Counter++; } else if ( Aig_ObjIsConst1(pObj) ) @@ -578,7 +594,7 @@ void Ntl_ManRemapClassesScorr( Ntl_Man_t * pNtl, Aig_Man_t * p, Aig_Man_t * pNew // map things back Aig_ManForEachObj( p, pObj, i ) { - pObjNew = pObj->pData; + pObjNew = (Aig_Obj_t *)pObj->pData; assert( pObjNew != NULL && !Aig_IsComplement(pObjNew) ); pObjNew->pData = pObj; } @@ -588,8 +604,8 @@ void Ntl_ManRemapClassesScorr( Ntl_Man_t * pNtl, Aig_Man_t * p, Aig_Man_t * pNew pObjNewRepr = pNew->pReprs[pObjNew->Id]; if ( pObjNewRepr == NULL ) continue; - pObj = pObjNew->pData; - pObjRepr = pObjNewRepr->pData; + pObj = (Aig_Obj_t *)pObjNew->pData; + pObjRepr = (Aig_Obj_t *)pObjNewRepr->pData; assert( Aig_ObjId(pObjRepr) < Aig_ObjId(pObj) ); Aig_ObjCreateRepr( p, pObjRepr, pObj ); } @@ -787,6 +803,8 @@ Ntl_Man_t * Ntl_ManScorr( Ntl_Man_t * p, Ssw_Pars_t * pPars ) } else { + pPars->fVerbose = 1; + pTemp = Ssw_SignalCorrespondence( pAigCol, pPars ); Aig_ManStop( pTemp ); } @@ -872,7 +890,7 @@ void Ntl_ManAttachWhiteBoxes( Ntl_Man_t * p, Aig_Man_t * pAigCol, Aig_Man_t * pA if ( pNet->pCopy == NULL ) continue; // skip the outputs that are not preserved after merging equivalence - if ( Aig_Regular(pNet->pCopy2)->pData == NULL ) + if ( Aig_Regular((Aig_Obj_t *)pNet->pCopy2)->pData == NULL ) continue; break; } @@ -982,3 +1000,5 @@ Ntl_Man_t * Ntl_ManSsw2( Ntl_Man_t * p, Fra_Ssw_t * pPars ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlInsert.c b/src/aig/ntl/ntlInsert.c index 750eb8f7..8b0e3493 100644 --- a/src/aig/ntl/ntlInsert.c +++ b/src/aig/ntl/ntlInsert.c @@ -21,6 +21,9 @@ #include "ntl.h" #include "kit.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -65,7 +68,7 @@ Ntl_Man_t * Ntl_ManInsertMapping( Ntl_Man_t * p, Vec_Ptr_t * vMapping, Aig_Man_t // create a new node for each LUT vCover = Vec_IntAlloc( 1 << 16 ); nDigits = Aig_Base10Log( Vec_PtrSize(vMapping) ); - Vec_PtrForEachEntry( vMapping, pLut, i ) + Vec_PtrForEachEntry( Ntl_Lut_t *, vMapping, pLut, i ) { pNode = Ntl_ModelCreateNode( pRoot, pLut->nFanins ); pNode->pSop = Kit_PlaFromTruth( p->pMemSops, pLut->pTruth, pLut->nFanins, vCover ); @@ -73,7 +76,7 @@ Ntl_Man_t * Ntl_ManInsertMapping( Ntl_Man_t * p, Vec_Ptr_t * vMapping, Aig_Man_t { for ( k = 0; k < pLut->nFanins; k++ ) { - pNet = Vec_PtrEntry( vCopies, pLut->pFanins[k] ); + pNet = (Ntl_Net_t *)Vec_PtrEntry( vCopies, pLut->pFanins[k] ); if ( pNet == NULL ) { printf( "Ntl_ManInsert(): Internal error: Net not found.\n" ); @@ -108,9 +111,9 @@ Ntl_Man_t * Ntl_ManInsertMapping( Ntl_Man_t * p, Vec_Ptr_t * vMapping, Aig_Man_t if ( pNetCo->fMark ) continue; pNetCo->fMark = 1; - pNet = Vec_PtrEntry( vCopies, Aig_Regular(pNetCo->pCopy)->Id ); + pNet = (Ntl_Net_t *)Vec_PtrEntry( vCopies, Aig_Regular((Aig_Obj_t *)pNetCo->pCopy)->Id ); pNode = Ntl_ModelCreateNode( pRoot, 1 ); - pNode->pSop = Aig_IsComplement(pNetCo->pCopy)? Ntl_ManStoreSop( p->pMemSops, "0 1\n" ) : Ntl_ManStoreSop( p->pMemSops, "1 1\n" ); + pNode->pSop = Aig_IsComplement((Aig_Obj_t *)pNetCo->pCopy)? Ntl_ManStoreSop( p->pMemSops, "0 1\n" ) : Ntl_ManStoreSop( p->pMemSops, "1 1\n" ); Ntl_ObjSetFanin( pNode, pNet, 0 ); // update the CO driver net assert( pNetCo->pDriver == NULL ); @@ -187,8 +190,8 @@ Ntl_Man_t * Ntl_ManInsertAig( Ntl_Man_t * p, Aig_Man_t * pAig ) return 0; } pNode = Ntl_ModelCreateNode( pRoot, 2 ); - Ntl_ObjSetFanin( pNode, Aig_ObjFanin0(pObj)->pData, 0 ); - Ntl_ObjSetFanin( pNode, Aig_ObjFanin1(pObj)->pData, 1 ); + Ntl_ObjSetFanin( pNode, (Ntl_Net_t *)Aig_ObjFanin0(pObj)->pData, 0 ); + Ntl_ObjSetFanin( pNode, (Ntl_Net_t *)Aig_ObjFanin1(pObj)->pData, 1 ); if ( Aig_ObjFaninC0(pObj) && Aig_ObjFaninC1(pObj) ) pNode->pSop = Ntl_ManStoreSop( p->pMemSops, "00 1\n" ); else if ( Aig_ObjFaninC0(pObj) && !Aig_ObjFaninC1(pObj) ) @@ -224,7 +227,7 @@ Ntl_Man_t * Ntl_ManInsertAig( Ntl_Man_t * p, Aig_Man_t * pAig ) pObj = Aig_ManPo( pAig, i ); pFanin = Aig_ObjFanin0( pObj ); // get the net driving the driver - pNet = pFanin->pData; + pNet = (Ntl_Net_t *)pFanin->pData; pNode = Ntl_ModelCreateNode( pRoot, 1 ); pNode->pSop = Aig_ObjFaninC0(pObj)? Ntl_ManStoreSop( p->pMemSops, "0 1\n" ) : Ntl_ManStoreSop( p->pMemSops, "1 1\n" ); Ntl_ObjSetFanin( pNode, pNet, 0 ); @@ -317,7 +320,7 @@ Ntl_Man_t * Ntl_ManInsertNtk2( Ntl_Man_t * p, Nwk_Man_t * pNtk ) nDigits = Aig_Base10Log( Nwk_ManNodeNum(pNtk) ); // go through the nodes in the topological order vObjs = Nwk_ManDfs( pNtk ); - Vec_PtrForEachEntry( vObjs, pObj, i ) + Vec_PtrForEachEntry( Nwk_Obj_t *, vObjs, pObj, i ) { if ( !Nwk_ObjIsNode(pObj) ) continue; @@ -351,7 +354,7 @@ Ntl_Man_t * Ntl_ManInsertNtk2( Ntl_Man_t * p, Nwk_Man_t * pNtk ) { Nwk_ObjForEachFanin( pObj, pFanin, k ) { - pNet = pFanin->pCopy; + pNet = (Ntl_Net_t *)pFanin->pCopy; if ( pNet == NULL ) { printf( "Ntl_ManInsertNtk(): Internal error: Net not found.\n" ); @@ -404,7 +407,7 @@ Ntl_Man_t * Ntl_ManInsertNtk2( Ntl_Man_t * p, Nwk_Man_t * pNtk ) pObj = Nwk_ManCo( pNtk, i ); pFanin = Nwk_ObjFanin0( pObj ); // get the net driving this PO - pNet = pFanin->pCopy; + pNet = (Ntl_Net_t *)pFanin->pCopy; if ( pNet == NULL ) // constant net { assert( fWriteConstants ); @@ -500,7 +503,7 @@ Ntl_Man_t * Ntl_ManInsertNtk( Ntl_Man_t * p, Nwk_Man_t * pNtk ) nDigits = Aig_Base10Log( Nwk_ManNodeNum(pNtk) ); // go through the nodes in the topological order vObjs = Nwk_ManDfs( pNtk ); - Vec_PtrForEachEntry( vObjs, pObj, i ) + Vec_PtrForEachEntry( Nwk_Obj_t *, vObjs, pObj, i ) { if ( !Nwk_ObjIsNode(pObj) ) continue; @@ -512,7 +515,7 @@ Ntl_Man_t * Ntl_ManInsertNtk( Ntl_Man_t * p, Nwk_Man_t * pNtk ) { Nwk_ObjForEachFanin( pObj, pFanin, k ) { - pNet = pFanin->pCopy; + pNet = (Ntl_Net_t *)pFanin->pCopy; if ( pNet == NULL ) { printf( "Ntl_ManInsertNtk(): Internal error: Net not found.\n" ); @@ -562,7 +565,7 @@ Ntl_Man_t * Ntl_ManInsertNtk( Ntl_Man_t * p, Nwk_Man_t * pNtk ) pObj = Nwk_ManCo( pNtk, i ); pFanin = Nwk_ObjFanin0( pObj ); // get the net driving this PO - pNet = pFanin->pCopy; + pNet = (Ntl_Net_t *)pFanin->pCopy; if ( Nwk_ObjFanoutNum(pFanin) == 1 && Ntl_ObjIsNode(pNet->pDriver) ) { pNode = pNet->pDriver; @@ -607,3 +610,5 @@ Ntl_Man_t * Ntl_ManInsertNtk( Ntl_Man_t * p, Nwk_Man_t * pNtk ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlMan.c b/src/aig/ntl/ntlMan.c index b5ad7815..45fb7226 100644 --- a/src/aig/ntl/ntlMan.c +++ b/src/aig/ntl/ntlMan.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -108,7 +111,7 @@ Ntl_Man_t * Ntl_ManStartFrom( Ntl_Man_t * pOld ) pNew = Ntl_ManAlloc(); pNew->pName = Ntl_ManStoreFileName( pNew, pOld->pName ); pNew->pSpec = Ntl_ManStoreName( pNew, pOld->pName ); - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) { if ( i == 0 ) { @@ -119,10 +122,10 @@ Ntl_Man_t * Ntl_ManStartFrom( Ntl_Man_t * pOld ) else pModel->pCopy = Ntl_ModelDup( pNew, pModel ); } - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) Ntl_ModelForEachBox( pModel, pBox, k ) { - ((Ntl_Obj_t *)pBox->pCopy)->pImplem = pBox->pImplem->pCopy; + ((Ntl_Obj_t *)pBox->pCopy)->pImplem = (Ntl_Mod_t *)pBox->pImplem->pCopy; ((Ntl_Obj_t *)pBox->pCopy)->iTemp = pBox->iTemp; // ((Ntl_Obj_t *)pBox->pCopy)->Reset = pBox->Reset; } @@ -158,11 +161,11 @@ Ntl_Man_t * Ntl_ManDup( Ntl_Man_t * pOld ) pNew = Ntl_ManAlloc(); pNew->pName = Ntl_ManStoreFileName( pNew, pOld->pName ); pNew->pSpec = Ntl_ManStoreName( pNew, pOld->pName ); - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) pModel->pCopy = Ntl_ModelDup( pNew, pModel ); - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) Ntl_ModelForEachBox( pModel, pBox, k ) - ((Ntl_Obj_t *)pBox->pCopy)->pImplem = pBox->pImplem->pCopy; + ((Ntl_Obj_t *)pBox->pCopy)->pImplem = (Ntl_Mod_t *)pBox->pImplem->pCopy; Ntl_ManForEachCiNet( pOld, pNet, i ) Vec_PtrPush( pNew->vCis, pNet->pCopy ); Ntl_ManForEachCoNet( pOld, pNet, i ) @@ -195,12 +198,12 @@ Ntl_Man_t * Ntl_ManDupCollapseLuts( Ntl_Man_t * pOld ) pNew = Ntl_ManAlloc(); pNew->pName = Ntl_ManStoreFileName( pNew, pOld->pName ); pNew->pSpec = Ntl_ManStoreName( pNew, pOld->pName ); - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) pModel->pCopy = Ntl_ModelDupCollapseLuts( pNew, pModel ); - Vec_PtrForEachEntry( pOld->vModels, pModel, i ) + Vec_PtrForEachEntry( Ntl_Mod_t *, pOld->vModels, pModel, i ) Ntl_ModelForEachBox( pModel, pBox, k ) if ( pBox->pCopy ) - ((Ntl_Obj_t *)pBox->pCopy)->pImplem = pBox->pImplem->pCopy; + ((Ntl_Obj_t *)pBox->pCopy)->pImplem = (Ntl_Mod_t *)pBox->pImplem->pCopy; // Ntl_ManForEachCiNet( pOld, pNet, i ) // Vec_PtrPush( pNew->vCis, pNet->pCopy ); // Ntl_ManForEachCoNet( pOld, pNet, i ) @@ -301,10 +304,16 @@ void Nwk_ManPrintStatsShort( Ntl_Man_t * p, Aig_Man_t * pAig, Nwk_Man_t * pNtk ) Ntl_ModelForEachBox( pRoot, pObj, i ) if ( strcmp(pObj->pImplem->pName, "dff") == 0 ) Counter++; + if ( Counter == 0 ) + { + Ntl_ModelForEachBox( pRoot, pObj, i ) + Counter += (pObj->pImplem->attrWhite && !pObj->pImplem->attrComb); + } printf( "%-15s : ", p->pName ); printf( "pi =%5d ", Ntl_ModelPiNum(pRoot) ); printf( "po =%5d ", Ntl_ModelPoNum(pRoot) ); printf( "ff =%5d ", Counter ); + printf( "box =%6d ", Ntl_ModelBoxNum(pRoot) ); if ( pAig != NULL ) { Counter = Aig_ManChoiceNum( pAig ); @@ -314,7 +323,7 @@ void Nwk_ManPrintStatsShort( Ntl_Man_t * p, Aig_Man_t * pAig, Nwk_Man_t * pNtk ) printf( "aig =%7d ", Aig_ManNodeNum(pAig) ); } if ( pNtk == NULL ) - printf( "Mapping is not available.\n" ); + printf( "No mapping.\n" ); else { printf( "lut =%5d ", Nwk_ManNodeNum(pNtk) ); @@ -509,7 +518,7 @@ void Ntl_ManPrintTypes( Ntl_Man_t * p ) printf( "CLOCK STATISTICS:\n" ); Vec_VecForEachLevel( pModel->vClockFlops, vFlops, i ) { - pNet = Vec_PtrEntry( pModel->vClocks, i ); + pNet = (Ntl_Net_t *)Vec_PtrEntry( pModel->vClocks, i ); printf( "Clock %2d : Name = %30s Flops = %6d.\n", i+1, pNet->pName, Vec_PtrSize(vFlops) ); } } @@ -562,7 +571,7 @@ void Ntl_ManPrintClocks( Ntl_Man_t * p ) printf( "CLOCK STATISTICS:\n" ); Vec_VecForEachLevel( pModel->vClockFlops, vFlops, i ) { - pNet = Vec_PtrEntry( pModel->vClocks, i ); + pNet = (Ntl_Net_t *)Vec_PtrEntry( pModel->vClocks, i ); printf( "Clock %2d : Name = %30s Flops = %6d.\n", i+1, pNet->pName, Vec_PtrSize(vFlops) ); if ( i == 10 ) { @@ -599,7 +608,7 @@ void Ntl_ManPrintResets( Ntl_Man_t * p ) printf( "RESET STATISTICS:\n" ); Vec_VecForEachLevel( pModel->vResetFlops, vFlops, i ) { - pNet = Vec_PtrEntry( pModel->vResets, i ); + pNet = (Ntl_Net_t *)Vec_PtrEntry( pModel->vResets, i ); printf( "Reset %2d : Name = %30s Flops = %6d.\n", i+1, pNet->pName, Vec_PtrSize(vFlops) ); if ( i == 10 ) { @@ -690,7 +699,7 @@ Ntl_Mod_t * Ntl_ModelStartFrom( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld ) else if ( pNet->fMark ) { pNet->pCopy = Ntl_ModelFindOrCreateNet( pModelNew, pNet->pName ); - ((Ntl_Net_t *)pNet->pCopy)->pDriver = pNet->pDriver->pCopy; + ((Ntl_Net_t *)pNet->pCopy)->pDriver = (Ntl_Obj_t *)pNet->pDriver->pCopy; } else pNet->pCopy = NULL; @@ -703,14 +712,14 @@ Ntl_Mod_t * Ntl_ModelStartFrom( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld ) continue; Ntl_ObjForEachFanin( pObj, pNet, k ) if ( pNet->pCopy != NULL ) - Ntl_ObjSetFanin( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanin( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); Ntl_ObjForEachFanout( pObj, pNet, k ) if ( pNet->pCopy != NULL ) - Ntl_ObjSetFanout( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanout( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); if ( Ntl_ObjIsLatch(pObj) ) { ((Ntl_Obj_t *)pObj->pCopy)->LatchId = pObj->LatchId; - ((Ntl_Obj_t *)pObj->pCopy)->pClock = pObj->pClock->pCopy; + ((Ntl_Obj_t *)pObj->pCopy)->pClock = (Ntl_Net_t *)pObj->pClock->pCopy; } } pModelNew->vDelays = pModelOld->vDelays? Vec_IntDup( pModelOld->vDelays ) : NULL; @@ -753,19 +762,19 @@ Ntl_Mod_t * Ntl_ModelDup( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld ) assert( !pModelOld->attrWhite ); continue; } - ((Ntl_Net_t *)pNet->pCopy)->pDriver = pNet->pDriver->pCopy; + ((Ntl_Net_t *)pNet->pCopy)->pDriver = (Ntl_Obj_t *)pNet->pDriver->pCopy; assert( pNet->pDriver->pCopy != NULL ); } Ntl_ModelForEachObj( pModelOld, pObj, i ) { Ntl_ObjForEachFanin( pObj, pNet, k ) - Ntl_ObjSetFanin( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanin( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); Ntl_ObjForEachFanout( pObj, pNet, k ) - Ntl_ObjSetFanout( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanout( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); if ( Ntl_ObjIsLatch(pObj) ) { ((Ntl_Obj_t *)pObj->pCopy)->LatchId = pObj->LatchId; - ((Ntl_Obj_t *)pObj->pCopy)->pClock = pObj->pClock? pObj->pClock->pCopy : NULL; + ((Ntl_Obj_t *)pObj->pCopy)->pClock = pObj->pClock? (Ntl_Net_t *)pObj->pClock->pCopy : NULL; } if ( Ntl_ObjIsNode(pObj) ) ((Ntl_Obj_t *)pObj->pCopy)->pSop = Ntl_ManStoreSop( pManNew->pMemSops, pObj->pSop ); @@ -821,7 +830,7 @@ Ntl_Mod_t * Ntl_ModelDupCollapseLuts( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld } if ( Ntl_ObjIsLutBox(pNet->pDriver) ) continue; - ((Ntl_Net_t *)pNet->pCopy)->pDriver = pNet->pDriver->pCopy; + ((Ntl_Net_t *)pNet->pCopy)->pDriver = (Ntl_Obj_t *)pNet->pDriver->pCopy; assert( pNet->pDriver->pCopy != NULL ); } Ntl_ModelForEachObj( pModelOld, pObj, i ) @@ -848,33 +857,33 @@ Ntl_Mod_t * Ntl_ModelDupCollapseLuts( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld continue; sprintf( pNameBuf, "box%d_%s", i, pNet->pName ); pNet->pCopy = Ntl_ModelFindOrCreateNet( pModelNew, pNameBuf ); // change name!!! - ((Ntl_Net_t *)pNet->pCopy)->pDriver = pNet->pDriver->pCopy; + ((Ntl_Net_t *)pNet->pCopy)->pDriver = (Ntl_Obj_t *)pNet->pDriver->pCopy; } // connect nodes Ntl_ModelForEachNode( pModelBox, pObjBox, k ) { Ntl_ObjForEachFanin( pObjBox, pNet, m ) - Ntl_ObjSetFanin( pObjBox->pCopy, pNet->pCopy, m ); + Ntl_ObjSetFanin( (Ntl_Obj_t *)pObjBox->pCopy, (Ntl_Net_t *)pNet->pCopy, m ); Ntl_ObjForEachFanout( pObjBox, pNet, m ) - Ntl_ObjSetFanout( pObjBox->pCopy, pNet->pCopy, m ); + Ntl_ObjSetFanout( (Ntl_Obj_t *)pObjBox->pCopy, (Ntl_Net_t *)pNet->pCopy, m ); ((Ntl_Obj_t *)pObjBox->pCopy)->pSop = Ntl_ManStoreSop( pManNew->pMemSops, pObjBox->pSop ); } // connect the PO nets Ntl_ModelForEachPo( pModelBox, pObjBox, k ) - ((Ntl_Net_t *)Ntl_ObjFanin0(pObjBox)->pCopy)->pDriver = Ntl_ObjFanin0(pObjBox)->pDriver->pCopy; + ((Ntl_Net_t *)Ntl_ObjFanin0(pObjBox)->pCopy)->pDriver = (Ntl_Obj_t *)Ntl_ObjFanin0(pObjBox)->pDriver->pCopy; assert( pObj->pCopy == NULL ); Counter++; } else { Ntl_ObjForEachFanin( pObj, pNet, k ) - Ntl_ObjSetFanin( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanin( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); Ntl_ObjForEachFanout( pObj, pNet, k ) - Ntl_ObjSetFanout( pObj->pCopy, pNet->pCopy, k ); + Ntl_ObjSetFanout( (Ntl_Obj_t *)pObj->pCopy, (Ntl_Net_t *)pNet->pCopy, k ); if ( Ntl_ObjIsLatch(pObj) ) { ((Ntl_Obj_t *)pObj->pCopy)->LatchId = pObj->LatchId; - ((Ntl_Obj_t *)pObj->pCopy)->pClock = pObj->pClock? pObj->pClock->pCopy : NULL; + ((Ntl_Obj_t *)pObj->pCopy)->pClock = pObj->pClock? (Ntl_Net_t *)pObj->pClock->pCopy : NULL; } if ( Ntl_ObjIsNode(pObj) ) ((Ntl_Obj_t *)pObj->pCopy)->pSop = Ntl_ManStoreSop( pManNew->pMemSops, pObj->pSop ); @@ -1055,3 +1064,5 @@ int Ntl_ModelCountInv( Ntl_Mod_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlMap.c b/src/aig/ntl/ntlMap.c index 10e7dd17..0ce8549d 100644 --- a/src/aig/ntl/ntlMap.c +++ b/src/aig/ntl/ntlMap.c @@ -22,6 +22,9 @@ #include "kit.h" #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -80,14 +83,14 @@ Vec_Ptr_t * Ntl_MappingFromAig( Aig_Man_t * p ) vMapping = Ntl_MappingAlloc( Aig_ManAndNum(p) + (int)(Aig_ManConst1(p)->nRefs > 0), 2 ); if ( Aig_ManConst1(p)->nRefs > 0 ) { - pLut = Vec_PtrEntry( vMapping, k++ ); + pLut = (Ntl_Lut_t *)Vec_PtrEntry( vMapping, k++ ); pLut->Id = 0; pLut->nFanins = 0; memset( pLut->pTruth, 0xFF, nBytes ); } Aig_ManForEachNode( p, pObj, i ) { - pLut = Vec_PtrEntry( vMapping, k++ ); + pLut = (Ntl_Lut_t *)Vec_PtrEntry( vMapping, k++ ); pLut->Id = pObj->Id; pLut->nFanins = 2; pLut->pFanins[0] = Aig_ObjFaninId0(pObj); @@ -200,7 +203,7 @@ If_Man_t * Ntl_ManToIf( Aig_Man_t * p, If_Par_t * pPars ) pIfMan->nLevelMax = (int)pNode->Level; } else if ( Aig_ObjIsPo(pNode) ) - pNode->pData = If_ManCreateCo( pIfMan, If_NotCond( Aig_ObjFanin0(pNode)->pData, Aig_ObjFaninC0(pNode) ) ); + pNode->pData = If_ManCreateCo( pIfMan, If_NotCond( (If_Obj_t *)Aig_ObjFanin0(pNode)->pData, Aig_ObjFaninC0(pNode) ) ); else if ( Aig_ObjIsConst1(pNode) ) Aig_ManConst1(p)->pData = If_ManConst1( pIfMan ); else // add the node to the mapper @@ -214,7 +217,7 @@ If_Man_t * Ntl_ManToIf( Aig_Man_t * p, If_Par_t * pPars ) // If_ManCreateChoice( pIfMan, (If_Obj_t *)pNode->pData ); // } { - If_Obj_t * pIfObj = pNode->pData; + If_Obj_t * pIfObj = (If_Obj_t *)pNode->pData; assert( !If_IsComplement(pIfObj) ); assert( pIfObj->Id == pNode->Id ); } @@ -255,7 +258,7 @@ Vec_Ptr_t * Ntl_ManFromIf( Aig_Man_t * p, If_Man_t * pMan ) continue; if ( Aig_ObjIsPi(pObj) && pObj->pData == NULL ) continue; - pNode = pObj->pData; + pNode = (If_Obj_t *)pObj->pData; assert( pNode != NULL ); Vec_IntWriteEntry( vIfToAig, pNode->Id, pObj->Id ); } @@ -267,19 +270,19 @@ Vec_Ptr_t * Ntl_ManFromIf( Aig_Man_t * p, If_Man_t * pMan ) nLuts = 0; if ( Aig_ManConst1(p)->nRefs > 0 ) { - pLut = Vec_PtrEntry( vMapping, nLuts++ ); + pLut = (Ntl_Lut_t *)Vec_PtrEntry( vMapping, nLuts++ ); pLut->Id = 0; pLut->nFanins = 0; memset( pLut->pTruth, 0xFF, 4 * nWords ); } - Vec_PtrForEachEntry( vIfMap, pNode, i ) + Vec_PtrForEachEntry( If_Obj_t *, vIfMap, pNode, i ) { // get the best cut pCutBest = If_ObjCutBest(pNode); nLeaves = If_CutLeaveNum( pCutBest ); ppLeaves = If_CutLeaves( pCutBest ); // fill the LUT - pLut = Vec_PtrEntry( vMapping, nLuts++ ); + pLut = (Ntl_Lut_t *)Vec_PtrEntry( vMapping, nLuts++ ); pLut->Id = Vec_IntEntry( vIfToAig, pNode->Id ); pLut->nFanins = nLeaves; If_CutForEachLeaf( pMan, pCutBest, pLeaf, k ) @@ -339,3 +342,5 @@ Vec_Ptr_t * Ntl_MappingIf( Ntl_Man_t * pMan, Aig_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlNames.c b/src/aig/ntl/ntlNames.c new file mode 100644 index 00000000..fa91711d --- /dev/null +++ b/src/aig/ntl/ntlNames.c @@ -0,0 +1,471 @@ +/**CFile**************************************************************** + + FileName [ntlNames.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Netlist representation.] + + Synopsis [Data-structure for storing hiNamrchical object names.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: ntlNames.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include "ntl.h" + +ABC_NAMESPACE_IMPL_START + + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +// name object +typedef struct Ntl_ObjNam_t_ Ntl_ObjNam_t; +struct Ntl_ObjNam_t_ +{ + int iPrev; // prefix of this name + int iNext; // the next name in the hash table + char pName[0]; // name characters +}; + +// name manager +typedef struct Ntl_ManNam_t_ Ntl_ManNam_t; +struct Ntl_ManNam_t_ +{ + // info storage for names + char * pStore; // storage for name objects + int nStore; // the size of allocated storage + int iHandle; // the current free handle + int nHandles; // the number of handles + int nRefs; // reference counter for the manager + // hash table for names + int nBins; + unsigned * pBins; + // temporaries + Vec_Str_t * vName; // storage for returned name +}; + +static inline Ntl_ObjNam_t * Ntl_ManNamObj( Ntl_ManNam_t * p, int h ) { assert( !(h & 3) ); return (Ntl_ObjNam_t *)(p->pStore + h); } +static inline int Ntl_ManNamObjHandle( Ntl_ManNam_t * p, Ntl_ObjNam_t * pObj ) { return ((char *)pObj) - p->pStore; } + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Creates manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Ntl_ManNam_t * Ntl_ManNamStart() +{ + Ntl_ManNam_t * p; + p = ABC_CALLOC( Ntl_ManNam_t, 1 ); + p->nStore = (1 << 20); + p->pStore = ABC_ALLOC( char, p->nStore ); + p->iHandle = 4; + p->nBins = Aig_PrimeCudd( 500000 ); + p->pBins = ABC_CALLOC( unsigned, p->nBins ); + p->vName = Vec_StrAlloc( 1000 ); + return p; +} + +/**Function************************************************************* + + Synopsis [Deletes manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Ntl_ManNamStop( Ntl_ManNam_t * p ) +{ + Vec_StrFree( p->vName ); + ABC_FREE( p->pStore ); + ABC_FREE( p->pBins ); + ABC_FREE( p ); +} + +/**Function************************************************************* + + Synopsis [Deletes manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_ManNamReportMemUsage( Ntl_ManNam_t * p ) +{ + return sizeof(Ntl_ManNam_t) + p->nStore + sizeof(int) * p->nBins + sizeof(int) * Vec_StrSize(p->vName); +} + +/**Function************************************************************* + + Synopsis [References the manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Ntl_ManNamRef( Ntl_ManNam_t * p ) +{ + p->nRefs++; +} + +/**Function************************************************************* + + Synopsis [Dereferences the manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Ntl_ManNamDeref( Ntl_ManNam_t * p ) +{ + if ( --p->nRefs == 0 ) + Ntl_ManNamStop( p ); +} + +/**Function************************************************************* + + Synopsis [Returns object with the given handle.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ + + +/**Function************************************************************* + + Synopsis [Computes hash value of the node using its simulation info.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_ManNamStrHash( char * pStr, int Length, int nTableSize ) +{ + static int s_FPrimes[128] = { + 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459, + 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997, + 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543, + 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089, + 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671, + 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243, + 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871, + 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471, + 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073, + 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689, + 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309, + 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933, + 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147 + }; + unsigned uHash; + int i; + uHash = 0; + for ( i = 0; i < Length; i++ ) + if ( i & 1 ) + uHash *= pStr[i] * s_FPrimes[i & 0x7F]; + else + uHash ^= pStr[i] * s_FPrimes[i & 0x7F]; + return uHash % nTableSize; +} + + +/**Function************************************************************* + + Synopsis [Compares two strings to be equal.] + + Description [Returns 1 if the strings match.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_ManNamStrCompare_rec( Ntl_ManNam_t * p, char * pStr, int Length, Ntl_ObjNam_t * pThis ) +{ + Ntl_ObjNam_t * pNext = (pThis->iPrev)? Ntl_ManNamObj(p, pThis->iPrev) : NULL; + int LengthNew = strlen(pThis->pName); + if ( !strncmp( pThis->pName, pStr + Length - LengthNew, LengthNew ) ) + return 0; + if ( pNext == NULL ) + return 1; + return Ntl_ManNamStrCompare_rec( p, pStr, Length - LengthNew, pNext ); +} + + +/**Function************************************************************* + + Synopsis [Returns the place of this state in the table or NULL if it exists.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline unsigned * Ntl_ManNamStrHashFind( Ntl_ManNam_t * p, char * pStr, int Length, int * pHandle ) +{ + Ntl_ObjNam_t * pThis; + unsigned * pPlace = p->pBins + Ntl_ManNamStrHash( pStr, Length, p->nBins ); + for ( pThis = (*pPlace)? Ntl_ManNamObj(p, *pPlace) : NULL; pThis; + pPlace = (unsigned *)&pThis->iNext, pThis = (*pPlace)? Ntl_ManNamObj(p, *pPlace) : NULL ) + if ( !Ntl_ManNamStrCompare_rec( p, pStr, Length, pThis ) ) + { + *pHandle = Ntl_ManNamObjHandle( p, pThis ); + return NULL; + } + *pHandle = -1; + return pPlace; +} + +/**Function************************************************************* + + Synopsis [Resizes the hash table.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Ntl_ManNamStrHashResize( Ntl_ManNam_t * p ) +{ + Ntl_ObjNam_t * pThis; + unsigned * pBinsOld, * piPlace; + int nBinsOld, iNext, iHandle, Counter, i; + assert( p->pBins != NULL ); + // replace the table + pBinsOld = p->pBins; + nBinsOld = p->nBins; + p->nBins = Aig_PrimeCudd( 3 * p->nBins ); + p->pBins = ABC_CALLOC( unsigned, p->nBins ); + // rehash the entries from the old table + Counter = 0; + for ( i = 0; i < nBinsOld; i++ ) + for ( pThis = (pBinsOld[i]? Ntl_ManNamObj(p, pBinsOld[i]) : NULL), + iNext = (pThis? pThis->iNext : 0); + pThis; pThis = (iNext? Ntl_ManNamObj(p, iNext) : NULL), + iNext = (pThis? pThis->iNext : 0) ) + { + pThis->iNext = 0; + piPlace = Ntl_ManNamStrHashFind( p, pThis->pName, strlen(pThis->pName), &iHandle ); + assert( *piPlace == 0 ); // should not be there + *piPlace = Ntl_ManNamObjHandle( p, pThis ); + Counter++; + } + assert( Counter == p->nHandles ); + ABC_FREE( pBinsOld ); +} + +/**Function************************************************************* + + Synopsis [Returns the handle of a new object to represent the name.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_ManNamStrGrow_rec( Ntl_ManNam_t * p, char * pStr, int Length, unsigned * piPlace ) +{ + Ntl_ObjNam_t * pThis; + char * pStrNew; + int Separ, LengthNew; + int iHandle; + assert( Length > 0 ); + // find the separator symbol + for ( Separ = Length - 2; Separ >= 0 && pStr[Separ] != '/'; Separ-- ); + pStrNew = (Separ == -1) ? pStr : pStr + Separ + 1; + LengthNew = Length - (pStrNew - pStr); + // realloc memory if needed + if ( p->iHandle + (int)sizeof(Ntl_ObjNam_t) + LengthNew+5 > p->nStore ) + { + int OffSet; + if ( (char *)piPlace > p->pStore && (char *)piPlace < p->pStore + p->nStore ) + OffSet = (char *)piPlace - p->pStore; + else + OffSet = -1; + p->nStore *= 2; + p->pStore = ABC_REALLOC( char, p->pStore, p->nStore ); + if ( OffSet >= 0 ) + piPlace = (unsigned *)(p->pStore + OffSet); + } + // new entry is created + p->nHandles++; + *piPlace = p->iHandle; + pThis = Ntl_ManNamObj( p, p->iHandle ); + p->iHandle += sizeof(Ntl_ObjNam_t) + 4 * Aig_BitWordNum( 8*(LengthNew+1) ); + pThis->iNext = 0; + pThis->iPrev = 0; + strncpy( pThis->pName, pStrNew, LengthNew ); + pThis->pName[LengthNew] = 0; + // expand hash table if needed +// if ( p->nHandles > 2 * p->nBins ) +// Ntl_ManNamStrHashResize( p ); + // create previous object if needed + if ( Separ >= 0 ) + { + assert( pStr[Separ] == '/' ); + Separ++; + piPlace = Ntl_ManNamStrHashFind( p, pStr, Separ, &iHandle ); + if ( piPlace != NULL ) + iHandle = Ntl_ManNamStrGrow_rec( p, pStr, Separ, piPlace ); + pThis->iPrev = iHandle; + } + return Ntl_ManNamObjHandle( p, pThis ); +} + +/**Function************************************************************* + + Synopsis [Finds or adds the given name to storage.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_ManNamStrFind( Ntl_ManNam_t * p, char * pStr ) +{ + int iHandle; + Ntl_ManNamStrHashFind( p, pStr, strlen(pStr), &iHandle ); + return iHandle; +} + +/**Function************************************************************* + + Synopsis [Finds or adds the given name to storage.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +unsigned Ntl_ManNamStrFindOrAdd( Ntl_ManNam_t * p, char * pStr ) +{ + unsigned * piPlace; + int iHandle, Length = strlen(pStr); + assert( Length > 0 ); + piPlace = Ntl_ManNamStrHashFind( p, pStr, Length, &iHandle ); + if ( piPlace == NULL ) + return iHandle; + assert( *piPlace == 0 ); + return Ntl_ManNamStrGrow_rec( p, pStr, Length, piPlace ); +} + +/**Function************************************************************* + + Synopsis [Returns name from handle.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +char * Ntl_ManNamStr( Ntl_ManNam_t * p, int h ) +{ + Ntl_ObjNam_t * pObj; + int k; + assert( h && h < p->iHandle ); + Vec_StrClear( p->vName ); + for ( pObj = Ntl_ManNamObj( p, h ); pObj; pObj = pObj->iPrev ? Ntl_ManNamObj(p, pObj->iPrev) : NULL ) + for ( k = strlen(pObj->pName) - 1; k >= 0; k-- ) + Vec_StrPush( p->vName, pObj->pName[k] ); + Vec_StrReverseOrder( p->vName ); + Vec_StrPush( p->vName, 0 ); + return Vec_StrArray( p->vName ); +} + +/**Function************************************************************* + + Synopsis [Testing procedure for the manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Ntl_ManNamTest( Ntl_Man_t * pNtl ) +{ + Ntl_ManNam_t * p; + Ntl_Mod_t * pRoot; + Ntl_Net_t * pNet; + int Memory; + int i, iHandle; + int clk = clock(); + + p = Ntl_ManNamStart(); +printf( "a" ); + Memory = 0; + pRoot = Ntl_ManRootModel( pNtl ); + Ntl_ModelForEachNet( pRoot, pNet, i ) + { + Memory += strlen(pNet->pName) + 1; + iHandle = Ntl_ManNamStrFindOrAdd( p, pNet->pName ); + +// printf( "Before = %s\n", pNet->pName ); +// printf( "After = %s\n", Ntl_ManNamStr(p, iHandle) ); + } + printf( "Net =%7d. Handle =%8d. ", Vec_PtrSize(pRoot->vNets), p->nHandles ); + printf( "Mem old = %7.2f Mb. Mem new = %7.2f Mb.\n", + 1.0 * Memory / (1 << 20), 1.0 * Ntl_ManNamReportMemUsage(p) / (1 << 20) ); + ABC_PRT( "Time", clock() - clk ); +printf( "b" ); + + Ntl_ManNamStop( p ); +} + + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlObj.c b/src/aig/ntl/ntlObj.c index 1915d650..209974aa 100644 --- a/src/aig/ntl/ntlObj.c +++ b/src/aig/ntl/ntlObj.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -160,7 +163,7 @@ Ntl_Obj_t * Ntl_ModelCreateBox( Ntl_Mod_t * pModel, int nFanins, int nFanouts ) p->Type = NTL_OBJ_BOX; p->nFanins = nFanins; p->nFanouts = nFanouts; -// p->Reset = -1; + p->Reset = -1; pModel->nObjs[NTL_OBJ_BOX]++; return p; } @@ -246,7 +249,7 @@ char * Ntl_ManStoreName( Ntl_Man_t * p, char * pName ) SeeAlso [] ***********************************************************************/ -char * Ntl_ManStoreSop( Aig_MmFlex_t * pMan, char * pSop ) +char * Ntl_ManStoreSop( Aig_MmFlex_t * pMan, const char * pSop ) { char * pStore; pStore = Aig_MmFlexEntryFetch( pMan, strlen(pSop) + 1 ); @@ -312,3 +315,5 @@ int Ntl_ManObjWhichFanout( Ntl_Obj_t * pNode, Ntl_Net_t * pFanout ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlReadBlif.c b/src/aig/ntl/ntlReadBlif.c index 2e8a8096..103f8540 100644 --- a/src/aig/ntl/ntlReadBlif.c +++ b/src/aig/ntl/ntlReadBlif.c @@ -24,14 +24,17 @@ #include "bzlib.h" #include "zlib.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// -typedef struct Ioa_ReadMod_t_ Ioa_ReadMod_t; // parsing model -typedef struct Ioa_ReadMan_t_ Ioa_ReadMan_t; // parsing manager +typedef struct Ntl_ReadMod_t_ Ntl_ReadMod_t; // parsing model +typedef struct Ntl_ReadMan_t_ Ntl_ReadMan_t; // parsing manager -struct Ioa_ReadMod_t_ +struct Ntl_ReadMod_t_ { // file lines char * pFirst; // .model line @@ -53,10 +56,10 @@ struct Ioa_ReadMod_t_ // the resulting network Ntl_Mod_t * pNtk; // the parent manager - Ioa_ReadMan_t * pMan; + Ntl_ReadMan_t * pMan; }; -struct Ioa_ReadMan_t_ +struct Ntl_ReadMan_t_ { // general info about file char * pFileName; // the name of the file @@ -66,7 +69,7 @@ struct Ioa_ReadMan_t_ Ntl_Man_t * pDesign; // the design under construction // intermediate storage for models Vec_Ptr_t * vModels; // vector of models - Ioa_ReadMod_t * pLatest; // the current model + Ntl_ReadMod_t * pLatest; // the current model // current processing info Vec_Ptr_t * vTokens; // the current tokens Vec_Ptr_t * vTokens2; // the current tokens @@ -79,28 +82,28 @@ struct Ioa_ReadMan_t_ }; // static functions -static Ioa_ReadMan_t * Ioa_ReadAlloc(); -static void Ioa_ReadFree( Ioa_ReadMan_t * p ); -static Ioa_ReadMod_t * Ioa_ReadModAlloc(); -static void Ioa_ReadModFree( Ioa_ReadMod_t * p ); -static char * Ioa_ReadLoadFile( char * pFileName ); -static char * Ioa_ReadLoadFileBz2( char * pFileName ); -static char * Ioa_ReadLoadFileGz( char * pFileName ); -static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ); -static int Ioa_ReadReadInterfaces( Ioa_ReadMan_t * p ); -static Ntl_Man_t * Ioa_ReadParse( Ioa_ReadMan_t * p ); -static int Ioa_ReadParseLineModel( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineAttrib( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineInputs( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineOutputs( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineLatch( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineDelay( Ioa_ReadMod_t * p, char * pLine ); -static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput ); -static int Ioa_ReadParseLineNamesBlif( Ioa_ReadMod_t * p, char * pLine ); - -static int Ioa_ReadCharIsSpace( char s ) { return s == ' ' || s == '\t' || s == '\r' || s == '\n'; } -static int Ioa_ReadCharIsSopSymb( char s ) { return s == '0' || s == '1' || s == '-' || s == '\r' || s == '\n'; } +static Ntl_ReadMan_t * Ntl_ReadAlloc(); +static void Ntl_ReadFree( Ntl_ReadMan_t * p ); +static Ntl_ReadMod_t * Ntl_ReadModAlloc(); +static void Ntl_ReadModFree( Ntl_ReadMod_t * p ); +static char * Ntl_ReadLoadFile( char * pFileName ); +static char * Ntl_ReadLoadFileBz2( char * pFileName ); +static char * Ntl_ReadLoadFileGz( char * pFileName ); +static void Ntl_ReadReadPreparse( Ntl_ReadMan_t * p ); +static int Ntl_ReadReadInterfaces( Ntl_ReadMan_t * p ); +static Ntl_Man_t * Ntl_ReadParse( Ntl_ReadMan_t * p ); +static int Ntl_ReadParseLineModel( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineAttrib( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineInputs( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineOutputs( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineLatch( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineSubckt( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineDelay( Ntl_ReadMod_t * p, char * pLine ); +static int Ntl_ReadParseLineTimes( Ntl_ReadMod_t * p, char * pLine, int fOutput ); +static int Ntl_ReadParseLineNamesBlif( Ntl_ReadMod_t * p, char * pLine ); + +static int Ntl_ReadCharIsSpace( char s ) { return s == ' ' || s == '\t' || s == '\r' || s == '\n'; } +static int Ntl_ReadCharIsSopSymb( char s ) { return s == '0' || s == '1' || s == '-' || s == '\r' || s == '\n'; } //////////////////////////////////////////////////////////////////////// @@ -118,61 +121,64 @@ static int Ioa_ReadCharIsSopSymb( char s ) { return s == '0' || s SeeAlso [] ***********************************************************************/ -Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ) +Ntl_Man_t * Ntl_ManReadBlif( char * pFileName, int fCheck ) { FILE * pFile; - Ioa_ReadMan_t * p; + Ntl_ReadMan_t * p; Ntl_Man_t * pDesign; -// int nNodes; - + if ( !Ntl_FileIsType(pFileName, ".blif", ".blif.gz", ".blif.bz2") ) + { + printf( "Wrong file format\n" ); + return NULL; + } // check that the file is available pFile = fopen( pFileName, "rb" ); if ( pFile == NULL ) { - printf( "Ioa_ReadBlif(): The file is unavailable (absent or open).\n" ); + printf( "Ntl_ManReadBlif(): The file is unavailable (absent or open).\n" ); return 0; } fclose( pFile ); // start the file reader - p = Ioa_ReadAlloc(); + p = Ntl_ReadAlloc(); p->pFileName = pFileName; if ( !strncmp(pFileName+strlen(pFileName)-4,".bz2",4) ) - p->pBuffer = Ioa_ReadLoadFileBz2( pFileName ); + p->pBuffer = Ntl_ReadLoadFileBz2( pFileName ); else if ( !strncmp(pFileName+strlen(pFileName)-3,".gz",3) ) - p->pBuffer = Ioa_ReadLoadFileGz( pFileName ); + p->pBuffer = Ntl_ReadLoadFileGz( pFileName ); else - p->pBuffer = Ioa_ReadLoadFile( pFileName ); + p->pBuffer = Ntl_ReadLoadFile( pFileName ); if ( p->pBuffer == NULL ) { - Ioa_ReadFree( p ); + Ntl_ReadFree( p ); return NULL; } // set the design name - p->pDesign = Ntl_ManAlloc( pFileName ); + p->pDesign = Ntl_ManAlloc(); p->pDesign->pName = Ntl_ManStoreFileName( p->pDesign, pFileName ); p->pDesign->pSpec = Ntl_ManStoreName( p->pDesign, pFileName ); // prepare the file for parsing - Ioa_ReadReadPreparse( p ); + Ntl_ReadReadPreparse( p ); // parse interfaces of each network - if ( !Ioa_ReadReadInterfaces( p ) ) + if ( !Ntl_ReadReadInterfaces( p ) ) { if ( p->sError[0] ) fprintf( stdout, "%s\n", p->sError ); - Ioa_ReadFree( p ); + Ntl_ReadFree( p ); return NULL; } // construct the network - pDesign = Ioa_ReadParse( p ); + pDesign = Ntl_ReadParse( p ); if ( p->sError[0] ) fprintf( stdout, "%s\n", p->sError ); if ( pDesign == NULL ) { - Ioa_ReadFree( p ); + Ntl_ReadFree( p ); return NULL; } p->pDesign = NULL; - Ioa_ReadFree( p ); + Ntl_ReadFree( p ); // pDesign should be linked to all models of the design // make sure that everything is okay with the network structure @@ -180,7 +186,7 @@ Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ) { if ( !Ntl_ManCheck( pDesign ) ) { - printf( "Ioa_ReadBlif: The check has failed for design %s.\n", pDesign->pName ); + printf( "Ntl_ReadBlif: The check has failed for design %s.\n", pDesign->pName ); Ntl_ManFree( pDesign ); return NULL; } @@ -189,7 +195,7 @@ Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ) // transform the design by removing the CO drivers // if ( (nNodes = Ntl_ManReconnectCoDrivers(pDesign)) ) // printf( "The design was transformed by removing %d buf/inv CO drivers.\n", nNodes ); -//Ioa_WriteBlif( pDesign, "_temp_.blif" ); +//Ntl_ManWriteBlif( pDesign, "_temp_.blif" ); /* { Aig_Man_t * p = Ntl_ManCollapseSeq( pDesign ); @@ -210,11 +216,11 @@ Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ) SeeAlso [] ***********************************************************************/ -static Ioa_ReadMan_t * Ioa_ReadAlloc() +static Ntl_ReadMan_t * Ntl_ReadAlloc() { - Ioa_ReadMan_t * p; - p = ABC_ALLOC( Ioa_ReadMan_t, 1 ); - memset( p, 0, sizeof(Ioa_ReadMan_t) ); + Ntl_ReadMan_t * p; + p = ABC_ALLOC( Ntl_ReadMan_t, 1 ); + memset( p, 0, sizeof(Ntl_ReadMan_t) ); p->vLines = Vec_PtrAlloc( 512 ); p->vModels = Vec_PtrAlloc( 512 ); p->vTokens = Vec_PtrAlloc( 512 ); @@ -234,9 +240,9 @@ static Ioa_ReadMan_t * Ioa_ReadAlloc() SeeAlso [] ***********************************************************************/ -static void Ioa_ReadFree( Ioa_ReadMan_t * p ) +static void Ntl_ReadFree( Ntl_ReadMan_t * p ) { - Ioa_ReadMod_t * pMod; + Ntl_ReadMod_t * pMod; int i; if ( p->pDesign ) Ntl_ManFree( p->pDesign ); @@ -246,8 +252,8 @@ static void Ioa_ReadFree( Ioa_ReadMan_t * p ) Vec_PtrFree( p->vLines ); if ( p->vModels ) { - Vec_PtrForEachEntry( p->vModels, pMod, i ) - Ioa_ReadModFree( pMod ); + Vec_PtrForEachEntry( Ntl_ReadMod_t *, p->vModels, pMod, i ) + Ntl_ReadModFree( pMod ); Vec_PtrFree( p->vModels ); } Vec_PtrFree( p->vTokens ); @@ -267,11 +273,11 @@ static void Ioa_ReadFree( Ioa_ReadMan_t * p ) SeeAlso [] ***********************************************************************/ -static Ioa_ReadMod_t * Ioa_ReadModAlloc() +static Ntl_ReadMod_t * Ntl_ReadModAlloc() { - Ioa_ReadMod_t * p; - p = ABC_ALLOC( Ioa_ReadMod_t, 1 ); - memset( p, 0, sizeof(Ioa_ReadMod_t) ); + Ntl_ReadMod_t * p; + p = ABC_ALLOC( Ntl_ReadMod_t, 1 ); + memset( p, 0, sizeof(Ntl_ReadMod_t) ); p->vInputs = Vec_PtrAlloc( 8 ); p->vOutputs = Vec_PtrAlloc( 8 ); p->vLatches = Vec_PtrAlloc( 8 ); @@ -294,7 +300,7 @@ static Ioa_ReadMod_t * Ioa_ReadModAlloc() SeeAlso [] ***********************************************************************/ -static void Ioa_ReadModFree( Ioa_ReadMod_t * p ) +static void Ntl_ReadModFree( Ntl_ReadMod_t * p ) { Vec_PtrFree( p->vInputs ); Vec_PtrFree( p->vOutputs ); @@ -320,7 +326,7 @@ static void Ioa_ReadModFree( Ioa_ReadMod_t * p ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadCountChars( char * pLine, char Char ) +static int Ntl_ReadCountChars( char * pLine, char Char ) { char * pCur; int Counter = 0; @@ -341,7 +347,7 @@ static int Ioa_ReadCountChars( char * pLine, char Char ) SeeAlso [] ***********************************************************************/ -static void Ioa_ReadCollectTokens( Vec_Ptr_t * vTokens, char * pInput, char * pOutput ) +static void Ntl_ReadCollectTokens( Vec_Ptr_t * vTokens, char * pInput, char * pOutput ) { char * pCur; Vec_PtrClear( vTokens ); @@ -365,15 +371,15 @@ static void Ioa_ReadCollectTokens( Vec_Ptr_t * vTokens, char * pInput, char * pO SeeAlso [] ***********************************************************************/ -static void Ioa_ReadSplitIntoTokens( Vec_Ptr_t * vTokens, char * pLine, char Stop ) +static void Ntl_ReadSplitIntoTokens( Vec_Ptr_t * vTokens, char * pLine, char Stop ) { char * pCur; // clear spaces for ( pCur = pLine; *pCur != Stop; pCur++ ) - if ( Ioa_ReadCharIsSpace(*pCur) ) + if ( Ntl_ReadCharIsSpace(*pCur) ) *pCur = 0; // collect tokens - Ioa_ReadCollectTokens( vTokens, pLine, pCur ); + Ntl_ReadCollectTokens( vTokens, pLine, pCur ); } /**Function************************************************************* @@ -387,15 +393,15 @@ static void Ioa_ReadSplitIntoTokens( Vec_Ptr_t * vTokens, char * pLine, char Sto SeeAlso [] ***********************************************************************/ -static void Ioa_ReadSplitIntoTokensAndClear( Vec_Ptr_t * vTokens, char * pLine, char Stop, char Char ) +static void Ntl_ReadSplitIntoTokensAndClear( Vec_Ptr_t * vTokens, char * pLine, char Stop, char Char ) { char * pCur; // clear spaces for ( pCur = pLine; *pCur != Stop; pCur++ ) - if ( Ioa_ReadCharIsSpace(*pCur) || *pCur == Char ) + if ( Ntl_ReadCharIsSpace(*pCur) || *pCur == Char ) *pCur = 0; // collect tokens - Ioa_ReadCollectTokens( vTokens, pLine, pCur ); + Ntl_ReadCollectTokens( vTokens, pLine, pCur ); } /**Function************************************************************* @@ -409,11 +415,11 @@ static void Ioa_ReadSplitIntoTokensAndClear( Vec_Ptr_t * vTokens, char * pLine, SeeAlso [] ***********************************************************************/ -static int Ioa_ReadGetLine( Ioa_ReadMan_t * p, char * pToken ) +static int Ntl_ReadGetLine( Ntl_ReadMan_t * p, char * pToken ) { char * pLine; int i; - Vec_PtrForEachEntry( p->vLines, pLine, i ) + Vec_PtrForEachEntry( char *, p->vLines, pLine, i ) if ( pToken < pLine ) return i; return -1; @@ -430,7 +436,7 @@ static int Ioa_ReadGetLine( Ioa_ReadMan_t * p, char * pToken ) SeeAlso [] ***********************************************************************/ -static char * Ioa_ReadLoadFile( char * pFileName ) +static char * Ntl_ReadLoadFile( char * pFileName ) { FILE * pFile; int nFileSize; @@ -438,14 +444,14 @@ static char * Ioa_ReadLoadFile( char * pFileName ) pFile = fopen( pFileName, "rb" ); if ( pFile == NULL ) { - printf( "Ioa_ReadLoadFile(): The file is unavailable (absent or open).\n" ); + printf( "Ntl_ReadLoadFile(): The file is unavailable (absent or open).\n" ); return NULL; } fseek( pFile, 0, SEEK_END ); nFileSize = ftell( pFile ); if ( nFileSize == 0 ) { - printf( "Ioa_ReadLoadFile(): The file is empty.\n" ); + printf( "Ntl_ReadLoadFile(): The file is empty.\n" ); return NULL; } pContents = ABC_ALLOC( char, nFileSize + 10 ); @@ -475,7 +481,7 @@ typedef struct buflist { struct buflist * next; } buflist; -static char * Ioa_ReadLoadFileBz2( char * pFileName ) +static char * Ntl_ReadLoadFileBz2( char * pFileName ) { FILE * pFile; int nFileSize = 0; @@ -488,12 +494,12 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) pFile = fopen( pFileName, "rb" ); if ( pFile == NULL ) { - printf( "Ioa_ReadLoadFileBz2(): The file is unavailable (absent or open).\n" ); + printf( "Ntl_ReadLoadFileBz2(): The file is unavailable (absent or open).\n" ); return NULL; } b = BZ2_bzReadOpen(&bzError,pFile,0,0,NULL,0); if (bzError != BZ_OK) { - printf( "Ioa_ReadLoadFileBz2(): BZ2_bzReadOpen() failed with error %d.\n",bzError ); + printf( "Ntl_ReadLoadFileBz2(): BZ2_bzReadOpen() failed with error %d.\n",bzError ); return NULL; } do { @@ -525,7 +531,7 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) nFileSize = ftell( pFile ); if ( nFileSize == 0 ) { - printf( "Ioa_ReadLoadFileBz2(): The file is empty.\n" ); + printf( "Ntl_ReadLoadFileBz2(): The file is empty.\n" ); return NULL; } pContents = ABC_ALLOC( char, nFileSize + 10 ); @@ -533,7 +539,7 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) fread( pContents, nFileSize, 1, pFile ); } else { // Some other error. - printf( "Ioa_ReadLoadFileBz2(): Unable to read the compressed BLIF.\n" ); + printf( "Ntl_ReadLoadFileBz2(): Unable to read the compressed BLIF.\n" ); return NULL; } fclose( pFile ); @@ -554,13 +560,13 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) SeeAlso [] ***********************************************************************/ -static char * Ioa_ReadLoadFileGz( char * pFileName ) +static char * Ntl_ReadLoadFileGz( char * pFileName ) { const int READ_BLOCK_SIZE = 100000; FILE * pFile; char * pContents; int amtRead, readBlock, nFileSize = READ_BLOCK_SIZE; - pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen + pFile = (FILE *)gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen pContents = ABC_ALLOC( char, nFileSize ); readBlock = 0; while ((amtRead = gzread(pFile, pContents + readBlock * READ_BLOCK_SIZE, READ_BLOCK_SIZE)) == READ_BLOCK_SIZE) { @@ -593,7 +599,7 @@ static char * Ioa_ReadLoadFileGz( char * pFileName ) SeeAlso [] ***********************************************************************/ -static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) +static void Ntl_ReadReadPreparse( Ntl_ReadMan_t * p ) { char * pCur, * pPrev; int i, fComment = 0; @@ -617,13 +623,13 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) } // unfold the line extensions and sort lines by directive - Vec_PtrForEachEntry( p->vLines, pCur, i ) + Vec_PtrForEachEntry( char *, p->vLines, pCur, i ) { if ( *pCur == 0 ) continue; // find previous non-space character for ( pPrev = pCur - 2; pPrev >= p->pBuffer; pPrev-- ) - if ( !Ioa_ReadCharIsSpace(*pPrev) ) + if ( !Ntl_ReadCharIsSpace(*pPrev) ) break; // if it is the line extender, overwrite it with spaces if ( pPrev >= p->pBuffer && *pPrev == '\\' ) @@ -634,7 +640,7 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) continue; } // skip spaces at the beginning of the line - while ( Ioa_ReadCharIsSpace(*pCur++) ); + while ( Ntl_ReadCharIsSpace(*pCur++) ); // parse directives if ( *(pCur-1) != '.' ) continue; @@ -672,14 +678,14 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) p->pLatest->fBlackBox = 1; else if ( !strncmp(pCur, "model", 5) ) { - p->pLatest = Ioa_ReadModAlloc(); + p->pLatest = Ntl_ReadModAlloc(); p->pLatest->pFirst = pCur; p->pLatest->pMan = p; } else if ( !strncmp(pCur, "attrib", 6) ) { if ( p->pLatest->pAttrib != NULL ) - fprintf( stdout, "Line %d: Skipping second .attrib line for this model.\n", Ioa_ReadGetLine(p, pCur) ); + fprintf( stdout, "Line %d: Skipping second .attrib line for this model.\n", Ntl_ReadGetLine(p, pCur) ); else p->pLatest->pAttrib = pCur; } @@ -691,7 +697,7 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) } else if ( !strncmp(pCur, "exdc", 4) ) { - fprintf( stdout, "Line %d: Skipping EXDC network.\n", Ioa_ReadGetLine(p, pCur) ); + fprintf( stdout, "Line %d: Skipping EXDC network.\n", Ntl_ReadGetLine(p, pCur) ); break; } else if ( !strncmp(pCur, "no_merge", 8) ) @@ -703,7 +709,7 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) pCur--; if ( pCur[strlen(pCur)-1] == '\r' ) pCur[strlen(pCur)-1] = 0; - fprintf( stdout, "Line %d: Skipping line \"%s\".\n", Ioa_ReadGetLine(p, pCur), pCur ); + fprintf( stdout, "Line %d: Skipping line \"%s\".\n", Ntl_ReadGetLine(p, pCur), pCur ); } } } @@ -719,41 +725,41 @@ static void Ioa_ReadReadPreparse( Ioa_ReadMan_t * p ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadReadInterfaces( Ioa_ReadMan_t * p ) +static int Ntl_ReadReadInterfaces( Ntl_ReadMan_t * p ) { - Ioa_ReadMod_t * pMod; + Ntl_ReadMod_t * pMod; char * pLine; int i, k; // iterate through the models - Vec_PtrForEachEntry( p->vModels, pMod, i ) + Vec_PtrForEachEntry( Ntl_ReadMod_t *, p->vModels, pMod, i ) { // parse the model - if ( !Ioa_ReadParseLineModel( pMod, pMod->pFirst ) ) + if ( !Ntl_ReadParseLineModel( pMod, pMod->pFirst ) ) return 0; // parse the model attributes - if ( pMod->pAttrib && !Ioa_ReadParseLineAttrib( pMod, pMod->pAttrib ) ) + if ( pMod->pAttrib && !Ntl_ReadParseLineAttrib( pMod, pMod->pAttrib ) ) return 0; // parse no-merge if ( pMod->fNoMerge ) pMod->pNtk->attrNoMerge = 1; // parse the inputs - Vec_PtrForEachEntry( pMod->vInputs, pLine, k ) - if ( !Ioa_ReadParseLineInputs( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vInputs, pLine, k ) + if ( !Ntl_ReadParseLineInputs( pMod, pLine ) ) return 0; // parse the outputs - Vec_PtrForEachEntry( pMod->vOutputs, pLine, k ) - if ( !Ioa_ReadParseLineOutputs( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vOutputs, pLine, k ) + if ( !Ntl_ReadParseLineOutputs( pMod, pLine ) ) return 0; // parse the delay info Ntl_ModelSetPioNumbers( pMod->pNtk ); - Vec_PtrForEachEntry( pMod->vDelays, pLine, k ) - if ( !Ioa_ReadParseLineDelay( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vDelays, pLine, k ) + if ( !Ntl_ReadParseLineDelay( pMod, pLine ) ) return 0; - Vec_PtrForEachEntry( pMod->vTimeInputs, pLine, k ) - if ( !Ioa_ReadParseLineTimes( pMod, pLine, 0 ) ) + Vec_PtrForEachEntry( char *, pMod->vTimeInputs, pLine, k ) + if ( !Ntl_ReadParseLineTimes( pMod, pLine, 0 ) ) return 0; - Vec_PtrForEachEntry( pMod->vTimeOutputs, pLine, k ) - if ( !Ioa_ReadParseLineTimes( pMod, pLine, 1 ) ) + Vec_PtrForEachEntry( char *, pMod->vTimeOutputs, pLine, k ) + if ( !Ntl_ReadParseLineTimes( pMod, pLine, 1 ) ) return 0; // report timing line stats if ( pMod->fInArr && pMod->fInReq ) @@ -780,26 +786,26 @@ static int Ioa_ReadReadInterfaces( Ioa_ReadMan_t * p ) SeeAlso [] ***********************************************************************/ -static Ntl_Man_t * Ioa_ReadParse( Ioa_ReadMan_t * p ) +static Ntl_Man_t * Ntl_ReadParse( Ntl_ReadMan_t * p ) { Ntl_Man_t * pDesign; - Ioa_ReadMod_t * pMod; + Ntl_ReadMod_t * pMod; char * pLine; int i, k; // iterate through the models - Vec_PtrForEachEntry( p->vModels, pMod, i ) + Vec_PtrForEachEntry( Ntl_ReadMod_t *, p->vModels, pMod, i ) { // parse the latches - Vec_PtrForEachEntry( pMod->vLatches, pLine, k ) - if ( !Ioa_ReadParseLineLatch( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vLatches, pLine, k ) + if ( !Ntl_ReadParseLineLatch( pMod, pLine ) ) return NULL; // parse the nodes - Vec_PtrForEachEntry( pMod->vNames, pLine, k ) - if ( !Ioa_ReadParseLineNamesBlif( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vNames, pLine, k ) + if ( !Ntl_ReadParseLineNamesBlif( pMod, pLine ) ) return NULL; // parse the subcircuits - Vec_PtrForEachEntry( pMod->vSubckts, pLine, k ) - if ( !Ioa_ReadParseLineSubckt( pMod, pLine ) ) + Vec_PtrForEachEntry( char *, pMod->vSubckts, pLine, k ) + if ( !Ntl_ReadParseLineSubckt( pMod, pLine ) ) return NULL; // finalize the network Ntl_ModelFixNonDrivenNets( pMod->pNtk ); @@ -807,7 +813,7 @@ static Ntl_Man_t * Ioa_ReadParse( Ioa_ReadMan_t * p ) if ( i == 0 ) return NULL; // update the design name - pMod = Vec_PtrEntry( p->vModels, 0 ); + pMod = (Ntl_ReadMod_t *)Vec_PtrEntry( p->vModels, 0 ); if ( Ntl_ModelLatchNum(pMod->pNtk) > 0 ) Ntl_ModelTransformLatches( pMod->pNtk ); p->pDesign->pName = Ntl_ManStoreName( p->pDesign, pMod->pNtk->pName ); @@ -828,22 +834,22 @@ static Ntl_Man_t * Ioa_ReadParse( Ioa_ReadMan_t * p ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineModel( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineModel( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; char * pToken; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry( vTokens, 0 ); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry( vTokens, 0 ); assert( !strcmp(pToken, "model") ); if ( Vec_PtrSize(vTokens) != 2 ) { - sprintf( p->pMan->sError, "Line %d: The number of entries (%d) in .model line is different from two.", Ioa_ReadGetLine(p->pMan, pToken), Vec_PtrSize(vTokens) ); + sprintf( p->pMan->sError, "Line %d: The number of entries (%d) in .model line is different from two.", Ntl_ReadGetLine(p->pMan, pToken), Vec_PtrSize(vTokens) ); return 0; } - p->pNtk = Ntl_ModelAlloc( p->pMan->pDesign, Vec_PtrEntry(vTokens, 1) ); + p->pNtk = Ntl_ModelAlloc( p->pMan->pDesign, (char *)Vec_PtrEntry(vTokens, 1) ); if ( p->pNtk == NULL ) { - sprintf( p->pMan->sError, "Line %d: Model %s already exists.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); + sprintf( p->pMan->sError, "Line %d: Model %s already exists.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); return 0; } return 1; @@ -860,17 +866,17 @@ static int Ioa_ReadParseLineModel( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineAttrib( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineAttrib( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; char * pToken; int i; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry( vTokens, 0 ); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry( vTokens, 0 ); assert( !strncmp(pToken, "attrib", 6) ); - Vec_PtrForEachEntryStart( vTokens, pToken, i, 1 ) + Vec_PtrForEachEntryStart( char *, vTokens, pToken, i, 1 ) { - pToken = Vec_PtrEntry( vTokens, i ); + pToken = (char *)Vec_PtrEntry( vTokens, i ); if ( strcmp( pToken, "white" ) == 0 ) p->pNtk->attrWhite = 1; else if ( strcmp( pToken, "black" ) == 0 ) @@ -889,7 +895,7 @@ static int Ioa_ReadParseLineAttrib( Ioa_ReadMod_t * p, char * pLine ) p->pNtk->attrKeep = 0; else { - sprintf( p->pMan->sError, "Line %d: Unknown attribute (%s) in the .attrib line of model %s.", Ioa_ReadGetLine(p->pMan, pToken), pToken, p->pNtk->pName ); + sprintf( p->pMan->sError, "Line %d: Unknown attribute (%s) in the .attrib line of model %s.", Ntl_ReadGetLine(p->pMan, pToken), pToken, p->pNtk->pName ); return 0; } } @@ -907,23 +913,23 @@ static int Ioa_ReadParseLineAttrib( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineInputs( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineInputs( Ntl_ReadMod_t * p, char * pLine ) { Ntl_Net_t * pNet; Ntl_Obj_t * pObj; Vec_Ptr_t * vTokens = p->pMan->vTokens; char * pToken; int i; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry(vTokens, 0); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry(vTokens, 0); assert( !strcmp(pToken, "inputs") ); - Vec_PtrForEachEntryStart( vTokens, pToken, i, 1 ) + Vec_PtrForEachEntryStart( char *, vTokens, pToken, i, 1 ) { pObj = Ntl_ModelCreatePi( p->pNtk ); pNet = Ntl_ModelFindOrCreateNet( p->pNtk, pToken ); if ( !Ntl_ModelSetNetDriver( pObj, pNet ) ) { - sprintf( p->pMan->sError, "Line %d: Net %s already has a driver.", Ioa_ReadGetLine(p->pMan, pToken), pNet->pName ); + sprintf( p->pMan->sError, "Line %d: Net %s already has a driver.", Ntl_ReadGetLine(p->pMan, pToken), pNet->pName ); return 0; } } @@ -941,17 +947,17 @@ static int Ioa_ReadParseLineInputs( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineOutputs( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineOutputs( Ntl_ReadMod_t * p, char * pLine ) { Ntl_Net_t * pNet; Ntl_Obj_t * pObj; Vec_Ptr_t * vTokens = p->pMan->vTokens; char * pToken; int i; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry(vTokens, 0); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry(vTokens, 0); assert( !strcmp(pToken, "outputs") ); - Vec_PtrForEachEntryStart( vTokens, pToken, i, 1 ) + Vec_PtrForEachEntryStart( char *, vTokens, pToken, i, 1 ) { pNet = Ntl_ModelFindOrCreateNet( p->pNtk, pToken ); pObj = Ntl_ModelCreatePo( p->pNtk, pNet ); @@ -971,46 +977,47 @@ static int Ioa_ReadParseLineOutputs( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineLatch( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineLatch( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; Ntl_Net_t * pNetLi, * pNetLo; Ntl_Obj_t * pObj; char * pToken, * pNameLi, * pNameLo; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry(vTokens,0); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry(vTokens,0); assert( !strcmp(pToken, "latch") ); if ( Vec_PtrSize(vTokens) < 3 ) { - sprintf( p->pMan->sError, "Line %d: Latch does not have input name and output name.", Ioa_ReadGetLine(p->pMan, pToken) ); + sprintf( p->pMan->sError, "Line %d: Latch does not have input name and output name.", Ntl_ReadGetLine(p->pMan, pToken) ); return 0; } // create latch - pNameLi = Vec_PtrEntry( vTokens, 1 ); - pNameLo = Vec_PtrEntry( vTokens, 2 ); + pNameLi = (char *)Vec_PtrEntry( vTokens, 1 ); + pNameLo = (char *)Vec_PtrEntry( vTokens, 2 ); pNetLi = Ntl_ModelFindOrCreateNet( p->pNtk, pNameLi ); pNetLo = Ntl_ModelFindOrCreateNet( p->pNtk, pNameLo ); pObj = Ntl_ModelCreateLatch( p->pNtk ); pObj->pFanio[0] = pNetLi; if ( !Ntl_ModelSetNetDriver( pObj, pNetLo ) ) { - sprintf( p->pMan->sError, "Line %d: Net %s already has a driver.", Ioa_ReadGetLine(p->pMan, pToken), pNetLo->pName ); + sprintf( p->pMan->sError, "Line %d: Net %s already has a driver.", Ntl_ReadGetLine(p->pMan, pToken), pNetLo->pName ); return 0; } // get initial value if ( Vec_PtrSize(vTokens) > 3 ) - pObj->LatchId.regInit = atoi( Vec_PtrEntry(vTokens,Vec_PtrSize(vTokens)-1) ); + pObj->LatchId.regInit = atoi( (char *)Vec_PtrEntry(vTokens,Vec_PtrSize(vTokens)-1) ); else pObj->LatchId.regInit = 2; if ( pObj->LatchId.regInit < 0 || pObj->LatchId.regInit > 2 ) { - sprintf( p->pMan->sError, "Line %d: Initial state of the latch is incorrect \"%s\".", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens,3) ); + sprintf( p->pMan->sError, "Line %d: Initial state of the latch is incorrect \"%s\".", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens,3) ); return 0; } // get the register class - if ( Vec_PtrSize(vTokens) == 6 ) +// if ( Vec_PtrSize(vTokens) == 6 ) + if ( Vec_PtrSize(vTokens) == 5 || Vec_PtrSize(vTokens) == 6 ) { - pToken = Vec_PtrEntry(vTokens,3); + pToken = (char *)Vec_PtrEntry(vTokens,3); if ( strcmp( pToken, "fe" ) == 0 ) pObj->LatchId.regType = 1; else if ( strcmp( pToken, "re" ) == 0 ) @@ -1025,19 +1032,20 @@ static int Ioa_ReadParseLineLatch( Ioa_ReadMod_t * p, char * pLine ) pObj->LatchId.regClass = atoi(pToken); else { - sprintf( p->pMan->sError, "Line %d: Type/class of the latch is incorrect \"%s\".", Ioa_ReadGetLine(p->pMan, pToken), pToken ); + sprintf( p->pMan->sError, "Line %d: Type/class of the latch is incorrect \"%s\".", Ntl_ReadGetLine(p->pMan, pToken), pToken ); return 0; } } if ( pObj->LatchId.regClass < 0 || pObj->LatchId.regClass > (1<<24) ) { - sprintf( p->pMan->sError, "Line %d: Class of the latch is incorrect \"%s\".", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens,3) ); + sprintf( p->pMan->sError, "Line %d: Class of the latch is incorrect \"%s\".", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens,3) ); return 0; } // get the clock - if ( Vec_PtrSize(vTokens) == 5 || Vec_PtrSize(vTokens) == 6 ) +// if ( Vec_PtrSize(vTokens) == 5 || Vec_PtrSize(vTokens) == 6 ) + if ( Vec_PtrSize(vTokens) == 6 ) { - pToken = Vec_PtrEntry(vTokens,Vec_PtrSize(vTokens)-2); + pToken = (char *)Vec_PtrEntry(vTokens,Vec_PtrSize(vTokens)-2); pNetLi = Ntl_ModelFindOrCreateNet( p->pNtk, pToken ); pObj->pClock = pNetLi; } @@ -1055,7 +1063,7 @@ static int Ioa_ReadParseLineLatch( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineSubckt( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; Ntl_Mod_t * pModel; @@ -1065,17 +1073,17 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) int nEquals, i, k; // split the line into tokens - nEquals = Ioa_ReadCountChars( pLine, '=' ); - Ioa_ReadSplitIntoTokensAndClear( vTokens, pLine, '\0', '=' ); - pToken = Vec_PtrEntry(vTokens,0); + nEquals = Ntl_ReadCountChars( pLine, '=' ); + Ntl_ReadSplitIntoTokensAndClear( vTokens, pLine, '\0', '=' ); + pToken = (char *)Vec_PtrEntry(vTokens,0); assert( !strcmp(pToken, "subckt") ); // get the model for this box - pName = Vec_PtrEntry(vTokens,1); + pName = (char *)Vec_PtrEntry(vTokens,1); pModel = Ntl_ManFindModel( p->pMan->pDesign, pName ); if ( pModel == NULL ) { - sprintf( p->pMan->sError, "Line %d: Cannot find the model for subcircuit %s.", Ioa_ReadGetLine(p->pMan, pToken), pName ); + sprintf( p->pMan->sError, "Line %d: Cannot find the model for subcircuit %s.", Ntl_ReadGetLine(p->pMan, pToken), pName ); return 0; } /* @@ -1087,9 +1095,9 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) pToken = Vec_PtrEntry( vTokens, Vec_PtrSize(vTokens) - 1 ); for ( ; *pToken; pToken++ ); for ( ; *pToken == 0; pToken++ ); - Ioa_ReadSplitIntoTokensAndClear( vTokens2, pToken, '\0', '=' ); + Ntl_ReadSplitIntoTokensAndClear( vTokens2, pToken, '\0', '=' ); // assert( Vec_PtrSize( vTokens2 ) == 2 ); - Vec_PtrForEachEntry( vTokens2, pToken, i ) + Vec_PtrForEachEntry( char *, vTokens2, pToken, i ) Vec_PtrPush( vTokens, pToken ); nEquals += Vec_PtrSize(vTokens2)/2; Vec_PtrFree( vTokens2 ); @@ -1099,7 +1107,7 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) if ( nEquals != Ntl_ModelPiNum(pModel) + Ntl_ModelPoNum(pModel) ) { sprintf( p->pMan->sError, "Line %d: The number of ports (%d) in .subckt %s differs from the sum of PIs and POs of the model (%d).", - Ioa_ReadGetLine(p->pMan, pToken), nEquals, pName, Ntl_ModelPiNum(pModel) + Ntl_ModelPoNum(pModel) ); + Ntl_ReadGetLine(p->pMan, pToken), nEquals, pName, Ntl_ModelPiNum(pModel) + Ntl_ModelPoNum(pModel) ); return 0; } @@ -1119,7 +1127,7 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) if ( k == nEquals ) { sprintf( p->pMan->sError, "Line %d: Cannot find PI \"%s\" of the model \"%s\" as a formal input of the subcircuit.", - Ioa_ReadGetLine(p->pMan, pToken), pName, pModel->pName ); + Ntl_ReadGetLine(p->pMan, pToken), pName, pModel->pName ); return 0; } // create the BI with the actual name @@ -1136,7 +1144,7 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) if ( k == nEquals ) { sprintf( p->pMan->sError, "Line %d: Cannot find PO \"%s\" of the model \"%s\" as a formal output of the subcircuit.", - Ioa_ReadGetLine(p->pMan, pToken), pName, pModel->pName ); + Ntl_ReadGetLine(p->pMan, pToken), pName, pModel->pName ); return 0; } // create the BI with the actual name @@ -1157,54 +1165,54 @@ static int Ioa_ReadParseLineSubckt( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineDelay( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineDelay( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; int RetValue1, RetValue2, Number1, Number2, Temp; char * pToken, * pTokenNum; float Delay; assert( sizeof(float) == sizeof(int) ); - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry(vTokens,0); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry(vTokens,0); assert( !strcmp(pToken, "delay") ); if ( Vec_PtrSize(vTokens) < 2 && Vec_PtrSize(vTokens) > 4 ) { - sprintf( p->pMan->sError, "Line %d: Delay line does not have a valid number of parameters (1, 2, or 3).", Ioa_ReadGetLine(p->pMan, pToken) ); + sprintf( p->pMan->sError, "Line %d: Delay line does not have a valid number of parameters (1, 2, or 3).", Ntl_ReadGetLine(p->pMan, pToken) ); return 0; } // find the delay number - pTokenNum = Vec_PtrEntryLast(vTokens); + pTokenNum = (char *)Vec_PtrEntryLast(vTokens); Delay = atof( pTokenNum ); if ( Delay == 0.0 && pTokenNum[0] != '0' ) { - sprintf( p->pMan->sError, "Line %d: Delay value (%s) appears to be invalid.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntryLast(vTokens) ); + sprintf( p->pMan->sError, "Line %d: Delay value (%s) appears to be invalid.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntryLast(vTokens) ); return 0; } // find the PI/PO numbers RetValue1 = 0; Number1 = -1; if ( Vec_PtrSize(vTokens) > 2 ) { - RetValue1 = Ntl_ModelFindPioNumber( p->pNtk, 0, 0, Vec_PtrEntry(vTokens, 1), &Number1 ); + RetValue1 = Ntl_ModelFindPioNumber( p->pNtk, 0, 0, (char *)Vec_PtrEntry(vTokens, 1), &Number1 ); if ( RetValue1 == 0 ) { - sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs/POs.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); + sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs/POs.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); return 0; } } RetValue2 = 0; Number2 = -1; if ( Vec_PtrSize(vTokens) > 3 ) { - RetValue2 = Ntl_ModelFindPioNumber( p->pNtk, 0, 0, Vec_PtrEntry(vTokens, 2), &Number2 ); + RetValue2 = Ntl_ModelFindPioNumber( p->pNtk, 0, 0, (char *)Vec_PtrEntry(vTokens, 2), &Number2 ); if ( RetValue2 == 0 ) { - sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs/POs.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 2) ); + sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs/POs.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 2) ); return 0; } } if ( RetValue1 == RetValue2 && RetValue1 ) { sprintf( p->pMan->sError, "Line %d: Both signals \"%s\" and \"%s\" listed appear to be PIs or POs.", - Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1), (char*)Vec_PtrEntry(vTokens, 2) ); + Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1), (char*)Vec_PtrEntry(vTokens, 2) ); return 0; } if ( RetValue2 < RetValue1 ) @@ -1234,26 +1242,26 @@ static int Ioa_ReadParseLineDelay( Ioa_ReadMod_t * p, char * pLine ) SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput ) +static int Ntl_ReadParseLineTimes( Ntl_ReadMod_t * p, char * pLine, int fOutput ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; int RetValue, Number = -1; char * pToken, * pTokenNum; float Delay; assert( sizeof(float) == sizeof(int) ); - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); - pToken = Vec_PtrEntry(vTokens,0); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + pToken = (char *)Vec_PtrEntry(vTokens,0); if ( fOutput ) assert( !strncmp(pToken, "output_", 7) ); else assert( !strncmp(pToken, "input_", 6) ); if ( Vec_PtrSize(vTokens) != 2 && Vec_PtrSize(vTokens) != 3 ) { - sprintf( p->pMan->sError, "Line %d: Delay line does not have a valid number of parameters (2 or 3).", Ioa_ReadGetLine(p->pMan, pToken) ); + sprintf( p->pMan->sError, "Line %d: Delay line does not have a valid number of parameters (2 or 3).", Ntl_ReadGetLine(p->pMan, pToken) ); return 0; } // find the delay number - pTokenNum = Vec_PtrEntryLast(vTokens); + pTokenNum = (char *)Vec_PtrEntryLast(vTokens); if ( !strcmp( pTokenNum, "-inf" ) ) Delay = -TIM_ETERNITY; else if ( !strcmp( pTokenNum, "inf" ) ) @@ -1262,7 +1270,7 @@ static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput Delay = atof( pTokenNum ); if ( Delay == 0.0 && pTokenNum[0] != '0' ) { - sprintf( p->pMan->sError, "Line %d: Delay value (%s) appears to be invalid.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntryLast(vTokens) ); + sprintf( p->pMan->sError, "Line %d: Delay value (%s) appears to be invalid.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntryLast(vTokens) ); return 0; } // find the PI/PO numbers @@ -1270,10 +1278,10 @@ static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput { if ( Vec_PtrSize(vTokens) == 3 ) { - RetValue = Ntl_ModelFindPioNumber( p->pNtk, 0, 1, Vec_PtrEntry(vTokens, 1), &Number ); + RetValue = Ntl_ModelFindPioNumber( p->pNtk, 0, 1, (char *)Vec_PtrEntry(vTokens, 1), &Number ); if ( RetValue == 0 ) { - sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among POs.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); + sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among POs.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); return 0; } } @@ -1287,10 +1295,10 @@ static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput { if ( Vec_PtrSize(vTokens) == 3 ) { - RetValue = Ntl_ModelFindPioNumber( p->pNtk, 1, 0, Vec_PtrEntry(vTokens, 1), &Number ); + RetValue = Ntl_ModelFindPioNumber( p->pNtk, 1, 0, (char *)Vec_PtrEntry(vTokens, 1), &Number ); if ( RetValue == 0 ) { - sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs.", Ioa_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); + sprintf( p->pMan->sError, "Line %d: Cannot find signal \"%s\" among PIs.", Ntl_ReadGetLine(p->pMan, pToken), (char*)Vec_PtrEntry(vTokens, 1) ); return 0; } } @@ -1315,7 +1323,7 @@ static int Ioa_ReadParseLineTimes( Ioa_ReadMod_t * p, char * pLine, int fOutput SeeAlso [] ***********************************************************************/ -static char * Ioa_ReadParseTableBlif( Ioa_ReadMod_t * p, char * pTable, int nFanins ) +static char * Ntl_ReadParseTableBlif( Ntl_ReadMod_t * p, char * pTable, int nFanins ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; Vec_Str_t * vFunc = p->pMan->vFunc; @@ -1325,52 +1333,52 @@ static char * Ioa_ReadParseTableBlif( Ioa_ReadMod_t * p, char * pTable, int nFan p->pMan->nTablesRead++; // get the tokens - Ioa_ReadSplitIntoTokens( vTokens, pTable, '.' ); + Ntl_ReadSplitIntoTokens( vTokens, pTable, '.' ); if ( Vec_PtrSize(vTokens) == 0 ) return Ntl_ManStoreSop( p->pMan->pDesign->pMemSops, " 0\n" ); if ( Vec_PtrSize(vTokens) == 1 ) { - pOutput = Vec_PtrEntry( vTokens, 0 ); + pOutput = (char *)Vec_PtrEntry( vTokens, 0 ); if ( *pOutput == '\"' ) return Ntl_ManStoreSop( p->pMan->pDesign->pMemSops, pOutput ); if ( ((pOutput[0] - '0') & 0x8E) || pOutput[1] ) { - sprintf( p->pMan->sError, "Line %d: Constant table has wrong output value \"%s\".", Ioa_ReadGetLine(p->pMan, pOutput), pOutput ); + sprintf( p->pMan->sError, "Line %d: Constant table has wrong output value \"%s\".", Ntl_ReadGetLine(p->pMan, pOutput), pOutput ); return NULL; } return Ntl_ManStoreSop( p->pMan->pDesign->pMemSops, (pOutput[0] == '0') ? " 0\n" : " 1\n" ); } - pProduct = Vec_PtrEntry( vTokens, 0 ); + pProduct = (char *)Vec_PtrEntry( vTokens, 0 ); if ( Vec_PtrSize(vTokens) % 2 == 1 ) { - sprintf( p->pMan->sError, "Line %d: Table has odd number of tokens (%d).", Ioa_ReadGetLine(p->pMan, pProduct), Vec_PtrSize(vTokens) ); + sprintf( p->pMan->sError, "Line %d: Table has odd number of tokens (%d).", Ntl_ReadGetLine(p->pMan, pProduct), Vec_PtrSize(vTokens) ); return NULL; } // parse the table Vec_StrClear( vFunc ); for ( i = 0; i < Vec_PtrSize(vTokens)/2; i++ ) { - pProduct = Vec_PtrEntry( vTokens, 2*i + 0 ); - pOutput = Vec_PtrEntry( vTokens, 2*i + 1 ); + pProduct = (char *)Vec_PtrEntry( vTokens, 2*i + 0 ); + pOutput = (char *)Vec_PtrEntry( vTokens, 2*i + 1 ); if ( strlen(pProduct) != (unsigned)nFanins ) { - sprintf( p->pMan->sError, "Line %d: Cube \"%s\" has size different from the fanin count (%d).", Ioa_ReadGetLine(p->pMan, pProduct), pProduct, nFanins ); + sprintf( p->pMan->sError, "Line %d: Cube \"%s\" has size different from the fanin count (%d).", Ntl_ReadGetLine(p->pMan, pProduct), pProduct, nFanins ); return NULL; } if ( ((pOutput[0] - '0') & 0x8E) || pOutput[1] ) { - sprintf( p->pMan->sError, "Line %d: Output value \"%s\" is incorrect.", Ioa_ReadGetLine(p->pMan, pProduct), pOutput ); + sprintf( p->pMan->sError, "Line %d: Output value \"%s\" is incorrect.", Ntl_ReadGetLine(p->pMan, pProduct), pOutput ); return NULL; } if ( Polarity == -1 ) Polarity = pOutput[0] - '0'; else if ( Polarity != pOutput[0] - '0' ) { - sprintf( p->pMan->sError, "Line %d: Output value \"%s\" differs from the value in the first line of the table (%d).", Ioa_ReadGetLine(p->pMan, pProduct), pOutput, Polarity ); + sprintf( p->pMan->sError, "Line %d: Output value \"%s\" differs from the value in the first line of the table (%d).", Ntl_ReadGetLine(p->pMan, pProduct), pOutput, Polarity ); return NULL; } // parse one product - Vec_StrAppend( vFunc, pProduct ); + Vec_StrPrintStr( vFunc, pProduct ); Vec_StrPush( vFunc, ' ' ); Vec_StrPush( vFunc, pOutput[0] ); Vec_StrPush( vFunc, '\n' ); @@ -1390,36 +1398,36 @@ static char * Ioa_ReadParseTableBlif( Ioa_ReadMod_t * p, char * pTable, int nFan SeeAlso [] ***********************************************************************/ -static int Ioa_ReadParseLineNamesBlif( Ioa_ReadMod_t * p, char * pLine ) +static int Ntl_ReadParseLineNamesBlif( Ntl_ReadMod_t * p, char * pLine ) { Vec_Ptr_t * vTokens = p->pMan->vTokens; Ntl_Obj_t * pNode; Ntl_Net_t * pNetOut, * pNetIn; char * pNameOut, * pNameIn; int i; - Ioa_ReadSplitIntoTokens( vTokens, pLine, '\0' ); + Ntl_ReadSplitIntoTokens( vTokens, pLine, '\0' ); // parse the mapped node // if ( !strcmp(Vec_PtrEntry(vTokens,0), "gate") ) -// return Ioa_ReadParseLineGateBlif( p, vTokens ); +// return Ntl_ReadParseLineGateBlif( p, vTokens ); // parse the regular name line - assert( !strcmp(Vec_PtrEntry(vTokens,0), "names") ); - pNameOut = Vec_PtrEntryLast( vTokens ); + assert( !strcmp((char *)Vec_PtrEntry(vTokens,0), "names") ); + pNameOut = (char *)Vec_PtrEntryLast( vTokens ); pNetOut = Ntl_ModelFindOrCreateNet( p->pNtk, pNameOut ); // create fanins pNode = Ntl_ModelCreateNode( p->pNtk, Vec_PtrSize(vTokens) - 2 ); for ( i = 0; i < Vec_PtrSize(vTokens) - 2; i++ ) { - pNameIn = Vec_PtrEntry(vTokens, i+1); + pNameIn = (char *)Vec_PtrEntry(vTokens, i+1); pNetIn = Ntl_ModelFindOrCreateNet( p->pNtk, pNameIn ); Ntl_ObjSetFanin( pNode, pNetIn, i ); } if ( !Ntl_ModelSetNetDriver( pNode, pNetOut ) ) { - sprintf( p->pMan->sError, "Line %d: Signal \"%s\" is defined more than once.", Ioa_ReadGetLine(p->pMan, pNameOut), pNameOut ); + sprintf( p->pMan->sError, "Line %d: Signal \"%s\" is defined more than once.", Ntl_ReadGetLine(p->pMan, pNameOut), pNameOut ); return 0; } // parse the table of this node - pNode->pSop = Ioa_ReadParseTableBlif( p, pNameOut + strlen(pNameOut), pNode->nFanins ); + pNode->pSop = Ntl_ReadParseTableBlif( p, pNameOut + strlen(pNameOut), pNode->nFanins ); if ( pNode->pSop == NULL ) return 0; pNode->pSop = Ntl_ManStoreSop( p->pNtk->pMan->pMemSops, pNode->pSop ); @@ -1432,3 +1440,5 @@ static int Ioa_ReadParseLineNamesBlif( Ioa_ReadMod_t * p, char * pLine ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlSweep.c b/src/aig/ntl/ntlSweep.c index b2c700fb..29e40f30 100644 --- a/src/aig/ntl/ntlSweep.c +++ b/src/aig/ntl/ntlSweep.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -207,3 +210,5 @@ int Ntl_ManSweep( Ntl_Man_t * p, int fVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlTable.c b/src/aig/ntl/ntlTable.c index 0b87c8be..23207081 100644 --- a/src/aig/ntl/ntlTable.c +++ b/src/aig/ntl/ntlTable.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -55,7 +58,9 @@ static unsigned Ntl_HashString( const char * pName, int TableSize ) Ntl_Net_t * Ntl_ModelCreateNet( Ntl_Mod_t * p, const char * pName ) { Ntl_Net_t * pNet; - pNet = (Ntl_Net_t *)Aig_MmFlexEntryFetch( p->pMan->pMemObjs, sizeof(Ntl_Net_t) + strlen(pName) + 1 ); + int nSize = sizeof(Ntl_Net_t) + strlen(pName) + 1; + nSize = (nSize / sizeof(char*) + ((nSize % sizeof(char*)) > 0)) * sizeof(char*); // added by Saurabh on Sep 3, 2009 + pNet = (Ntl_Net_t *)Aig_MmFlexEntryFetch( p->pMan->pMemObjs, nSize ); memset( pNet, 0, sizeof(Ntl_Net_t) ); strcpy( pNet->pName, pName ); pNet->NetId = Vec_PtrSize( p->vNets ); @@ -362,7 +367,7 @@ int Ntl_ModelFindPioNumber( Ntl_Mod_t * p, int fPiOnly, int fPoOnly, const char } if ( fPoOnly ) { - pTerm = pNet->pCopy; + pTerm = (Ntl_Obj_t *)pNet->pCopy; if ( pTerm && Ntl_ObjIsPo(pTerm) ) { *pNumber = pTerm->iTemp; @@ -370,7 +375,7 @@ int Ntl_ModelFindPioNumber( Ntl_Mod_t * p, int fPiOnly, int fPoOnly, const char } return 0; } - pTerm = pNet->pCopy; + pTerm = (Ntl_Obj_t *)pNet->pCopy; if ( pTerm && Ntl_ObjIsPo(pTerm) ) { *pNumber = pTerm->iTemp; @@ -545,3 +550,5 @@ Ntl_Mod_t * Ntl_ManFindModel( Ntl_Man_t * p, const char * pName ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlTime.c b/src/aig/ntl/ntlTime.c index f9fadaa8..7a531482 100644 --- a/src/aig/ntl/ntlTime.c +++ b/src/aig/ntl/ntlTime.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -217,7 +220,7 @@ Tim_Man_t * Ntl_ManCreateTiming( Ntl_Man_t * p ) // set up the boxes iBox = 0; curPi = p->iLastCi; - Vec_PtrForEachEntry( p->vVisNodes, pObj, i ) + Vec_PtrForEachEntry( Ntl_Obj_t *, p->vVisNodes, pObj, i ) { if ( !Ntl_ObjIsBox(pObj) ) continue; @@ -238,3 +241,5 @@ Tim_Man_t * Ntl_ManCreateTiming( Ntl_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlUtil.c b/src/aig/ntl/ntlUtil.c index 0bd86247..c3c6fd49 100644 --- a/src/aig/ntl/ntlUtil.c +++ b/src/aig/ntl/ntlUtil.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -30,6 +33,32 @@ /**Function************************************************************* + Synopsis [Returns one if the file has a given extension.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Ntl_FileIsType( char * pFileName, char * pS1, char * pS2, char * pS3 ) +{ + int lenS, lenF = strlen(pFileName); + lenS = pS1 ? strlen(pS1) : 0; + if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS1, lenS ) ) + return 1; + lenS = pS2 ? strlen(pS2) : 0; + if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS2, lenS ) ) + return 1; + lenS = pS3 ? strlen(pS3) : 0; + if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS3, lenS ) ) + return 1; + return 0; +} + +/**Function************************************************************* + Synopsis [Reads the maximum number of fanins.] Description [] @@ -419,7 +448,7 @@ Vec_Vec_t * Ntl_ManTransformRegClasses( Ntl_Man_t * pMan, int nSizeMax, int fVer if ( fVerbose ) { printf( "The number of selected register clases = %d.\n", Vec_PtrSize(vParts) ); - Vec_PtrForEachEntry( vParts, vPart, i ) + Vec_PtrForEachEntry( Vec_Int_t *, vParts, vPart, i ) printf( "(%d, %d) ", i, Vec_IntSize(vPart) ); printf( "\n" ); } @@ -704,3 +733,5 @@ void Ntl_ManRemoveUselessNets( Ntl_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlWriteBlif.c b/src/aig/ntl/ntlWriteBlif.c index e6e4cbdd..f9b2781f 100644 --- a/src/aig/ntl/ntlWriteBlif.c +++ b/src/aig/ntl/ntlWriteBlif.c @@ -27,6 +27,9 @@ #include "bzlib.h" #include "zlib.h" +ABC_NAMESPACE_IMPL_START + + #ifdef _WIN32 #define vsnprintf _vsnprintf #endif @@ -50,7 +53,7 @@ SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlifModel( FILE * pFile, Ntl_Mod_t * pModel, int fMain ) +void Ntl_ManWriteBlifModel( FILE * pFile, Ntl_Mod_t * pModel, int fMain ) { Ntl_Obj_t * pObj; Ntl_Net_t * pNet; @@ -195,7 +198,7 @@ void Ioa_WriteBlifModel( FILE * pFile, Ntl_Mod_t * pModel, int fMain ) SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlif_old( Ntl_Man_t * p, char * pFileName ) +void Ntl_ManWriteBlif_old( Ntl_Man_t * p, char * pFileName ) { FILE * pFile; Ntl_Mod_t * pModel; @@ -204,13 +207,13 @@ void Ioa_WriteBlif_old( Ntl_Man_t * p, char * pFileName ) pFile = fopen( pFileName, "w" ); if ( pFile == NULL ) { - fprintf( stdout, "Ioa_WriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); + fprintf( stdout, "Ntl_ManWriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); return; } - fprintf( pFile, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Ioa_TimeStamp() ); + fprintf( pFile, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Aig_TimeStamp() ); // write the models Ntl_ManForEachModel( p, pModel, i ) - Ioa_WriteBlifModel( pFile, pModel, i==0 ); + Ntl_ManWriteBlifModel( pFile, pModel, i==0 ); // close the file fclose( pFile ); } @@ -226,11 +229,11 @@ void Ioa_WriteBlif_old( Ntl_Man_t * p, char * pFileName ) SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlifLogic( Nwk_Man_t * pNtk, Ntl_Man_t * p, char * pFileName ) +void Ntl_ManWriteBlifLogic( Nwk_Man_t * pNtk, Ntl_Man_t * p, char * pFileName ) { Ntl_Man_t * pNew; pNew = Ntl_ManInsertNtk( p, pNtk ); - Ioa_WriteBlif( pNew, pFileName ); + Ntl_ManWriteBlif( pNew, pFileName ); Ntl_ManFree( pNew ); } @@ -277,7 +280,7 @@ int fprintfBz2(bz2file * b, char * fmt, ...) { } BZ2_bzWrite( &bzError, b->b, b->buf, b->nBytes ); if (bzError == BZ_IO_ERROR) { - fprintf( stdout, "Ioa_WriteBlif(): I/O error writing to compressed stream.\n" ); + fprintf( stdout, "Ntl_ManWriteBlif(): I/O error writing to compressed stream.\n" ); return -1; } return b->nBytes; @@ -302,7 +305,7 @@ int fprintfBz2(bz2file * b, char * fmt, ...) { SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlifModelGz( gzFile pFile, Ntl_Mod_t * pModel, int fMain ) +void Ntl_ManWriteBlifModelGz( gzFile pFile, Ntl_Mod_t * pModel, int fMain ) { Ntl_Obj_t * pObj; Ntl_Net_t * pNet; @@ -447,7 +450,7 @@ void Ioa_WriteBlifModelGz( gzFile pFile, Ntl_Mod_t * pModel, int fMain ) SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlifGz( Ntl_Man_t * p, char * pFileName ) +void Ntl_ManWriteBlifGz( Ntl_Man_t * p, char * pFileName ) { Ntl_Mod_t * pModel; int i; @@ -457,14 +460,14 @@ void Ioa_WriteBlifGz( Ntl_Man_t * p, char * pFileName ) pFile = gzopen( pFileName, "wb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen if ( pFile == NULL ) { - fprintf( stdout, "Ioa_WriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); + fprintf( stdout, "Ntl_ManWriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); return; } - gzprintf( pFile, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Ioa_TimeStamp() ); + gzprintf( pFile, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Aig_TimeStamp() ); // write the models Ntl_ManForEachModel( p, pModel, i ) - Ioa_WriteBlifModelGz( pFile, pModel, i==0 ); + Ntl_ManWriteBlifModelGz( pFile, pModel, i==0 ); // close the file gzclose( pFile ); } @@ -481,7 +484,7 @@ void Ioa_WriteBlifGz( Ntl_Man_t * p, char * pFileName ) SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlifModelBz2( bz2file * b, Ntl_Mod_t * pModel, int fMain ) +void Ntl_ManWriteBlifModelBz2( bz2file * b, Ntl_Mod_t * pModel, int fMain ) { Ntl_Obj_t * pObj; Ntl_Net_t * pNet; @@ -626,12 +629,12 @@ void Ioa_WriteBlifModelBz2( bz2file * b, Ntl_Mod_t * pModel, int fMain ) SeeAlso [] ***********************************************************************/ -void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) +void Ntl_ManWriteBlif( Ntl_Man_t * p, char * pFileName ) { Ntl_Mod_t * pModel; int i, bzError; bz2file b; - if ( p->pNal && strncmp(pFileName+strlen(pFileName)-5,".blif",5) ) + if ( p->pNal && !Ntl_FileIsType(pFileName, ".blif", ".blif.gz", ".blif.bz2") ) { p->pNalW( p, pFileName ); return; @@ -639,7 +642,7 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) // write the GZ file if (!strncmp(pFileName+strlen(pFileName)-3,".gz",3)) { - Ioa_WriteBlifGz( p, pFileName ); + Ntl_ManWriteBlifGz( p, pFileName ); return; } @@ -651,7 +654,7 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) b.f = fopen( pFileName, "wb" ); if ( b.f == NULL ) { - fprintf( stdout, "Ioa_WriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); + fprintf( stdout, "Ntl_ManWriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); ABC_FREE(b.buf); return; } @@ -659,22 +662,22 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) b.b = BZ2_bzWriteOpen( &bzError, b.f, 9, 0, 0 ); if ( bzError != BZ_OK ) { BZ2_bzWriteClose( &bzError, b.b, 0, NULL, NULL ); - fprintf( stdout, "Ioa_WriteBlif(): Cannot start compressed stream.\n" ); + fprintf( stdout, "Ntl_ManWriteBlif(): Cannot start compressed stream.\n" ); fclose( b.f ); ABC_FREE(b.buf); return; } } - fprintfBz2( &b, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Ioa_TimeStamp() ); + fprintfBz2( &b, "# Benchmark \"%s\" written by ABC-8 on %s\n", p->pName, Aig_TimeStamp() ); // write the models Ntl_ManForEachModel( p, pModel, i ) - Ioa_WriteBlifModelBz2( &b, pModel, i==0 ); + Ntl_ManWriteBlifModelBz2( &b, pModel, i==0 ); // close the file if (b.b) { BZ2_bzWriteClose( &bzError, b.b, 0, NULL, NULL ); if (bzError == BZ_IO_ERROR) { - fprintf( stdout, "Ioa_WriteBlif(): I/O error closing compressed stream.\n" ); + fprintf( stdout, "Ntl_ManWriteBlif(): I/O error closing compressed stream.\n" ); fclose( b.f ); ABC_FREE(b.buf); return; @@ -690,3 +693,5 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntl_.c b/src/aig/ntl/ntl_.c index 4b3ad684..9b0b1d0a 100644 --- a/src/aig/ntl/ntl_.c +++ b/src/aig/ntl/ntl_.c @@ -20,6 +20,9 @@ #include "ntl.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -45,3 +48,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ntl/ntlnwk.h b/src/aig/ntl/ntlnwk.h new file mode 100644 index 00000000..0b07f243 --- /dev/null +++ b/src/aig/ntl/ntlnwk.h @@ -0,0 +1,113 @@ +/**CFile**************************************************************** + + FileName [ntlnwk.h] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Netlist and network representation.] + + Synopsis [External declarations.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: ntlnwk.h,v 1.3 2008/10/24 14:18:44 mjarvin Exp $] + +***********************************************************************/ + +#ifndef __NTLNWK_H__ +#define __NTLNWK_H__ + + +//////////////////////////////////////////////////////////////////////// +/// INCLUDES /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// PARAMETERS /// +//////////////////////////////////////////////////////////////////////// + +ABC_NAMESPACE_HEADER_START + + +//////////////////////////////////////////////////////////////////////// +/// BASIC TYPES /// +//////////////////////////////////////////////////////////////////////// + +typedef struct Ntl_Man_t_ Ntl_Man_t; +typedef struct Nwk_Man_t_ Nwk_Man_t; + +//////////////////////////////////////////////////////////////////////// +/// MACRO DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// INLINED FUNCTIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// ITERATORS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +extern ABC_DLL Ntl_Man_t * Ntl_ManReadBlif( char * pFileName, int fCheck ); +extern ABC_DLL void Ntl_ManWriteBlif( Ntl_Man_t * p, char * pFileName ); + +extern ABC_DLL Tim_Man_t * Ntl_ManReadTimeMan( Ntl_Man_t * p ); +extern ABC_DLL Ntl_Man_t * Ntl_ManDup( Ntl_Man_t * p ); +extern ABC_DLL void Ntl_ManFree( Ntl_Man_t * p ); +extern ABC_DLL int Ntl_ManIsComb( Ntl_Man_t * p ); +extern ABC_DLL void Ntl_ManPrintStats( Ntl_Man_t * p ); +extern ABC_DLL int Ntl_ManSweep( Ntl_Man_t * p, int fVerbose ); +extern ABC_DLL Ntl_Man_t * Ntl_ManInsertNtk( Ntl_Man_t * p, Nwk_Man_t * pNtk ); +extern ABC_DLL Ntl_Man_t * Ntl_ManInsertAig( Ntl_Man_t * p, Aig_Man_t * pAig ); +extern ABC_DLL Aig_Man_t * Ntl_ManExtract( Ntl_Man_t * p ); +extern ABC_DLL Aig_Man_t * Ntl_ManCollapse( Ntl_Man_t * p, int fSeq ); +extern ABC_DLL Aig_Man_t * Ntl_ManCollapseSeq( Ntl_Man_t * p, int nMinDomSize, int fVerbose ); +extern ABC_DLL Ntl_Man_t * Ntl_ManDupCollapseLuts( Ntl_Man_t * p ); +extern ABC_DLL Ntl_Man_t * Ntl_ManFraig( Ntl_Man_t * p, int nPartSize, int nConfLimit, int nLevelMax, int fUseCSat, int fVerbose ); +extern ABC_DLL void Ntl_ManPrepareCecMans( Ntl_Man_t * pMan1, Ntl_Man_t * pMan2, Aig_Man_t ** ppAig1, Aig_Man_t ** ppAig2 ); +extern ABC_DLL Vec_Ptr_t * Ntl_ManCollectCiNames( Ntl_Man_t * p ); +extern ABC_DLL Vec_Ptr_t * Ntl_ManCollectCoNames( Ntl_Man_t * p ); +extern ABC_DLL Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVerbose ); +extern ABC_DLL Ntl_Man_t * Ntl_ManLcorr( Ntl_Man_t * p, int nConfMax, int fScorrGia, int fUseCSat, int fVerbose ); +extern ABC_DLL Ntl_Man_t * Ntl_ManSsw( Ntl_Man_t * p, Fra_Ssw_t * pPars ); +extern ABC_DLL Ntl_Man_t * Ntl_ManScorr( Ntl_Man_t * p, Ssw_Pars_t * pPars ); +extern ABC_DLL void Ntl_ManTransformInitValues( Ntl_Man_t * p ); + +extern ABC_DLL void Ntl_ManPrepareCec( char * pFileName1, char * pFileName2, Aig_Man_t ** ppMan1, Aig_Man_t ** ppMan2 ); +extern ABC_DLL Aig_Man_t * Ntl_ManPrepareSec( char * pFileName1, char * pFileName2 ); + +extern ABC_DLL Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig, Tim_Man_t * pManTime ); +extern ABC_DLL Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pManTime ); +extern ABC_DLL void Nwk_ManPrintStats( Nwk_Man_t * p, If_Lib_t * pLutLib, int fSaveBest, int fDumpResult, int fPower, Ntl_Man_t * pNtl ); +extern ABC_DLL void Nwk_ManPrintStatsShort( Ntl_Man_t * p, Aig_Man_t * pAig, Nwk_Man_t * pNtk ); +extern ABC_DLL void Nwk_ManPrintFanioNew( Nwk_Man_t * p ); +extern ABC_DLL Nwk_Man_t * Nwk_MappingIf( Aig_Man_t * p, Tim_Man_t * pManTime, If_Par_t * pPars ); +extern ABC_DLL void Nwk_ManSetIfParsDefault( If_Par_t * pPars ); +extern ABC_DLL void Nwk_ManBidecResyn( Nwk_Man_t * p, int fVerbose ); +extern ABC_DLL Aig_Man_t * Nwk_ManSpeedup( Nwk_Man_t * p, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose ); +extern ABC_DLL Aig_Man_t * Nwk_ManStrash( Nwk_Man_t * p ); +extern ABC_DLL Vec_Int_t * Nwk_ManLutMerge( Nwk_Man_t * p, void * pPars ); +extern ABC_DLL int Nwk_ManCheck( Nwk_Man_t * p ); +extern ABC_DLL void Nwk_ManDumpBlif( Nwk_Man_t * p, char * pFileName, Vec_Ptr_t * vCiNames, Vec_Ptr_t * vCoNames ); +extern ABC_DLL void Nwk_ManFree( Nwk_Man_t * p ); + + + +ABC_NAMESPACE_HEADER_END + + + +#endif + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + |