abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcReorder.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcReorder.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Reordering local BDDs of the nodes.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: abcReorder.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "bdd/reo/reo.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Reorders BDD of the local function of the node.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
46 {
47  Abc_Obj_t * pFanin;
48  DdNode * bFunc;
49  int * pOrder, i;
50  // create the temporary array for the variable order
51  pOrder = ABC_ALLOC( int, Abc_ObjFaninNum(pNode) );
52  for ( i = 0; i < Abc_ObjFaninNum(pNode); i++ )
53  pOrder[i] = -1;
54  // reorder the BDD
55  bFunc = Extra_Reorder( p, (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData, pOrder ); Cudd_Ref( bFunc );
56  Cudd_RecursiveDeref( (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData );
57  pNode->pData = bFunc;
58  // update the fanin order
59  Abc_ObjForEachFanin( pNode, pFanin, i )
60  pOrder[i] = pNode->vFanins.pArray[ pOrder[i] ];
61  Abc_ObjForEachFanin( pNode, pFanin, i )
62  pNode->vFanins.pArray[i] = pOrder[i];
63  ABC_FREE( pOrder );
64 }
65 
66 /**Function*************************************************************
67 
68  Synopsis [Reorders BDDs of the local functions.]
69 
70  Description []
71 
72  SideEffects []
73 
74  SeeAlso []
75 
76 ***********************************************************************/
77 void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose )
78 {
79  reo_man * p;
80  Abc_Obj_t * pNode;
81  int i;
82  Abc_NtkRemoveDupFanins( pNtk );
83  Abc_NtkMinimumBase( pNtk );
84  p = Extra_ReorderInit( Abc_NtkGetFaninMax(pNtk), 100 );
85  Abc_NtkForEachNode( pNtk, pNode, i )
86  {
87  if ( Abc_ObjFaninNum(pNode) < 3 )
88  continue;
89  if ( fVerbose )
90  fprintf( stdout, "%10s: ", Abc_ObjName(pNode) );
91  if ( fVerbose )
92  fprintf( stdout, "Before = %5d BDD nodes. ", Cudd_DagSize((DdNode *)pNode->pData) );
93  Abc_NodeBddReorder( p, pNode );
94  if ( fVerbose )
95  fprintf( stdout, "After = %5d BDD nodes.\n", Cudd_DagSize((DdNode *)pNode->pData) );
96  }
97  Extra_ReorderQuit( p );
98 }
99 
100 ////////////////////////////////////////////////////////////////////////
101 /// END OF FILE ///
102 ////////////////////////////////////////////////////////////////////////
103 
104 
106 
ABC_NAMESPACE_IMPL_START void Abc_NodeBddReorder(reo_man *p, Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcReorder.c:45
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcMinBase.c:48
static Llb_Mgr_t * p
Definition: llb3Image.c:950
DdNode * Extra_Reorder(reo_man *p, DdManager *dd, DdNode *Func, int *pOrder)
Definition: reoApi.c:262
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
Vec_Int_t vFanins
Definition: abc.h:143
ABC_DLL int Abc_NtkRemoveDupFanins(Abc_Ntk_t *pNtk)
Definition: abcMinBase.c:116
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Abc_NtkBddReorder(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcReorder.c:77
void * pManFunc
Definition: abc.h:191
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
reo_man * Extra_ReorderInit(int nDdVarsMax, int nNodesMax)
FUNCTION DECLARATIONS ///.
Definition: reoApi.c:50
void Extra_ReorderQuit(reo_man *p)
Definition: reoApi.c:79
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Definition: reo.h:101
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442