ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dsd.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Dsd_IsComplement(p)
 MACRO DEFINITIONS ///.
 
#define Dsd_Regular(p)
 
#define Dsd_Not(p)
 
#define Dsd_NotCond(p, c)
 
#define Dsd_NodeForEachChild(Node, Index, Child)
 ITERATORS ///.
 

Typedefs

typedef struct Dsd_Manager_t_ Dsd_Manager_t
 TYPEDEF DEFINITIONS ///.
 
typedef struct Dsd_Node_t_ Dsd_Node_t
 
typedef enum Dsd_Type_t_ Dsd_Type_t
 

Enumerations

enum  Dsd_Type_t_ {
  DSD_NODE_NONE = 0 , DSD_NODE_CONST1 = 1 , DSD_NODE_BUF = 2 , DSD_NODE_OR = 3 ,
  DSD_NODE_EXOR = 4 , DSD_NODE_PRIME = 5
}
 STRUCTURE DEFINITIONS ///. More...
 

Functions

Dsd_Type_t Dsd_NodeReadType (Dsd_Node_t *p)
 FUNCTION DEFINITIONS ///.
 
DdNode * Dsd_NodeReadFunc (Dsd_Node_t *p)
 
DdNode * Dsd_NodeReadSupp (Dsd_Node_t *p)
 
Dsd_Node_t ** Dsd_NodeReadDecs (Dsd_Node_t *p)
 
Dsd_Node_tDsd_NodeReadDec (Dsd_Node_t *p, int i)
 
int Dsd_NodeReadDecsNum (Dsd_Node_t *p)
 
word Dsd_NodeReadMark (Dsd_Node_t *p)
 
void Dsd_NodeSetMark (Dsd_Node_t *p, word Mark)
 
DdManager * Dsd_ManagerReadDd (Dsd_Manager_t *pMan)
 
Dsd_Node_tDsd_ManagerReadRoot (Dsd_Manager_t *pMan, int i)
 
Dsd_Node_tDsd_ManagerReadInput (Dsd_Manager_t *pMan, int i)
 
Dsd_Node_tDsd_ManagerReadConst1 (Dsd_Manager_t *pMan)
 
Dsd_Manager_tDsd_ManagerStart (DdManager *dd, int nSuppMax, int fVerbose)
 FUNCTION DECLARATIONS ///.
 
void Dsd_ManagerStop (Dsd_Manager_t *dMan)
 
void Dsd_Decompose (Dsd_Manager_t *dMan, DdNode **pbFuncs, int nFuncs)
 DECOMPOSITION FUNCTIONS ///.
 
Dsd_Node_tDsd_DecomposeOne (Dsd_Manager_t *pDsdMan, DdNode *bFunc)
 
void Dsd_TreeNodeGetInfo (Dsd_Manager_t *dMan, int *DepthMax, int *GateSizeMax)
 
void Dsd_TreeNodeGetInfoOne (Dsd_Node_t *pNode, int *DepthMax, int *GateSizeMax)
 
int Dsd_TreeGetAigCost (Dsd_Node_t *pNode)
 
int Dsd_TreeCountNonTerminalNodes (Dsd_Manager_t *dMan)
 
int Dsd_TreeCountNonTerminalNodesOne (Dsd_Node_t *pRoot)
 
int Dsd_TreeCountPrimeNodes (Dsd_Manager_t *pDsdMan)
 
int Dsd_TreeCountPrimeNodesOne (Dsd_Node_t *pRoot)
 
int Dsd_TreeCollectDecomposableVars (Dsd_Manager_t *dMan, int *pVars)
 
Dsd_Node_t ** Dsd_TreeCollectNodesDfs (Dsd_Manager_t *dMan, int *pnNodes)
 
Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne (Dsd_Manager_t *pDsdMan, Dsd_Node_t *pNode, int *pnNodes)
 
void Dsd_TreePrint (FILE *pFile, Dsd_Manager_t *dMan, char *pInputNames[], char *pOutputNames[], int fShortNames, int Output, int OffSet)
 
void Dsd_TreePrint2 (FILE *pFile, Dsd_Manager_t *dMan, char *pInputNames[], char *pOutputNames[], int Output)
 
void Dsd_TreePrint3 (void *pStr, Dsd_Manager_t *pDsdMan, int Output)
 
void Dsd_TreePrint4 (void *pStr, Dsd_Manager_t *pDsdMan, int Output)
 
void Dsd_NodePrint (FILE *pFile, Dsd_Node_t *pNode)
 
int Dsd_TreeNonDsdMax (Dsd_Manager_t *pDsdMan, int Output)
 
int Dsd_TreeSuppSize (Dsd_Manager_t *pDsdMan, int Output)
 
DdNode * Dsd_TreeGetPrimeFunction (DdManager *dd, Dsd_Node_t *pNode)
 FUNCTION DEFINITIONS ///.
 

Macro Definition Documentation

◆ Dsd_IsComplement

#define Dsd_IsComplement ( p)
Value:
(((int)((ABC_PTRUINT_T) (p) & 01)))
Cube * p
Definition exorList.c:222

MACRO DEFINITIONS ///.

