diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-11-26 23:19:22 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-11-26 23:19:22 -0800 |
commit | ee50e84e57f70c5b7cc9d66edeef05a8de4b3f9f (patch) | |
tree | 7401e0d75e96dbe67d5ee549379e99f9bf76b2b7 /src | |
parent | a9eb8677fee8c32b9292b30c92cadb3882123800 (diff) | |
download | abc-ee50e84e57f70c5b7cc9d66edeef05a8de4b3f9f.tar.gz abc-ee50e84e57f70c5b7cc9d66edeef05a8de4b3f9f.tar.bz2 abc-ee50e84e57f70c5b7cc9d66edeef05a8de4b3f9f.zip |
Structural mapper into structures.
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/giaIff.c | 89 | ||||
-rw-r--r-- | src/base/abci/abc.c | 18 |
2 files changed, 65 insertions, 42 deletions
diff --git a/src/aig/gia/giaIff.c b/src/aig/gia/giaIff.c index 9fd5a48a..57578f78 100644 --- a/src/aig/gia/giaIff.c +++ b/src/aig/gia/giaIff.c @@ -90,24 +90,24 @@ void Gia_ManIffStop( Iff_Man_t * p ) SeeAlso [] ***********************************************************************/ -int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip, int iFaninSkip2 ) +int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip2, int iFaninSkip3 ) { int i, iFanin, Count = 0; Gia_ManIncrementTravId( pGia ); Gia_LutForEachFanin( pGia, iObj, iFanin, i ) { - if ( iFanin == iFaninSkip || iFanin == iFaninSkip2 ) + if ( iFanin == iFaninSkip2 || iFanin == iFaninSkip3 ) continue; if ( Gia_ObjIsTravIdCurrentId( pGia, iFanin ) ) continue; Gia_ObjSetTravIdCurrentId( pGia, iFanin ); Count++; } - if ( iFaninSkip >= 0 ) + if ( iFaninSkip2 >= 0 ) { - Gia_LutForEachFanin( pGia, iFaninSkip, iFanin, i ) + Gia_LutForEachFanin( pGia, iFaninSkip2, iFanin, i ) { - if ( iFanin == iFaninSkip2 ) + if ( iFanin == iFaninSkip3 ) continue; if ( Gia_ObjIsTravIdCurrentId( pGia, iFanin ) ) continue; @@ -115,11 +115,11 @@ int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip, int iFaninSkip2 Count++; } } - if ( iFaninSkip2 >= 0 ) + if ( iFaninSkip3 >= 0 ) { - Gia_LutForEachFanin( pGia, iFaninSkip2, iFanin, i ) + Gia_LutForEachFanin( pGia, iFaninSkip3, iFanin, i ) { - if ( iFanin == iFaninSkip ) + if ( iFanin == iFaninSkip2 ) continue; if ( Gia_ObjIsTravIdCurrentId( pGia, iFanin ) ) continue; @@ -141,23 +141,23 @@ int Gia_IffObjCount( Gia_Man_t * pGia, int iObj, int iFaninSkip, int iFaninSkip2 SeeAlso [] ***********************************************************************/ -float Gia_IffObjTimeOne( Iff_Man_t * p, int iObj, int iFaninSkip, int iFaninSkip2 ) +float Gia_IffObjTimeOne( Iff_Man_t * p, int iObj, int iFaninSkip2, int iFaninSkip3 ) { int i, iFanin; float DelayMax = -ABC_INFINITY; Gia_LutForEachFanin( p->pGia, iObj, iFanin, i ) - if ( iFanin != iFaninSkip && iFanin != iFaninSkip2 && DelayMax < Iff_ObjTimeId(p, iFanin) ) + if ( iFanin != iFaninSkip2 && iFanin != iFaninSkip3 && DelayMax < Iff_ObjTimeId(p, iFanin) ) DelayMax = Iff_ObjTimeId(p, iFanin); assert( i == Gia_ObjLutSize(p->pGia, iObj) ); - if ( iFaninSkip == -1 ) - return DelayMax; - Gia_LutForEachFanin( p->pGia, iFaninSkip, iFanin, i ) - if ( iFanin != iFaninSkip2 && DelayMax < Iff_ObjTimeId(p, iFanin) ) - DelayMax = Iff_ObjTimeId(p, iFanin); if ( iFaninSkip2 == -1 ) return DelayMax; Gia_LutForEachFanin( p->pGia, iFaninSkip2, iFanin, i ) - if ( iFanin != iFaninSkip && DelayMax < Iff_ObjTimeId(p, iFanin) ) + if ( iFanin != iFaninSkip3 && DelayMax < Iff_ObjTimeId(p, iFanin) ) + DelayMax = Iff_ObjTimeId(p, iFanin); + if ( iFaninSkip3 == -1 ) + return DelayMax; + Gia_LutForEachFanin( p->pGia, iFaninSkip3, iFanin, i ) + if ( iFanin != iFaninSkip2 && DelayMax < Iff_ObjTimeId(p, iFanin) ) DelayMax = Iff_ObjTimeId(p, iFanin); assert( DelayMax >= 0 ); return DelayMax; @@ -169,6 +169,8 @@ float Gia_IffObjTimeTwo( Iff_Man_t * p, int iObj, int * piFanin, float DelayMin *piFanin = -1; Gia_LutForEachFanin( p->pGia, iObj, iFanin, i ) { + if ( Gia_ObjIsCi(Gia_ManObj(p->pGia, iFanin)) ) + continue; This = Gia_IffObjTimeOne( p, iObj, iFanin, -1 ); nSize = Gia_IffObjCount( p->pGia, iObj, iFanin, -1 ); assert( nSize <= p->pLib->LutMax ); @@ -192,6 +194,10 @@ float Gia_IffObjTimeThree( Iff_Man_t * p, int iObj, int * piFanin, int * piFanin { if ( iFanin == iFanin2 ) continue; + if ( Gia_ObjIsCi(Gia_ManObj(p->pGia, iFanin)) ) + continue; + if ( Gia_ObjIsCi(Gia_ManObj(p->pGia, iFanin2)) ) + continue; This = Gia_IffObjTimeOne( p, iObj, iFanin, iFanin2 ); nSize = Gia_IffObjCount( p->pGia, iObj, iFanin, iFanin2 ); assert( nSize <= p->pLib->LutMax ); @@ -223,7 +229,7 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t * Gia_Obj_t * pObj; int iObj, iFanin, iFanin1, iFanin2; int CountAll = 0, Count2 = 0, Count3 = 0; - float arrTime1, arrTime2, arrTime3, arrBest = -ABC_INFINITY; + float arrTime1, arrTime2, arrTime3, arrMax = -ABC_INFINITY; assert( nDegree == 2 || nDegree == 3 ); // start the mapping manager and set its parameters p = Gia_ManIffStart( pGia ); @@ -265,6 +271,7 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t * Iff_ObjSetMatchId( p, iObj, 2, iFanin ), Count2++; else { + assert( arrTime3 < arrTime2 ); Iff_ObjSetMatchId( p, iObj, 2, iFanin1 ); Iff_ObjSetMatchId( p, iObj, 3, iFanin2 ), Count3++; } @@ -281,12 +288,12 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t * arrTime1 = Iff_ObjTimeId( p, Gia_ObjFaninId0p(pGia, pObj) ); Tim_ManSetCoArrival( pTime, Gia_ObjCioId(pObj), arrTime1 ); Iff_ObjSetTime( p, pObj, arrTime1 ); - arrBest = Abc_MaxFloat( arrBest, arrTime1 ); + arrMax = Abc_MaxFloat( arrMax, arrTime1 ); } else assert( 0 ); } printf( "Max delay = %.2f. Count1 = %d. Count2 = %d. Count3 = %d.\n", - arrBest, CountAll - Count2 - Count3, Count2, Count3 ); + arrMax, CountAll - Count2 - Count3, Count2, Count3 ); return p; } @@ -303,48 +310,48 @@ Iff_Man_t * Gia_ManIffPerform( Gia_Man_t * pGia, If_LibLut_t * pLib, Tim_Man_t * ***********************************************************************/ void Gia_ManIffSelect_rec( Iff_Man_t * p, int iObj, Vec_Int_t * vPacking ) { - int i, iFanin, iFaninSkip, iFaninSkip2; + int i, iFanin, iFaninSkip2, iFaninSkip3; if ( Gia_ObjIsTravIdCurrentId( p->pGia, iObj ) ) return; Gia_ObjSetTravIdCurrentId( p->pGia, iObj ); assert( Gia_ObjIsLut(p->pGia, iObj) ); - iFaninSkip = Iff_ObjMatchId(p, iObj, 2); - iFaninSkip2 = Iff_ObjMatchId(p, iObj, 3); - if ( iFaninSkip == -1 ) + iFaninSkip2 = Iff_ObjMatchId(p, iObj, 2); + iFaninSkip3 = Iff_ObjMatchId(p, iObj, 3); + if ( iFaninSkip2 == -1 ) { - assert( iFaninSkip2 == -1 ); + assert( iFaninSkip3 == -1 ); Gia_LutForEachFanin( p->pGia, iObj, iFanin, i ) Gia_ManIffSelect_rec( p, iFanin, vPacking ); Vec_IntPush( vPacking, 1 ); Vec_IntPush( vPacking, iObj ); } - else if ( iFaninSkip2 == -1 ) + else if ( iFaninSkip3 == -1 ) { - assert( iFaninSkip > 0 ); + assert( iFaninSkip2 > 0 ); Gia_LutForEachFanin( p->pGia, iObj, iFanin, i ) - if ( iFanin != iFaninSkip ) + if ( iFanin != iFaninSkip2 ) Gia_ManIffSelect_rec( p, iFanin, vPacking ); - Gia_LutForEachFanin( p->pGia, iFaninSkip, iFanin, i ) + Gia_LutForEachFanin( p->pGia, iFaninSkip2, iFanin, i ) Gia_ManIffSelect_rec( p, iFanin, vPacking ); Vec_IntPush( vPacking, 2 ); - Vec_IntPush( vPacking, iFaninSkip ); + Vec_IntPush( vPacking, iFaninSkip2 ); Vec_IntPush( vPacking, iObj ); } else { - assert( iFaninSkip > 0 && iFaninSkip2 > 0 ); + assert( iFaninSkip2 > 0 && iFaninSkip3 > 0 ); Gia_LutForEachFanin( p->pGia, iObj, iFanin, i ) - if ( iFanin != iFaninSkip && iFanin != iFaninSkip2 ) - Gia_ManIffSelect_rec( p, iFanin, vPacking ); - Gia_LutForEachFanin( p->pGia, iFaninSkip, iFanin, i ) - if ( iFanin != iFaninSkip2 ) + if ( iFanin != iFaninSkip2 && iFanin != iFaninSkip3 ) Gia_ManIffSelect_rec( p, iFanin, vPacking ); Gia_LutForEachFanin( p->pGia, iFaninSkip2, iFanin, i ) - if ( iFanin != iFaninSkip ) + if ( iFanin != iFaninSkip3 ) + Gia_ManIffSelect_rec( p, iFanin, vPacking ); + Gia_LutForEachFanin( p->pGia, iFaninSkip3, iFanin, i ) + if ( iFanin != iFaninSkip2 ) Gia_ManIffSelect_rec( p, iFanin, vPacking ); Vec_IntPush( vPacking, 3 ); - Vec_IntPush( vPacking, iFaninSkip ); Vec_IntPush( vPacking, iFaninSkip2 ); + Vec_IntPush( vPacking, iFaninSkip3 ); Vec_IntPush( vPacking, iObj ); } Vec_IntAddToEntry( vPacking, 0, 1 ); @@ -357,7 +364,7 @@ Vec_Int_t * Gia_ManIffSelect( Iff_Man_t * p ) Vec_IntPush( vPacking, 0 ); // mark const0 and PIs Gia_ManIncrementTravId( p->pGia ); - Gia_ObjSetTravIdCurrent( p->pGia, Gia_ManConst0(p->pGia) ); + Gia_ObjSetTravIdCurrentId( p->pGia, 0 ); Gia_ManForEachCi( p->pGia, pObj, i ) Gia_ObjSetTravIdCurrent( p->pGia, pObj ); // recursively collect internal nodes @@ -380,6 +387,7 @@ Vec_Int_t * Gia_ManIffSelect( Iff_Man_t * p ) void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose ) { Iff_Man_t * p; + Tim_Man_t * pTemp = NULL; int nDegree = -1; int nLutSize = Gia_ManLutSizeMax( pGia ); if ( nLutSize <= 4 ) @@ -411,10 +419,13 @@ void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose ) printf( "Performing %d-clustering with %d-LUTs:\n", nDegree, nLutSize ); // create timing manager if ( pGia->pManTime == NULL ) - pGia->pManTime = Tim_ManStart( Gia_ManCiNum(pGia), Gia_ManCoNum(pGia) ); + pGia->pManTime = pTemp = Tim_ManStart( Gia_ManCiNum(pGia), Gia_ManCoNum(pGia) ); // perform timing computation p = Gia_ManIffPerform( pGia, pLib, pGia->pManTime, nLutSize, nDegree ); - Tim_ManStopP( (Tim_Man_t **)&pGia->pManTime ); + // remove timing manager + if ( pGia->pManTime == pTemp ) + pGia->pManTime = NULL; + Tim_ManStopP( (Tim_Man_t **)&pTemp ); // derive clustering Vec_IntFreeP( &pGia->vPacking ); pGia->vPacking = Gia_ManIffSelect( p ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 9aec050b..7683d313 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -29833,7 +29833,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) } pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSqalepmrsdbgyojikfuztvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgyojikfuztvh" ) ) != EOF ) { switch ( c ) { @@ -29952,6 +29952,17 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } break; + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer 0,1,or 2.\n" ); + goto usage; + } + pPars->nStructType = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nStructType < 0 || pPars->nStructType > 2 ) + goto usage; + break; case 'q': pPars->fPreprocess ^= 1; break; @@ -30212,7 +30223,7 @@ usage: sprintf(LutSize, "library" ); else sprintf(LutSize, "%d", pPars->nLutSize ); - Abc_Print( -2, "usage: &if [-KCFAGR num] [-DEW float] [-S str] [-qarlepmsdbgyojikfucztvh]\n" ); + Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgyojikfucztvh]\n" ); Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); @@ -30224,6 +30235,7 @@ usage: Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); Abc_Print( -2, "\t-W float : sets wire delay between adjects LUTs [default = %f]\n", pPars->WireDelay ); Abc_Print( -2, "\t-S str : string representing the LUT structure [default = %s]\n", pPars->pLutStruct ? pPars->pLutStruct : "not used" ); + Abc_Print( -2, "\t-T num : the type of LUT structures [default = any]\n", pPars->nStructType ); Abc_Print( -2, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); Abc_Print( -2, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); @@ -30263,7 +30275,7 @@ usage: int Abc_CommandAbc9Iff( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose ); - int c, fVerbose = 1; + int c, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) { |