abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dsdInt.h File Reference
#include "misc/extra/extraBdd.h"
#include "dsd.h"

Go to the source code of this file.

Data Structures

struct  Dsd_Manager_t_
 STRUCTURE DEFINITIONS ///. More...
 
struct  Dsd_Node_t_
 

Macros

#define MAXINPUTS   1000
 MACRO DEFINITIONS ///. More...
 

Functions

void Dsd_CheckCacheAllocate (int nEntries)
 PARAMETERS ///. More...
 
void Dsd_CheckCacheDeallocate ()
 
void Dsd_CheckCacheClear ()
 
int Dsd_CheckRootFunctionIdentity (DdManager *dd, DdNode *bF1, DdNode *bF2, DdNode *bC1, DdNode *bC2)
 
Dsd_Node_tDsd_TreeNodeCreate (int Type, int nDecs, int BlockNum)
 FUNCTION DEFINITIONS ///. More...
 
void Dsd_TreeNodeDelete (DdManager *dd, Dsd_Node_t *pNode)
 
void Dsd_TreeUnmark (Dsd_Manager_t *dMan)
 
DdNodeDsd_TreeGetPrimeFunctionOld (DdManager *dd, Dsd_Node_t *pNode, int fRemap)
 

Variables

ABC_NAMESPACE_HEADER_START
typedef unsigned char 
byte
 TYPEDEF DEFINITIONS ///. More...
 

Macro Definition Documentation

#define MAXINPUTS   1000

MACRO DEFINITIONS ///.

Definition at line 69 of file dsdInt.h.

Function Documentation

void Dsd_CheckCacheAllocate ( int  nEntries)

PARAMETERS ///.

FUNCTION DECLARATIONS ///

PARAMETERS ///.

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