Definition at line 68 of file dsd.h.

◆ Dsd_NodeForEachChild

#define Dsd_NodeForEachChild ( Node,
Index,
Child )
Value:
for ( Index = 0; \
Index < Dsd_NodeReadDecsNum(Node) && \
((Child = Dsd_NodeReadDec(Node,Index))!=0); \
Index++ )
Dsd_Node_t * Dsd_NodeReadDec(Dsd_Node_t *p, int i)
Definition dsdApi.c:57
int Dsd_NodeReadDecsNum(Dsd_Node_t *p)
Definition dsdApi.c:58

ITERATORS ///.

Definition at line 78 of file dsd.h.

78#define Dsd_NodeForEachChild( Node, Index, Child ) \
79 for ( Index = 0; \
80 Index < Dsd_NodeReadDecsNum(Node) && \
81 ((Child = Dsd_NodeReadDec(Node,Index))!=0); \
82 Index++ )

◆ Dsd_Not

#define Dsd_Not ( p)
Value:
((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ 01))
struct Dsd_Node_t_ Dsd_Node_t
Definition dsd.h:60

Definition at line 70 of file dsd.h.

◆ Dsd_NotCond

#define Dsd_NotCond ( p,
c )
Value:
((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))

Definition at line 71 of file dsd.h.

◆ Dsd_Regular

#define Dsd_Regular ( p)
Value:
((Dsd_Node_t *)((ABC_PTRUINT_T)(p) & ~01))

Definition at line 69 of file dsd.h.

Typedef Documentation

◆ Dsd_Manager_t

typedef struct Dsd_Manager_t_ Dsd_Manager_t

TYPEDEF DEFINITIONS ///.

Definition at line 59 of file dsd.h.

◆ Dsd_Node_t

typedef struct Dsd_Node_t_ Dsd_Node_t

Definition at line 60 of file dsd.h.

◆ Dsd_Type_t

typedef enum Dsd_Type_t_ Dsd_Type_t

Definition at line 61 of file dsd.h.

Enumeration Type Documentation

◆ Dsd_Type_t_

STRUCTURE DEFINITIONS ///.

CFile****************************************************************

FileName [dsd.h]

PackageName [DSD: Disjoint-support decomposition package.]

