00001
00021 #include "abc.h"
00022 #include "reo.h"
00023
00027
00031
00043 void Abc_NodeBddReorder( reo_man * p, Abc_Obj_t * pNode )
00044 {
00045 Abc_Obj_t * pFanin;
00046 DdNode * bFunc;
00047 int * pOrder, i;
00048
00049 pOrder = ALLOC( int, Abc_ObjFaninNum(pNode) );
00050 for ( i = 0; i < Abc_ObjFaninNum(pNode); i++ )
00051 pOrder[i] = -1;
00052
00053 bFunc = Extra_Reorder( p, pNode->pNtk->pManFunc, pNode->pData, pOrder ); Cudd_Ref( bFunc );
00054 Cudd_RecursiveDeref( pNode->pNtk->pManFunc, pNode->pData );
00055 pNode->pData = bFunc;
00056
00057 Abc_ObjForEachFanin( pNode, pFanin, i )
00058 pOrder[i] = pNode->vFanins.pArray[ pOrder[i] ];
00059 Abc_ObjForEachFanin( pNode, pFanin, i )
00060 pNode->vFanins.pArray[i] = pOrder[i];
00061 free( pOrder );
00062 }
00063
00075 void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose )
00076 {
00077 reo_man * p;
00078 Abc_Obj_t * pNode;
00079 int i;
00080 p = Extra_ReorderInit( Abc_NtkGetFaninMax(pNtk), 100 );
00081 Abc_NtkForEachNode( pNtk, pNode, i )
00082 {
00083 if ( Abc_ObjFaninNum(pNode) < 3 )
00084 continue;
00085 if ( fVerbose )
00086 fprintf( stdout, "%10s: ", Abc_ObjName(pNode) );
00087 if ( fVerbose )
00088 fprintf( stdout, "Before = %5d BDD nodes. ", Cudd_DagSize(pNode->pData) );
00089 Abc_NodeBddReorder( p, pNode );
00090 if ( fVerbose )
00091 fprintf( stdout, "After = %5d BDD nodes.\n", Cudd_DagSize(pNode->pData) );
00092 }
00093 Extra_ReorderQuit( p );
00094 }
00095
00099
00100