Synopsis [(Re)allocates the local cache.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file dsdCheck.c.

64 {
65  int nRequested;
66 
68  memset( pCache, 0, sizeof(Dds_Cache_t) );
69 
70  // check what is the size of the current cache
71  nRequested = Abc_PrimeCudd( nEntries );
72  if ( pCache->nTableSize != nRequested )
73  { // the current size is different
74  // deallocate the old, allocate the new
75  if ( pCache->nTableSize )
77  // allocate memory for the hash table
78  pCache->nTableSize = nRequested;
79  pCache->pTable = ABC_ALLOC( Dsd_Entry_t, nRequested );
80  }
81  // otherwise, there is no need to allocate, just clean
83 // printf( "\nThe number of allocated cache entries = %d.\n\n", pCache->nTableSize );
84 }
char * memset()
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_IMPL_START struct Dsd_Cache_t_ Dds_Cache_t
DECLARATIONS ///.
Definition: dsdCheck.c:28
Definition: dsdCheck.c:39
void Dsd_CheckCacheClear()
Definition: dsdCheck.c:114
static Dds_Cache_t * pCache
Definition: dsdCheck.c:44
void Dsd_CheckCacheDeallocate()
Definition: dsdCheck.c:97
void Dsd_CheckCacheClear ( )

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

Synopsis [Clears the local cache.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file dsdCheck.c.

115 {
116  int i;
117  for ( i = 0; i < pCache->nTableSize; i++ )
118  pCache->pTable[0].bX[0] = NULL;
119 }
static Dds_Cache_t * pCache
Definition: dsdCheck.c:44
void Dsd_CheckCacheDeallocate ( )

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

Synopsis [Deallocates the local cache.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file dsdCheck.c.

98 {
99  ABC_FREE( pCache->pTable );
100  ABC_FREE( pCache );
101 }
static Dds_Cache_t * pCache
Definition: dsdCheck.c:44
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Dsd_CheckRootFunctionIdentity ( DdManager dd,
DdNode bF1,
DdNode bF2,
DdNode bC1,
DdNode bC2 
)

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

Synopsis [Checks whether it is true that bF1(bC1=0) == bF2(bC2=0).]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file dsdCheck.c.

134 {
135  int RetValue;
136 // pCache->nSuccess = 0;
137 // pCache->nFailure = 0;
138  RetValue = Dsd_CheckRootFunctionIdentity_rec(dd, bF1, bF2, bC1, bC2);
139 // printf( "Cache success = %d. Cache failure = %d.\n", pCache->nSuccess, pCache->nFailure );
140  return RetValue;
141 }
static int Dsd_CheckRootFunctionIdentity_rec(DdManager *dd, DdNode *bF1, DdNode *bF2, DdNode *bC1, DdNode *bC2)
Definition: dsdCheck.c:154
DdNode* Dsd_TreeGetPrimeFunctionOld ( DdManager dd,
Dsd_Node_t pNode,
int  fRemap 
)

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

Synopsis [Retuns the function of one node of the decomposition tree.]

Description [This is the old procedure. It is now superceded by the procedure Dsd_TreeGetPrimeFunction() found in "dsdLocal.c".]

SideEffects []

SeeAlso []

Definition at line 1120 of file dsdTree.c.

1121 {
1122  DdNode * bCof0, * bCof1, * bCube0, * bCube1, * bNewFunc, * bTemp;
1123  int i;
1124  static int Permute[MAXINPUTS];
1125 
1126  assert( pNode );
1127  assert( !Dsd_IsComplement( pNode ) );
1128  assert( pNode->Type == DSD_NODE_PRIME );
1129 
1130  // transform the function of this block to depend on inputs
1131  // corresponding to the formal inputs
1132 
1133  // first, substitute those inputs that have some blocks associated with them
1134  // second, remap the inputs to the top of the manager (then, it is easy to output them)
1135 
1136  // start the function
1137  bNewFunc = pNode->G; Cudd_Ref( bNewFunc );
1138  // go over all primary inputs
1139  for ( i = 0; i < pNode->nDecs; i++ )
1140  if ( pNode->pDecs[i]->Type != DSD_NODE_BUF ) // remap only if it is not the buffer
1141  {
1142  bCube0 = Extra_bddFindOneCube( dd, Cudd_Not(pNode->pDecs[i]->G) ); Cudd_Ref( bCube0 );
1143  bCof0 = Cudd_Cofactor( dd, bNewFunc, bCube0 ); Cudd_Ref( bCof0 );
1144  Cudd_RecursiveDeref( dd, bCube0 );
1145 
1146  bCube1 = Extra_bddFindOneCube( dd, pNode->pDecs[i]->G ); Cudd_Ref( bCube1 );
1147  bCof1 = Cudd_Cofactor( dd, bNewFunc, bCube1 ); Cudd_Ref( bCof1 );
1148  Cudd_RecursiveDeref( dd, bCube1 );
1149 
1150  Cudd_RecursiveDeref( dd, bNewFunc );
1151 
1152  // use the variable in the i-th level of the manager
1153 // bNewFunc = Cudd_bddIte( dd, dd->vars[dd->invperm[i]],bCof1,bCof0 ); Cudd_Ref( bNewFunc );
1154  // use the first variale in the support of the component
1155  bNewFunc = Cudd_bddIte( dd, dd->vars[pNode->pDecs[i]->S->index],bCof1,bCof0 ); Cudd_Ref( bNewFunc );
1156  Cudd_RecursiveDeref( dd, bCof0 );
1157  Cudd_RecursiveDeref( dd, bCof1 );
1158  }
1159 
1160  if ( fRemap )
1161  {
1162  // remap the function to the top of the manager
1163  // remap the function to the first variables of the manager
1164  for ( i = 0; i < pNode->nDecs; i++ )
1165  // Permute[ pNode->pDecs[i]->S->index ] = dd->invperm[i];
1166  Permute[ pNode->pDecs[i]->S->index ] = i;
1167 
1168  bNewFunc = Cudd_bddPermute( dd, bTemp = bNewFunc, Permute ); Cudd_Ref( bNewFunc );
1169  Cudd_RecursiveDeref( dd, bTemp );
1170  }
1171 
1172  Cudd_Deref( bNewFunc );
1173  return bNewFunc;
1174 }
DdNode * S
Definition: dsdInt.h:58
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
DdNode * G
Definition: dsdInt.h:57
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
#define MAXINPUTS
INCLUDES ///.
Definition: cas.h:38
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
Dsd_Node_t ** pDecs
Definition: dsdInt.h:59
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:123
DdNode * Cudd_bddPermute(DdManager *manager, DdNode *node, int *permut)
Definition: cuddCompose.c:332
Dsd_Type_t Type
Definition: dsdInt.h:56
DdNode * Extra_bddFindOneCube(DdManager *dd, DdNode *bF)
Definition: extraBddMisc.c:605
#define Dsd_IsComplement(p)
MACRO DEFINITIONS ///.
Definition: dsd.h:68
DdHalfWord index
Definition: cudd.h:279
DdNode ** vars
Definition: cuddInt.h:390
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
short nDecs
Definition: dsdInt.h:61
Dsd_Node_t* Dsd_TreeNodeCreate ( int  Type,
int  nDecs,
int  BlockNum 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Create the DSD node.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file dsdTree.c.

62 {
63  // allocate memory for this node
64  Dsd_Node_t * p = (Dsd_Node_t *) ABC_ALLOC( char, sizeof(Dsd_Node_t) );
65  memset( p, 0, sizeof(Dsd_Node_t) );
66  p->Type = (Dsd_Type_t)Type; // the type of this block
67  p->nDecs = nDecs; // the number of decompositions
68  if ( p->nDecs )
69  {
70  p->pDecs = (Dsd_Node_t **) ABC_ALLOC( char, p->nDecs * sizeof(Dsd_Node_t *) );
71  p->pDecs[0] = NULL;
72  }
73  return p;
74 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Dsd_Node_t ** pDecs
Definition: dsdInt.h:59
Dsd_Type_t Type
Definition: dsdInt.h:56
enum Dsd_Type_t_ Dsd_Type_t
Definition: dsd.h:61
short nDecs
Definition: dsdInt.h:61
void Dsd_TreeNodeDelete ( DdManager dd,
Dsd_Node_t pNode 
)

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

Synopsis [Frees the DSD node.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file dsdTree.c.

88 {
89  if ( pNode->G ) Cudd_RecursiveDeref( dd, pNode->G );
90  if ( pNode->S ) Cudd_RecursiveDeref( dd, pNode->S );
91  ABC_FREE( pNode->pDecs );
92  ABC_FREE( pNode );
93 }
DdNode * S
Definition: dsdInt.h:58
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
DdNode * G
Definition: dsdInt.h:57
Dsd_Node_t ** pDecs
Definition: dsdInt.h:59
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Dsd_TreeUnmark ( Dsd_Manager_t pDsdMan)

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

Synopsis [Unmarks the decomposition tree.]

Description [This function assumes that originally pNode->nVisits are set to zero!]

SideEffects []

SeeAlso []

Definition at line 107 of file dsdTree.c.

108 {
109  int i;
110  for ( i = 0; i < pDsdMan->nRoots; i++ )
111  Dsd_TreeUnmark_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
112 }
#define Dsd_Regular(p)
Definition: dsd.h:69
static ABC_NAMESPACE_IMPL_START void Dsd_TreeUnmark_rec(Dsd_Node_t *pNode)
FUNCTION DECLARATIONS ///.
Definition: dsdTree.c:127
int nRoots
Definition: dsdInt.h:45
Dsd_Node_t ** pRoots
Definition: dsdInt.h:48

Variable Documentation

ABC_NAMESPACE_HEADER_START typedef unsigned char byte

TYPEDEF DEFINITIONS ///.

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

FileName [dsdInt.h]

PackageName [DSD: Disjoint-support decomposition package.]

Synopsis [Internal declarations of the package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file dsdInt.h.