Synopsis [External declarations of the package. This fast BDD-based recursive algorithm for simple (single-output) DSD is based on the following papers: (1) V. Bertacco and M. Damiani, "Disjunctive decomposition of logic functions," Proc. ICCAD '97, pp. 78-82. (2) Y. Matsunaga, "An exact and efficient algorithm for disjunctive decomposition", Proc. SASIMI '98, pp. 44-50. The scope of detected decompositions is the same as in the paper: T. Sasao and M. Matsuura, "DECOMPOS: An integrated system for functional decomposition," Proc. IWLS '98, pp. 471-477.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 8.0. Started - September 22, 2003.]

Revision [

Id
dsd.h,v 1.0 2002/22/09 00:00:00 alanmi Exp

] PARAMETERS ///

Enumerator
DSD_NODE_NONE 
DSD_NODE_CONST1 
DSD_NODE_BUF 
DSD_NODE_OR 
DSD_NODE_EXOR 
DSD_NODE_PRIME 

Definition at line 46 of file dsd.h.

46 {
47 DSD_NODE_NONE = 0,
49 DSD_NODE_BUF = 2,
50 DSD_NODE_OR = 3,
51 DSD_NODE_EXOR = 4,
53};
@ DSD_NODE_EXOR
Definition dsd.h:51
@ DSD_NODE_OR
Definition dsd.h:50
@ DSD_NODE_PRIME
Definition dsd.h:52
@ DSD_NODE_CONST1
Definition dsd.h:48
@ DSD_NODE_NONE
Definition dsd.h:47
@ DSD_NODE_BUF
Definition dsd.h:49

Function Documentation

◆ Dsd_Decompose()

void Dsd_Decompose ( Dsd_Manager_t * pDsdMan,
DdNode ** pbFuncs,
int nFuncs )
extern

DECOMPOSITION FUNCTIONS ///.

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

Synopsis [Performs DSD for the array of functions represented by BDDs.]

Description [This function takes the DSD manager, which should be previously allocated by the call to Dsd_ManagerStart(). The resulting DSD tree is stored in the DSD manager (pDsdMan->pRoots, pDsdMan->nRoots). Access to the tree is through the APIs of the manager. The resulting tree is a shared DSD DAG for the functions given in the array. For one function the resulting DAG is always a tree. The root node pointers can be complemented, as discussed in the literature referred to in "dsd.h". This procedure can be called repeatedly for different functions. There is no need to remove the decomposition tree after it is returned, because the next call to the DSD manager will "recycle" the tree. The user should not modify or dereference any data associated with the nodes of the DSD trees (the user can only change the contents of a temporary mark associated with each node by the calling to Dsd_NodeSetMark()). All the decomposition trees and intermediate nodes will be removed when the DSD manager is deallocated at the end by calling Dsd_ManagerStop().]

SideEffects []

SeeAlso []

Definition at line 113 of file dsdProc.c.

114{
115 DdManager * dd = pDsdMan->dd;
116 int i;
117 abctime clk;
118 Dsd_Node_t * pTemp;
119 int SumMaxGateSize = 0;
120 int nDecOutputs = 0;
121 int nCBFOutputs = 0;
122/*
123s_Loops1 = 0;
124s_Loops2 = 0;
125s_Loops3 = 0;
126s_Case4Calls = 0;
127s_Case4CallsSpecial = 0;
128s_Case5 = 0;
129s_Loops2Useless = 0;
130*/
131 // resize the number of roots in the manager
132 if ( pDsdMan->nRootsAlloc < nFuncs )
133 {
134 if ( pDsdMan->nRootsAlloc > 0 )
135 ABC_FREE( pDsdMan->pRoots );
136 pDsdMan->nRootsAlloc = nFuncs;
137 pDsdMan->pRoots = (Dsd_Node_t **) ABC_ALLOC( char, pDsdMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
138 }
139
140 if ( pDsdMan->fVerbose )
141 printf( "\nDecomposability statistics for individual outputs:\n" );
142
143 // set the counter of decomposition nodes
144 s_nDecBlocks = 0;
145
146 // perform decomposition for all outputs
147 clk = Abc_Clock();
148 pDsdMan->nRoots = 0;
149 s_nCascades = 0;
150 for ( i = 0; i < nFuncs; i++ )
151 {
152 int nLiteralsPrev;
153 int nDecBlocksPrev;
154 int nExorGatesPrev;
155 int nReusedBlocksPres;
156 int nCascades;
157 int MaxBlock;
158 int nPrimeBlocks;
159 abctime clk;
160
161 clk = Abc_Clock();
162 nLiteralsPrev = s_nLiterals;
163 nDecBlocksPrev = s_nDecBlocks;
164 nExorGatesPrev = s_nExorGates;
165 nReusedBlocksPres = s_nReusedBlocks;
166 nPrimeBlocks = s_nPrimeBlocks;
167
168 pDsdMan->pRoots[ pDsdMan->nRoots++ ] = dsdKernelDecompose_rec( pDsdMan, pbFuncs[i] );
169
170 Dsd_TreeNodeGetInfoOne( pDsdMan->pRoots[i], &nCascades, &MaxBlock );
171 s_nCascades = ddMax( s_nCascades, nCascades );
172 pTemp = Dsd_Regular(pDsdMan->pRoots[i]);
173 if ( pTemp->Type != DSD_NODE_PRIME || pTemp->nDecs != Extra_bddSuppSize(dd,pTemp->S) )
174 nDecOutputs++;
175 if ( MaxBlock < 3 )
176 nCBFOutputs++;
177 SumMaxGateSize += MaxBlock;
178
179 if ( pDsdMan->fVerbose )
180 {
181 printf("#%02d: ", i );
182 printf("Ins=%2d. ", Cudd_SupportSize(dd,pbFuncs[i]) );
183 printf("Gts=%3d. ", Dsd_TreeCountNonTerminalNodesOne( pDsdMan->pRoots[i] ) );
184 printf("Pri=%3d. ", Dsd_TreeCountPrimeNodesOne( pDsdMan->pRoots[i] ) );
185 printf("Max=%3d. ", MaxBlock );
186 printf("Reuse=%2d. ", s_nReusedBlocks-nReusedBlocksPres );
187 printf("Csc=%2d. ", nCascades );
188 printf("T= %.2f s. ", (float)(Abc_Clock()-clk)/(float)(CLOCKS_PER_SEC) ) ;
189 printf("Bdd=%2d. ", Cudd_DagSize(pbFuncs[i]) );
190 printf("\n");
191 fflush( stdout );
192 }
193 }
194 assert( pDsdMan->nRoots == nFuncs );
195
196 if ( pDsdMan->fVerbose )
197 {
198 printf( "\n" );
199 printf( "The cumulative decomposability statistics:\n" );
200 printf( " Total outputs = %5d\n", nFuncs );
201 printf( " Decomposable outputs = %5d\n", nDecOutputs );
202 printf( " Completely decomposable outputs = %5d\n", nCBFOutputs );
203 printf( " The sum of max gate sizes = %5d\n", SumMaxGateSize );
204 printf( " Shared BDD size = %5d\n", Cudd_SharingSize( pbFuncs, nFuncs ) );
205 printf( " Decomposition entries = %5d\n", st__count( pDsdMan->Table ) );
206 printf( " Pure decomposition time = %.2f sec\n", (float)(Abc_Clock() - clk)/(float)(CLOCKS_PER_SEC) );
207 }
208/*
209 printf( "s_Loops1 = %d.\n", s_Loops1 );
210 printf( "s_Loops2 = %d.\n", s_Loops2 );
211 printf( "s_Loops3 = %d.\n", s_Loops3 );
212 printf( "s_Case4Calls = %d.\n", s_Case4Calls );
213 printf( "s_Case4CallsSpecial = %d.\n", s_Case4CallsSpecial );
214 printf( "s_Case5 = %d.\n", s_Case5 );
215 printf( "s_Loops2Useless = %d.\n", s_Loops2Useless );
216*/
217}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
int Dsd_TreeCountPrimeNodesOne(Dsd_Node_t *pRoot)
Definition dsdTree.c:410
void Dsd_TreeNodeGetInfoOne(Dsd_Node_t *pNode, int *DepthMax, int *GateSizeMax)
Definition dsdTree.c:183
int Dsd_TreeCountNonTerminalNodesOne(Dsd_Node_t *pRoot)
Definition dsdTree.c:331
#define Dsd_Regular(p)
Definition dsd.h:69
int Extra_bddSuppSize(DdManager *dd, DdNode *bSupp)
#define st__count(table)
Definition st.h:71
DdManager * dd
Definition dsdInt.h:42
int nRootsAlloc
Definition dsdInt.h:46
st__table * Table
Definition dsdInt.h:43
Dsd_Node_t ** pRoots
Definition dsdInt.h:48
Dsd_Type_t Type
Definition dsdInt.h:56
DdNode * S
Definition dsdInt.h:58
short nDecs
Definition dsdInt.h:61
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_DecomposeOne()

Dsd_Node_t * Dsd_DecomposeOne ( Dsd_Manager_t * pDsdMan,
DdNode * bFunc )
extern

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

Synopsis [Performs decomposition for one function.]

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file dsdProc.c.

231{
232 return dsdKernelDecompose_rec( pDsdMan, bFunc );
233}

◆ Dsd_ManagerReadConst1()

Dsd_Node_t * Dsd_ManagerReadConst1 ( Dsd_Manager_t * pMan)
extern

Definition at line 95 of file dsdApi.c.

95{ return pMan->pConst1; }
Dsd_Node_t * pConst1
Definition dsdInt.h:49

◆ Dsd_ManagerReadDd()

DdManager * Dsd_ManagerReadDd ( Dsd_Manager_t * pMan)
extern

Definition at line 96 of file dsdApi.c.

96{ return pMan->dd; }

◆ Dsd_ManagerReadInput()

Dsd_Node_t * Dsd_ManagerReadInput ( Dsd_Manager_t * pMan,
int i )
extern

Definition at line 94 of file dsdApi.c.

94{ return pMan->pInputs[i]; }
Dsd_Node_t ** pInputs
Definition dsdInt.h:47

◆ Dsd_ManagerReadRoot()

Dsd_Node_t * Dsd_ManagerReadRoot ( Dsd_Manager_t * pMan,
int i )
extern

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

Synopsis [APIs of the DSD manager.]

Description [Allows the use to get hold of an individual leave of the DSD tree (Dsd_ManagerReadInput) or an individual root of the decomposition tree (Dsd_ManagerReadRoot). The root may have the complemented attribute.]

SideEffects []

SeeAlso []

Definition at line 93 of file dsdApi.c.

93{ return pMan->pRoots[i]; }

◆ Dsd_ManagerStart()

Dsd_Manager_t * Dsd_ManagerStart ( DdManager * dd,
int nSuppMax,
int fVerbose )
extern

FUNCTION DECLARATIONS ///.

CFile****************************************************************

FileName [dsdMan.c]

PackageName [DSD: Disjoint-support decomposition package.]

Synopsis [APIs of the DSD manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 8.0. Started - September 22, 2003.]

Revision [

Id
dsdMan.c,v 1.0 2002/22/09 00:00:00 alanmi Exp

] API OF DSD MANAGER /// Function*************************************************************

Synopsis [Starts the DSD manager.]

Description [Takes the started BDD manager and the maximum support size of the function to be DSD-decomposed. The manager should have at least as many variables as there are variables in the support. The functions should be expressed using the first nSuppSizeMax variables in the manager (these may be ordered not necessarily on top of the manager).]

SideEffects []

SeeAlso []

Definition at line 47 of file dsdMan.c.

48{
49 Dsd_Manager_t * dMan;
50 Dsd_Node_t * pNode;
51 int i;
52
54
55 dMan = ABC_ALLOC( Dsd_Manager_t, 1 );
56 memset( dMan, 0, sizeof(Dsd_Manager_t) );
57 dMan->dd = dd;
58 dMan->nInputs = nSuppMax;
59 dMan->fVerbose = fVerbose;
60 dMan->nRoots = 0;
61 dMan->nRootsAlloc = 50;
62 dMan->pRoots = (Dsd_Node_t **) ABC_ALLOC( char, dMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
63 dMan->pInputs = (Dsd_Node_t **) ABC_ALLOC( char, dMan->nInputs * sizeof(Dsd_Node_t *) );
64
65 // create the primary inputs and insert them into the table
67 for ( i = 0; i < dMan->nInputs; i++ )
68 {
69 pNode = Dsd_TreeNodeCreate( DSD_NODE_BUF, 1, 0 );
70 pNode->G = dd->vars[i]; Cudd_Ref( pNode->G );
71 pNode->S = dd->vars[i]; Cudd_Ref( pNode->S );
72 st__insert( dMan->Table, (char*)dd->vars[i], (char*)pNode );
73 dMan->pInputs[i] = pNode;
74 }
75 pNode = Dsd_TreeNodeCreate( DSD_NODE_CONST1, 0, 0 );
76 pNode->G = b1; Cudd_Ref( pNode->G );
77 pNode->S = b1; Cudd_Ref( pNode->S );
78 st__insert( dMan->Table, (char*)b1, (char*)pNode );
79 dMan->pConst1 = pNode;
80
82 return dMan;
83}
#define b1
Definition bbrImage.c:97
void Dsd_CheckCacheAllocate(int nEntries)
FUNCTION DEFINITIONS ///.
Definition dsdCheck.c:63
Dsd_Node_t * Dsd_TreeNodeCreate(int Type, int nDecs, int BlockNum)
FUNCTION DEFINITIONS ///.
Definition dsdTree.c:61
struct Dsd_Manager_t_ Dsd_Manager_t
TYPEDEF DEFINITIONS ///.
Definition dsd.h:59
int nSuppMax
Definition llb3Image.c:83
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
int st__insert(st__table *table, const char *key, char *value)
Definition st.c:171
DdNode * G
Definition dsdInt.h:57
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_ManagerStop()

void Dsd_ManagerStop ( Dsd_Manager_t * dMan)
extern

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

Synopsis [Stops the DSD manager.]

Description [Stopping the DSD manager automatically derefereces and deallocates all the DSD nodes that were created during the life time of the DSD manager. As a result, the user does not need to deref or deallocate any DSD nodes or trees that are derived and placed in the manager while it exists.]

SideEffects []

SeeAlso []

Definition at line 100 of file dsdMan.c.

101{
102 st__generator * gen;
103 Dsd_Node_t * pNode;
104 DdNode * bFunc;
105 // delete the nodes
106 st__foreach_item( dMan->Table, gen, (const char**)&bFunc, (char**)&pNode )
107 Dsd_TreeNodeDelete( dMan->dd, Dsd_Regular(pNode) );
108 st__free_table(dMan->Table);
109 ABC_FREE( dMan->pInputs );
110 ABC_FREE( dMan->pRoots );
111 ABC_FREE( dMan );
113}
void Dsd_CheckCacheDeallocate()
Definition dsdCheck.c:97
void Dsd_TreeNodeDelete(DdManager *dd, Dsd_Node_t *pNode)
Definition dsdTree.c:87
void st__free_table(st__table *table)
Definition st.c:81
#define st__foreach_item(table, gen, key, value)
Definition st.h:107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_NodePrint()

void Dsd_NodePrint ( FILE * pFile,
Dsd_Node_t * pNode )
extern

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

Synopsis [Prints the decompostion tree into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1138 of file dsdTree.c.

1139{
1140 Dsd_Node_t * pNodeR;
1141 int SigCounter = 1;
1142 pNodeR = Dsd_Regular(pNode);
1143 Dsd_NodePrint_rec( pFile, pNodeR, pNodeR != pNode, "F", 0, &SigCounter );
1144}

◆ Dsd_NodeReadDec()

Dsd_Node_t * Dsd_NodeReadDec ( Dsd_Node_t * p,
int i )
extern

Definition at line 57 of file dsdApi.c.

57{ return p->pDecs[i]; }

◆ Dsd_NodeReadDecs()

Dsd_Node_t ** Dsd_NodeReadDecs ( Dsd_Node_t * p)
extern

Definition at line 56 of file dsdApi.c.

56{ return p->pDecs; }

◆ Dsd_NodeReadDecsNum()

int Dsd_NodeReadDecsNum ( Dsd_Node_t * p)
extern

Definition at line 58 of file dsdApi.c.

58{ return p->nDecs; }

◆ Dsd_NodeReadFunc()

DdNode * Dsd_NodeReadFunc ( Dsd_Node_t * p)
extern

Definition at line 54 of file dsdApi.c.

54{ return p->G; }

◆ Dsd_NodeReadMark()

word Dsd_NodeReadMark ( Dsd_Node_t * p)
extern

Definition at line 59 of file dsdApi.c.

59{ return p->Mark; }

◆ Dsd_NodeReadSupp()

DdNode * Dsd_NodeReadSupp ( Dsd_Node_t * p)
extern

Definition at line 55 of file dsdApi.c.

55{ return p->S; }

◆ Dsd_NodeReadType()

Dsd_Type_t Dsd_NodeReadType ( Dsd_Node_t * p)
extern

FUNCTION DEFINITIONS ///.

FUNCTION DEFINITIONS ///.

CFile****************************************************************

FileName [dsdApi.c]

PackageName [DSD: Disjoint-support decomposition package.]

Synopsis [Implementation of API functions.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 8.0. Started - September 22, 2003.]

Revision [

Id
dsdApi.c,v 1.0 2002/22/09 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [APIs of the DSD node.]

Description [The node's type can be retrieved by calling Dsd_NodeReadType(). The type is one of the following: constant 1 node, the buffer (or the elementary variable), OR gate, EXOR gate, or PRIME function (a non-DSD-decomposable function with more than two inputs). The return value of Dsd_NodeReadFunc() is the global function of the DSD node. The return value of Dsd_NodeReadSupp() is the support of the global function of the DSD node. The array of DSD nodes returned by Dsd_NodeReadDecs() is the array of decomposition nodes for the formal inputs of the given node. The number of decomposition entries returned by Dsd_NodeReadDecsNum() is the number of formal inputs. The mark is explained below.]

SideEffects []

SeeAlso []

Definition at line 53 of file dsdApi.c.

53{ return p->Type; }

◆ Dsd_NodeSetMark()

void Dsd_NodeSetMark ( Dsd_Node_t * p,
word Mark )
extern

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

Synopsis [APIs of the DSD node.]

Description [This API allows the user to set the integer mark in the given DSD node. The mark is guaranteed to persist as long as the calls to the decomposition are not performed. In any case, the mark is useful to associate the node with some temporary information, such as its number in the DFS ordered list of the DSD nodes or its number in the BLIF file that it being written.]

SideEffects []

SeeAlso []

Definition at line 77 of file dsdApi.c.

77{ p->Mark = Mark; }

◆ Dsd_TreeCollectDecomposableVars()

int Dsd_TreeCollectDecomposableVars ( Dsd_Manager_t * pDsdMan,
int * pVars )
extern

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

Synopsis [Collects the decomposable vars on the PI side.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file dsdTree.c.

471{
472 int nVars;
473
474 // set the vars collected to 0
475 nVars = 0;
476 Dsd_TreeCollectDecomposableVars_rec( pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[0]), pVars, &nVars );
477 // return the number of collected vars
478 return nVars;
479}

◆ Dsd_TreeCollectNodesDfs()

Dsd_Node_t ** Dsd_TreeCollectNodesDfs ( Dsd_Manager_t * pDsdMan,
int * pnNodes )
extern

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

Synopsis [Creates the DFS ordered array of DSD nodes in the tree.]

Description [The collected nodes do not include the terminal nodes and the constant 1 node. The array of nodes is returned. The number of entries in the array is returned in the variale pnNodes.]

SideEffects []

SeeAlso []

Definition at line 555 of file dsdTree.c.

556{
557 Dsd_Node_t ** ppNodes;
558 int nNodes, nNodesAlloc;
559 int i;
560
561 nNodesAlloc = Dsd_TreeCountNonTerminalNodes(pDsdMan);
562 nNodes = 0;
563 ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
564 for ( i = 0; i < pDsdMan->nRoots; i++ )
565 Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pDsdMan->pRoots[i]), ppNodes, &nNodes );
566 Dsd_TreeUnmark( pDsdMan );
567 assert( nNodesAlloc == nNodes );
568 *pnNodes = nNodes;
569 return ppNodes;
570}
int Dsd_TreeCountNonTerminalNodes(Dsd_Manager_t *pDsdMan)
Definition dsdTree.c:310
void Dsd_TreeUnmark(Dsd_Manager_t *pDsdMan)
Definition dsdTree.c:107
Here is the call graph for this function:

◆ Dsd_TreeCollectNodesDfsOne()

Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne ( Dsd_Manager_t * pDsdMan,
Dsd_Node_t * pNode,
int * pnNodes )
extern

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

Synopsis [Creates the DFS ordered array of DSD nodes in the tree.]

Description [The collected nodes do not include the terminal nodes and the constant 1 node. The array of nodes is returned. The number of entries in the array is returned in the variale pnNodes.]

SideEffects []

SeeAlso []

Definition at line 585 of file dsdTree.c.

586{
587 Dsd_Node_t ** ppNodes;
588 int nNodes, nNodesAlloc;
589 nNodesAlloc = Dsd_TreeCountNonTerminalNodesOne(pNode);
590 nNodes = 0;
591 ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
592 Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pNode), ppNodes, &nNodes );
593 Dsd_TreeUnmark_rec(Dsd_Regular(pNode));
594 assert( nNodesAlloc == nNodes );
595 *pnNodes = nNodes;
596 return ppNodes;
597}
int Dsd_TreeCountNonTerminalNodesOne(Dsd_Node_t *pRoot)
Definition dsdTree.c:331
Here is the call graph for this function:

◆ Dsd_TreeCountNonTerminalNodes()

int Dsd_TreeCountNonTerminalNodes ( Dsd_Manager_t * pDsdMan)
extern

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

Synopsis [Counts non-terminal nodes of the DSD tree.]

Description [Nonterminal nodes include all the nodes with the support more than 1. These are OR, EXOR, and PRIME nodes. They do not include the elementary variable nodes and the constant 1 node.]

SideEffects []

SeeAlso []

Definition at line 310 of file dsdTree.c.

311{
312 int Counter, i;
313 Counter = 0;
314 for ( i = 0; i < pDsdMan->nRoots; i++ )
315 Counter += Dsd_TreeCountNonTerminalNodes_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
316 Dsd_TreeUnmark( pDsdMan );
317 return Counter;
318}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeCountNonTerminalNodesOne()

int Dsd_TreeCountNonTerminalNodesOne ( Dsd_Node_t * pRoot)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 331 of file dsdTree.c.

332{
333 int Counter = 0;
334
335 // go through the list of successors and call recursively
336 Counter = Dsd_TreeCountNonTerminalNodes_rec( Dsd_Regular(pRoot) );
337
338 Dsd_TreeUnmark_rec( Dsd_Regular(pRoot) );
339 return Counter;
340}
Here is the caller graph for this function:

◆ Dsd_TreeCountPrimeNodes()

int Dsd_TreeCountPrimeNodes ( Dsd_Manager_t * pDsdMan)
extern

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

Synopsis [Counts prime nodes of the DSD tree.]

Description [Prime nodes are nodes with the support more than 2, that is not an OR or EXOR gate.]

SideEffects []

SeeAlso []

Definition at line 389 of file dsdTree.c.

390{
391 int Counter, i;
392 Counter = 0;
393 for ( i = 0; i < pDsdMan->nRoots; i++ )
394 Counter += Dsd_TreeCountPrimeNodes_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
395 Dsd_TreeUnmark( pDsdMan );
396 return Counter;
397}
Here is the call graph for this function:

◆ Dsd_TreeCountPrimeNodesOne()

int Dsd_TreeCountPrimeNodesOne ( Dsd_Node_t * pRoot)
extern

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

Synopsis [Counts prime nodes for one root.]

Description []

SideEffects []

SeeAlso []

Definition at line 410 of file dsdTree.c.

411{
412 int Counter = 0;
413
414 // go through the list of successors and call recursively
415 Counter = Dsd_TreeCountPrimeNodes_rec( Dsd_Regular(pRoot) );
416
417 Dsd_TreeUnmark_rec( Dsd_Regular(pRoot) );
418 return Counter;
419}
Here is the caller graph for this function:

◆ Dsd_TreeGetAigCost()

int Dsd_TreeGetAigCost ( Dsd_Node_t * pNode)
extern

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

Synopsis [Counts AIG nodes needed to implement this node.]

Description [Assumes that the only primes of the DSD tree are MUXes.]

SideEffects []

SeeAlso []

Definition at line 291 of file dsdTree.c.

292{
293 return Dsd_TreeGetAigCost_rec( Dsd_Regular(pNode) );
294}
int Dsd_TreeGetAigCost_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:255
Here is the call graph for this function:

◆ Dsd_TreeGetPrimeFunction()

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

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}
DdNode * Extra_bddGetOneCube(DdManager *dd, DdNode *bFunc)
Dsd_Node_t ** pDecs
Definition dsdInt.h:59
Definition st.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeNodeGetInfo()

void Dsd_TreeNodeGetInfo ( Dsd_Manager_t * pDsdMan,
int * DepthMax,
int * GateSizeMax )
extern

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

Synopsis [Getting information about the node.]

Description [This function computes the max depth and the max gate size of the tree rooted at the node.]

SideEffects []

SeeAlso []

Definition at line 156 of file dsdTree.c.

157{
158 int i;
159 s_DepthMax = 0;
160 s_GateSizeMax = 0;
161
162 for ( i = 0; i < pDsdMan->nRoots; i++ )
163 Dsd_TreeGetInfo_rec( Dsd_Regular( pDsdMan->pRoots[i] ), 0 );
164
165 if ( DepthMax )
166 *DepthMax = s_DepthMax;
167 if ( GateSizeMax )
168 *GateSizeMax = s_GateSizeMax;
169}

◆ Dsd_TreeNodeGetInfoOne()

void Dsd_TreeNodeGetInfoOne ( Dsd_Node_t * pNode,
int * DepthMax,
int * GateSizeMax )
extern

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

Synopsis [Getting information about the node.]

Description [This function computes the max depth and the max gate size of the tree rooted at the node.]

SideEffects []

SeeAlso []

Definition at line 183 of file dsdTree.c.

184{
185 s_DepthMax = 0;
186 s_GateSizeMax = 0;
187
188 Dsd_TreeGetInfo_rec( Dsd_Regular(pNode), 0 );
189
190 if ( DepthMax )
191 *DepthMax = s_DepthMax;
192 if ( GateSizeMax )
193 *GateSizeMax = s_GateSizeMax;
194}
Here is the caller graph for this function:

◆ Dsd_TreeNonDsdMax()

int Dsd_TreeNonDsdMax ( Dsd_Manager_t * pDsdMan,
int Output )
extern

Definition at line 655 of file dsdTree.c.

656{
657 if ( Output == -1 )
658 {
659 int i, Res = 0;
660 for ( i = 0; i < pDsdMan->nRoots; i++ )
661 Res = Abc_MaxInt( Res, Dsd_TreeNonDsdMax_rec( Dsd_Regular( pDsdMan->pRoots[i] ) ) );
662 return Res;
663 }
664 else
665 {
666 assert( Output >= 0 && Output < pDsdMan->nRoots );
667 return Dsd_TreeNonDsdMax_rec( Dsd_Regular( pDsdMan->pRoots[Output] ) );
668 }
669}
int Dsd_TreeNonDsdMax_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:641
Here is the call graph for this function:

◆ Dsd_TreePrint()

void Dsd_TreePrint ( FILE * pFile,
Dsd_Manager_t * pDsdMan,
char * pInputNames[],
char * pOutputNames[],
int fShortNames,
int Output,
int OffSet )
extern

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

Synopsis [Prints the decompostion tree into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 830 of file dsdTree.c.

831{
832 Dsd_Node_t * pNode;
833 int SigCounter;
834 int i;
835 SigCounter = 1;
836
837 if ( Output == -1 )
838 {
839 for ( i = 0; i < pDsdMan->nRoots; i++ )
840 {
841 pNode = Dsd_Regular( pDsdMan->pRoots[i] );
842 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->pRoots[i]), pInputNames, pOutputNames[i], OffSet, &SigCounter, fShortNames );
843 }
844 }
845 else
846 {
847 assert( Output >= 0 && Output < pDsdMan->nRoots );
848 pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
849 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->pRoots[Output]), pInputNames, pOutputNames[Output], OffSet, &SigCounter, fShortNames );
850 }
851}
Here is the caller graph for this function:

