summaryrefslogtreecommitdiffstats
path: root/src/aig/nwk
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/aig/nwk
parentf936cc0680c98ffe51b3a1716c996072d5dbf76c (diff)
downloadabc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.gz
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.bz2
abc-0871bffae307e0553e0c5186336189e8b55cf6a6.zip
Version abc90215
Diffstat (limited to 'src/aig/nwk')
-rw-r--r--src/aig/nwk/nwk.h21
-rw-r--r--src/aig/nwk/nwkBidec.c2
-rw-r--r--src/aig/nwk/nwkFlow.c4
-rw-r--r--src/aig/nwk/nwkMan.c16
-rw-r--r--src/aig/nwk/nwkMap.c4
-rw-r--r--src/aig/nwk/nwkMerge.c38
-rw-r--r--src/aig/nwk/nwkMerge.h8
-rw-r--r--src/aig/nwk/nwkSpeedup.c6
-rw-r--r--src/aig/nwk/nwkTiming.c4
9 files changed, 45 insertions, 58 deletions
diff --git a/src/aig/nwk/nwk.h b/src/aig/nwk/nwk.h
index 0ea8241b..c8cc91cb 100644
--- a/src/aig/nwk/nwk.h
+++ b/src/aig/nwk/nwk.h
@@ -20,10 +20,6 @@
#ifndef __NWK_H__
#define __NWK_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
@@ -39,6 +35,10 @@ extern "C" {
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+extern "C" {
+#endif
+
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
@@ -120,19 +120,6 @@ struct Nwk_Obj_t_
/// INLINED FUNCTIONS ///
////////////////////////////////////////////////////////////////////////
-//#pragma warning( disable : 4273 )
-
-#ifdef WIN32
-#define ABC_DLLEXPORT __declspec(dllexport)
-#define ABC_DLLIMPORT __declspec(dllimport)
-#else /* defined(WIN32) */
-#define ABC_DLLIMPORT
-#endif /* defined(WIN32) */
-
-#ifndef ABC_DLL
-#define ABC_DLL ABC_DLLIMPORT
-#endif
-
static inline int Nwk_ManCiNum( Nwk_Man_t * p ) { return p->nObjs[NWK_OBJ_CI]; }
static inline int Nwk_ManCoNum( Nwk_Man_t * p ) { return p->nObjs[NWK_OBJ_CO]; }
static inline int Nwk_ManNodeNum( Nwk_Man_t * p ) { return p->nObjs[NWK_OBJ_NODE]; }
diff --git a/src/aig/nwk/nwkBidec.c b/src/aig/nwk/nwkBidec.c
index 2b60d779..13abf81f 100644
--- a/src/aig/nwk/nwkBidec.c
+++ b/src/aig/nwk/nwkBidec.c
@@ -160,7 +160,7 @@ void Nwk_ManBidecResyn( Nwk_Man_t * pNtk, int fVerbose )
if ( fVerbose )
{
printf( "Total gain in AIG nodes = %d. ", nGainTotal );
- PRT( "Total runtime", clock() - clk );
+ ABC_PRT( "Total runtime", clock() - clk );
}
}
diff --git a/src/aig/nwk/nwkFlow.c b/src/aig/nwk/nwkFlow.c
index b6155056..5efd0233 100644
--- a/src/aig/nwk/nwkFlow.c
+++ b/src/aig/nwk/nwkFlow.c
@@ -501,7 +501,7 @@ Vec_Ptr_t * Nwk_ManRetimeCutForward( Nwk_Man_t * pMan, int nLatches, int fVerbos
if ( fVerbose )
{
printf( "Min-cut = %4d. Unmoved = %4d. ", Vec_PtrSize(vNodes), Counter );
- PRT( "Time", clock() - clk );
+ ABC_PRT( "Time", clock() - clk );
}
return vNodes;
}
@@ -588,7 +588,7 @@ Vec_Ptr_t * Nwk_ManRetimeCutBackward( Nwk_Man_t * pMan, int nLatches, int fVerbo
if ( fVerbose )
{
printf( "Min-cut = %4d. Unmoved = %4d. ", Vec_PtrSize(vNodes), Counter );
- PRT( "Time", clock() - clk );
+ ABC_PRT( "Time", clock() - clk );
}
return vNodes;
}
diff --git a/src/aig/nwk/nwkMan.c b/src/aig/nwk/nwkMan.c
index 6b67d3c1..d6e20672 100644
--- a/src/aig/nwk/nwkMan.c
+++ b/src/aig/nwk/nwkMan.c
@@ -42,7 +42,7 @@
Nwk_Man_t * Nwk_ManAlloc()
{
Nwk_Man_t * p;
- p = ALLOC( Nwk_Man_t, 1 );
+ p = ABC_ALLOC( Nwk_Man_t, 1 );
memset( p, 0, sizeof(Nwk_Man_t) );
p->vCis = Vec_PtrAlloc( 1000 );
p->vCos = Vec_PtrAlloc( 1000 );
@@ -68,8 +68,8 @@ Nwk_Man_t * Nwk_ManAlloc()
void Nwk_ManFree( Nwk_Man_t * p )
{
// printf( "The number of realloced nodes = %d.\n", p->nRealloced );
- if ( p->pName ) free( p->pName );
- if ( p->pSpec ) free( p->pSpec );
+ if ( p->pName ) ABC_FREE( p->pName );
+ if ( p->pSpec ) ABC_FREE( p->pSpec );
if ( p->vCis ) Vec_PtrFree( p->vCis );
if ( p->vCos ) Vec_PtrFree( p->vCos );
if ( p->vObjs ) Vec_PtrFree( p->vObjs );
@@ -77,7 +77,7 @@ void Nwk_ManFree( Nwk_Man_t * p )
if ( p->pManTime ) Tim_ManStop( p->pManTime );
if ( p->pMemObjs ) Aig_MmFlexStop( p->pMemObjs, 0 );
if ( p->pManHop ) Hop_ManStop( p->pManHop );
- free( p );
+ ABC_FREE( p );
}
/**Function*************************************************************
@@ -127,10 +127,10 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl )
int nPis; // the number of primary inputs
int nPos; // the number of primary outputs
} ParsNew, ParsBest = { 0 };
- // free storage for the name
+ // ABC_FREE storage for the name
if ( pNtk == NULL )
{
- FREE( ParsBest.pName );
+ ABC_FREE( ParsBest.pName );
return 0;
}
// get the parameters
@@ -146,7 +146,7 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl )
(ParsBest.Depth == ParsNew.Depth && ParsBest.Flops > ParsNew.Flops) ||
(ParsBest.Depth == ParsNew.Depth && ParsBest.Flops == ParsNew.Flops && ParsBest.Nodes > ParsNew.Nodes) )
{
- FREE( ParsBest.pName );
+ ABC_FREE( ParsBest.pName );
ParsBest.pName = Aig_UtilStrsav( pNtk->pName );
ParsBest.Depth = ParsNew.Depth;
ParsBest.Flops = ParsNew.Flops;
@@ -242,7 +242,7 @@ void Nwk_ManPrintStats( Nwk_Man_t * pNtk, If_Lib_t * pLutLib, int fSaveBest, int
Ioa_WriteBlifLogic( pNtk, pNtl, Buffer );
// sprintf( Buffer, "%s_dump_map.blif", pNameGen );
// Nwk_ManDumpBlif( pNtk, Buffer, NULL, NULL );
- if ( pNtk->pSpec ) free( pNameGen );
+ if ( pNtk->pSpec ) ABC_FREE( pNameGen );
}
pNtk->pLutLib = pLutLib;
diff --git a/src/aig/nwk/nwkMap.c b/src/aig/nwk/nwkMap.c
index a70bb9b1..e6865840 100644
--- a/src/aig/nwk/nwkMap.c
+++ b/src/aig/nwk/nwkMap.c
@@ -113,7 +113,7 @@ If_Man_t * Nwk_ManToIf( Aig_Man_t * p, If_Par_t * pPars, Vec_Ptr_t * vAigToIf )
vSwitching = Saig_ManComputeSwitchProbs( p, 48, 16, 0 );
if ( pPars->fVerbose )
{
- PRT( "Computing switching activity", clock() - clk );
+ ABC_PRT( "Computing switching activity", clock() - clk );
}
pSwitching = (float *)vSwitching->pArray;
vSwitching2 = Vec_IntStart( Aig_ManObjNumMax(p) );
@@ -355,7 +355,7 @@ Nwk_Man_t * Nwk_MappingIf( Aig_Man_t * p, Tim_Man_t * pManTime, If_Par_t * pPars
If_Man_t * pIfMan;
Vec_Ptr_t * vAigToIf;
// set the arrival times
- pPars->pTimesArr = ALLOC( float, Aig_ManPiNum(p) );
+ pPars->pTimesArr = ABC_ALLOC( float, Aig_ManPiNum(p) );
memset( pPars->pTimesArr, 0, sizeof(float) * Aig_ManPiNum(p) );
// translate into the mapper
vAigToIf = Vec_PtrStart( Aig_ManObjNumMax(p) );
diff --git a/src/aig/nwk/nwkMerge.c b/src/aig/nwk/nwkMerge.c
index 3aec4faa..bc7826e1 100644
--- a/src/aig/nwk/nwkMerge.c
+++ b/src/aig/nwk/nwkMerge.c
@@ -43,11 +43,11 @@
Nwk_Grf_t * Nwk_ManGraphAlloc( int nVertsMax )
{
Nwk_Grf_t * p;
- p = ALLOC( Nwk_Grf_t, 1 );
+ p = ABC_ALLOC( Nwk_Grf_t, 1 );
memset( p, 0, sizeof(Nwk_Grf_t) );
p->nVertsMax = nVertsMax;
p->nEdgeHash = Aig_PrimeCudd( 3 * nVertsMax );
- p->pEdgeHash = CALLOC( Nwk_Edg_t *, p->nEdgeHash );
+ p->pEdgeHash = ABC_CALLOC( Nwk_Edg_t *, p->nEdgeHash );
p->pMemEdges = Aig_MmFixedStart( sizeof(Nwk_Edg_t), p->nEdgeHash );
p->vPairs = Vec_IntAlloc( 1000 );
return p;
@@ -69,11 +69,11 @@ void Nwk_ManGraphFree( Nwk_Grf_t * p )
if ( p->vPairs ) Vec_IntFree( p->vPairs );
if ( p->pMemEdges ) Aig_MmFixedStop( p->pMemEdges, 0 );
if ( p->pMemVerts ) Aig_MmFlexStop( p->pMemVerts, 0 );
- FREE( p->pVerts );
- FREE( p->pEdgeHash );
- FREE( p->pMapLut2Id );
- FREE( p->pMapId2Lut );
- free( p );
+ ABC_FREE( p->pVerts );
+ ABC_FREE( p->pEdgeHash );
+ ABC_FREE( p->pMapLut2Id );
+ ABC_FREE( p->pMapId2Lut );
+ ABC_FREE( p );
}
/**Function*************************************************************
@@ -276,8 +276,8 @@ void Nwk_ManGraphPrepare( Nwk_Grf_t * p )
Nwk_Vrt_t * pVertex;
int * pnEdges, nBytes, i;
// allocate memory for the present objects
- p->pMapLut2Id = ALLOC( int, p->nObjs+1 );
- p->pMapId2Lut = ALLOC( int, p->nVertsMax+1 );
+ p->pMapLut2Id = ABC_ALLOC( int, p->nObjs+1 );
+ p->pMapId2Lut = ABC_ALLOC( int, p->nVertsMax+1 );
memset( p->pMapLut2Id, 0xff, sizeof(int) * (p->nObjs+1) );
memset( p->pMapId2Lut, 0xff, sizeof(int) * (p->nVertsMax+1) );
// mark present objects
@@ -299,7 +299,7 @@ void Nwk_ManGraphPrepare( Nwk_Grf_t * p )
}
}
// count the edges and mark present objects
- pnEdges = CALLOC( int, p->nVerts+1 );
+ pnEdges = ABC_CALLOC( int, p->nVerts+1 );
Nwk_GraphForEachEdge( p, pEntry, i )
{
// translate into vertices
@@ -315,7 +315,7 @@ void Nwk_ManGraphPrepare( Nwk_Grf_t * p )
}
// allocate the real graph
p->pMemVerts = Aig_MmFlexStart();
- p->pVerts = ALLOC( Nwk_Vrt_t *, p->nVerts + 1 );
+ p->pVerts = ABC_ALLOC( Nwk_Vrt_t *, p->nVerts + 1 );
p->pVerts[0] = NULL;
for ( i = 1; i <= p->nVerts; i++ )
{
@@ -341,9 +341,9 @@ void Nwk_ManGraphPrepare( Nwk_Grf_t * p )
}
// clean up
Aig_MmFixedStop( p->pMemEdges, 0 ); p->pMemEdges = NULL;
- FREE( p->pEdgeHash );
+ ABC_FREE( p->pEdgeHash );
// p->nEdgeHash = 0;
- free( pnEdges );
+ ABC_FREE( pnEdges );
}
/**Function*************************************************************
@@ -362,7 +362,7 @@ void Nwk_ManGraphSortPairs( Nwk_Grf_t * p )
int nSize = Vec_IntSize(p->vPairs);
int * pIdToPair, i;
// allocate storage
- pIdToPair = ALLOC( int, p->nObjs+1 );
+ pIdToPair = ABC_ALLOC( int, p->nObjs+1 );
for ( i = 0; i <= p->nObjs; i++ )
pIdToPair[i] = -1;
// create mapping
@@ -381,7 +381,7 @@ void Nwk_ManGraphSortPairs( Nwk_Grf_t * p )
Vec_IntPush( p->vPairs, pIdToPair[i] );
}
assert( nSize == Vec_IntSize(p->vPairs) );
- free( pIdToPair );
+ ABC_FREE( pIdToPair );
}
@@ -702,12 +702,12 @@ int Nwk_ManLutMergeGraphTest( char * pFileName )
Nwk_Grf_t * p;
int clk = clock();
p = Nwk_ManLutMergeReadGraph( pFileName );
- PRT( "Reading", clock() - clk );
+ ABC_PRT( "Reading", clock() - clk );
clk = clock();
Nwk_ManGraphSolve( p );
printf( "GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
p->nVerts, p->nEdges, Vec_IntSize(p->vPairs)/2 );
- PRT( "Solving", clock() - clk );
+ ABC_PRT( "Solving", clock() - clk );
nPairs = Vec_IntSize(p->vPairs)/2;
Nwk_ManGraphReportMemoryUsage( p );
Nwk_ManGraphFree( p );
@@ -1009,7 +1009,7 @@ Vec_Int_t * Nwk_ManLutMerge( Nwk_Man_t * pNtk, Nwk_LMPars_t * pPars )
if ( pPars->fVerbose )
{
printf( "Mergable LUTs = %6d. Total cands = %6d. ", p->nVertsMax, nCands );
- PRT( "Deriving graph", clock() - clk );
+ ABC_PRT( "Deriving graph", clock() - clk );
}
// solve the graph problem
clk = clock();
@@ -1018,7 +1018,7 @@ Vec_Int_t * Nwk_ManLutMerge( Nwk_Man_t * pNtk, Nwk_LMPars_t * pPars )
{
printf( "GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
p->nVerts, p->nEdges, Vec_IntSize(p->vPairs)/2 );
- PRT( "Solving", clock() - clk );
+ ABC_PRT( "Solving", clock() - clk );
Nwk_ManGraphReportMemoryUsage( p );
}
vResult = p->vPairs; p->vPairs = NULL;
diff --git a/src/aig/nwk/nwkMerge.h b/src/aig/nwk/nwkMerge.h
index 3763e4b2..ab39ec39 100644
--- a/src/aig/nwk/nwkMerge.h
+++ b/src/aig/nwk/nwkMerge.h
@@ -21,10 +21,6 @@
#ifndef __NWK_MERGE_H__
#define __NWK_MERGE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -33,6 +29,10 @@ extern "C" {
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define NWK_MAX_LIST 16
////////////////////////////////////////////////////////////////////////
diff --git a/src/aig/nwk/nwkSpeedup.c b/src/aig/nwk/nwkSpeedup.c
index 469e9b71..54e4d414 100644
--- a/src/aig/nwk/nwkSpeedup.c
+++ b/src/aig/nwk/nwkSpeedup.c
@@ -221,7 +221,7 @@ Aig_Man_t * Nwk_ManSpeedup( Nwk_Man_t * pNtk, int fUseLutLib, int Percentage, in
printf( "\n" );
}
// mark the timing critical nodes and edges
- puTCEdges = ALLOC( unsigned, Nwk_ManObjNumMax(pNtk) );
+ puTCEdges = ABC_ALLOC( unsigned, Nwk_ManObjNumMax(pNtk) );
memset( puTCEdges, 0, sizeof(unsigned) * Nwk_ManObjNumMax(pNtk) );
Nwk_ManForEachNode( pNtk, pNode, i )
{
@@ -244,7 +244,7 @@ Aig_Man_t * Nwk_ManSpeedup( Nwk_Man_t * pNtk, int fUseLutLib, int Percentage, in
}
// start the resulting network
pAig = Nwk_ManStrash( pNtk );
- pAig->pEquivs = ALLOC( Aig_Obj_t *, 3 * Aig_ManObjNumMax(pAig) );
+ pAig->pEquivs = ABC_ALLOC( Aig_Obj_t *, 3 * Aig_ManObjNumMax(pAig) );
memset( pAig->pEquivs, 0, sizeof(Aig_Obj_t *) * 3 * Aig_ManObjNumMax(pAig) );
// collect nodes to be used for resynthesis
@@ -332,7 +332,7 @@ Aig_Man_t * Nwk_ManSpeedup( Nwk_Man_t * pNtk, int fUseLutLib, int Percentage, in
}
Vec_PtrFree( vTimeCries );
Vec_PtrFree( vTimeFanins );
- free( puTCEdges );
+ ABC_FREE( puTCEdges );
if ( fVerbose )
printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
Nwk_ManNodeNum(pNtk), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
diff --git a/src/aig/nwk/nwkTiming.c b/src/aig/nwk/nwkTiming.c
index fc56b387..80391c66 100644
--- a/src/aig/nwk/nwkTiming.c
+++ b/src/aig/nwk/nwkTiming.c
@@ -468,7 +468,7 @@ void Nwk_ManDelayTracePrint( Nwk_Man_t * pNtk )
}
// decide how many steps
nSteps = pLutLib ? 20 : Nwk_ManLevelMax(pNtk);
- pCounters = ALLOC( int, nSteps + 1 );
+ pCounters = ABC_ALLOC( int, nSteps + 1 );
memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
// perform delay trace
tArrival = Nwk_ManDelayTraceLut( pNtk );
@@ -493,7 +493,7 @@ void Nwk_ManDelayTracePrint( Nwk_Man_t * pNtk )
printf( "%3d %s : %5d (%6.2f %%)\n", pLutLib? 5*(i+1) : i+1,
pLutLib? "%":"lev", Nodes, 100.0*Nodes/Nwk_ManNodeNum(pNtk) );
}
- free( pCounters );
+ ABC_FREE( pCounters );
}