diff options
-rw-r--r-- | src/aig/gia/gia.h | 4 | ||||
-rw-r--r-- | src/aig/gia/giaAiger.c | 24 | ||||
-rw-r--r-- | src/aig/gia/giaEdge.c | 57 | ||||
-rw-r--r-- | src/aig/gia/giaIf.c | 3 | ||||
-rw-r--r-- | src/aig/gia/giaMan.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaSatLut.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaTim.c | 8 | ||||
-rw-r--r-- | src/base/abci/abc.c | 27 |
8 files changed, 79 insertions, 48 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index a3fe1dc5..8d3bb198 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -1213,10 +1213,10 @@ extern Vec_Int_t * Gia_ManEdgeToArray( Gia_Man_t * p ); extern void Gia_ManConvertPackingToEdges( Gia_Man_t * p ); extern int Gia_ManEvalEdgeDelay( Gia_Man_t * p ); extern int Gia_ManEvalEdgeCount( Gia_Man_t * p ); -extern int Gia_ManComputeEdgeDelay( Gia_Man_t * p ); +extern int Gia_ManComputeEdgeDelay( Gia_Man_t * p, int fUseTwo ); extern int Gia_ManComputeEdgeDelay2( Gia_Man_t * p ); extern void Gia_ManUpdateMapping( Gia_Man_t * p, Vec_Int_t * vNodes, Vec_Wec_t * vWin ); -extern int Gia_ManEvalWindow( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp ); +extern int Gia_ManEvalWindow( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp, int fUseTwo ); /*=== giaEnable.c ==========================================================*/ extern void Gia_ManDetectSeqSignals( Gia_Man_t * p, int fSetReset, int fVerbose ); extern Gia_Man_t * Gia_ManUnrollAndCofactor( Gia_Man_t * p, int nFrames, int nFanMax, int fVerbose ); diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c index a6ea9322..04ad8641 100644 --- a/src/aig/gia/giaAiger.c +++ b/src/aig/gia/giaAiger.c @@ -1289,6 +1289,18 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int Vec_StrFree( vStrExt ); if ( fVerbose ) printf( "Finished writing extension \"k\".\n" ); } + // write edges + if ( p->vEdge1 ) + { + Vec_Int_t * vPairs = Gia_ManEdgeToArray( p ); + int i; + fprintf( pFile, "w" ); + Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(vPairs)+1) ); + Gia_FileWriteBufferSize( pFile, Vec_IntSize(vPairs)/2 ); + for ( i = 0; i < Vec_IntSize(vPairs); i++ ) + Gia_FileWriteBufferSize( pFile, Vec_IntEntry(vPairs, i) ); + Vec_IntFree( vPairs ); + } // write mapping if ( Gia_ManHasMapping(p) ) { @@ -1329,18 +1341,6 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int for ( i = 0; i < Vec_IntSize(p->vRegInits); i++ ) Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vRegInits, i) ); } - // write register inits - if ( p->vEdge1 ) - { - Vec_Int_t * vPairs = Gia_ManEdgeToArray( p ); - int i; - fprintf( pFile, "w" ); - Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(vPairs)+1) ); - Gia_FileWriteBufferSize( pFile, Vec_IntSize(vPairs)/2 ); - for ( i = 0; i < Vec_IntSize(vPairs); i++ ) - Gia_FileWriteBufferSize( pFile, Vec_IntEntry(vPairs, i) ); - Vec_IntFree( vPairs ); - } // write configuration data if ( p->vConfigs ) { diff --git a/src/aig/gia/giaEdge.c b/src/aig/gia/giaEdge.c index f633c97c..df738509 100644 --- a/src/aig/gia/giaEdge.c +++ b/src/aig/gia/giaEdge.c @@ -148,7 +148,8 @@ void Gia_ManConvertPackingToEdges( Gia_Man_t * p ) } } assert( nEntries == nEntries2 ); - printf( "Skipped %d illegal edges.\n", Count ); + if ( Count ) + printf( "Skipped %d illegal edges.\n", Count ); } /**Function************************************************************* @@ -174,7 +175,7 @@ static inline int Gia_ObjEvalEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDe assert( Gia_ObjLutSize(p, iObj) <= 4 ); Gia_LutForEachFanin( p, iObj, iFan, i ) { - Delay = Vec_IntEntry(vDelay, iFan) + !Gia_ObjHaveEdge(p, iObj, iFan); + Delay = Vec_IntEntry(vDelay, iFan) + (Gia_ObjHaveEdge(p, iObj, iFan) ? 2 : 10); DelayMax = Abc_MaxInt( DelayMax, Delay ); } } @@ -183,7 +184,7 @@ static inline int Gia_ObjEvalEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDe assert( Gia_ObjLutSize2(p, iObj) <= 4 ); Gia_LutForEachFanin2( p, iObj, iFan, i ) { - Delay = Vec_IntEntry(vDelay, iFan) + !Gia_ObjHaveEdge(p, iObj, iFan); + Delay = Vec_IntEntry(vDelay, iFan) + (Gia_ObjHaveEdge(p, iObj, iFan) ? 2 : 10); DelayMax = Abc_MaxInt( DelayMax, Delay ); } } @@ -290,10 +291,10 @@ int Gia_ManEvalEdgeCount( Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_Int_t * vEdge1, Vec_Int_t * vEdge2 ) +int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_Int_t * vEdge1, Vec_Int_t * vEdge2, int fUseTwo ) { int i, iFan, Delay, Status1, Status2; - int DelayMax = 0, nCountMax = 0; + int DelayMax = 0, DelayMax2 = 0, nCountMax = 0; int iFanMax1 = -1, iFanMax2 = -1; Vec_IntWriteEntry(vEdge1, iObj, 0); Vec_IntWriteEntry(vEdge2, iObj, 0); @@ -302,9 +303,10 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In assert( Gia_ObjLutSize(p, iObj) <= 4 ); Gia_LutForEachFanin( p, iObj, iFan, i ) { - Delay = Vec_IntEntry( vDelay, iFan ) + 1; + Delay = Vec_IntEntry( vDelay, iFan ) + 10; if ( DelayMax < Delay ) { + DelayMax2 = DelayMax; DelayMax = Delay; iFanMax1 = iFan; nCountMax = 1; @@ -313,7 +315,11 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In { iFanMax2 = iFan; nCountMax++; + if ( !fUseTwo ) + DelayMax2 = DelayMax; } + else + DelayMax2 = Abc_MaxInt( DelayMax2, Delay ); } } else if ( Gia_ObjIsLut2(p, iObj) ) @@ -321,9 +327,10 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In assert( Gia_ObjLutSize2(p, iObj) <= 4 ); Gia_LutForEachFanin2( p, iObj, iFan, i ) { - Delay = Vec_IntEntry( vDelay, iFan ) + 1; + Delay = Vec_IntEntry( vDelay, iFan ) + 10; if ( DelayMax < Delay ) { + DelayMax2 = DelayMax; DelayMax = Delay; iFanMax1 = iFan; nCountMax = 1; @@ -332,12 +339,16 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In { iFanMax2 = iFan; nCountMax++; + if ( !fUseTwo ) + DelayMax2 = DelayMax; } + else + DelayMax2 = Abc_MaxInt( DelayMax2, Delay ); } } else assert( 0 ); assert( nCountMax > 0 ); - if ( DelayMax == 1 ) + if ( DelayMax <= 10 ) {} // skip first level else if ( nCountMax == 1 ) { @@ -346,11 +357,12 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In { Gia_ObjEdgeAdd( iFanMax1, iObj, vEdge1, vEdge2 ); Gia_ObjEdgeAdd( iObj, iFanMax1, vEdge1, vEdge2 ); - Vec_IntWriteEntry( vDelay, iObj, DelayMax-1 ); - return DelayMax-1; + DelayMax = Abc_MaxInt( DelayMax2, DelayMax - 8 ); + Vec_IntWriteEntry( vDelay, iObj, DelayMax ); + return DelayMax; } } - else if ( nCountMax == 2 ) + else if ( fUseTwo && nCountMax == 2 ) { Status1 = Gia_ObjEdgeCount( iFanMax1, vEdge1, vEdge2 ); Status2 = Gia_ObjEdgeCount( iFanMax2, vEdge1, vEdge2 ); @@ -360,14 +372,15 @@ int Gia_ObjComputeEdgeDelay( Gia_Man_t * p, int iObj, Vec_Int_t * vDelay, Vec_In Gia_ObjEdgeAdd( iFanMax2, iObj, vEdge1, vEdge2 ); Gia_ObjEdgeAdd( iObj, iFanMax1, vEdge1, vEdge2 ); Gia_ObjEdgeAdd( iObj, iFanMax2, vEdge1, vEdge2 ); - Vec_IntWriteEntry( vDelay, iObj, DelayMax-1 ); - return DelayMax-1; + DelayMax = Abc_MaxInt( DelayMax2, DelayMax - 8 ); + Vec_IntWriteEntry( vDelay, iObj, DelayMax ); + return DelayMax; } } Vec_IntWriteEntry( vDelay, iObj, DelayMax ); return DelayMax; } -int Gia_ManComputeEdgeDelay( Gia_Man_t * p ) +int Gia_ManComputeEdgeDelay( Gia_Man_t * p, int fUseTwo ) { int k, iLut, DelayMax = 0; Vec_IntFreeP( &p->vEdgeDelay ); @@ -389,7 +402,7 @@ int Gia_ManComputeEdgeDelay( Gia_Man_t * p ) if ( Gia_ObjIsAnd(pObj) ) { if ( Gia_ObjIsLut(p, iLut) ) - Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2 ); + Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo ); } else if ( Gia_ObjIsCi(pObj) ) { @@ -409,7 +422,7 @@ int Gia_ManComputeEdgeDelay( Gia_Man_t * p ) else { Gia_ManForEachLut( p, iLut ) - Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2 ); + Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo ); } } else if ( Gia_ManHasMapping2(p) ) @@ -425,7 +438,7 @@ int Gia_ManComputeEdgeDelay( Gia_Man_t * p ) if ( Gia_ObjIsAnd(pObj) ) { if ( Gia_ObjIsLut2(p, iLut) ) - Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2 ); + Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo ); } else if ( Gia_ObjIsCi(pObj) ) { @@ -445,7 +458,7 @@ int Gia_ManComputeEdgeDelay( Gia_Man_t * p ) else { Gia_ManForEachLut2( p, iLut ) - Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2 ); + Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo ); } } else assert( 0 ); @@ -593,7 +606,7 @@ void Gia_ManUpdateMapping( Gia_Man_t * p, Vec_Int_t * vNodes, Vec_Wec_t * vWin ) Vec_IntForEachEntry( vNodes, iNode, i ) ABC_SWAP( Vec_Int_t, *Vec_WecEntry(p->vMapping2, iNode), *Vec_WecEntry(vWin, i) ); } -int Gia_ManEvalWindowInc( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp ) +int Gia_ManEvalWindowInc( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp, int fUseTwo ) { int i, iLut, Delay, DelayMax = 0; assert( Vec_IntSize(vNodes) == Vec_WecSize(vWin) ); @@ -604,18 +617,18 @@ int Gia_ManEvalWindowInc( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes { if ( !Gia_ObjIsLut(p, iLut) ) continue; - Delay = Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2 ); + Delay = Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo ); DelayMax = Abc_MaxInt( DelayMax, Delay ); } Gia_ManUpdateMapping( p, vNodes, vWin ); return DelayMax; } -int Gia_ManEvalWindow( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp ) +int Gia_ManEvalWindow( Gia_Man_t * p, Vec_Int_t * vLeaves, Vec_Int_t * vNodes, Vec_Wec_t * vWin, Vec_Int_t * vTemp, int fUseTwo ) { int DelayMax; assert( Vec_IntSize(vNodes) == Vec_WecSize(vWin) ); Gia_ManUpdateMapping( p, vNodes, vWin ); - DelayMax = Gia_ManComputeEdgeDelay( p ); + DelayMax = Gia_ManComputeEdgeDelay( p, fUseTwo ); Gia_ManUpdateMapping( p, vNodes, vWin ); return DelayMax; } diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index e6e326e3..59afb4da 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -2183,12 +2183,13 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) } else { - int fHashMapping = 1; + int fHashMapping = 0; pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp ); Gia_ManTransferTiming( pNew, p ); if ( fHashMapping ) { pNew = Gia_ManDupHashMapping( p = pNew ); + Gia_ManTransferPacking( pNew, p ); Gia_ManTransferTiming( pNew, p ); Gia_ManStop( p ); } diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c index cc93d4b8..b7434bff 100644 --- a/src/aig/gia/giaMan.c +++ b/src/aig/gia/giaMan.c @@ -406,7 +406,7 @@ int Gia_ManPrintEdges( Gia_Man_t * p ) { printf( "Edges (Q=2) : " ); printf( "edge =%8d ", (Vec_IntCountPositive(p->vEdge1) + Vec_IntCountPositive(p->vEdge2))/2 ); - printf( "lut =%5d", Gia_ManEvalEdgeDelay(p) ); + printf( "lev =%5.1f", 0.1*Gia_ManEvalEdgeDelay(p) ); printf( "\n" ); return 0; } diff --git a/src/aig/gia/giaSatLut.c b/src/aig/gia/giaSatLut.c index 2cfa6f3a..2c734f2b 100644 --- a/src/aig/gia/giaSatLut.c +++ b/src/aig/gia/giaSatLut.c @@ -431,7 +431,7 @@ int Sbl_ManEvaluateMappingEdge( Sbl_Man_t * p, int DelayGlo ) // update new timing Sbl_ManGetCurrentMapping( p ); // derive new timing - DelayMax = Gia_ManEvalWindow( p->pGia, p->vLeaves, p->vAnds, p->vWindow, p->vPolar ); + DelayMax = Gia_ManEvalWindow( p->pGia, p->vLeaves, p->vAnds, p->vWindow, p->vPolar, 1 ); p->timeTime += Abc_Clock() - clk; if ( DelayMax <= DelayGlo ) return 1; diff --git a/src/aig/gia/giaTim.c b/src/aig/gia/giaTim.c index c065ab5a..3d047dee 100644 --- a/src/aig/gia/giaTim.c +++ b/src/aig/gia/giaTim.c @@ -137,7 +137,7 @@ int Gia_ManIsNormalized( Gia_Man_t * p ) ***********************************************************************/ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ) { - int fHash = 1; + int fHashMapping = 0; Gia_Man_t * pNew; Gia_Obj_t * pObj; int i; @@ -171,15 +171,15 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ) Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); printf( "Warning: Shuffled CI order to be correct sequential AIG.\n" ); } - if ( fHash ) Gia_ManHashAlloc( pNew ); + if ( fHashMapping ) Gia_ManHashAlloc( pNew ); Gia_ManForEachAnd( p, pObj, i ) if ( Gia_ObjIsBuf(pObj) ) pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) ); - else if ( fHash ) + else if ( fHashMapping ) pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); else pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); - if ( fHash ) Gia_ManHashStop( pNew ); + if ( fHashMapping ) Gia_ManHashStop( pNew ); Gia_ManForEachCo( p, pObj, i ) pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 6b259bdb..eadd2ddd 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -27684,7 +27684,11 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) return 1; } if ( Gia_ManHasMapping(pAbc->pGia) && fRehashMap ) + { pTemp = Gia_ManDupHashMapping( pAbc->pGia ); + Gia_ManTransferPacking( pTemp, pAbc->pGia ); + Gia_ManTransferTiming( pTemp, pAbc->pGia ); + } else if ( Gia_ManHasMapping(pAbc->pGia) && pAbc->pGia->vConfigs ) pTemp = (Gia_Man_t *)If_ManDeriveGiaFromCells( pAbc->pGia ); else if ( Gia_ManHasMapping(pAbc->pGia) ) @@ -34839,15 +34843,21 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv ) { - int c, DelayMax = 0, fReverse = 0, fVerbose = 0; + int c, DelayMax = 0, fReverse = 0, fUseTwo = 1, fUsePack = 0, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "repvh" ) ) != EOF ) { switch ( c ) { case 'r': fReverse ^= 1; break; + case 'e': + fUseTwo ^= 1; + break; + case 'p': + fUsePack ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -34876,17 +34886,24 @@ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( 0, "Reverse computation does not work when boxes are present.\n" ); return 0; } + if ( fUsePack ) + { + Gia_ManConvertPackingToEdges( pAbc->pGia ); + return 0; + } if ( fReverse ) DelayMax = Gia_ManComputeEdgeDelay2( pAbc->pGia ); else - DelayMax = Gia_ManComputeEdgeDelay( pAbc->pGia ); - printf( "The number of edges = %d. Delay = %d.\n", Gia_ManEvalEdgeCount(pAbc->pGia), DelayMax ); + DelayMax = Gia_ManComputeEdgeDelay( pAbc->pGia, fUseTwo ); + //printf( "The number of edges = %d. Delay = %d.\n", Gia_ManEvalEdgeCount(pAbc->pGia), DelayMax ); return 0; usage: - Abc_Print( -2, "usage: &edge [-rvh]\n" ); + Abc_Print( -2, "usage: &edge [-repvh]\n" ); Abc_Print( -2, "\t find edge assignment of the LUT-mapped network\n" ); Abc_Print( -2, "\t-r : toggles using reverse order [default = %s]\n", fReverse? "yes": "no" ); + Abc_Print( -2, "\t-e : toggles different edge assignments [default = %s]\n", fUseTwo? "yes": "no" ); + Abc_Print( -2, "\t-p : toggles deriving edges from packing [default = %s]\n", fUsePack? "yes": "no" ); Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : prints the command usage\n"); return 1; |