summaryrefslogtreecommitdiffstats
path: root/src/bdd/dsd
diff options
context:
space:
mode:
Diffstat (limited to 'src/bdd/dsd')
-rw-r--r--src/bdd/dsd/dsd.h32
-rw-r--r--src/bdd/dsd/dsdCheck.c12
-rw-r--r--src/bdd/dsd/dsdLocal.c20
-rw-r--r--src/bdd/dsd/dsdMan.c12
-rw-r--r--src/bdd/dsd/dsdProc.c4
-rw-r--r--src/bdd/dsd/dsdTree.c20
6 files changed, 50 insertions, 50 deletions
diff --git a/src/bdd/dsd/dsd.h b/src/bdd/dsd/dsd.h
index 4a16bfc1..affdbe6f 100644
--- a/src/bdd/dsd/dsd.h
+++ b/src/bdd/dsd/dsd.h
@@ -28,18 +28,6 @@
#ifndef __DSD_H__
#define __DSD_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-////////////////////////////////////////////////////////////////////////
-/// TYPEDEF DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-typedef struct Dsd_Manager_t_ Dsd_Manager_t;
-typedef struct Dsd_Node_t_ Dsd_Node_t;
-typedef enum Dsd_Type_t_ Dsd_Type_t;
-
////////////////////////////////////////////////////////////////////////
/// STRUCTURE DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
@@ -48,6 +36,10 @@ typedef enum Dsd_Type_t_ Dsd_Type_t;
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// types of DSD nodes
enum Dsd_Type_t_ {
DSD_NODE_NONE = 0,
@@ -59,14 +51,22 @@ enum Dsd_Type_t_ {
};
////////////////////////////////////////////////////////////////////////
+/// TYPEDEF DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+typedef struct Dsd_Manager_t_ Dsd_Manager_t;
+typedef struct Dsd_Node_t_ Dsd_Node_t;
+typedef enum Dsd_Type_t_ Dsd_Type_t;
+
+////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
// complementation and testing for pointers for decomposition entries
-#define Dsd_IsComplement(p) (((int)((PORT_PTRUINT_T) (p) & 01)))
-#define Dsd_Regular(p) ((Dsd_Node_t *)((PORT_PTRUINT_T)(p) & ~01))
-#define Dsd_Not(p) ((Dsd_Node_t *)((PORT_PTRUINT_T)(p) ^ 01))
-#define Dsd_NotCond(p,c) ((Dsd_Node_t *)((PORT_PTRUINT_T)(p) ^ (c)))
+#define Dsd_IsComplement(p) (((int)((ABC_PTRUINT_T) (p) & 01)))
+#define Dsd_Regular(p) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) & ~01))
+#define Dsd_Not(p) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ 01))
+#define Dsd_NotCond(p,c) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))
////////////////////////////////////////////////////////////////////////
/// ITERATORS ///
diff --git a/src/bdd/dsd/dsdCheck.c b/src/bdd/dsd/dsdCheck.c
index ce466a71..926237ca 100644
--- a/src/bdd/dsd/dsdCheck.c
+++ b/src/bdd/dsd/dsdCheck.c
@@ -61,7 +61,7 @@ void Dsd_CheckCacheAllocate( int nEntries )
{
int nRequested;
- pCache = ALLOC( Dds_Cache_t, 1 );
+ pCache = ABC_ALLOC( Dds_Cache_t, 1 );
memset( pCache, 0, sizeof(Dds_Cache_t) );
// check what is the size of the current cache
@@ -73,7 +73,7 @@ void Dsd_CheckCacheAllocate( int nEntries )
Dsd_CheckCacheDeallocate();
// allocate memory for the hash table
pCache->nTableSize = nRequested;
- pCache->pTable = ALLOC( Dsd_Entry_t, nRequested );
+ pCache->pTable = ABC_ALLOC( Dsd_Entry_t, nRequested );
}
// otherwise, there is no need to allocate, just clean
Dsd_CheckCacheClear();
@@ -93,8 +93,8 @@ void Dsd_CheckCacheAllocate( int nEntries )
******************************************************************************/
void Dsd_CheckCacheDeallocate()
{
- free( pCache->pTable );
- free( pCache );
+ ABC_FREE( pCache->pTable );
+ ABC_FREE( pCache );
}
/**Function********************************************************************
@@ -183,7 +183,7 @@ int Dsd_CheckRootFunctionIdentity_rec( DdManager * dd, DdNode * bF1, DdNode * bF
pCache->pTable[HKey].bX[3] == bC2 )
{
pCache->nSuccess++;
- return (int)(PORT_PTRUINT_T)pCache->pTable[HKey].bX[4]; // the last bit records the result (yes/no)
+ return (int)(ABC_PTRUINT_T)pCache->pTable[HKey].bX[4]; // the last bit records the result (yes/no)
}
else
{
@@ -302,7 +302,7 @@ int Dsd_CheckRootFunctionIdentity_rec( DdManager * dd, DdNode * bF1, DdNode * bF
// set cache
for ( i = 0; i < 4; i++ )
pCache->pTable[HKey].bX[i] = bA[i];
- pCache->pTable[HKey].bX[4] = (DdNode*)(PORT_PTRUINT_T)RetValue;
+ pCache->pTable[HKey].bX[4] = (DdNode*)(ABC_PTRUINT_T)RetValue;
return RetValue;
}
diff --git a/src/bdd/dsd/dsdLocal.c b/src/bdd/dsd/dsdLocal.c
index 6dd6e7d1..98b6d7d0 100644
--- a/src/bdd/dsd/dsdLocal.c
+++ b/src/bdd/dsd/dsdLocal.c
@@ -57,12 +57,12 @@ DdNode * Dsd_TreeGetPrimeFunction( DdManager * dd, Dsd_Node_t * pNode )
DdNode * bFunc, * bRes, * bTemp;
st_table * pCache;
- pPermute = ALLOC( int, dd->size );
- pVar2Form = ALLOC( int, dd->size );
- pForm2Var = ALLOC( int, dd->size );
+ pPermute = ABC_ALLOC( int, dd->size );
+ pVar2Form = ABC_ALLOC( int, dd->size );
+ pForm2Var = ABC_ALLOC( int, dd->size );
- pbCube0 = ALLOC( DdNode *, dd->size );
- pbCube1 = ALLOC( DdNode *, dd->size );
+ pbCube0 = ABC_ALLOC( DdNode *, dd->size );
+ pbCube1 = ABC_ALLOC( DdNode *, dd->size );
// remap the global function in such a way that
// the support variables of each formal input are adjacent
@@ -119,11 +119,11 @@ DdNode * Dsd_TreeGetPrimeFunction( DdManager * dd, Dsd_Node_t * pNode )
Cudd_RecursiveDeref( dd, bTemp );
////////////
*/
- FREE(pPermute);
- FREE(pVar2Form);
- FREE(pForm2Var);
- FREE(pbCube0);
- FREE(pbCube1);
+ ABC_FREE(pPermute);
+ ABC_FREE(pVar2Form);
+ ABC_FREE(pForm2Var);
+ ABC_FREE(pbCube0);
+ ABC_FREE(pbCube1);
Cudd_Deref( bRes );
return bRes;
diff --git a/src/bdd/dsd/dsdMan.c b/src/bdd/dsd/dsdMan.c
index 6e43f0f4..6df6a15e 100644
--- a/src/bdd/dsd/dsdMan.c
+++ b/src/bdd/dsd/dsdMan.c
@@ -49,15 +49,15 @@ Dsd_Manager_t * Dsd_ManagerStart( DdManager * dd, int nSuppMax, int fVerbose )
assert( nSuppMax <= dd->size );
- dMan = ALLOC( Dsd_Manager_t, 1 );
+ dMan = ABC_ALLOC( Dsd_Manager_t, 1 );
memset( dMan, 0, sizeof(Dsd_Manager_t) );
dMan->dd = dd;
dMan->nInputs = nSuppMax;
dMan->fVerbose = fVerbose;
dMan->nRoots = 0;
dMan->nRootsAlloc = 50;
- dMan->pRoots = (Dsd_Node_t **) malloc( dMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
- dMan->pInputs = (Dsd_Node_t **) malloc( dMan->nInputs * sizeof(Dsd_Node_t *) );
+ dMan->pRoots = (Dsd_Node_t **) ABC_ALLOC( char, dMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
+ dMan->pInputs = (Dsd_Node_t **) ABC_ALLOC( char, dMan->nInputs * sizeof(Dsd_Node_t *) );
// create the primary inputs and insert them into the table
dMan->Table = st_init_table(st_ptrcmp, st_ptrhash);
@@ -103,9 +103,9 @@ void Dsd_ManagerStop( Dsd_Manager_t * dMan )
st_foreach_item( dMan->Table, gen, (char**)&bFunc, (char**)&pNode )
Dsd_TreeNodeDelete( dMan->dd, Dsd_Regular(pNode) );
st_free_table(dMan->Table);
- free( dMan->pInputs );
- free( dMan->pRoots );
- free( dMan );
+ ABC_FREE( dMan->pInputs );
+ ABC_FREE( dMan->pRoots );
+ ABC_FREE( dMan );
Dsd_CheckCacheDeallocate();
}
diff --git a/src/bdd/dsd/dsdProc.c b/src/bdd/dsd/dsdProc.c
index 45c0986f..0192346c 100644
--- a/src/bdd/dsd/dsdProc.c
+++ b/src/bdd/dsd/dsdProc.c
@@ -129,9 +129,9 @@ s_Loops2Useless = 0;
if ( pDsdMan->nRootsAlloc < nFuncs )
{
if ( pDsdMan->nRootsAlloc > 0 )
- free( pDsdMan->pRoots );
+ ABC_FREE( pDsdMan->pRoots );
pDsdMan->nRootsAlloc = nFuncs;
- pDsdMan->pRoots = (Dsd_Node_t **) malloc( pDsdMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
+ pDsdMan->pRoots = (Dsd_Node_t **) ABC_ALLOC( char, pDsdMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
}
if ( pDsdMan->fVerbose )
diff --git a/src/bdd/dsd/dsdTree.c b/src/bdd/dsd/dsdTree.c
index 5d69f2f4..a4641afc 100644
--- a/src/bdd/dsd/dsdTree.c
+++ b/src/bdd/dsd/dsdTree.c
@@ -56,13 +56,13 @@ static int s_GateSizeMax;
Dsd_Node_t * Dsd_TreeNodeCreate( int Type, int nDecs, int BlockNum )
{
// allocate memory for this node
- Dsd_Node_t * p = (Dsd_Node_t *) malloc( sizeof(Dsd_Node_t) );
+ Dsd_Node_t * p = (Dsd_Node_t *) ABC_ALLOC( char, sizeof(Dsd_Node_t) );
memset( p, 0, sizeof(Dsd_Node_t) );
p->Type = Type; // the type of this block
p->nDecs = nDecs; // the number of decompositions
if ( p->nDecs )
{
- p->pDecs = (Dsd_Node_t **) malloc( p->nDecs * sizeof(Dsd_Node_t *) );
+ p->pDecs = (Dsd_Node_t **) ABC_ALLOC( char, p->nDecs * sizeof(Dsd_Node_t *) );
p->pDecs[0] = NULL;
}
return p;
@@ -83,8 +83,8 @@ void Dsd_TreeNodeDelete( DdManager * dd, Dsd_Node_t * pNode )
{
if ( pNode->G ) Cudd_RecursiveDeref( dd, pNode->G );
if ( pNode->S ) Cudd_RecursiveDeref( dd, pNode->S );
- FREE( pNode->pDecs );
- FREE( pNode );
+ ABC_FREE( pNode->pDecs );
+ ABC_FREE( pNode );
}
/**Function*************************************************************
@@ -555,7 +555,7 @@ Dsd_Node_t ** Dsd_TreeCollectNodesDfs( Dsd_Manager_t * pDsdMan, int * pnNodes )
nNodesAlloc = Dsd_TreeCountNonTerminalNodes(pDsdMan);
nNodes = 0;
- ppNodes = ALLOC( Dsd_Node_t *, nNodesAlloc );
+ ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
for ( i = 0; i < pDsdMan->nRoots; i++ )
Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pDsdMan->pRoots[i]), ppNodes, &nNodes );
Dsd_TreeUnmark( pDsdMan );
@@ -583,7 +583,7 @@ Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne( Dsd_Manager_t * pDsdMan, Dsd_Node_t *
int nNodes, nNodesAlloc;
nNodesAlloc = Dsd_TreeCountNonTerminalNodesOne(pNode);
nNodes = 0;
- ppNodes = ALLOC( Dsd_Node_t *, nNodesAlloc );
+ ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pNode), ppNodes, &nNodes );
Dsd_TreeUnmark_rec(Dsd_Regular(pNode));
assert( nNodesAlloc == nNodes );
@@ -682,7 +682,7 @@ void Dsd_TreePrint_rec( FILE * pFile, Dsd_Node_t * pNode, int fComp, char * pInp
fprintf( pFile, "%s = ", pOutputName );
else
fprintf( pFile, "NOT(%s) = ", pOutputName );
- pInputNums = ALLOC( int, pNode->nDecs );
+ pInputNums = ABC_ALLOC( int, pNode->nDecs );
if ( pNode->Type == DSD_NODE_CONST1 )
{
fprintf( pFile, " Constant 1.\n" );
@@ -815,7 +815,7 @@ void Dsd_TreePrint_rec( FILE * pFile, Dsd_Node_t * pNode, int fComp, char * pInp
Dsd_TreePrint_rec( pFile, Dsd_Regular( pNode->pDecs[i] ), 0, pInputNames, Buffer, nOffset + 6, pSigCounter, fShortNames );
}
}
- free( pInputNums );
+ ABC_FREE( pInputNums );
}
/**Function*************************************************************
@@ -863,7 +863,7 @@ void Dsd_NodePrint_rec( FILE * pFile, Dsd_Node_t * pNode, int fComp, char * pOut
fprintf( pFile, "%s = ", pOutputName );
else
fprintf( pFile, "NOT(%s) = ", pOutputName );
- pInputNums = ALLOC( int, pNode->nDecs );
+ pInputNums = ABC_ALLOC( int, pNode->nDecs );
if ( pNode->Type == DSD_NODE_CONST1 )
{
fprintf( pFile, " Constant 1.\n" );
@@ -984,7 +984,7 @@ void Dsd_NodePrint_rec( FILE * pFile, Dsd_Node_t * pNode, int fComp, char * pOut
Dsd_NodePrint_rec( pFile, Dsd_Regular( pNode->pDecs[i] ), 0, Buffer, nOffset + 6, pSigCounter );
}
}
- free( pInputNums );
+ ABC_FREE( pInputNums );
}