From 0871bffae307e0553e0c5186336189e8b55cf6a6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko <alanmi@berkeley.edu> Date: Sun, 15 Feb 2009 08:01:00 -0800 Subject: Version abc90215 --- src/aig/ntl/ntl.h | 19 ++++--------------- src/aig/ntl/ntlFraig.c | 10 +++++----- src/aig/ntl/ntlMan.c | 18 +++++++++--------- src/aig/ntl/ntlMap.c | 4 ++-- src/aig/ntl/ntlReadBlif.c | 26 +++++++++++++------------- src/aig/ntl/ntlTable.c | 12 ++++++------ src/aig/ntl/ntlTime.c | 2 +- src/aig/ntl/ntlUtil.c | 6 +++--- src/aig/ntl/ntlWriteBlif.c | 12 ++++++------ 9 files changed, 49 insertions(+), 60 deletions(-) (limited to 'src/aig/ntl') diff --git a/src/aig/ntl/ntl.h b/src/aig/ntl/ntl.h index ac266ca5..0a44d2dc 100644 --- a/src/aig/ntl/ntl.h +++ b/src/aig/ntl/ntl.h @@ -21,10 +21,6 @@ #ifndef __NTL_H__ #define __NTL_H__ -#ifdef __cplusplus -extern "C" { -#endif - //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -37,6 +33,10 @@ extern "C" { /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// @@ -185,17 +185,6 @@ struct Ntl_Lut_t_ /// INLINED FUNCTIONS /// //////////////////////////////////////////////////////////////////////// -#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 Ntl_Mod_t * Ntl_ManRootModel( Ntl_Man_t * p ) { return (Ntl_Mod_t *)Vec_PtrEntry( p->vModels, 0 ); } static inline int Ntl_ModelPiNum( Ntl_Mod_t * p ) { return p->nObjs[NTL_OBJ_PI]; } diff --git a/src/aig/ntl/ntlFraig.c b/src/aig/ntl/ntlFraig.c index d2ae4204..405ec83f 100644 --- a/src/aig/ntl/ntlFraig.c +++ b/src/aig/ntl/ntlFraig.c @@ -52,7 +52,7 @@ void Ntl_ManUpdateNoMergeReprs( Aig_Man_t * pAig, Aig_Obj_t ** pReprs ) int i; // allocate room for the new representative - pReprsNew = ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) ); + pReprsNew = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) ); memset( pReprsNew, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(pAig) ); Aig_ManForEachObj( pAig, pObj, i ) { @@ -105,7 +105,7 @@ void Ntl_ManUpdateNoMergeReprs( Aig_Man_t * pAig, Aig_Obj_t ** pReprs ) else pReprs[ pObj->Id ] = NULL; } - free( pReprsNew ); + ABC_FREE( pReprsNew ); } /**Function************************************************************* @@ -148,7 +148,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ // (each node in the collapsed manager may have more than one equivalent node // in the original manager; this procedure finds the first node in the original // manager that is equivalent to the given node in the collapsed manager) - pMapBack = ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAigCol) ); + pMapBack = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAigCol) ); memset( pMapBack, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(pAigCol) ); Aig_ManForEachObj( pAig, pObj, i ) { @@ -162,7 +162,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ } // create the equivalence classes for the original manager - pReprs = ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) ); + pReprs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) ); memset( pReprs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(pAig) ); Aig_ManForEachObj( pAig, pObj, i ) { @@ -186,7 +186,7 @@ Aig_Obj_t ** Ntl_ManFraigDeriveClasses( Aig_Man_t * pAig, Ntl_Man_t * pNew, Aig_ else pReprs[pCorresp->Id] = pObj; } - free( pMapBack ); + ABC_FREE( pMapBack ); // recall pointers to the nets of pNew Aig_ManForEachObj( pAig, pObj, i ) diff --git a/src/aig/ntl/ntlMan.c b/src/aig/ntl/ntlMan.c index 8b26e405..552d5c15 100644 --- a/src/aig/ntl/ntlMan.c +++ b/src/aig/ntl/ntlMan.c @@ -43,7 +43,7 @@ Ntl_Man_t * Ntl_ManAlloc() { Ntl_Man_t * p; // start the manager - p = ALLOC( Ntl_Man_t, 1 ); + p = ABC_ALLOC( Ntl_Man_t, 1 ); memset( p, 0, sizeof(Ntl_Man_t) ); p->vModels = Vec_PtrAlloc( 1000 ); p->vCis = Vec_PtrAlloc( 1000 ); @@ -56,7 +56,7 @@ Ntl_Man_t * Ntl_ManAlloc() p->pMemSops = Aig_MmFlexStart(); // allocate model table p->nModTableSize = Aig_PrimeCudd( 100 ); - p->pModTable = ALLOC( Ntl_Mod_t *, p->nModTableSize ); + p->pModTable = ABC_ALLOC( Ntl_Mod_t *, p->nModTableSize ); memset( p->pModTable, 0, sizeof(Ntl_Mod_t *) * p->nModTableSize ); return p; } @@ -203,8 +203,8 @@ void Ntl_ManFree( Ntl_Man_t * p ) if ( p->pAig ) Aig_ManStop( p->pAig ); if ( p->pManTime ) Tim_ManStop( p->pManTime ); if ( p->pNal ) p->pNalF( p->pNal ); - FREE( p->pModTable ); - free( p ); + ABC_FREE( p->pModTable ); + ABC_FREE( p ); } /**Function************************************************************* @@ -266,7 +266,7 @@ void Nwk_ManPrintStatsShort( Ntl_Man_t * p, Aig_Man_t * pAig, Nwk_Man_t * pNtk ) printf( "ff =%5d ", Counter ); if ( pAig != NULL ) { - Counter = Aig_ManCountChoices( pAig ); + Counter = Aig_ManChoiceNum( pAig ); if ( Counter ) printf( "cho =%7d ", Counter ); else @@ -392,7 +392,7 @@ Ntl_Mod_t * Ntl_ModelAlloc( Ntl_Man_t * pMan, char * pName ) { Ntl_Mod_t * p; // start the manager - p = ALLOC( Ntl_Mod_t, 1 ); + p = ABC_ALLOC( Ntl_Mod_t, 1 ); memset( p, 0, sizeof(Ntl_Mod_t) ); p->attrBox = 1; p->attrComb = 1; @@ -407,7 +407,7 @@ Ntl_Mod_t * Ntl_ModelAlloc( Ntl_Man_t * pMan, char * pName ) p->vNets = Vec_PtrAlloc( 100 ); // start the table p->nTableSize = Aig_PrimeCudd( 100 ); - p->pTable = ALLOC( Ntl_Net_t *, p->nTableSize ); + p->pTable = ABC_ALLOC( Ntl_Net_t *, p->nTableSize ); memset( p->pTable, 0, sizeof(Ntl_Net_t *) * p->nTableSize ); // add model to the table if ( !Ntl_ManAddModel( pMan, p ) ) @@ -562,8 +562,8 @@ void Ntl_ModelFree( Ntl_Mod_t * p ) Vec_PtrFree( p->vObjs ); Vec_PtrFree( p->vPis ); Vec_PtrFree( p->vPos ); - free( p->pTable ); - free( p ); + ABC_FREE( p->pTable ); + ABC_FREE( p ); } /**Function************************************************************* diff --git a/src/aig/ntl/ntlMap.c b/src/aig/ntl/ntlMap.c index c6e80e75..10e7dd17 100644 --- a/src/aig/ntl/ntlMap.c +++ b/src/aig/ntl/ntlMap.c @@ -47,7 +47,7 @@ Vec_Ptr_t * Ntl_MappingAlloc( int nLuts, int nVars ) Ntl_Lut_t ** pArray; int nEntrySize, i; nEntrySize = sizeof(Ntl_Lut_t) + sizeof(int) * nVars + sizeof(unsigned) * Aig_TruthWordNum(nVars); - pArray = (Ntl_Lut_t **)malloc( (sizeof(Ntl_Lut_t *) + nEntrySize) * nLuts ); + pArray = (Ntl_Lut_t **)ABC_ALLOC( char, (sizeof(Ntl_Lut_t *) + nEntrySize) * nLuts ); pMemory = (char *)(pArray + nLuts); memset( pMemory, 0, nEntrySize * nLuts ); for ( i = 0; i < nLuts; i++ ) @@ -312,7 +312,7 @@ Vec_Ptr_t * Ntl_MappingIf( Ntl_Man_t * pMan, Aig_Man_t * p ) // perform FPGA mapping Ntl_ManSetIfParsDefault( pPars ); // 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 pIfMan = Ntl_ManToIf( p, pPars ); diff --git a/src/aig/ntl/ntlReadBlif.c b/src/aig/ntl/ntlReadBlif.c index 3021d556..f94595b8 100644 --- a/src/aig/ntl/ntlReadBlif.c +++ b/src/aig/ntl/ntlReadBlif.c @@ -213,7 +213,7 @@ Ntl_Man_t * Ioa_ReadBlif( char * pFileName, int fCheck ) static Ioa_ReadMan_t * Ioa_ReadAlloc() { Ioa_ReadMan_t * p; - p = ALLOC( Ioa_ReadMan_t, 1 ); + p = ABC_ALLOC( Ioa_ReadMan_t, 1 ); memset( p, 0, sizeof(Ioa_ReadMan_t) ); p->vLines = Vec_PtrAlloc( 512 ); p->vModels = Vec_PtrAlloc( 512 ); @@ -241,7 +241,7 @@ static void Ioa_ReadFree( Ioa_ReadMan_t * p ) if ( p->pDesign ) Ntl_ManFree( p->pDesign ); if ( p->pBuffer ) - free( p->pBuffer ); + ABC_FREE( p->pBuffer ); if ( p->vLines ) Vec_PtrFree( p->vLines ); if ( p->vModels ) @@ -253,7 +253,7 @@ static void Ioa_ReadFree( Ioa_ReadMan_t * p ) Vec_PtrFree( p->vTokens ); Vec_PtrFree( p->vTokens2 ); Vec_StrFree( p->vFunc ); - free( p ); + ABC_FREE( p ); } /**Function************************************************************* @@ -270,7 +270,7 @@ static void Ioa_ReadFree( Ioa_ReadMan_t * p ) static Ioa_ReadMod_t * Ioa_ReadModAlloc() { Ioa_ReadMod_t * p; - p = ALLOC( Ioa_ReadMod_t, 1 ); + p = ABC_ALLOC( Ioa_ReadMod_t, 1 ); memset( p, 0, sizeof(Ioa_ReadMod_t) ); p->vInputs = Vec_PtrAlloc( 8 ); p->vOutputs = Vec_PtrAlloc( 8 ); @@ -304,7 +304,7 @@ static void Ioa_ReadModFree( Ioa_ReadMod_t * p ) Vec_PtrFree( p->vDelays ); Vec_PtrFree( p->vTimeInputs ); Vec_PtrFree( p->vTimeOutputs ); - free( p ); + ABC_FREE( p ); } @@ -448,7 +448,7 @@ static char * Ioa_ReadLoadFile( char * pFileName ) printf( "Ioa_ReadLoadFile(): The file is empty.\n" ); return NULL; } - pContents = ALLOC( char, nFileSize + 10 ); + pContents = ABC_ALLOC( char, nFileSize + 10 ); rewind( pFile ); fread( pContents, nFileSize, 1, pFile ); fclose( pFile ); @@ -498,9 +498,9 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) } do { if (!bufHead) - buf = bufHead = ALLOC( buflist, 1 ); + buf = bufHead = ABC_ALLOC( buflist, 1 ); else - buf = buf->next = ALLOC( buflist, 1 ); + buf = buf->next = ABC_ALLOC( buflist, 1 ); nFileSize += buf->nBuf = BZ2_bzRead(&bzError,b,buf->buf,1<<20); buf->next = NULL; } while (bzError == BZ_OK); @@ -509,14 +509,14 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) char * p; int nBytes = 0; BZ2_bzReadClose(&bzError,b); - p = pContents = ALLOC( char, nFileSize + 10 ); + p = pContents = ABC_ALLOC( char, nFileSize + 10 ); buf = bufHead; do { memcpy(p+nBytes,buf->buf,buf->nBuf); nBytes += buf->nBuf; // } while((buf = buf->next)); pNext = buf->next; - free( buf ); + ABC_FREE( buf ); } while((buf = pNext)); } else if (bzError == BZ_DATA_ERROR_MAGIC) { // not a BZIP2 file @@ -528,7 +528,7 @@ static char * Ioa_ReadLoadFileBz2( char * pFileName ) printf( "Ioa_ReadLoadFileBz2(): The file is empty.\n" ); return NULL; } - pContents = ALLOC( char, nFileSize + 10 ); + pContents = ABC_ALLOC( char, nFileSize + 10 ); rewind( pFile ); fread( pContents, nFileSize, 1, pFile ); } else { @@ -561,12 +561,12 @@ static char * Ioa_ReadLoadFileGz( char * pFileName ) char * pContents; int amtRead, readBlock, nFileSize = READ_BLOCK_SIZE; pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen - pContents = ALLOC( char, nFileSize ); + pContents = ABC_ALLOC( char, nFileSize ); readBlock = 0; while ((amtRead = gzread(pFile, pContents + readBlock * READ_BLOCK_SIZE, READ_BLOCK_SIZE)) == READ_BLOCK_SIZE) { //printf("%d: read %d bytes\n", readBlock, amtRead); nFileSize += READ_BLOCK_SIZE; - pContents = REALLOC(char, pContents, nFileSize); + pContents = ABC_REALLOC(char, pContents, nFileSize); ++readBlock; } //printf("%d: read %d bytes\n", readBlock, amtRead); diff --git a/src/aig/ntl/ntlTable.c b/src/aig/ntl/ntlTable.c index 62f65d6c..d227b1b9 100644 --- a/src/aig/ntl/ntlTable.c +++ b/src/aig/ntl/ntlTable.c @@ -82,7 +82,7 @@ clk = clock(); // get the new table size nTableSizeNew = Aig_PrimeCudd( 3 * p->nTableSize ); // allocate a new array - pTableNew = ALLOC( Ntl_Net_t *, nTableSizeNew ); + pTableNew = ABC_ALLOC( Ntl_Net_t *, nTableSizeNew ); memset( pTableNew, 0, sizeof(Ntl_Net_t *) * nTableSizeNew ); // rehash entries Counter = 0; @@ -97,9 +97,9 @@ clk = clock(); } assert( Counter == p->nEntries ); // printf( "Increasing the structural table size from %6d to %6d. ", p->nTableSize, nTableSizeNew ); -// PRT( "Time", clock() - clk ); +// ABC_PRT( "Time", clock() - clk ); // replace the table and the parameters - free( p->pTable ); + ABC_FREE( p->pTable ); p->pTable = pTableNew; p->nTableSize = nTableSizeNew; } @@ -447,7 +447,7 @@ clk = clock(); // get the new table size nModTableSizeNew = Aig_PrimeCudd( 3 * p->nModTableSize ); // allocate a new array - pModTableNew = ALLOC( Ntl_Mod_t *, nModTableSizeNew ); + pModTableNew = ABC_ALLOC( Ntl_Mod_t *, nModTableSizeNew ); memset( pModTableNew, 0, sizeof(Ntl_Mod_t *) * nModTableSizeNew ); // rehash entries Counter = 0; @@ -462,9 +462,9 @@ clk = clock(); } assert( Counter == p->nModEntries ); // printf( "Increasing the structural table size from %6d to %6d. ", p->nTableSize, nTableSizeNew ); -// PRT( "Time", clock() - clk ); +// ABC_PRT( "Time", clock() - clk ); // replace the table and the parameters - free( p->pModTable ); + ABC_FREE( p->pModTable ); p->pModTable = pModTableNew; p->nModTableSize = nModTableSizeNew; } diff --git a/src/aig/ntl/ntlTime.c b/src/aig/ntl/ntlTime.c index 121fb8ea..f9fadaa8 100644 --- a/src/aig/ntl/ntlTime.c +++ b/src/aig/ntl/ntlTime.c @@ -44,7 +44,7 @@ float * Ntl_ManCreateDelayTable( Vec_Int_t * vDelays, int nIns, int nOuts ) float * pDelayTable, Delay; int iIn, iOut, i, k; assert( Vec_IntSize(vDelays) % 3 == 0 ); - pDelayTable = ALLOC( float, nIns * nOuts ); + pDelayTable = ABC_ALLOC( float, nIns * nOuts ); memset( pDelayTable, 0, sizeof(float) * nIns * nOuts ); Vec_IntForEachEntry( vDelays, iIn, i ) { diff --git a/src/aig/ntl/ntlUtil.c b/src/aig/ntl/ntlUtil.c index 6e797590..9c3d4e42 100644 --- a/src/aig/ntl/ntlUtil.c +++ b/src/aig/ntl/ntlUtil.c @@ -390,7 +390,7 @@ Vec_Vec_t * Ntl_ManTransformRegClasses( Ntl_Man_t * pMan, int nSizeMax, int fVer return NULL; } // count the number of classes - pClassNums = CALLOC( int, ClassMax + 1 ); + pClassNums = ABC_CALLOC( int, ClassMax + 1 ); Vec_IntForEachEntry( pMan->vRegClasses, Class, k ) pClassNums[Class]++; // count the number of classes @@ -417,7 +417,7 @@ Vec_Vec_t * Ntl_ManTransformRegClasses( Ntl_Man_t * pMan, int nSizeMax, int fVer Vec_PtrPush( vParts, vPart ); } printf( "There is only one class with %d registers.\n", Vec_IntSize(pMan->vRegClasses) ); - free( pClassNums ); + ABC_FREE( pClassNums ); return (Vec_Vec_t *)vParts; } // create classes @@ -433,7 +433,7 @@ Vec_Vec_t * Ntl_ManTransformRegClasses( Ntl_Man_t * pMan, int nSizeMax, int fVer assert( Vec_IntSize(vPart) == pClassNums[i] ); Vec_PtrPush( vParts, vPart ); } - free( pClassNums ); + ABC_FREE( pClassNums ); Vec_VecSort( (Vec_Vec_t *)vParts, 1 ); // report the selected classes if ( fVerbose ) diff --git a/src/aig/ntl/ntlWriteBlif.c b/src/aig/ntl/ntlWriteBlif.c index 3df49270..4099d738 100644 --- a/src/aig/ntl/ntlWriteBlif.c +++ b/src/aig/ntl/ntlWriteBlif.c @@ -270,7 +270,7 @@ int fprintfBz2(bz2file * b, char * fmt, ...) { b->nBytesMax = b->nBytes + 1; else b->nBytesMax *= 2; - if ((newBuf = REALLOC( char,b->buf,b->nBytesMax )) == NULL) + if ((newBuf = ABC_REALLOC( char,b->buf,b->nBytesMax )) == NULL) return -1; else b->buf = newBuf; @@ -645,14 +645,14 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) memset(&b,0,sizeof(b)); b.nBytesMax = (1<<12); - b.buf = ALLOC( char,b.nBytesMax ); + b.buf = ABC_ALLOC( char,b.nBytesMax ); // start the output stream b.f = fopen( pFileName, "wb" ); if ( b.f == NULL ) { fprintf( stdout, "Ioa_WriteBlif(): Cannot open the output file \"%s\".\n", pFileName ); - FREE(b.buf); + ABC_FREE(b.buf); return; } if (!strncmp(pFileName+strlen(pFileName)-4,".bz2",4)) { @@ -661,7 +661,7 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) BZ2_bzWriteClose( &bzError, b.b, 0, NULL, NULL ); fprintf( stdout, "Ioa_WriteBlif(): Cannot start compressed stream.\n" ); fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); return; } } @@ -676,12 +676,12 @@ void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName ) if (bzError == BZ_IO_ERROR) { fprintf( stdout, "Ioa_WriteBlif(): I/O error closing compressed stream.\n" ); fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); return; } } fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); } -- cgit v1.2.3