FUNCTION DEFINITIONS ///.
Synopsis [Returns the local function of the DSD node. ]
Description [The local function is computed using the global function of the node and the global functions of the formal inputs. The resulting local function is mapped using the topmost N variables of the manager. The number of variables N is equal to the number of formal inputs.]
55{
56 int * pForm2Var;
57 int * pVar2Form;
58 int i, iVar, iLev, * pPermute;
59 DdNode ** pbCube0, ** pbCube1;
60 DdNode * bFunc, * bRes, * bTemp;
62
66
67 pbCube0 =
ABC_ALLOC( DdNode *, dd->size );
68 pbCube1 =
ABC_ALLOC( DdNode *, dd->size );
69
70
71
72 iLev = 0;
73 for ( i = 0; i < pNode->
nDecs; i++ )
74 {
75 pForm2Var[i] = dd->invperm[i];
76 for ( bTemp = pNode->
pDecs[i]->
S; bTemp !=
b1; bTemp = cuddT(bTemp) )
77 {
78 iVar = dd->invperm[iLev];
79 pPermute[bTemp->index] = iVar;
80 pVar2Form[iVar] = i;
81 iLev++;
82 }
83
84
86 Cudd_Ref( pbCube0[i] );
88 Cudd_Ref( pbCube1[i] );
89 }
90
91
92 bFunc = Cudd_bddPermute( dd, pNode->
G, pPermute ); Cudd_Ref( bFunc );
93
94 for ( i = 0; i < pNode->
nDecs; i++ )
95 {
96 pbCube0[i] = Cudd_bddPermute( dd, bTemp = pbCube0[i], pPermute ); Cudd_Ref( pbCube0[i] );
97 Cudd_RecursiveDeref( dd, bTemp );
98 pbCube1[i] = Cudd_bddPermute( dd, bTemp = pbCube1[i], pPermute ); Cudd_Ref( pbCube1[i] );
99 Cudd_RecursiveDeref( dd, bTemp );
100 }
101
102
104 bRes = Extra_dsdRemap( dd, bFunc, pCache, pVar2Form, pForm2Var, pbCube0, pbCube1 ); Cudd_Ref( bRes );
106
107 Cudd_RecursiveDeref( dd, bFunc );
108 for ( i = 0; i < pNode->
nDecs; i++ )
109 {
110 Cudd_RecursiveDeref( dd, pbCube0[i] );
111 Cudd_RecursiveDeref( dd, pbCube1[i] );
112 }
113
115 // permute the function once again
116 // in such a way that i-th var stood for i-th formal input
117 for ( i = 0; i < dd->size; i++ )
118 pPermute[i] = -1;
119 for ( i = 0; i < pNode->nDecs; i++ )
120 pPermute[dd->invperm[i]] = i;
121 bRes = Cudd_bddPermute( dd, bTemp = bRes, pPermute ); Cudd_Ref( bRes );
122 Cudd_RecursiveDeref( dd, bTemp );
124*/
130
131 Cudd_Deref( bRes );
132 return bRes;
133}
#define ABC_ALLOC(type, num)
int st__ptrhash(const char *, int)
int st__ptrcmp(const char *, const char *)
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
void st__free_table(st__table *table)