◆ Dsd_TreePrint2()

void Dsd_TreePrint2 ( FILE * pFile,
Dsd_Manager_t * dMan,
char * pInputNames[],
char * pOutputNames[],
int Output )
extern

Definition at line 1106 of file dsdTree.c.

1107{
1108 if ( Output == -1 )
1109 {
1110 int i;
1111 for ( i = 0; i < pDsdMan->nRoots; i++ )
1112 {
1113 fprintf( pFile, "%8s = ", pOutputNames[i] );
1114 Dsd_TreePrint2_rec( pFile, pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[i]), Dsd_IsComplement(pDsdMan->pRoots[i]), pInputNames );
1115 fprintf( pFile, "\n" );
1116 }
1117 }
1118 else
1119 {
1120 assert( Output >= 0 && Output < pDsdMan->nRoots );
1121 fprintf( pFile, "%8s = ", pOutputNames[Output] );
1122 Dsd_TreePrint2_rec( pFile, pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[Output]), Dsd_IsComplement(pDsdMan->pRoots[Output]), pInputNames );
1123 fprintf( pFile, "\n" );
1124 }
1125}
void Dsd_TreePrint2_rec(FILE *pFile, DdManager *dd, Dsd_Node_t *pNode, int fComp, char *pInputNames[])
Definition dsdTree.c:1042
#define Dsd_IsComplement(p)
MACRO DEFINITIONS ///.
Definition dsd.h:68
Here is the call graph for this function:

