diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2017-04-17 17:57:41 -0400 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2017-04-17 17:57:41 -0400 |
commit | f401c17facb9a13557d6a96ebd15404492a6e7f0 (patch) | |
tree | e7a484bdfaa54acbb82c8d2e455357c6979d87a1 /src | |
parent | fb12c23ad54b610c9a063991924249ef6f5e89b7 (diff) | |
download | abc-f401c17facb9a13557d6a96ebd15404492a6e7f0.tar.gz abc-f401c17facb9a13557d6a96ebd15404492a6e7f0.tar.bz2 abc-f401c17facb9a13557d6a96ebd15404492a6e7f0.zip |
Logic restruturing after mapping.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/acb/acbPush.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/src/base/acb/acbPush.c b/src/base/acb/acbPush.c new file mode 100644 index 00000000..08edc4d1 --- /dev/null +++ b/src/base/acb/acbPush.c @@ -0,0 +1,124 @@ +/**CFile**************************************************************** + + FileName [acbPush.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Hierarchical word-level netlist.] + + Synopsis [Implementation of logic pushing.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - July 21, 2015.] + + Revision [$Id: acbPush.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include "acb.h" +#include "misc/util/utilTruth.h" + +ABC_NAMESPACE_IMPL_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Check if the node can have its logic pushed.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Acb_ObjCheckFaninDsd( Acb_Ntk_t * p, int iObj, int iFanIndex ) +{ + int k, iFanin, * pFanins; + Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k ) + if ( Abc_TtCheckDsdAnd(Acb_ObjTruth(p, iObj), iFanIndex, k, NULL) >= 0 ) + return 1; + return 0; +} +int Acb_ObjCountFaninAbsorb( Acb_Ntk_t * p, int iObj, int iFanin, int iFanIndex, int nLutSize ) +{ + if ( Acb_ObjSetTravIdCur(p, iFanin) ) + return 0; + if ( Acb_ObjIsCi(p, iFanin) ) + return 0; + if ( Acb_ObjFanoutNum(p, iFanin) > 1 ) + return 0; + if ( !Acb_ObjCheckFaninDsd(p, iObj, iFanIndex) ) + return 0; + if ( Acb_ObjFaninNum(p, iFanin) == nLutSize ) + return 0; + return 1; +} +int Acb_NtkObjPushEstimate( Acb_Ntk_t * p, int iObj, int nLutSize ) +{ + int k, iFanin, * pFanins; + int Count = Acb_ObjFaninNum(p, iObj); + Acb_NtkIncTravId( p ); + Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k ) + { + Count -= Acb_ObjCountFaninAbsorb( p, iObj, iFanin, k, nLutSize ); + if ( Count <= 0 ) + return 1; + } + if ( Acb_ObjFanoutNum(p, iObj) > 1 ) + return 0; + Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k ) + if ( Abc_TtCheckOutAnd(Acb_ObjTruth(p, iObj), k, NULL) ) + break; + if ( k == Acb_ObjFaninNum(p, iFanin) ) + return 0; + iFanin = Vec_IntEntry( Acb_ObjFanout(p, iObj), 0 ); + if ( Acb_ObjFaninNum(p, iFanin) == nLutSize ) + return 0; + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Acb_NtkPushLogic( Acb_Ntk_t * p, int nLutSize, int fVerbose ) +{ + //Vec_Bit_t * vVisited = Vec_BitStart( Acb_NtkObjNumMax(p) ); + int n = 0, iObj, nNodes = 0; + Acb_NtkCreateFanout( p ); // fanout data structure + for ( n = 2; n <= nLutSize; n++ ) + Acb_NtkForEachNode( p, iObj ) + { + if ( !Acb_NtkObjPushEstimate(p, iObj, nLutSize) ) + continue; + nNodes++; + } + printf( "Performed optimization at %d nodes.\n", nNodes ); + //Vec_BitFree( vVisited ); +} + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + |