diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-09-01 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-09-01 08:01:00 -0700 |
commit | b2470dd3da962026fd874e13c2cf78c10099fe68 (patch) | |
tree | 1f05e75c3017afc746283ecdcef83808fec75d2a /src/opt | |
parent | 9f5ef0d6184ef9c73591250ef00b18edfd99885b (diff) | |
download | abc-b2470dd3da962026fd874e13c2cf78c10099fe68.tar.gz abc-b2470dd3da962026fd874e13c2cf78c10099fe68.tar.bz2 abc-b2470dd3da962026fd874e13c2cf78c10099fe68.zip |
Version abc70901
Diffstat (limited to 'src/opt')
-rw-r--r-- | src/opt/lpk/lpkAbcDec.c (renamed from src/opt/lpk/lpkAbcCore.c) | 26 | ||||
-rw-r--r-- | src/opt/lpk/lpkAbcDsd.c | 6 | ||||
-rw-r--r-- | src/opt/lpk/lpkAbcMux.c | 6 | ||||
-rw-r--r-- | src/opt/lpk/lpkAbcUtil.c (renamed from src/opt/lpk/lpkAbcFun.c) | 4 | ||||
-rw-r--r-- | src/opt/lpk/lpkCore.c | 2 | ||||
-rw-r--r-- | src/opt/lpk/lpkInt.h | 61 | ||||
-rw-r--r-- | src/opt/lpk/module.make | 4 |
7 files changed, 55 insertions, 54 deletions
diff --git a/src/opt/lpk/lpkAbcCore.c b/src/opt/lpk/lpkAbcDec.c index 53b2668d..831097b0 100644 --- a/src/opt/lpk/lpkAbcCore.c +++ b/src/opt/lpk/lpkAbcDec.c @@ -1,6 +1,6 @@ /**CFile**************************************************************** - FileName [lpkAbcCore.c] + FileName [lpkAbcDec.c] SystemName [ABC: Logic synthesis and verification system.] @@ -14,7 +14,7 @@ Date [Ver. 1.0. Started - April 28, 2007.] - Revision [$Id: lpkAbcCore.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $] + Revision [$Id: lpkAbcDec.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $] ***********************************************************************/ @@ -39,7 +39,7 @@ SeeAlso [] ***********************************************************************/ -Abc_Obj_t * Lpk_FunImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t * p ) +Abc_Obj_t * Lpk_ImplementFun( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t * p ) { Abc_Obj_t * pObjNew; int i; @@ -73,7 +73,7 @@ Abc_Obj_t * Lpk_FunImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t * SeeAlso [] ***********************************************************************/ -Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeavesOld ) +Abc_Obj_t * Lpk_Implement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeavesOld ) { Lpk_Fun_t * pFun; Abc_Obj_t * pRes; @@ -81,7 +81,7 @@ Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeaves for ( i = Vec_PtrSize(vLeaves) - 1; i >= nLeavesOld; i-- ) { pFun = Vec_PtrEntry( vLeaves, i ); - pRes = Lpk_FunImplement( pNtk, vLeaves, pFun ); + pRes = Lpk_ImplementFun( pNtk, vLeaves, pFun ); Vec_PtrWriteEntry( vLeaves, i, pRes ); Lpk_FunFree( pFun ); } @@ -99,7 +99,7 @@ Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeaves SeeAlso [] ***********************************************************************/ -int Lpk_LpkDecompose_rec( Lpk_Fun_t * p ) +int Lpk_Decompose_rec( Lpk_Fun_t * p ) { Lpk_Fun_t * p2; int VarPol; @@ -107,14 +107,14 @@ int Lpk_LpkDecompose_rec( Lpk_Fun_t * p ) if ( p->nVars <= p->nLutK ) return 1; // check if decomposition exists - VarPol = Lpk_FunAnalizeMux( p ); + VarPol = Lpk_MuxAnalize( p ); if ( VarPol == -1 ) return 0; // split and call recursively - p2 = Lpk_FunSplitMux( p, VarPol ); - if ( !Lpk_LpkDecompose_rec( p2 ) ) + p2 = Lpk_MuxSplit( p, VarPol ); + if ( !Lpk_Decompose_rec( p2 ) ) return 0; - return Lpk_LpkDecompose_rec( p ); + return Lpk_Decompose_rec( p ); } @@ -129,7 +129,7 @@ int Lpk_LpkDecompose_rec( Lpk_Fun_t * p ) SeeAlso [] ***********************************************************************/ -Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim ) +Abc_Obj_t * Lpk_Decompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim ) { Lpk_Fun_t * p; Abc_Obj_t * pObjNew = NULL; @@ -139,8 +139,8 @@ Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * p = Lpk_FunCreate( pNtk, vLeaves, pTruth, nLutK, AreaLim, DelayLim ); Lpk_FunSuppMinimize( p ); // decompose the function - if ( Lpk_LpkDecompose_rec(p) ) - pObjNew = Lpk_LptImplement( pNtk, vLeaves, nLeaves ); + if ( Lpk_Decompose_rec(p) ) + pObjNew = Lpk_Implement( pNtk, vLeaves, nLeaves ); else { for ( i = Vec_PtrSize(vLeaves) - 1; i >= nLeaves; i-- ) diff --git a/src/opt/lpk/lpkAbcDsd.c b/src/opt/lpk/lpkAbcDsd.c index 893844e0..8de8391f 100644 --- a/src/opt/lpk/lpkAbcDsd.c +++ b/src/opt/lpk/lpkAbcDsd.c @@ -6,7 +6,7 @@ PackageName [Fast Boolean matching for LUT structures.] - Synopsis [] + Synopsis [LUT-decomposition based on recursive DSD.] Author [Alan Mishchenko] @@ -266,7 +266,7 @@ void Lpk_FunFreeTruthTables( Lpk_Fun_t * p, int nCofDepth, unsigned * ppTruths[5 SeeAlso [] ***********************************************************************/ -Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth ) +Lpk_Res_t * Lpk_DsdAnalize( Lpk_Fun_t * p, int nCofDepth ) { static Lpk_Res_t Res, * pRes = &Res; unsigned * ppTruths[5][16]; @@ -330,7 +330,7 @@ Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth ) SeeAlso [] ***********************************************************************/ -Lpk_Fun_t * Lpk_FunSplitDsd( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet ) +Lpk_Fun_t * Lpk_DsdSplit( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet ) { Kit_DsdMan_t * pDsdMan; Kit_DsdNtk_t * pNtkDec, * pTemp; diff --git a/src/opt/lpk/lpkAbcMux.c b/src/opt/lpk/lpkAbcMux.c index 1525a7e0..6549e175 100644 --- a/src/opt/lpk/lpkAbcMux.c +++ b/src/opt/lpk/lpkAbcMux.c @@ -6,7 +6,7 @@ PackageName [Fast Boolean matching for LUT structures.] - Synopsis [Iterative MUX decomposition.] + Synopsis [LUT-decomposition based on recursive MUX decomposition.] Author [Alan Mishchenko] @@ -85,7 +85,7 @@ void Lpk_FunComputeCofSupps( Lpk_Fun_t * p, unsigned * puSupps ) SeeAlso [] ***********************************************************************/ -int Lpk_FunAnalizeMux( Lpk_Fun_t * p ) +int Lpk_MuxAnalize( Lpk_Fun_t * p ) { unsigned puSupps[32] = {0}; int nSuppSize0, nSuppSize1, Delay, Delay0, Delay1, DelayA, DelayB; @@ -193,7 +193,7 @@ int Lpk_FunAnalizeMux( Lpk_Fun_t * p ) SeeAlso [] ***********************************************************************/ -Lpk_Fun_t * Lpk_FunSplitMux( Lpk_Fun_t * p, int VarPol ) +Lpk_Fun_t * Lpk_MuxSplit( Lpk_Fun_t * p, int VarPol ) { Lpk_Fun_t * pNew; unsigned * pTruth = Lpk_FunTruth( p, 0 ); diff --git a/src/opt/lpk/lpkAbcFun.c b/src/opt/lpk/lpkAbcUtil.c index f7d2f402..960ebded 100644 --- a/src/opt/lpk/lpkAbcFun.c +++ b/src/opt/lpk/lpkAbcUtil.c @@ -1,6 +1,6 @@ /**CFile**************************************************************** - FileName [lpkAbcFun.c] + FileName [lpkAbcUtil.c] SystemName [ABC: Logic synthesis and verification system.] @@ -14,7 +14,7 @@ Date [Ver. 1.0. Started - April 28, 2007.] - Revision [$Id: lpkAbcFun.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $] + Revision [$Id: lpkAbcUtil.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $] ***********************************************************************/ diff --git a/src/opt/lpk/lpkCore.c b/src/opt/lpk/lpkCore.c index 2158f8f7..fda5423e 100644 --- a/src/opt/lpk/lpkCore.c +++ b/src/opt/lpk/lpkCore.c @@ -378,7 +378,7 @@ p->timeTruth += clock() - clk; // update the network clk = clock(); - pObjNew = Lpk_LpkDecompose( p->pNtk, vLeaves, pTruth, p->pPars->nLutSize, + pObjNew = Lpk_Decompose( p->pNtk, vLeaves, pTruth, p->pPars->nLutSize, (int)pCut->nNodes - (int)pCut->nNodesDup - 1, Abc_ObjRequiredLevel(p->pObj) ); p->timeEval += clock() - clk; diff --git a/src/opt/lpk/lpkInt.h b/src/opt/lpk/lpkInt.h index d04032ef..7022cc4a 100644 --- a/src/opt/lpk/lpkInt.h +++ b/src/opt/lpk/lpkInt.h @@ -118,21 +118,7 @@ struct Lpk_Man_t_ }; -// preliminary decomposition result -typedef struct Lpk_Res_t_ Lpk_Res_t; -struct Lpk_Res_t_ -{ - int nBSVars; - unsigned BSVars; - int nCofVars; - char pCofVars[4]; - int nSuppSizeS; - int nSuppSizeL; - int DelayEst; - int AreaEst; -}; - -// function to be decomposed +// internal representation of the function to be decomposed typedef struct Lpk_Fun_t_ Lpk_Fun_t; struct Lpk_Fun_t_ { @@ -148,15 +134,23 @@ struct Lpk_Fun_t_ unsigned pTruth[0]; // the truth table (contains room for three truth tables) }; -#define Lpk_SuppForEachVar( Supp, Var )\ - for ( Var = 0; Var < 16; Var++ )\ - if ( !(Supp & (1<<Var)) ) {} else - -static inline int Lpk_LutNumVars( int nLutsLim, int nLutK ) { return nLutsLim * (nLutK - 1) + 1; } -static inline int Lpk_LutNumLuts( int nVarsMax, int nLutK ) { return (nVarsMax - 1) / (nLutK - 1) + (int)((nVarsMax - 1) % (nLutK - 1) > 0); } - -static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num < 3 ); return p->pTruth + Kit_TruthWordNum(p->nVars) * Num; } +// preliminary decomposition result +typedef struct Lpk_Res_t_ Lpk_Res_t; +struct Lpk_Res_t_ +{ + int nBSVars; // the number of bound set variables + unsigned BSVars; // the bound set + int nCofVars; // the number of cofactoring variables + char pCofVars[4]; // the cofactoring variables + int nSuppSizeS; // support size of the smaller (decomposed) function + int nSuppSizeL; // support size of the larger (composition) function + int DelayEst; // estimated delay of the decomposition + int AreaEst; // estimated area of the decomposition +}; +static inline int Lpk_LutNumVars( int nLutsLim, int nLutK ) { return nLutsLim * (nLutK - 1) + 1; } +static inline int Lpk_LutNumLuts( int nVarsMax, int nLutK ) { return (nVarsMax - 1) / (nLutK - 1) + (int)((nVarsMax - 1) % (nLutK - 1) > 0); } +static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num < 3 ); return p->pTruth + Kit_TruthWordNum(p->nVars) * Num; } //////////////////////////////////////////////////////////////////////// /// MACRO DEFINITIONS /// @@ -172,14 +166,23 @@ static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num < for ( i = 0; (i < (int)(pCut)->nNodes) && (((pObj) = Abc_NtkObj(pNtk, (pCut)->pNodes[i])), 1); i++ ) #define Lpk_CutForEachNodeReverse( pNtk, pCut, pObj, i ) \ for ( i = (int)(pCut)->nNodes - 1; (i >= 0) && (((pObj) = Abc_NtkObj(pNtk, (pCut)->pNodes[i])), 1); i-- ) +#define Lpk_SuppForEachVar( Supp, Var )\ + for ( Var = 0; Var < 16; Var++ )\ + if ( !(Supp & (1<<Var)) ) {} else //////////////////////////////////////////////////////////////////////// /// FUNCTION DECLARATIONS /// //////////////////////////////////////////////////////////////////////// -/*=== lpkAbcCore.c ============================================================*/ -extern Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim ); -/*=== lpkAbcFun.c ============================================================*/ +/*=== lpkAbcDec.c ============================================================*/ +extern Abc_Obj_t * Lpk_Decompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim ); +/*=== lpkAbcDsd.c ============================================================*/ +extern Lpk_Res_t * Lpk_DsdAnalize( Lpk_Fun_t * p, int nCofDepth ); +extern Lpk_Fun_t * Lpk_DsdSplit( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet ); +/*=== lpkAbcMux.c ============================================================*/ +extern int Lpk_MuxAnalize( Lpk_Fun_t * p ); +extern Lpk_Fun_t * Lpk_MuxSplit( Lpk_Fun_t * p, int VarPol ); +/*=== lpkAbcUtil.c ============================================================*/ extern Lpk_Fun_t * Lpk_FunAlloc( int nVars ); extern void Lpk_FunFree( Lpk_Fun_t * p ); extern Lpk_Fun_t * Lpk_FunCreate( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim ); @@ -187,12 +190,6 @@ extern Lpk_Fun_t * Lpk_FunDup( Lpk_Fun_t * p, unsigned * pTruth ); extern void Lpk_FunSuppMinimize( Lpk_Fun_t * p ); extern int Lpk_SuppDelay( unsigned uSupp, char * pDelays ); extern int Lpk_SuppToVars( unsigned uBoundSet, char * pVars ); -/*=== lpkAbcDsd.c ============================================================*/ -extern Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth ); -extern Lpk_Fun_t * Lpk_FunSplitDsd( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet ); -/*=== lpkAbcMux.c ============================================================*/ -extern int Lpk_FunAnalizeMux( Lpk_Fun_t * p ); -extern Lpk_Fun_t * Lpk_FunSplitMux( Lpk_Fun_t * p, int VarPol ); /*=== lpkCut.c =========================================================*/ diff --git a/src/opt/lpk/module.make b/src/opt/lpk/module.make index 9a46e0ce..26a54894 100644 --- a/src/opt/lpk/module.make +++ b/src/opt/lpk/module.make @@ -1,4 +1,8 @@ SRC += src/opt/lpk/lpkCore.c \ + src/opt/lpk/lpkAbcDec.c \ + src/opt/lpk/lpkAbcMux.c \ + src/opt/lpk/lpkAbcDsd.c \ + src/opt/lpk/lpkAbcUtil.c \ src/opt/lpk/lpkCut.c \ src/opt/lpk/lpkMan.c \ src/opt/lpk/lpkMap.c \ |