◆ Dsd_TreePrint3()

void Dsd_TreePrint3 ( void * pStr,
Dsd_Manager_t * pDsdMan,
int Output )
extern

Definition at line 748 of file dsdTree.c.

749{
750 Vec_Str_t * p = (Vec_Str_t *)pStr;
751 assert( Output >= 0 && Output < pDsdMan->nRoots );
752 Dsd_Node_t * pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
753 int fCompl = pNode != pDsdMan->pRoots[Output];
754 if ( pNode->Type == DSD_NODE_CONST1 )
755 Vec_StrPush( p, fCompl ? '0' : '1' );
756 else {
757 if ( fCompl )
758 Vec_StrPush( p, '~' );
759 Dsd_TreePrint3_rec( p, pNode );
760 }
761 Vec_StrPush( p, '\0' );
762}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Dsd_TreePrint3_rec(Vec_Str_t *p, Dsd_Node_t *pNode)
Definition dsdTree.c:720
Here is the call graph for this function:

◆ Dsd_TreePrint4()

void Dsd_TreePrint4 ( void * pStr,
Dsd_Manager_t * pDsdMan,
int Output )
extern

Definition at line 803 of file dsdTree.c.

804{
805 Vec_Str_t * p = (Vec_Str_t *)pStr;
806 assert( Output >= 0 && Output < pDsdMan->nRoots );
807 Dsd_Node_t * pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
808 int fCompl = pNode != pDsdMan->pRoots[Output];
809 if ( pNode->Type == DSD_NODE_CONST1 )
810 Vec_StrPush( p, fCompl ? '0' : '1' );
811 else {
812 if ( fCompl ^ (pNode->Type == DSD_NODE_OR) )
813 Vec_StrPush( p, '~' );
814 Dsd_TreePrint4_rec( p, pNode );
815 }
816 Vec_StrPush( p, '\0' );
817}
void Dsd_TreePrint4_rec(Vec_Str_t *p, Dsd_Node_t *pNode)
Definition dsdTree.c:775
Here is the call graph for this function:

◆ Dsd_TreeSuppSize()

int Dsd_TreeSuppSize ( Dsd_Manager_t * pDsdMan,
int Output )
extern

Definition at line 693 of file dsdTree.c.

694{
695 if ( Output == -1 )
696 {
697 int i, Res = 0;
698 for ( i = 0; i < pDsdMan->nRoots; i++ )
699 Res += Dsd_TreeSuppSize_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
700 return Res;
701 }
702 else
703 {
704 assert( Output >= 0 && Output < pDsdMan->nRoots );
705 return Dsd_TreeSuppSize_rec( Dsd_Regular( pDsdMan->pRoots[Output] ) );
706 }
707}
int Dsd_TreeSuppSize_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:682
Here is the call graph for this function: