Commit bef247a4 by Alan Mishchenko

Logic restructuring after mapping.

parent 4124a00d
...@@ -5863,6 +5863,7 @@ int Abc_CommandLogicPush( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -5863,6 +5863,7 @@ int Abc_CommandLogicPush( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "This command can only be applied to a logic network.\n" ); Abc_Print( -1, "This command can only be applied to a logic network.\n" );
return 1; return 1;
} }
nLutSize = Abc_MaxInt( nLutSize, Abc_NtkGetFaninMax(pNtk) );
Abc_NtkToSop( pNtk, -1, ABC_INFINITY ); Abc_NtkToSop( pNtk, -1, ABC_INFINITY );
pNtkRes = Abc_NtkOptPush( pNtk, nLutSize, fVerbose ); pNtkRes = Abc_NtkOptPush( pNtk, nLutSize, fVerbose );
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
...@@ -262,7 +262,7 @@ void Acb_ObjRemoveBufInv( Acb_Ntk_t * p, int iObj ) ...@@ -262,7 +262,7 @@ void Acb_ObjRemoveBufInv( Acb_Ntk_t * p, int iObj )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline int Acb_ObjFindPushableIndex( Acb_Ntk_t * p, int iObj, int iFanIndex ) static inline int Acb_ObjFindFaninPushableIndex( Acb_Ntk_t * p, int iObj, int iFanIndex )
{ {
int k, iFanin, * pFanins; int k, iFanin, * pFanins;
Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k ) Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k )
...@@ -270,6 +270,14 @@ static inline int Acb_ObjFindPushableIndex( Acb_Ntk_t * p, int iObj, int iFanInd ...@@ -270,6 +270,14 @@ static inline int Acb_ObjFindPushableIndex( Acb_Ntk_t * p, int iObj, int iFanInd
return k; return k;
return -1; return -1;
} }
static inline int Acb_ObjFindFanoutPushableIndex( Acb_Ntk_t * p, int iObj )
{
int k, iFanin, * pFanins;
Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k )
if ( Abc_TtCheckOutAnd(Acb_ObjTruth(p, iObj), k, NULL) >= 0 )
return k;
return -1;
}
int Acb_ObjPushToFanins( Acb_Ntk_t * p, int iObj, int nLutSize ) int Acb_ObjPushToFanins( Acb_Ntk_t * p, int iObj, int nLutSize )
{ {
int k, k2, iFanin, * pFanins; int k, k2, iFanin, * pFanins;
...@@ -283,11 +291,23 @@ int Acb_ObjPushToFanins( Acb_Ntk_t * p, int iObj, int nLutSize ) ...@@ -283,11 +291,23 @@ int Acb_ObjPushToFanins( Acb_Ntk_t * p, int iObj, int nLutSize )
continue; continue;
if ( Acb_ObjFaninNum(p, iFanin) == nLutSize ) if ( Acb_ObjFaninNum(p, iFanin) == nLutSize )
continue; continue;
if ( (k2 = Acb_ObjFindPushableIndex(p, iObj, k)) == -1 ) if ( (k2 = Acb_ObjFindFaninPushableIndex(p, iObj, k)) == -1 )
continue; continue;
//printf( "Object %4d : Pushing fanin %d (%d) into fanin %d.\n", iObj, Acb_ObjFanin(p, iObj, k2), k2, iFanin );
Acb_ObjPushToFanin( p, iObj, k2, iFanin ); Acb_ObjPushToFanin( p, iObj, k2, iFanin );
return 1; return 1;
} }
if ( Acb_ObjFaninNum(p, iObj) == 2 && Acb_ObjFanoutNum(p, iObj) == 1 )
{
int iFanout = Acb_ObjFanout( p, iObj, 0 );
if ( !Acb_ObjIsCo(p, iFanout) && Acb_ObjFaninNum(p, iFanout) < nLutSize )
{
k2 = Acb_ObjFindFanoutPushableIndex( p, iObj );
//printf( "Object %4d : Pushing fanin %d (%d) into fanout %d.\n", iObj, Acb_ObjFanin(p, iObj, k2), k2, iFanout );
Acb_ObjPushToFanout( p, iObj, k2, iFanout );
return 1;
}
}
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment