ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dsdLocal.c File Reference
#include "dsdInt.h"
Include dependency graph for dsdLocal.c:

Go to the source code of this file.

Functions

DdNode * Dsd_TreeGetPrimeFunction (DdManager *dd, Dsd_Node_t *pNode)
 FUNCTION DEFINITIONS ///.
 

Function Documentation

◆ Dsd_TreeGetPrimeFunction()

DdNode * Dsd_TreeGetPrimeFunction ( DdManager * dd,
Dsd_Node_t * pNode )

FUNCTION DEFINITIONS ///.

Function*************************************************************

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.]

SideEffects []

SeeAlso []

Definition at line 54 of file dsdLocal.c.

55{
56 int * pForm2Var; // the mapping of each formal input into its first var
57 int * pVar2Form; // the mapping of each var into its formal inputs
58 int i, iVar, iLev, * pPermute;
59 DdNode ** pbCube0, ** pbCube1;
60 DdNode * bFunc, * bRes, * bTemp;
61 st__table * pCache;
62
63 pPermute = ABC_ALLOC( int, dd->size );
64 pVar2Form = ABC_ALLOC( int, dd->size );
65 pForm2Var = ABC_ALLOC( int, dd->size );
66
67 pbCube0 = ABC_ALLOC( DdNode *, dd->size );
68 pbCube1 = ABC_ALLOC( DdNode *, dd->size );
69
70 // remap the global function in such a way that
71 // the support variables of each formal input are adjacent
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 // collect the cubes representing each assignment
85 pbCube0[i] = Extra_bddGetOneCube( dd, Cudd_Not(pNode->pDecs[i]->G) );
86 Cudd_Ref( pbCube0[i] );
87 pbCube1[i] = Extra_bddGetOneCube( dd, pNode->pDecs[i]->G );
88 Cudd_Ref( pbCube1[i] );
89 }
90
91 // remap the function
92 bFunc = Cudd_bddPermute( dd, pNode->G, pPermute ); Cudd_Ref( bFunc );
93 // remap the cube
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 // remap the function
104 bRes = Extra_dsdRemap( dd, bFunc, pCache, pVar2Form, pForm2Var, pbCube0, pbCube1 ); Cudd_Ref( bRes );
105 st__free_table( pCache );
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*/
125 ABC_FREE(pPermute);
126 ABC_FREE(pVar2Form);
127 ABC_FREE(pForm2Var);
128 ABC_FREE(pbCube0);
129 ABC_FREE(pbCube1);
130
131 Cudd_Deref( bRes );
132 return bRes;
133}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define b1
Definition bbrImage.c:97
DdNode * Extra_bddGetOneCube(DdManager *dd, DdNode *bFunc)
int st__ptrhash(const char *, int)
Definition st.c:467
int st__ptrcmp(const char *, const char *)
Definition st.c:479
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition st.c:72
void st__free_table(st__table *table)
Definition st.c:81
DdNode * G
Definition dsdInt.h:57
DdNode * S
Definition dsdInt.h:58
Dsd_Node_t ** pDecs
Definition dsdInt.h:59
short nDecs
Definition dsdInt.h:61
Definition st.h:52
Here is the call graph for this function:
Here is the caller graph for this function: