From 6130e39b18b5f53902e4eab14f6d5cdde5219563 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 1 Nov 2010 01:35:04 -0700 Subject: initial commit of public abc --- src/opt/fret/fretFlow.c | 13 +++++++++---- src/opt/fret/fretInit.c | 21 +++++++++++++-------- src/opt/fret/fretMain.c | 17 +++++++++++------ src/opt/fret/fretTime.c | 39 ++++++++++++++++++++++----------------- src/opt/fret/fretime.h | 30 +++++++++++++++++++----------- 5 files changed, 74 insertions(+), 46 deletions(-) (limited to 'src/opt/fret') diff --git a/src/opt/fret/fretFlow.c b/src/opt/fret/fretFlow.c index 4b2bd936..498cb962 100644 --- a/src/opt/fret/fretFlow.c +++ b/src/opt/fret/fretFlow.c @@ -22,6 +22,9 @@ #include "vec.h" #include "fretime.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -60,7 +63,7 @@ void dfsfast_preorder( Abc_Ntk_t *pNtk ) { // create reverse timing edges for backward traversal #if !defined(IGNORE_TIMING) if (pManMR->maxDelay) { - Abc_NtkForEachObj( pNtk, pObj, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, pNtk, pObj, i ) { Vec_PtrForEachEntry( FTIMEEDGES(pObj), pNext, j ) { vTimeIn = FDATA(pNext)->vNodes; if (!vTimeIn) { @@ -77,7 +80,7 @@ void dfsfast_preorder( Abc_Ntk_t *pNtk ) { memset(Vec_IntArray(pManMR->vSinkDistHist), 0, sizeof(int)*Vec_IntSize(pManMR->vSinkDistHist)); // seed queue : latches, PIOs, and blocks - Abc_NtkForEachObj( pNtk, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, pNtk, pObj, i ) if (Abc_ObjIsPo(pObj) || Abc_ObjIsLatch(pObj) || (pManMR->fIsForward && FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask)) { @@ -180,7 +183,7 @@ void dfsfast_preorder( Abc_Ntk_t *pNtk ) { // free time edges #if !defined(IGNORE_TIMING) if (pManMR->maxDelay) { - Abc_NtkForEachObj( pNtk, pObj, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, pNtk, pObj, i ) { vTimeIn = FDATA(pObj)->vNodes; if (vTimeIn) { Vec_PtrFree(vTimeIn); @@ -190,7 +193,7 @@ void dfsfast_preorder( Abc_Ntk_t *pNtk ) { } #endif - Abc_NtkForEachObj( pNtk, pObj, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, pNtk, pObj, i ) { Vec_IntAddToEntry(pManMR->vSinkDistHist, FDATA(pObj)->r_dist, 1); Vec_IntAddToEntry(pManMR->vSinkDistHist, FDATA(pObj)->e_dist, 1); @@ -695,3 +698,5 @@ int dfsplain_r( Abc_Obj_t *pObj, Abc_Obj_t *pPred ) { #endif return 1; } +ABC_NAMESPACE_IMPL_END + diff --git a/src/opt/fret/fretInit.c b/src/opt/fret/fretInit.c index 0c7b1e29..ce9adefa 100644 --- a/src/opt/fret/fretInit.c +++ b/src/opt/fret/fretInit.c @@ -25,6 +25,9 @@ #include "mio.h" #include "hop.h" +ABC_NAMESPACE_IMPL_START + + #undef DEBUG_PRINT_INIT_NTK @@ -698,7 +701,7 @@ void Abc_FlowRetime_UpdateBackwardInit( Abc_Ntk_t * pNtk ) { } // recursively build init network - Vec_PtrForEachEntry( vBo, pOrigObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vBo, pOrigObj, i ) Abc_FlowRetime_UpdateBackwardInit_rec( pOrigObj ); // clear flags @@ -759,9 +762,9 @@ Abc_Obj_t *Abc_FlowRetime_CopyNodeToInitNtk( Abc_Obj_t *pOrigObj ) { fCompl[0] = pOrigObj->fCompl0 ? 1 : 0; fCompl[1] = pOrigObj->fCompl1 ? 1 : 0; - pData = Abc_SopCreateAnd( pInitNtk->pManFunc, 2, fCompl ); + pData = Abc_SopCreateAnd( (Extra_MmFlex_t *)pInitNtk->pManFunc, 2, fCompl ); assert(pData); - pInitObj->pData = Abc_SopRegister( pInitNtk->pManFunc, pData ); + pInitObj->pData = Abc_SopRegister( (Extra_MmFlex_t *)pInitNtk->pManFunc, pData ); } // (ii) mapped node -> SOP node @@ -779,7 +782,7 @@ Abc_Obj_t *Abc_FlowRetime_CopyNodeToInitNtk( Abc_Obj_t *pOrigObj ) { pData = Mio_GateReadSop(pOrigObj->pData); assert( Abc_SopGetVarNum(pData) == Abc_ObjFaninNum(pOrigObj) ); - pInitObj->pData = Abc_SopRegister( pInitNtk->pManFunc, pData ); + pInitObj->pData = Abc_SopRegister( (Extra_MmFlex_t *)pInitNtk->pManFunc, pData ); } // (iii) otherwise, duplicate obj @@ -941,7 +944,7 @@ void Abc_FlowRetime_VerifyBackwardInit_rec( Abc_Obj_t * pObj ) { SeeAlso [] ***********************************************************************/ -bool Abc_FlowRetime_PartialSat(Vec_Ptr_t *vNodes, int cut) { +int Abc_FlowRetime_PartialSat(Vec_Ptr_t *vNodes, int cut) { Abc_Ntk_t *pPartNtk, *pInitNtk = pManMR->pInitNtk; Abc_Obj_t *pObj, *pNext, *pPartObj, *pPartNext, *pPo; int i, j, result; @@ -951,7 +954,7 @@ bool Abc_FlowRetime_PartialSat(Vec_Ptr_t *vNodes, int cut) { pPartNtk = Abc_NtkAlloc( pInitNtk->ntkType, pInitNtk->ntkFunc, 0 ); // copy network - Vec_PtrForEachEntry( vNodes, pObj, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) { pObj->Level = i; assert(!Abc_ObjIsPo( pObj )); @@ -1117,7 +1120,7 @@ void Abc_FlowRetime_RemoveInitBias( ) { InitConstraint_t *pConstraint; int i; - Vec_PtrForEachEntry( pManMR->vInitConstraints, pConstraint, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, pManMR->vInitConstraints, pConstraint, i ) { pBiasNode = pConstraint->pBiasNode; pConstraint->pBiasNode = NULL; @@ -1215,7 +1218,7 @@ void Abc_FlowRetime_AddInitBias( ) { vprintf("\t\tcreating %d bias structures\n", nConstraints); - Vec_PtrForEachEntry( pManMR->vInitConstraints, pConstraint, i ) { + Vec_PtrForEachEntry( Abc_Obj_t *, pManMR->vInitConstraints, pConstraint, i ) { if (pConstraint->pBiasNode) continue; // printf("\t\t\tbias %d...\n", i); @@ -1327,3 +1330,5 @@ void Abc_FlowRetime_GetInitToOrig( Abc_Obj_t *pInit, Abc_Obj_t **pOrig, int *lag *pOrig = Abc_NtkObj(pManMR->pNtk, origId); *lag = pManMR->pInitToOrig[id].lag; } +ABC_NAMESPACE_IMPL_END + diff --git a/src/opt/fret/fretMain.c b/src/opt/fret/fretMain.c index 77ea8468..141baff4 100644 --- a/src/opt/fret/fretMain.c +++ b/src/opt/fret/fretMain.c @@ -22,6 +22,9 @@ #include "vec.h" #include "fretime.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -475,7 +478,7 @@ Abc_FlowRetime_MarkBlocks( Abc_Ntk_t * pNtk ) { ***********************************************************************/ int -Abc_FlowRetime_PushFlows( Abc_Ntk_t * pNtk, bool fVerbose ) { +Abc_FlowRetime_PushFlows( Abc_Ntk_t * pNtk, int fVerbose ) { int i, j, flow = 0, last, srcDist = 0; Abc_Obj_t *pObj, *pObj2; // int clk = clock(); @@ -1049,7 +1052,7 @@ Abc_ObjBetterTransferFanout( Abc_Obj_t * pFrom, Abc_Obj_t * pTo, int compl ) { SeeAlso [] ***********************************************************************/ -bool +int Abc_FlowRetime_IsAcrossCut( Abc_Obj_t *pObj, Abc_Obj_t *pNext ) { if (FTEST(pObj, VISITED_R) && !FTEST(pObj, VISITED_E)) { @@ -1083,7 +1086,7 @@ Abc_FlowRetime_IsAcrossCut( Abc_Obj_t *pObj, Abc_Obj_t *pNext ) { SeeAlso [] ***********************************************************************/ -void Abc_FlowRetime_ClearFlows( bool fClearAll ) { +void Abc_FlowRetime_ClearFlows( int fClearAll ) { int i; if (fClearAll) @@ -1180,7 +1183,7 @@ static Abc_Ntk_t* Abc_FlowRetime_NtkDup( Abc_Ntk_t * pNtk ) { SeeAlso [] ***********************************************************************/ -Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash( Abc_Ntk_t * pNtk, bool fCleanup ) +Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash( Abc_Ntk_t * pNtk, int fCleanup ) { Abc_Ntk_t * pNtkAig; Abc_Obj_t * pObj; @@ -1190,12 +1193,12 @@ Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash( Abc_Ntk_t * pNtk, bool fCleanup ) pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG ); // restrash the nodes (assuming a topological order of the old network) Abc_NtkForEachNode( pNtk, pObj, i ) - pObj->pCopy = Abc_AigAnd( pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); + pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); // finalize the network Abc_NtkFinalize( pNtk, pNtkAig ); // perform cleanup if requested if ( fCleanup ) - nNodes = Abc_AigCleanup(pNtkAig->pManFunc); + nNodes = Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc); // duplicate EXDC if ( pNtk->pExdc ) pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc ); @@ -1378,3 +1381,5 @@ void Abc_ObjPrintNeighborhood( Abc_Obj_t *pObj, int depth ) { Vec_PtrFree(vNodes); } +ABC_NAMESPACE_IMPL_END + diff --git a/src/opt/fret/fretTime.c b/src/opt/fret/fretTime.c index f497df60..47e90519 100644 --- a/src/opt/fret/fretTime.c +++ b/src/opt/fret/fretTime.c @@ -22,6 +22,9 @@ #include "vec.h" #include "fretime.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -131,7 +134,7 @@ void Abc_FlowRetime_ConstrainConserv_forw( Abc_Ntk_t * pNtk ) { Abc_FlowRetime_Dfs_forw( pObj, vNodes ); // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanin( pObj, pNext, j ) { @@ -168,19 +171,19 @@ void Abc_FlowRetime_ConstrainConserv_forw( Abc_Ntk_t * pNtk ) { #if defined(DEBUG_CHECK) // DEBUG: check DFS ordering - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->fMarkB = 1; Abc_ObjForEachFanin( pObj, pNext, j ) if ( Abc_NodeIsTravIdCurrent(pNext) && !Abc_ObjIsLatch(pNext)) assert(pNext->fMarkB); } - Vec_PtrForEachEntryReverse(vNodes, pObj, i) + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) pObj->fMarkB = 0; #endif // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanin( pObj, pNext, j ) { @@ -203,7 +206,7 @@ void Abc_FlowRetime_ConstrainConserv_forw( Abc_Ntk_t * pNtk ) { } // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanin( pObj, pNext, j ) { if ( Abc_NodeIsTravIdCurrent(pNext) && @@ -231,7 +234,7 @@ void Abc_FlowRetime_ConstrainConserv_forw( Abc_Ntk_t * pNtk ) { } // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanin( pObj, pNext, j ) { if ( Abc_NodeIsTravIdCurrent(pNext) && @@ -269,7 +272,7 @@ void Abc_FlowRetime_ConstrainConserv_back( Abc_Ntk_t * pNtk ) { Abc_FlowRetime_Dfs_back( pObj, vNodes ); // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanout( pObj, pNext, j ) { @@ -306,19 +309,19 @@ void Abc_FlowRetime_ConstrainConserv_back( Abc_Ntk_t * pNtk ) { #if defined(DEBUG_CHECK) // DEBUG: check DFS ordering - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->fMarkB = 1; Abc_ObjForEachFanout( pObj, pNext, j ) if ( Abc_NodeIsTravIdCurrent(pNext) && !Abc_ObjIsLatch(pNext)) assert(pNext->fMarkB); } - Vec_PtrForEachEntryReverse(vNodes, pObj, i) + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) pObj->fMarkB = 0; #endif // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanout( pObj, pNext, j ) { @@ -341,7 +344,7 @@ void Abc_FlowRetime_ConstrainConserv_back( Abc_Ntk_t * pNtk ) { } // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanout( pObj, pNext, j ) { l = pNext->Level + (Abc_ObjIsNode(pObj) ? 1 : 0); @@ -371,7 +374,7 @@ void Abc_FlowRetime_ConstrainConserv_back( Abc_Ntk_t * pNtk ) { } // ... propagate values - Vec_PtrForEachEntryReverse(vNodes, pObj, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *,vNodes, pObj, i) { pObj->Level = 0; Abc_ObjForEachFanout( pObj, pNext, j ) { l = pNext->Level + (Abc_ObjIsNode(pObj) ? 1 : 0); @@ -462,7 +465,7 @@ void Abc_FlowRetime_ConstrainExact_forw( Abc_Obj_t * pObj ) { // rev topo order Abc_FlowRetime_ConstrainExact_forw_rec( pObj, vNodes, 0 ); - Vec_PtrForEachEntryReverse( vNodes, pCur, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pCur, i) { pReg = Abc_ObjRegular( pCur ); if (pReg == pCur) { @@ -474,7 +477,7 @@ void Abc_FlowRetime_ConstrainExact_forw( Abc_Obj_t * pObj ) { pReg->fMarkA = pReg->fMarkB = 0; } } - Vec_PtrForEachEntryReverse( vNodes, pCur, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pCur, i) { pReg = Abc_ObjRegular( pCur ); if (pReg != pCur) { Abc_ObjForEachFanin(pReg, pNext, j) @@ -537,7 +540,7 @@ void Abc_FlowRetime_ConstrainExact_back( Abc_Obj_t * pObj ) { // rev topo order Abc_FlowRetime_ConstrainExact_back_rec( pObj, vNodes, 0 ); - Vec_PtrForEachEntryReverse( vNodes, pCur, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pCur, i) { pReg = Abc_ObjRegular( pCur ); if (pReg == pCur) { @@ -549,7 +552,7 @@ void Abc_FlowRetime_ConstrainExact_back( Abc_Obj_t * pObj ) { pReg->fMarkA = pReg->fMarkB = 0; } } - Vec_PtrForEachEntryReverse( vNodes, pCur, i) { + Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pCur, i) { pReg = Abc_ObjRegular( pCur ); if (pReg != pCur) { Abc_ObjForEachFanout(pReg, pNext, j) @@ -689,7 +692,7 @@ void Abc_FlowRetime_Dfs_back( Abc_Obj_t * pObj, Vec_Ptr_t *vNodes ) { SeeAlso [] ***********************************************************************/ -bool Abc_FlowRetime_RefineConstraints( ) { +int Abc_FlowRetime_RefineConstraints( ) { Abc_Ntk_t *pNtk = pManMR->pNtk; int i, flow, count = 0; Abc_Obj_t *pObj; @@ -761,3 +764,5 @@ bool Abc_FlowRetime_RefineConstraints( ) { } +ABC_NAMESPACE_IMPL_END + diff --git a/src/opt/fret/fretime.h b/src/opt/fret/fretime.h index bbb79d26..2d70d7e3 100644 --- a/src/opt/fret/fretime.h +++ b/src/opt/fret/fretime.h @@ -21,8 +21,12 @@ #if !defined(RETIME_H_) #define RETIME_H_ + #include "abc.h" +ABC_NAMESPACE_HEADER_START + + // #define IGNORE_TIMING // #define DEBUG_PRINT_FLOWS // #define DEBUG_VISITED @@ -89,19 +93,19 @@ typedef struct MinRegMan_t_ { // problem description: int maxDelay; - bool fComputeInitState, fGuaranteeInitState, fBlockConst; + int fComputeInitState, fGuaranteeInitState, fBlockConst; int nNodes, nLatches; - bool fForwardOnly, fBackwardOnly; - bool fConservTimingOnly; + int fForwardOnly, fBackwardOnly; + int fConservTimingOnly; int nMaxIters; - bool fVerbose; + int fVerbose; Abc_Ntk_t *pNtk; int nPreRefine; // problem state - bool fIsForward; - bool fSinkDistTerminate; + int fIsForward; + int fSinkDistTerminate; int nExactConstraints, nConservConstraints; int fSolutionIsDc; int constraintMask; @@ -145,9 +149,9 @@ void print_node(Abc_Obj_t *pObj); void Abc_ObjBetterTransferFanout( Abc_Obj_t * pFrom, Abc_Obj_t * pTo, int compl ); -int Abc_FlowRetime_PushFlows( Abc_Ntk_t * pNtk, bool fVerbose ); -bool Abc_FlowRetime_IsAcrossCut( Abc_Obj_t *pCur, Abc_Obj_t *pNext ); -void Abc_FlowRetime_ClearFlows( bool fClearAll ); +int Abc_FlowRetime_PushFlows( Abc_Ntk_t * pNtk, int fVerbose ); +int Abc_FlowRetime_IsAcrossCut( Abc_Obj_t *pCur, Abc_Obj_t *pNext ); +void Abc_FlowRetime_ClearFlows( int fClearAll ); int Abc_FlowRetime_GetLag( Abc_Obj_t *pObj ); void Abc_FlowRetime_SetLag( Abc_Obj_t *pObj, int lag ); @@ -156,7 +160,7 @@ void Abc_FlowRetime_UpdateLags( ); void Abc_ObjPrintNeighborhood( Abc_Obj_t *pObj, int depth ); -Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash( Abc_Ntk_t * pNtk, bool fCleanup ); +Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash( Abc_Ntk_t * pNtk, int fCleanup ); /*=== fretFlow.c ==========================================================*/ @@ -188,10 +192,14 @@ void Abc_FlowRetime_RemoveInitBias( ); void Abc_FlowRetime_InitTiming( Abc_Ntk_t *pNtk ); void Abc_FlowRetime_FreeTiming( Abc_Ntk_t *pNtk ); -bool Abc_FlowRetime_RefineConstraints( ); +int Abc_FlowRetime_RefineConstraints( ); void Abc_FlowRetime_ConstrainConserv( Abc_Ntk_t * pNtk ); void Abc_FlowRetime_ConstrainExact( Abc_Obj_t * pObj ); void Abc_FlowRetime_ConstrainExactAll( Abc_Ntk_t * pNtk ); + + +ABC_NAMESPACE_HEADER_END + #endif -- cgit v1.2.3