summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2009-02-15 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2009-02-15 08:01:00 -0800
commit0871bffae307e0553e0c5186336189e8b55cf6a6 (patch)
tree4571d1563fe33a53a57fea1c35fb668b9d33265f /src/map/if
parentf936cc0680c98ffe51b3a1716c996072d5dbf76c (diff)
downloadabc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.gz
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.bz2
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.zip
Version abc90215
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h20
-rw-r--r--src/map/if/ifCore.c2
-rw-r--r--src/map/if/ifCut.c4
-rw-r--r--src/map/if/ifLib.c12
-rw-r--r--src/map/if/ifMan.c26
-rw-r--r--src/map/if/ifMap.c10
-rw-r--r--src/map/if/ifReduce.c6
-rw-r--r--src/map/if/ifUtil.c12
8 files changed, 46 insertions, 46 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h
index ce2cb483..91d6e037 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -21,10 +21,6 @@
#ifndef __IF_H__
#define __IF_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -38,6 +34,10 @@ extern "C" {
#include "mem.h"
#include "tim.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
@@ -166,7 +166,7 @@ struct If_Man_t_
Mem_Fixed_t * pMemSet; // memory manager for sets of cuts (entrysize = nCutSize*(nCutsMax+1))
If_Set_t * pMemCi; // memory for CI cutsets
If_Set_t * pMemAnd; // memory for AND cutsets
- If_Set_t * pFreeList; // the list of free cutsets
+ If_Set_t * pFreeList; // the list of ABC_FREE cutsets
int nSmallSupp; // the small support
// timing manager
Tim_Man_t * pManTim;
@@ -198,7 +198,7 @@ struct If_Set_t_
{
short nCutsMax; // the max number of cuts
short nCuts; // the current number of cuts
- If_Set_t * pNext; // next cutset in the free list
+ If_Set_t * pNext; // next cutset in the ABC_FREE list
If_Cut_t ** ppCuts; // the array of pointers to the cuts
};
@@ -229,10 +229,10 @@ struct If_Obj_t_
If_Cut_t CutBest; // the best cut selected
};
-static inline If_Obj_t * If_Regular( If_Obj_t * p ) { return (If_Obj_t *)((PORT_PTRUINT_T)(p) & ~01); }
-static inline If_Obj_t * If_Not( If_Obj_t * p ) { return (If_Obj_t *)((PORT_PTRUINT_T)(p) ^ 01); }
-static inline If_Obj_t * If_NotCond( If_Obj_t * p, int c ) { return (If_Obj_t *)((PORT_PTRUINT_T)(p) ^ (c)); }
-static inline int If_IsComplement( If_Obj_t * p ) { return (int )(((PORT_PTRUINT_T)p) & 01); }
+static inline If_Obj_t * If_Regular( If_Obj_t * p ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
+static inline If_Obj_t * If_Not( If_Obj_t * p ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
+static inline If_Obj_t * If_NotCond( If_Obj_t * p, int c ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
+static inline int If_IsComplement( If_Obj_t * p ) { return (int )(((ABC_PTRUINT_T)p) & 01); }
static inline int If_ManCiNum( If_Man_t * p ) { return p->nObjs[IF_CI]; }
static inline int If_ManCoNum( If_Man_t * p ) { return p->nObjs[IF_CO]; }
diff --git a/src/map/if/ifCore.c b/src/map/if/ifCore.c
index 99b99af7..0f0ca002 100644
--- a/src/map/if/ifCore.c
+++ b/src/map/if/ifCore.c
@@ -134,7 +134,7 @@ int If_ManPerformMappingComb( If_Man_t * p )
// printf( "Total memory = %7.2f Mb. Peak cut memory = %7.2f Mb. ",
// 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20),
// 1.0 * p->nSetBytes * Mem_FixedReadMaxEntriesUsed(p->pMemSet) / (1<<20) );
- PRT( "Total time", clock() - clkTotal );
+ ABC_PRT( "Total time", clock() - clkTotal );
}
// printf( "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) );
s_MappingTime = clock() - clkTotal;
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index af1f5213..d3ce5397 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -1349,7 +1349,7 @@ int If_CutGetCones( If_Man_t * p )
}
}
printf( "Cound not find boundary for %d nodes.\n", Counter );
- PRT( "Cones", clock() - clk );
+ ABC_PRT( "Cones", clock() - clk );
return 1;
}
@@ -1406,7 +1406,7 @@ int If_CutCountTotalFanins( If_Man_t * p )
}
}
printf( "Total cut inputs = %d. Total fanins incremental = %d.\n", nFaninsTotal, Counter );
- PRT( "Fanins", clock() - clk );
+ ABC_PRT( "Fanins", clock() - clk );
Vec_IntFree( vLeaves );
return 1;
}
diff --git a/src/map/if/ifLib.c b/src/map/if/ifLib.c
index 51630164..176edb24 100644
--- a/src/map/if/ifLib.c
+++ b/src/map/if/ifLib.c
@@ -24,7 +24,7 @@
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
-static inline char * If_UtilStrsav( char *s ) { return !s ? s : strcpy(ALLOC(char, strlen(s)+1), s); }
+static inline char * If_UtilStrsav( char *s ) { return !s ? s : strcpy(ABC_ALLOC(char, strlen(s)+1), s); }
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -55,7 +55,7 @@ If_Lib_t * If_LutLibRead( char * FileName )
return NULL;
}
- p = ALLOC( If_Lib_t, 1 );
+ p = ABC_ALLOC( If_Lib_t, 1 );
memset( p, 0, sizeof(If_Lib_t) );
p->pName = If_UtilStrsav( FileName );
@@ -70,7 +70,7 @@ If_Lib_t * If_LutLibRead( char * FileName )
if ( i != atoi(pToken) )
{
printf( "Error in the LUT library file \"%s\".\n", FileName );
- free( p );
+ ABC_FREE( p );
return NULL;
}
@@ -145,7 +145,7 @@ If_Lib_t * If_LutLibRead( char * FileName )
If_Lib_t * If_LutLibDup( If_Lib_t * p )
{
If_Lib_t * pNew;
- pNew = ALLOC( If_Lib_t, 1 );
+ pNew = ABC_ALLOC( If_Lib_t, 1 );
*pNew = *p;
pNew->pName = If_UtilStrsav( pNew->pName );
return pNew;
@@ -166,8 +166,8 @@ void If_LutLibFree( If_Lib_t * pLutLib )
{
if ( pLutLib == NULL )
return;
- FREE( pLutLib->pName );
- FREE( pLutLib );
+ ABC_FREE( pLutLib->pName );
+ ABC_FREE( pLutLib );
}
diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c
index 82ee6728..97f2a06a 100644
--- a/src/map/if/ifMan.c
+++ b/src/map/if/ifMan.c
@@ -48,7 +48,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
{
If_Man_t * p;
// start the manager
- p = ALLOC( If_Man_t, 1 );
+ p = ABC_ALLOC( If_Man_t, 1 );
memset( p, 0, sizeof(If_Man_t) );
p->pPars = pPars;
p->fEpsilon = pPars->Epsilon;
@@ -71,7 +71,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
printf( "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d.\n",
p->pPars->nLutSize, 4 * p->nTruthWords, p->nCutBytes, p->nObjBytes, p->nSetBytes );
// room for temporary truth tables
- p->puTemp[0] = p->pPars->fTruth? ALLOC( unsigned, 4 * p->nTruthWords ) : NULL;
+ p->puTemp[0] = p->pPars->fTruth? ABC_ALLOC( unsigned, 4 * p->nTruthWords ) : NULL;
p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
@@ -96,7 +96,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
***********************************************************************/
void If_ManRestart( If_Man_t * p )
{
- FREE( p->pMemCi );
+ ABC_FREE( p->pMemCi );
Vec_PtrClear( p->vCis );
Vec_PtrClear( p->vCos );
Vec_PtrClear( p->vObjs );
@@ -124,7 +124,7 @@ void If_ManRestart( If_Man_t * p )
***********************************************************************/
void If_ManStop( If_Man_t * p )
{
-// PRT( "Truth", p->timeTruth );
+// ABC_PRT( "Truth", p->timeTruth );
// printf( "Small support = %d.\n", p->nSmallSupp );
Vec_PtrFree( p->vCis );
Vec_PtrFree( p->vCos );
@@ -135,19 +135,19 @@ void If_ManStop( If_Man_t * p )
if ( p->vLatchOrder ) Vec_PtrFree( p->vLatchOrder );
if ( p->vLags ) Vec_IntFree( p->vLags );
Mem_FixedStop( p->pMemObj, 0 );
- FREE( p->pMemCi );
- FREE( p->pMemAnd );
- FREE( p->puTemp[0] );
- // free pars memory
+ ABC_FREE( p->pMemCi );
+ ABC_FREE( p->pMemAnd );
+ ABC_FREE( p->puTemp[0] );
+ // ABC_FREE pars memory
if ( p->pPars->pTimesArr )
- FREE( p->pPars->pTimesArr );
+ ABC_FREE( p->pPars->pTimesArr );
if ( p->pPars->pTimesReq )
- FREE( p->pPars->pTimesReq );
+ ABC_FREE( p->pPars->pTimesReq );
if ( p->pManTim )
Tim_ManStop( p->pManTim );
if ( p->vSwitching )
Vec_IntFree( p->vSwitching );
- free( p );
+ ABC_FREE( p );
}
/**Function*************************************************************
@@ -427,7 +427,7 @@ void If_ManSetupCiCutSets( If_Man_t * p )
If_ManForEachCi( p, pObj, i )
If_ManSetupCutTriv( p, &pObj->CutBest, pObj->Id );
// create elementary cutsets for the CIs
- p->pMemCi = (If_Set_t *)malloc( If_ManCiNum(p) * (sizeof(If_Set_t) + sizeof(void *)) );
+ p->pMemCi = (If_Set_t *)ABC_ALLOC( char, If_ManCiNum(p) * (sizeof(If_Set_t) + sizeof(void *)) );
If_ManForEachCi( p, pObj, i )
{
pObj->pCutSet = (If_Set_t *)((char *)p->pMemCi + i * (sizeof(If_Set_t) + sizeof(void *)));
@@ -552,7 +552,7 @@ void If_ManSetupSetAll( If_Man_t * p, int nCrossCut )
If_Set_t * pCutSet;
int i, nCutSets;
nCutSets = 128 + nCrossCut;
- p->pFreeList = p->pMemAnd = pCutSet = (If_Set_t *)malloc( nCutSets * p->nSetBytes );
+ p->pFreeList = p->pMemAnd = pCutSet = (If_Set_t *)ABC_ALLOC( char, nCutSets * p->nSetBytes );
for ( i = 0; i < nCutSets; i++ )
{
If_ManSetupSet( p, pCutSet );
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index fc3d7cd3..2879081c 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -106,7 +106,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_ObjForEachCut( pObj->pFanin0, pCut0, i )
If_ObjForEachCut( pObj->pFanin1, pCut1, k )
{
- // get the next free cut
+ // get the next ABC_FREE cut
assert( pCutSet->nCuts <= pCutSet->nCutsMax );
pCut = pCutSet->ppCuts[pCutSet->nCuts];
// make sure K-feasible cut exists
@@ -169,7 +169,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_ObjForEachCut( pObj, pCut, i )
p->pPars->pFuncUser( p, pObj, pCut );
- // free the cuts
+ // ABC_FREE the cuts
If_ManDerefNodeCutSet( p, pObj );
}
@@ -212,7 +212,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
If_ObjForEachCut( pTemp, pCutTemp, i )
{
assert( p->pPars->fSeqMap || pCutTemp->nLeaves > 1 );
- // get the next free cut
+ // get the next ABC_FREE cut
assert( pCutSet->nCuts <= pCutSet->nCutsMax );
pCut = pCutSet->ppCuts[pCutSet->nCuts];
// copy the cut into storage
@@ -253,7 +253,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
if ( Mode && pObj->nRefs > 0 )
If_CutAreaRef( p, If_ObjCutBest(pObj) );
- // free the cuts
+ // ABC_FREE the cuts
If_ManDerefChoiceCutSet( p, pObj );
}
@@ -342,7 +342,7 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPrepr
char Symb = fPreprocess? 'P' : ((Mode == 0)? 'D' : ((Mode == 1)? 'F' : 'A'));
printf( "%c: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ",
Symb, p->RequiredGlo, p->AreaGlo, p->nNets, p->dPower, p->nCutsMerged );
- PRT( "T", clock() - clk );
+ ABC_PRT( "T", clock() - clk );
// printf( "Max number of cuts = %d. Average number of cuts = %5.2f.\n",
// p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
}
diff --git a/src/map/if/ifReduce.c b/src/map/if/ifReduce.c
index a5fa7d86..b3130600 100644
--- a/src/map/if/ifReduce.c
+++ b/src/map/if/ifReduce.c
@@ -57,7 +57,7 @@ void If_ManImproveMapping( If_Man_t * p )
{
printf( "E: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ",
p->RequiredGlo, p->AreaGlo, p->nNets, p->dPower, p->nCutsMerged );
- PRT( "T", clock() - clk );
+ ABC_PRT( "T", clock() - clk );
}
/*
@@ -68,7 +68,7 @@ void If_ManImproveMapping( If_Man_t * p )
{
printf( "R: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ",
p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
- PRT( "T", clock() - clk );
+ ABC_PRT( "T", clock() - clk );
}
*/
/*
@@ -79,7 +79,7 @@ void If_ManImproveMapping( If_Man_t * p )
{
printf( "E: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ",
p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
- PRT( "T", clock() - clk );
+ ABC_PRT( "T", clock() - clk );
}
*/
}
diff --git a/src/map/if/ifUtil.c b/src/map/if/ifUtil.c
index 06015b06..1e6d7704 100644
--- a/src/map/if/ifUtil.c
+++ b/src/map/if/ifUtil.c
@@ -333,7 +333,7 @@ float If_ManScanMapping( If_Man_t * p )
pObj->nRefs = 0;
}
// allocate place to store the nodes
- ppStore = ALLOC( If_Obj_t *, p->nLevelMax + 1 );
+ ppStore = ABC_ALLOC( If_Obj_t *, p->nLevelMax + 1 );
memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) );
// collect nodes reachable from POs in the DFS order through the best cuts
aArea = 0;
@@ -344,7 +344,7 @@ float If_ManScanMapping( If_Man_t * p )
for ( i = p->nLevelMax; i >= 0; i-- )
for ( pObj = ppStore[i]; pObj; pObj = pObj->pCopy )
Vec_PtrPush( p->vMapped, pObj );
- free( ppStore );
+ ABC_FREE( ppStore );
return aArea;
}
@@ -374,7 +374,7 @@ float If_ManScanMappingDirect( If_Man_t * p )
pObj->nRefs = 0;
}
// allocate place to store the nodes
- ppStore = ALLOC( If_Obj_t *, p->nLevelMax + 1 );
+ ppStore = ABC_ALLOC( If_Obj_t *, p->nLevelMax + 1 );
memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) );
// collect nodes reachable from POs in the DFS order through the best cuts
aArea = 0;
@@ -386,7 +386,7 @@ float If_ManScanMappingDirect( If_Man_t * p )
for ( i = 0; i <= p->nLevelMax; i++ )
for ( pObj = ppStore[i]; pObj; pObj = pObj->pCopy )
Vec_PtrPush( p->vMapped, pObj );
- free( ppStore );
+ ABC_FREE( ppStore );
return aArea;
}
@@ -550,7 +550,7 @@ Vec_Ptr_t * If_ManReverseOrder( If_Man_t * p )
If_Obj_t * pObj, ** ppStore;
int i;
// allocate place to store the nodes
- ppStore = ALLOC( If_Obj_t *, p->nLevelMax + 1 );
+ ppStore = ABC_ALLOC( If_Obj_t *, p->nLevelMax + 1 );
memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) );
// add the nodes
If_ManForEachObj( p, pObj, i )
@@ -563,7 +563,7 @@ Vec_Ptr_t * If_ManReverseOrder( If_Man_t * p )
for ( i = p->nLevelMax; i >= 0; i-- )
for ( pObj = ppStore[i]; pObj; pObj = pObj->pCopy )
Vec_PtrPush( vOrder, pObj );
- free( ppStore );
+ ABC_FREE( ppStore );
// print the order
// Vec_PtrForEachEntry( vOrder, pObj, i )
// printf( "Obj %2d Type %d Level = %d\n", pObj->Id, pObj->Type, pObj->Level );