diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2009-02-15 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2009-02-15 08:01:00 -0800 |
commit | 0871bffae307e0553e0c5186336189e8b55cf6a6 (patch) | |
tree | 4571d1563fe33a53a57fea1c35fb668b9d33265f /src/base/io | |
parent | f936cc0680c98ffe51b3a1716c996072d5dbf76c (diff) | |
download | abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.gz abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.bz2 abc-0871bffae307e0553e0c5186336189e8b55cf6a6.zip |
Version abc90215
Diffstat (limited to 'src/base/io')
-rw-r--r-- | src/base/io/io.c | 4 | ||||
-rw-r--r-- | src/base/io/ioAbc.h | 8 | ||||
-rw-r--r-- | src/base/io/ioReadAiger.c | 23 | ||||
-rw-r--r-- | src/base/io/ioReadBaf.c | 8 | ||||
-rw-r--r-- | src/base/io/ioReadBlif.c | 30 | ||||
-rw-r--r-- | src/base/io/ioReadBlifAig.c | 20 | ||||
-rw-r--r-- | src/base/io/ioReadBlifMv.c | 108 | ||||
-rw-r--r-- | src/base/io/ioReadDsd.c | 6 | ||||
-rw-r--r-- | src/base/io/ioReadEdif.c | 2 | ||||
-rw-r--r-- | src/base/io/ioReadEqn.c | 2 | ||||
-rw-r--r-- | src/base/io/ioReadPla.c | 4 | ||||
-rw-r--r-- | src/base/io/ioUtil.c | 4 | ||||
-rw-r--r-- | src/base/io/ioWriteAiger.c | 34 | ||||
-rw-r--r-- | src/base/io/ioWriteBaf.c | 16 | ||||
-rw-r--r-- | src/base/io/ioWriteBlif.c | 2 | ||||
-rw-r--r-- | src/base/io/ioWriteBlifMv.c | 2 | ||||
-rw-r--r-- | src/base/io/ioWriteBook.c | 15 | ||||
-rw-r--r-- | src/base/io/ioWriteCnf.c | 2 | ||||
-rw-r--r-- | src/base/io/ioWritePla.c | 20 | ||||
-rw-r--r-- | src/base/io/ioWriteVerilog.c | 2 |
20 files changed, 193 insertions, 119 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c index a8941868..ee5df414 100644 --- a/src/base/io/io.c +++ b/src/base/io/io.c @@ -847,7 +847,7 @@ int IoCommandReadTruth( Abc_Frame_t * pAbc, int argc, char ** argv ) } pNtk = Abc_NtkCreateWithNode( pSopCover ); - free( pSopCover ); + ABC_FREE( pSopCover ); if ( pNtk == NULL ) { fprintf( pAbc->Err, "Deriving the network has failed.\n" ); @@ -1082,7 +1082,7 @@ int IoCommandReadVerLib( Abc_Frame_t * pAbc, int argc, char ** argv ) return 1; } printf( "The library contains %d gates.\n", st_count(pLibrary->tModules) ); - // free old library + // ABC_FREE old library if ( Abc_FrameReadLibVer() ) Abc_LibFree( Abc_FrameReadLibVer(), NULL ); // read new library diff --git a/src/base/io/ioAbc.h b/src/base/io/ioAbc.h index 842d8995..c11168df 100644 --- a/src/base/io/ioAbc.h +++ b/src/base/io/ioAbc.h @@ -21,10 +21,6 @@ #ifndef __IO_H__ #define __IO_H__ -#ifdef __cplusplus -extern "C" { -#endif - //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -35,6 +31,10 @@ extern "C" { /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// diff --git a/src/base/io/ioReadAiger.c b/src/base/io/ioReadAiger.c index 3a6ecd19..2c37e210 100644 --- a/src/base/io/ioReadAiger.c +++ b/src/base/io/ioReadAiger.c @@ -130,9 +130,9 @@ static char * Ioa_ReadLoadFileBz2Aig( char * pFileName, int * pFileSize ) } 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); @@ -141,14 +141,14 @@ static char * Ioa_ReadLoadFileBz2Aig( char * pFileName, int * pFileSize ) 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 @@ -160,7 +160,7 @@ static char * Ioa_ReadLoadFileBz2Aig( char * pFileName, int * pFileSize ) 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 { @@ -194,12 +194,12 @@ static char * Ioa_ReadLoadFileGzAig( char * pFileName, int * pFileSize ) 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); @@ -244,7 +244,7 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck ) // pContents = Ioa_ReadLoadFile( pFileName ); nFileSize = Extra_FileSize( pFileName ); pFile = fopen( pFileName, "rb" ); - pContents = ALLOC( char, nFileSize ); + pContents = ABC_ALLOC( char, nFileSize ); fread( pContents, nFileSize, 1, pFile ); fclose( pFile ); } @@ -254,6 +254,7 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck ) if ( strncmp(pContents, "aig", 3) != 0 || (pContents[3] != ' ' && pContents[3] != '2') ) { fprintf( stdout, "Wrong input file format.\n" ); + free( pContents ); return NULL; } @@ -262,7 +263,7 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck ) pName = Extra_FileNameGeneric( pFileName ); pNtkNew->pName = Extra_UtilStrsav( pName ); pNtkNew->pSpec = Extra_UtilStrsav( pFileName ); - free( pName ); + ABC_FREE( pName ); // read the file type @@ -469,14 +470,14 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck ) char * pTemp; for ( pTemp = pCur + 9; *pTemp && *pTemp != '\n'; pTemp++ ); *pTemp = 0; - free( pNtkNew->pName ); + ABC_FREE( pNtkNew->pName ); pNtkNew->pName = Extra_UtilStrsav( pCur + 9 ); } } // skipping the comments - free( pContents ); + ABC_FREE( pContents ); Vec_PtrFree( vNodes ); // remove the extra nodes diff --git a/src/base/io/ioReadBaf.c b/src/base/io/ioReadBaf.c index eb337603..495f122b 100644 --- a/src/base/io/ioReadBaf.c +++ b/src/base/io/ioReadBaf.c @@ -53,7 +53,7 @@ Abc_Ntk_t * Io_ReadBaf( char * pFileName, int fCheck ) // read the file into the buffer nFileSize = Extra_FileSize( pFileName ); pFile = fopen( pFileName, "rb" ); - pContents = ALLOC( char, nFileSize ); + pContents = ABC_ALLOC( char, nFileSize ); fread( pContents, nFileSize, 1, pFile ); fclose( pFile ); @@ -116,7 +116,7 @@ Abc_Ntk_t * Io_ReadBaf( char * pFileName, int fCheck ) // make sure we are at the place where the nodes begin if ( pBufferNode != (unsigned *)pCur ) { - free( pContents ); + ABC_FREE( pContents ); Vec_PtrFree( vNodes ); Abc_NtkDelete( pNtkNew ); printf( "Warning: Internal reader error.\n" ); @@ -140,13 +140,13 @@ Abc_Ntk_t * Io_ReadBaf( char * pFileName, int fCheck ) Num = pBufferNode[2*nAnds+i]; if ( Abc_ObjFanoutNum(pObj) > 0 && Abc_ObjIsLatch(Abc_ObjFanout0(pObj)) ) { - Abc_ObjSetData( Abc_ObjFanout0(pObj), (void *)(PORT_PTRINT_T)(Num & 3) ); + Abc_ObjSetData( Abc_ObjFanout0(pObj), (void *)(ABC_PTRINT_T)(Num & 3) ); Num >>= 2; } pNode0 = Abc_ObjNotCond( Vec_PtrEntry(vNodes, Num >> 1), Num & 1 ); Abc_ObjAddFanin( pObj, pNode0 ); } - free( pContents ); + ABC_FREE( pContents ); Vec_PtrFree( vNodes ); // remove the extra nodes diff --git a/src/base/io/ioReadBlif.c b/src/base/io/ioReadBlif.c index c818cd55..b6eb29e3 100644 --- a/src/base/io/ioReadBlif.c +++ b/src/base/io/ioReadBlif.c @@ -610,7 +610,7 @@ int Io_ReadBlifNetworkGate( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) Description [] - SideEffects [] + SideEffects [] SeeAlso [] @@ -642,7 +642,7 @@ int Io_ReadBlifNetworkSubcircuit( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) // set the pointer to the node names Abc_ObjSetData( pBox, vNames ); // remember the line of the file - pBox->pCopy = (void *)(PORT_PTRINT_T)Extra_FileReaderGetLineNumber(p->pReader, 0); + pBox->pCopy = (void *)(ABC_PTRINT_T)Extra_FileReaderGetLineNumber(p->pReader, 0); return 0; } @@ -795,7 +795,7 @@ Vec_Ptr_t * Io_ReadBlifGetTokens( Io_ReadBlif_t * p ) if ( p->vNewTokens->nSize > 0 ) { for ( i = 0; i < p->vNewTokens->nSize; i++ ) - free( p->vNewTokens->pArray[i] ); + ABC_FREE( p->vNewTokens->pArray[i] ); p->vNewTokens->nSize = 0; } @@ -868,7 +868,7 @@ Io_ReadBlif_t * Io_ReadBlifFile( char * pFileName ) return NULL; // start the reading data structure - p = ALLOC( Io_ReadBlif_t, 1 ); + p = ABC_ALLOC( Io_ReadBlif_t, 1 ); memset( p, 0, sizeof(Io_ReadBlif_t) ); p->pFileName = pFileName; p->pReader = pReader; @@ -894,7 +894,7 @@ void Io_ReadBlifFree( Io_ReadBlif_t * p ) Extra_FileReaderFree( p->pReader ); Vec_PtrFree( p->vNewTokens ); Vec_StrFree( p->vCubes ); - free( p ); + ABC_FREE( p ); } @@ -921,7 +921,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pNames = pBox->pData; if ( !stmm_lookup( tName2Model, Vec_PtrEntry(pNames, 0), (char **)&pNtkModel ) ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Cannot find the model for subcircuit %s.", (char*)Vec_PtrEntry(pNames, 0) ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -939,7 +939,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pActual = Io_ReadBlifCleanName(pName); if ( pActual == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -950,7 +950,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pObj = Abc_NtkFindNet( pNtkModel, pName ); if ( pObj == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Cannot find formal input \"%s\" as an PI of model \"%s\".", pName, (char*)Vec_PtrEntry(pNames, 0) ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -967,7 +967,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s // remember the actual name in the net if ( pObj->pCopy != NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Formal input \"%s\" is used more than once.", pName ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -987,7 +987,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pActual = (void *)pObj->pCopy; if ( pActual == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Formal input \"%s\" of model %s is not driven.", pName, (char*)Vec_PtrEntry(pNames, 0) ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -1006,7 +1006,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pActual = Io_ReadBlifCleanName(pName); if ( pActual == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -1017,7 +1017,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pObj = Abc_NtkFindNet( pNtkModel, pName ); if ( pObj == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Cannot find formal output \"%s\" as an PO of model \"%s\".", pName, (char*)Vec_PtrEntry(pNames, 0) ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -1026,7 +1026,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pObj = Abc_ObjFanout0(pObj); if ( pObj->pCopy != NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Formal output \"%s\" is used more than once.", pName ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -1039,7 +1039,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s pActual = (void *)pObj->pCopy; if ( pActual == NULL ) { - p->LineCur = (int)(PORT_PTRINT_T)pBox->pCopy; + p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy; sprintf( p->sError, "Formal output \"%s\" of model %s is not driven.", pName, (char*)Vec_PtrEntry(pNames, 0) ); Io_ReadBlifPrintErrorMessage( p ); return 1; @@ -1052,7 +1052,7 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s // remove the array of names, assign the pointer to the model Vec_PtrForEachEntry( pBox->pData, pName, i ) - free( pName ); + ABC_FREE( pName ); Vec_PtrFree( pBox->pData ); pBox->pData = pNtkModel; return 0; diff --git a/src/base/io/ioReadBlifAig.c b/src/base/io/ioReadBlifAig.c index 75552192..8d4c77d4 100644 --- a/src/base/io/ioReadBlifAig.c +++ b/src/base/io/ioReadBlifAig.c @@ -60,7 +60,7 @@ struct Io_BlifMan_t_ // temporary objects Io_BlifObj_t * pObjects; // the storage for objects int nObjects; // the number of objects allocated - int iObjNext; // the next free object + int iObjNext; // the next ABC_FREE object // file lines char * pModel; // .model line Vec_Ptr_t * vInputs; // .inputs lines @@ -171,7 +171,7 @@ Abc_Ntk_t * Io_ReadBlifAsAig( char * pFileName, int fCheck ) static Io_BlifMan_t * Io_BlifAlloc() { Io_BlifMan_t * p; - p = ALLOC( Io_BlifMan_t, 1 ); + p = ABC_ALLOC( Io_BlifMan_t, 1 ); memset( p, 0, sizeof(Io_BlifMan_t) ); p->vLines = Vec_PtrAlloc( 512 ); p->vInputs = Vec_PtrAlloc( 512 ); @@ -201,9 +201,9 @@ static void Io_BlifFree( Io_BlifMan_t * p ) { if ( p->pAig ) Abc_NtkDelete( p->pAig ); - if ( p->pBuffer ) free( p->pBuffer ); - if ( p->pObjects ) free( p->pObjects ); - if ( p->pTable ) free( p->pTable ); + if ( p->pBuffer ) ABC_FREE( p->pBuffer ); + if ( p->pObjects ) ABC_FREE( p->pObjects ); + if ( p->pTable ) ABC_FREE( p->pTable ); Vec_PtrFree( p->vLines ); Vec_PtrFree( p->vInputs ); Vec_PtrFree( p->vOutputs ); @@ -214,7 +214,7 @@ static void Io_BlifFree( Io_BlifMan_t * p ) Vec_PtrFree( p->vPos ); Vec_PtrFree( p->vLis ); Vec_PtrFree( p->vLos ); - free( p ); + ABC_FREE( p ); } @@ -444,7 +444,7 @@ static char * Io_BlifLoadFile( char * pFileName ) printf( "Io_BlifLoadFile(): 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 ); @@ -539,12 +539,12 @@ static void Io_BlifReadPreparse( Io_BlifMan_t * p ) p->nObjects = Io_BlifEstimatePiNum(p) + Vec_PtrSize(p->vLatches) + Vec_PtrSize(p->vNames) + 512; // allocate memory for objects - p->pObjects = ALLOC( Io_BlifObj_t, p->nObjects ); + p->pObjects = ABC_ALLOC( Io_BlifObj_t, p->nObjects ); memset( p->pObjects, 0, p->nObjects * sizeof(Io_BlifObj_t) ); // allocate memory for the hash table p->nTableSize = p->nObjects/2 + 1; - p->pTable = ALLOC( Io_BlifObj_t *, p->nTableSize ); + p->pTable = ABC_ALLOC( Io_BlifObj_t *, p->nTableSize ); memset( p->pTable, 0, p->nTableSize * sizeof(Io_BlifObj_t *) ); } @@ -970,7 +970,7 @@ static int Io_BlifParseConstruct( Io_BlifMan_t * p ) // add the latch box pLatch = Abc_NtkCreateLatch( pAig ); - pLatch->pData = (void *)(PORT_PTRUINT_T)pObjIo->Init; + pLatch->pData = (void *)(ABC_PTRUINT_T)pObjIo->Init; Abc_ObjAssignName( pLatch, pObjIo->pName, "L" ); Abc_ObjAddFanin( pLatch, pObj ); diff --git a/src/base/io/ioReadBlifMv.c b/src/base/io/ioReadBlifMv.c index 87358ed2..95ea4fe5 100644 --- a/src/base/io/ioReadBlifMv.c +++ b/src/base/io/ioReadBlifMv.c @@ -49,6 +49,7 @@ struct Io_MvMod_t_ Vec_Ptr_t * vResets; // .reset lines Vec_Ptr_t * vNames; // .names lines Vec_Ptr_t * vSubckts; // .subckt lines + Vec_Ptr_t * vShorts; // .short lines Vec_Ptr_t * vOnehots; // .onehot lines Vec_Ptr_t * vMvs; // .mv lines int fBlackBox; // indicates blackbox model @@ -102,6 +103,7 @@ static Vec_Int_t * Io_MvParseLineOnehot( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineNamesMv( Io_MvMod_t * p, char * pLine, int fReset ); static int Io_MvParseLineNamesBlif( Io_MvMod_t * p, char * pLine ); +static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine ); static int Io_MvParseLineGateBlif( Io_MvMod_t * p, Vec_Ptr_t * vTokens ); static Io_MvVar_t * Abc_NtkMvVarDup( Abc_Ntk_t * pNtk, Io_MvVar_t * pVar ); @@ -157,8 +159,8 @@ Abc_Ntk_t * Io_ReadBlifMv( char * pFileName, int fBlifMv, int fCheck ) // set the design name pDesignName = Extra_FileNameGeneric( pFileName ); p->pDesign = Abc_LibCreate( pDesignName ); - free( pDesignName ); - // free the HOP manager + ABC_FREE( pDesignName ); + // ABC_FREE the HOP manager Hop_ManStop( p->pDesign->pManFunc ); p->pDesign->pManFunc = NULL; // prepare the file for parsing @@ -232,7 +234,7 @@ Abc_Ntk_t * Io_ReadBlifMv( char * pFileName, int fBlifMv, int fCheck ) static Io_MvMan_t * Io_MvAlloc() { Io_MvMan_t * p; - p = ALLOC( Io_MvMan_t, 1 ); + p = ABC_ALLOC( Io_MvMan_t, 1 ); memset( p, 0, sizeof(Io_MvMan_t) ); p->vLines = Vec_PtrAlloc( 512 ); p->vModels = Vec_PtrAlloc( 512 ); @@ -260,7 +262,7 @@ static void Io_MvFree( Io_MvMan_t * p ) if ( p->pDesign ) Abc_LibFree( p->pDesign, NULL ); if ( p->pBuffer ) - free( p->pBuffer ); + ABC_FREE( p->pBuffer ); if ( p->vLines ) Vec_PtrFree( p->vLines ); if ( p->vModels ) @@ -272,7 +274,7 @@ static void Io_MvFree( Io_MvMan_t * p ) Vec_PtrFree( p->vTokens ); Vec_PtrFree( p->vTokens2 ); Vec_StrFree( p->vFunc ); - free( p ); + ABC_FREE( p ); } /**Function************************************************************* @@ -289,7 +291,7 @@ static void Io_MvFree( Io_MvMan_t * p ) static Io_MvMod_t * Io_MvModAlloc() { Io_MvMod_t * p; - p = ALLOC( Io_MvMod_t, 1 ); + p = ABC_ALLOC( Io_MvMod_t, 1 ); memset( p, 0, sizeof(Io_MvMod_t) ); p->vInputs = Vec_PtrAlloc( 512 ); p->vOutputs = Vec_PtrAlloc( 512 ); @@ -297,6 +299,7 @@ static Io_MvMod_t * Io_MvModAlloc() p->vResets = Vec_PtrAlloc( 512 ); p->vNames = Vec_PtrAlloc( 512 ); p->vSubckts = Vec_PtrAlloc( 512 ); + p->vShorts = Vec_PtrAlloc( 512 ); p->vOnehots = Vec_PtrAlloc( 512 ); p->vMvs = Vec_PtrAlloc( 512 ); return p; @@ -323,9 +326,10 @@ static void Io_MvModFree( Io_MvMod_t * p ) Vec_PtrFree( p->vResets ); Vec_PtrFree( p->vNames ); Vec_PtrFree( p->vSubckts ); + Vec_PtrFree( p->vShorts ); Vec_PtrFree( p->vOnehots ); Vec_PtrFree( p->vMvs ); - free( p ); + ABC_FREE( p ); } @@ -515,7 +519,7 @@ static char * Io_MvLoadFile( char * pFileName ) printf( "Io_MvLoadFile(): 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 ); @@ -601,6 +605,8 @@ static void Io_MvReadPreparse( Io_MvMan_t * p ) Vec_PtrPush( p->pLatest->vOutputs, pCur ); else if ( !strncmp(pCur, "subckt", 6) ) Vec_PtrPush( p->pLatest->vSubckts, pCur ); + else if ( !strncmp(pCur, "short", 5) ) + Vec_PtrPush( p->pLatest->vShorts, pCur ); else if ( !strncmp(pCur, "onehot", 6) ) Vec_PtrPush( p->pLatest->vOnehots, pCur ); else if ( p->fBlifMv && !strncmp(pCur, "mv", 2) ) @@ -634,6 +640,8 @@ static void Io_MvReadPreparse( Io_MvMan_t * p ) {} else if ( !strncmp(pCur, "no_merge", 8) ) {} +// else if ( !strncmp(pCur, "inouts", 6) ) +// {} else { pCur--; @@ -746,6 +754,9 @@ static Abc_Lib_t * Io_MvParse( Io_MvMan_t * p ) Vec_PtrForEachEntry( pMod->vNames, pLine, k ) if ( !Io_MvParseLineNamesBlif( pMod, pLine ) ) return NULL; + Vec_PtrForEachEntry( pMod->vShorts, pLine, k ) + if ( !Io_MvParseLineShortBlif( pMod, pLine ) ) + return NULL; } // parse the subcircuits Vec_PtrForEachEntry( pMod->vSubckts, pLine, k ) @@ -753,10 +764,14 @@ static Abc_Lib_t * Io_MvParse( Io_MvMan_t * p ) return NULL; // allow for blackboxes without .blackbox line - if ( Abc_NtkLatchNum(pMod->pNtk) == 0 && Abc_NtkNodeNum(pMod->pNtk) == 0 ) + if ( Abc_NtkLatchNum(pMod->pNtk) == 0 && Abc_NtkNodeNum(pMod->pNtk) == 0 && Abc_NtkBoxNum(pMod->pNtk) == 0 ) { if ( pMod->pNtk->ntkFunc == ABC_FUNC_SOP ) + { + Extra_MmFlexStop( pMod->pNtk->pManFunc ); + pMod->pNtk->pManFunc = NULL; pMod->pNtk->ntkFunc = ABC_FUNC_BLACKBOX; + } } // finalize the network @@ -768,7 +783,7 @@ static Abc_Lib_t * Io_MvParse( Io_MvMan_t * p ) Abc_Obj_t * pObj; // set register numbers Abc_NtkForEachLatch( pMod->pNtk, pObj, k ) - pObj->pNext = (Abc_Obj_t *)(PORT_PTRINT_T)k; + pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)k; // derive register pMod->pNtk->vOnehots = Vec_PtrAlloc( Vec_PtrSize(pMod->vOnehots) ); Vec_PtrForEachEntry( pMod->vOnehots, pLine, k ) @@ -990,7 +1005,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) sprintf( p->pMan->sError, "Line %d: Cannot find the model for subcircuit %s.", Io_MvGetLine(p->pMan, pToken), pName ); return 0; } - +/* // check if the number of tokens is correct if ( nEquals != Abc_NtkPiNum(pModel) + Abc_NtkPoNum(pModel) ) { @@ -998,7 +1013,7 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) Io_MvGetLine(p->pMan, pToken), nEquals, Abc_NtkPiNum(pModel) + Abc_NtkPoNum(pModel) ); return 0; } - +*/ // get the names ppNames = (char **)Vec_PtrArray(vTokens) + 2 + p->pMan->fBlifMv; @@ -1010,41 +1025,59 @@ static int Io_MvParseLineSubckt( Io_MvMod_t * p, char * pLine ) pBox->pData = pModel; if ( p->pMan->fBlifMv ) Abc_ObjAssignName( pBox, Vec_PtrEntry(vTokens,2), NULL ); + // go through formal inputs Abc_NtkForEachPi( pModel, pTerm, i ) - { - // find this terminal among the formal inputs of the subcircuit + { + // find this terminal among the actual inputs of the subcircuit pName = Abc_ObjName(Abc_ObjFanout0(pTerm)); for ( k = 0; k < nEquals; k++ ) if ( !strcmp( ppNames[2*k], pName ) ) break; +/* if ( k == nEquals ) { sprintf( p->pMan->sError, "Line %d: Cannot find PI \"%s\" of the model \"%s\" as a formal input of the subcircuit.", Io_MvGetLine(p->pMan, pToken), pName, Abc_NtkName(pModel) ); return 0; } +*/ + if ( k == nEquals ) + { + Abc_Obj_t * pNode = Abc_NtkCreateNode( p->pNtk ); + pNode->pData = Abc_SopRegister( p->pNtk->pManFunc, " 0\n" ); + pNet = Abc_NtkFindOrCreateNet( p->pNtk, Abc_ObjNameSuffix(pNode, "abc") ); + Abc_ObjAddFanin( pNet, pNode ); + pTerm = Abc_NtkCreateBi( p->pNtk ); + Abc_ObjAddFanin( pBox, pTerm ); + Abc_ObjAddFanin( pTerm, pNet ); + continue; + } + // create the BI with the actual name pNet = Abc_NtkFindOrCreateNet( p->pNtk, ppNames[2*k+1] ); pTerm = Abc_NtkCreateBi( p->pNtk ); Abc_ObjAddFanin( pBox, pTerm ); Abc_ObjAddFanin( pTerm, pNet ); } + // go through formal outputs Abc_NtkForEachPo( pModel, pTerm, i ) { - // find this terminal among the formal outputs of the subcircuit + // find this terminal among the actual outputs of the subcircuit pName = Abc_ObjName(Abc_ObjFanin0(pTerm)); for ( k = 0; k < nEquals; k++ ) if ( !strcmp( ppNames[2*k], pName ) ) break; +/* if ( k == nEquals ) { sprintf( p->pMan->sError, "Line %d: Cannot find PO \"%s\" of the modell \"%s\" as a formal output of the subcircuit.", Io_MvGetLine(p->pMan, pToken), pName, Abc_NtkName(pModel) ); return 0; } +*/ // create the BI with the actual name - pNet = Abc_NtkFindOrCreateNet( p->pNtk, ppNames[2*k+1] ); pTerm = Abc_NtkCreateBo( p->pNtk ); + pNet = Abc_NtkFindOrCreateNet( p->pNtk, k == nEquals ? Abc_ObjNameSuffix(pTerm, "abc") : ppNames[2*k+1] ); Abc_ObjAddFanin( pNet, pTerm ); Abc_ObjAddFanin( pTerm, pBox ); } @@ -1100,9 +1133,9 @@ static Vec_Int_t * Io_MvParseLineOnehot( Io_MvMod_t * p, char * pLine ) } // save register name // Vec_PtrPush( vResult, Abc_ObjName(pNet) ); - Vec_IntPush( vResult, (int)(PORT_PTRINT_T)Abc_ObjFanin0(pTerm)->pNext ); + Vec_IntPush( vResult, (int)(ABC_PTRINT_T)Abc_ObjFanin0(pTerm)->pNext ); // printf( "%d(%d) ", (int)Abc_ObjFanin0(pTerm)->pNext, ((int)Abc_ObjFanin0(pTerm)->pData) -1 ); - printf( "%d", ((int)(PORT_PTRINT_T)Abc_ObjFanin0(pTerm)->pData)-1 ); + printf( "%d", ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pTerm)->pData)-1 ); } printf( "\n" ); return vResult; @@ -1681,6 +1714,45 @@ static int Io_MvParseLineNamesBlif( Io_MvMod_t * p, char * pLine ) /**Function************************************************************* + Synopsis [Parses the nodes line.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine ) +{ + Vec_Ptr_t * vTokens = p->pMan->vTokens; + Abc_Obj_t * pNet, * pNode; + char * pName; + assert( !p->pMan->fBlifMv ); + Io_MvSplitIntoTokens( vTokens, pLine, '\0' ); + if ( Vec_PtrSize(vTokens) != 3 ) + { + sprintf( p->pMan->sError, "Line %d: Expecting three entries in the .short line.", Io_MvGetLine(p->pMan, Vec_PtrEntry(vTokens,0)) ); + return 0; + } + // parse the regular name line + assert( !strcmp(Vec_PtrEntry(vTokens,0), "short") ); + pName = Vec_PtrEntryLast( vTokens ); + pNet = Abc_NtkFindOrCreateNet( p->pNtk, pName ); + if ( Abc_ObjFaninNum(pNet) > 0 ) + { + sprintf( p->pMan->sError, "Line %d: Signal \"%s\" is defined more than once.", Io_MvGetLine(p->pMan, pName), pName ); + return 0; + } + // create fanins + pNode = Io_ReadCreateNode( p->pNtk, pName, (char **)(vTokens->pArray + 1), 1 ); + // parse the table of this node + pNode->pData = Abc_SopRegister( p->pNtk->pManFunc, "1 1\n" ); + return 1; +} + +/**Function************************************************************* + Synopsis [Duplicate the MV variable.] Description [] diff --git a/src/base/io/ioReadDsd.c b/src/base/io/ioReadDsd.c index 482b5d06..4848e4e9 100644 --- a/src/base/io/ioReadDsd.c +++ b/src/base/io/ioReadDsd.c @@ -211,7 +211,7 @@ Abc_Obj_t * Io_ReadDsd_rec( Abc_Ntk_t * pNtk, char * pCur, char * pSop ) pSop = Abc_SopFromTruthHex( pCur ); *pEnd = '('; pObj = Io_ReadDsd_rec( pNtk, pEnd, pSop ); - free( pSop ); + ABC_FREE( pSop ); return pObj; } @@ -253,7 +253,7 @@ Abc_Ntk_t * Io_ReadDsd( char * pForm ) // transform the formula by inserting parantheses // this transforms strings like PRIME(a,b,cd) into (PRIME((a),(b),(cd))) - pCur = pFormCopy = ALLOC( char, 3 * strlen(pForm) + 10 ); + pCur = pFormCopy = ABC_ALLOC( char, 3 * strlen(pForm) + 10 ); *pCur++ = '('; for ( ; *pForm; pForm++ ) if ( *pForm == '(' ) @@ -279,7 +279,7 @@ Abc_Ntk_t * Io_ReadDsd( char * pForm ) // parse the formula pObj = Io_ReadDsd_rec( pNtk, pFormCopy, NULL ); - free( pFormCopy ); + ABC_FREE( pFormCopy ); if ( pObj == NULL ) return NULL; diff --git a/src/base/io/ioReadEdif.c b/src/base/io/ioReadEdif.c index 2f97644a..26e49d0e 100644 --- a/src/base/io/ioReadEdif.c +++ b/src/base/io/ioReadEdif.c @@ -184,7 +184,7 @@ Abc_Ntk_t * Io_ReadEdifNetwork( Extra_FileReader_t * p ) } else if ( strcmp( vTokens->pArray[0], "design" ) == 0 ) { - free( pNtk->pName ); + ABC_FREE( pNtk->pName ); pNtk->pName = Extra_UtilStrsav( vTokens->pArray[3] ); break; } diff --git a/src/base/io/ioReadEqn.c b/src/base/io/ioReadEqn.c index ad35c73b..f778197b 100644 --- a/src/base/io/ioReadEqn.c +++ b/src/base/io/ioReadEqn.c @@ -158,7 +158,7 @@ Abc_Ntk_t * Io_ReadEqnNetwork( Extra_FileReader_t * p ) // derive the function pNode->pData = Parse_FormulaParserEqn( stdout, pFormula, vVars, pNtk->pManFunc ); // remove the cubes - FREE( pFormulaCopy ); + ABC_FREE( pFormulaCopy ); } } Extra_ProgressBarStop( pProgress ); diff --git a/src/base/io/ioReadPla.c b/src/base/io/ioReadPla.c index 4b326783..347d1daa 100644 --- a/src/base/io/ioReadPla.c +++ b/src/base/io/ioReadPla.c @@ -168,7 +168,7 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) { // first time here // create the PO drivers and add them // start the SOP covers - ppSops = ALLOC( Vec_Str_t *, nOutputs ); + ppSops = ABC_ALLOC( Vec_Str_t *, nOutputs ); Abc_NtkForEachPo( pNtk, pTermPo, i ) { ppSops[i] = Vec_StrAlloc( 100 ); @@ -250,7 +250,7 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) pNode->pData = Abc_SopRegister( pNtk->pManFunc, ppSops[i]->pArray ); Vec_StrFree( ppSops[i] ); } - free( ppSops ); + ABC_FREE( ppSops ); Abc_NtkFinalizeRead( pNtk ); return pNtk; } diff --git a/src/base/io/ioUtil.c b/src/base/io/ioUtil.c index 60e6adc8..c67c183d 100644 --- a/src/base/io/ioUtil.c +++ b/src/base/io/ioUtil.c @@ -733,11 +733,11 @@ FILE * Io_FileOpen( const char * FileName, const char * PathVar, const char * Mo { if ( fVerbose ) fprintf ( stdout, "Using file %s\n", ActualFileName ); - free( t ); + ABC_FREE( t ); return fp; } } - free( t ); + ABC_FREE( t ); return 0; } else diff --git a/src/base/io/ioWriteAiger.c b/src/base/io/ioWriteAiger.c index 45e1e965..f1793a59 100644 --- a/src/base/io/ioWriteAiger.c +++ b/src/base/io/ioWriteAiger.c @@ -136,8 +136,8 @@ Binary Format Definition */ static unsigned Io_ObjMakeLit( int Var, int fCompl ) { return (Var << 1) | fCompl; } -static unsigned Io_ObjAigerNum( Abc_Obj_t * pObj ) { return (unsigned)(PORT_PTRINT_T)pObj->pCopy; } -static void Io_ObjSetAigerNum( Abc_Obj_t * pObj, unsigned Num ) { pObj->pCopy = (void *)(PORT_PTRINT_T)Num; } +static unsigned Io_ObjAigerNum( Abc_Obj_t * pObj ) { return (unsigned)(ABC_PTRINT_T)pObj->pCopy; } +static void Io_ObjSetAigerNum( Abc_Obj_t * pObj, unsigned Num ) { pObj->pCopy = (void *)(ABC_PTRINT_T)Num; } //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// @@ -331,7 +331,7 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i // write the nodes into the buffer Pos = 0; nBufferSize = 6 * Abc_NtkNodeNum(pNtk) + 100; // skeptically assuming 3 chars per one AIG edge - pBuffer = ALLOC( unsigned char, nBufferSize ); + pBuffer = ABC_ALLOC( unsigned char, nBufferSize ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) ); Abc_AigForEachAnd( pNtk, pObj, i ) { @@ -354,7 +354,7 @@ void Io_WriteAiger_old( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, i // write the buffer fwrite( pBuffer, 1, Pos, pFile ); - free( pBuffer ); + ABC_FREE( pBuffer ); // write the symbol table if ( fWriteSymbols ) @@ -451,7 +451,7 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols ) // write the nodes into the buffer Pos = 0; nBufferSize = 6 * Abc_NtkNodeNum(pNtk) + 100; // skeptically assuming 3 chars per one AIG edge - pBuffer = ALLOC( char, nBufferSize ); + pBuffer = ABC_ALLOC( char, nBufferSize ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) ); Abc_AigForEachAnd( pNtk, pObj, i ) { @@ -474,7 +474,7 @@ void Io_WriteAigerGz( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols ) // write the buffer gzwrite(pFile, pBuffer, Pos); - free( pBuffer ); + ABC_FREE( pBuffer ); // write the symbol table if ( fWriteSymbols ) @@ -534,7 +534,7 @@ int fprintfBz2Aig( 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; @@ -594,14 +594,14 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f 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)) { @@ -610,7 +610,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f 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; } } @@ -663,7 +663,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f if (bzError == BZ_IO_ERROR) { fprintf( stdout, "Io_WriteAiger(): I/O error writing to compressed stream.\n" ); fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); return; } } @@ -674,7 +674,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f // write the nodes into the buffer Pos = 0; nBufferSize = 6 * Abc_NtkNodeNum(pNtk) + 100; // skeptically assuming 3 chars per one AIG edge - pBuffer = ALLOC( unsigned char, nBufferSize ); + pBuffer = ABC_ALLOC( unsigned char, nBufferSize ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) ); Abc_AigForEachAnd( pNtk, pObj, i ) { @@ -689,7 +689,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f { printf( "Io_WriteAiger(): AIGER generation has failed because the allocated buffer is too small.\n" ); fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); return; } } @@ -705,11 +705,11 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f if (bzError == BZ_IO_ERROR) { fprintf( stdout, "Io_WriteAiger(): I/O error writing to compressed stream.\n" ); fclose( b.f ); - FREE(b.buf); + ABC_FREE(b.buf); return; } } - free( pBuffer ); + ABC_FREE( pBuffer ); // write the symbol table if ( fWriteSymbols ) @@ -738,12 +738,12 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f if (bzError == BZ_IO_ERROR) { fprintf( stdout, "Io_WriteAiger(): 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); } //////////////////////////////////////////////////////////////////////// diff --git a/src/base/io/ioWriteBaf.c b/src/base/io/ioWriteBaf.c index 6a9af2f2..1154e218 100644 --- a/src/base/io/ioWriteBaf.c +++ b/src/base/io/ioWriteBaf.c @@ -126,29 +126,29 @@ void Io_WriteBaf( Abc_Ntk_t * pNtk, char * pFileName ) Abc_NtkCleanCopy( pNtk ); nNodes = 1; Abc_NtkForEachCi( pNtk, pObj, i ) - pObj->pCopy = (void *)(PORT_PTRINT_T)nNodes++; + pObj->pCopy = (void *)(ABC_PTRINT_T)nNodes++; Abc_AigForEachAnd( pNtk, pObj, i ) - pObj->pCopy = (void *)(PORT_PTRINT_T)nNodes++; + pObj->pCopy = (void *)(ABC_PTRINT_T)nNodes++; // write the nodes into the buffer nAnds = 0; nBufferSize = Abc_NtkNodeNum(pNtk) * 2 + Abc_NtkCoNum(pNtk); - pBufferNode = ALLOC( unsigned, nBufferSize ); + pBufferNode = ABC_ALLOC( unsigned, nBufferSize ); pProgress = Extra_ProgressBarStart( stdout, nBufferSize ); Abc_AigForEachAnd( pNtk, pObj, i ) { Extra_ProgressBarUpdate( pProgress, nAnds, NULL ); - pBufferNode[nAnds++] = (((int)(PORT_PTRINT_T)Abc_ObjFanin0(pObj)->pCopy) << 1) | Abc_ObjFaninC0(pObj); - pBufferNode[nAnds++] = (((int)(PORT_PTRINT_T)Abc_ObjFanin1(pObj)->pCopy) << 1) | Abc_ObjFaninC1(pObj); + pBufferNode[nAnds++] = (((int)(ABC_PTRINT_T)Abc_ObjFanin0(pObj)->pCopy) << 1) | Abc_ObjFaninC0(pObj); + pBufferNode[nAnds++] = (((int)(ABC_PTRINT_T)Abc_ObjFanin1(pObj)->pCopy) << 1) | Abc_ObjFaninC1(pObj); } // write the COs into the buffer Abc_NtkForEachCo( pNtk, pObj, i ) { Extra_ProgressBarUpdate( pProgress, nAnds, NULL ); - pBufferNode[nAnds] = (((int)(PORT_PTRINT_T)Abc_ObjFanin0(pObj)->pCopy) << 1) | Abc_ObjFaninC0(pObj); + pBufferNode[nAnds] = (((int)(ABC_PTRINT_T)Abc_ObjFanin0(pObj)->pCopy) << 1) | Abc_ObjFaninC0(pObj); if ( Abc_ObjFanoutNum(pObj) > 0 && Abc_ObjIsLatch(Abc_ObjFanout0(pObj)) ) - pBufferNode[nAnds] = (pBufferNode[nAnds] << 2) | ((int)(PORT_PTRINT_T)Abc_ObjData(Abc_ObjFanout0(pObj)) & 3); + pBufferNode[nAnds] = (pBufferNode[nAnds] << 2) | ((int)(ABC_PTRINT_T)Abc_ObjData(Abc_ObjFanout0(pObj)) & 3); nAnds++; } Extra_ProgressBarStop( pProgress ); @@ -157,7 +157,7 @@ void Io_WriteBaf( Abc_Ntk_t * pNtk, char * pFileName ) // write the buffer fwrite( pBufferNode, 1, sizeof(int) * nBufferSize, pFile ); fclose( pFile ); - free( pBufferNode ); + ABC_FREE( pBufferNode ); } diff --git a/src/base/io/ioWriteBlif.c b/src/base/io/ioWriteBlif.c index 342dc0aa..dae8b783 100644 --- a/src/base/io/ioWriteBlif.c +++ b/src/base/io/ioWriteBlif.c @@ -434,7 +434,7 @@ void Io_NtkWriteLatch( FILE * pFile, Abc_Obj_t * pLatch ) int Reset; pNetLi = Abc_ObjFanin0( Abc_ObjFanin0(pLatch) ); pNetLo = Abc_ObjFanout0( Abc_ObjFanout0(pLatch) ); - Reset = (int)(PORT_PTRUINT_T)Abc_ObjData( pLatch ); + Reset = (int)(ABC_PTRUINT_T)Abc_ObjData( pLatch ); // write the latch line fprintf( pFile, ".latch" ); fprintf( pFile, " %10s", Abc_ObjName(pNetLi) ); diff --git a/src/base/io/ioWriteBlifMv.c b/src/base/io/ioWriteBlifMv.c index 266ee95f..e1494475 100644 --- a/src/base/io/ioWriteBlifMv.c +++ b/src/base/io/ioWriteBlifMv.c @@ -341,7 +341,7 @@ void Io_NtkWriteBlifMvLatch( FILE * pFile, Abc_Obj_t * pLatch ) int Reset; pNetLi = Abc_ObjFanin0( Abc_ObjFanin0(pLatch) ); pNetLo = Abc_ObjFanout0( Abc_ObjFanout0(pLatch) ); - Reset = (int)(PORT_PTRUINT_T)Abc_ObjData( pLatch ); + Reset = (int)(ABC_PTRUINT_T)Abc_ObjData( pLatch ); // write the latch line fprintf( pFile, ".latch" ); fprintf( pFile, " %10s", Abc_ObjName(pNetLi) ); diff --git a/src/base/io/ioWriteBook.c b/src/base/io/ioWriteBook.c index 95405438..322c3ef4 100644 --- a/src/base/io/ioWriteBook.c +++ b/src/base/io/ioWriteBook.c @@ -97,7 +97,7 @@ void Io_WriteBook( Abc_Ntk_t * pNtk, char * FileName ) FILE * pFileNodes, * pFileNets, * pFileAux; FILE * pFileScl, * pFilePl, * pFileWts; - char * FileExt = (char *)calloc(strlen(FileName)+7, sizeof(char)); + char * FileExt = ABC_CALLOC( char, strlen(FileName)+7 ); unsigned coreCellArea=0; Abc_Ntk_t * pExdc, * pNtkTemp; int i; @@ -156,7 +156,7 @@ void Io_WriteBook( Abc_Ntk_t * pNtk, char * FileName ) pFilePl = fopen( strcat(FileExt,".pl"), "w" ); strcpy(FileExt, FileName); pFileWts = fopen( strcat(FileExt,".wts"), "w" ); - free(FileExt); + ABC_FREE(FileExt); Io_NtkBuildLayout( pFileScl, pFilePl, pNtk, 1.0, 10, coreCellArea ); fclose( pFileScl ); @@ -555,7 +555,7 @@ void Io_NtkWriteScl( FILE * pFile, unsigned numCoreRows, double layoutWidth ) double sitewidth=1.0; double spacing=1.0; - int rowId; + unsigned rowId; // write the forehead fprintf( pFile, "UCLA scl 1.0\n\n" ); fprintf( pFile, "Numrows : %d\n\n", numCoreRows ); @@ -596,7 +596,8 @@ void Io_NtkWritePl( FILE * pFile, Abc_Ntk_t * pNtk, unsigned numTerms, double la double nextLoc_x, nextLoc_y; double delta; unsigned termsOnTop, termsOnBottom, termsOnLeft, termsOnRight; - int i, t; + unsigned t; + int i; termsOnTop = termsOnBottom = (unsigned)(Abc_Rint(numTerms*(layoutWidth/layoutPerim))); termsOnLeft = numTerms - (termsOnTop+termsOnBottom); @@ -609,7 +610,7 @@ void Io_NtkWritePl( FILE * pFile, Abc_Ntk_t * pNtk, unsigned numTerms, double la Vec_PtrPush( vTerms, pTerm ); // Ordering Pads vOrderedTerms=Io_NtkOrderingPads( pNtk, vTerms ); - assert( termsOnTop+termsOnBottom+termsOnLeft+termsOnRight == Vec_PtrSize(vOrderedTerms) ); + assert( termsOnTop+termsOnBottom+termsOnLeft+termsOnRight == (unsigned)Vec_PtrSize(vOrderedTerms) ); printf( "Done constructing layout region\n" ); printf( "Terminals: %d\n", numTerms ); @@ -714,11 +715,11 @@ Vec_Ptr_t * Io_NtkOrderingPads( Abc_Ntk_t * pNtk, Vec_Ptr_t * vTerms ) ProgressBar * pProgress; unsigned numTerms=Vec_PtrSize(vTerms); unsigned termIdx=0, termCount=0; - bool * pOrdered = (bool *)malloc(sizeof(bool)*numTerms); + bool * pOrdered = ABC_ALLOC(bool, numTerms); bool newNeighbor=1; Vec_Ptr_t * vOrderedTerms = Vec_PtrAlloc ( numTerms ); Abc_Obj_t * pNeighbor, * pNextTerm; - int i; + unsigned i; for( i=0 ; i<numTerms ; i++ ) pOrdered[i]=0; diff --git a/src/base/io/ioWriteCnf.c b/src/base/io/ioWriteCnf.c index 3df189d1..7d03e545 100644 --- a/src/base/io/ioWriteCnf.c +++ b/src/base/io/ioWriteCnf.c @@ -78,7 +78,7 @@ int Io_WriteCnf( Abc_Ntk_t * pNtk, char * pFileName, int fAllPrimes ) s_pNtk = pNtk; Sat_SolverWriteDimacs( pSat, pFileName, 0, 0, 1 ); s_pNtk = NULL; - // free the solver + // ABC_FREE the solver sat_solver_delete( pSat ); return 1; } diff --git a/src/base/io/ioWritePla.c b/src/base/io/ioWritePla.c index 653e2f74..93332793 100644 --- a/src/base/io/ioWritePla.c +++ b/src/base/io/ioWritePla.c @@ -106,8 +106,8 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) // collect the parameters nInputs = Abc_NtkCiNum(pNtk); nOutputs = Abc_NtkCoNum(pNtk); - pCubeIn = ALLOC( char, nInputs + 1 ); - pCubeOut = ALLOC( char, nOutputs + 1 ); + pCubeIn = ABC_ALLOC( char, nInputs + 1 ); + pCubeOut = ABC_ALLOC( char, nOutputs + 1 ); memset( pCubeIn, '-', nInputs ); pCubeIn[nInputs] = 0; memset( pCubeOut, '0', nOutputs ); pCubeOut[nOutputs] = 0; @@ -126,7 +126,7 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) // mark the CI nodes Abc_NtkForEachCi( pNtk, pNode, i ) - pNode->pCopy = (Abc_Obj_t *)(PORT_PTRUINT_T)i; + pNode->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)i; // write the cubes pProgress = Extra_ProgressBarStart( stdout, nOutputs ); @@ -142,9 +142,9 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) if ( !Abc_ObjIsNode(pDriver) ) { assert( Abc_ObjIsCi(pDriver) ); - pCubeIn[(int)(PORT_PTRUINT_T)pDriver->pCopy] = '1' - Abc_ObjFaninC0(pNode); + pCubeIn[(int)(ABC_PTRUINT_T)pDriver->pCopy] = '1' - Abc_ObjFaninC0(pNode); fprintf( pFile, "%s %s\n", pCubeIn, pCubeOut ); - pCubeIn[(int)(PORT_PTRUINT_T)pDriver->pCopy] = '-'; + pCubeIn[(int)(ABC_PTRUINT_T)pDriver->pCopy] = '-'; continue; } if ( Abc_NodeIsConst(pDriver) ) @@ -164,8 +164,8 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) Abc_ObjForEachFanin( pDriver, pFanin, k ) { pFanin = Abc_ObjFanin0Ntk(pFanin); - assert( (int)(PORT_PTRUINT_T)pFanin->pCopy < nInputs ); - pCubeIn[(int)(PORT_PTRUINT_T)pFanin->pCopy] = pCube[k]; + assert( (int)(ABC_PTRUINT_T)pFanin->pCopy < nInputs ); + pCubeIn[(int)(ABC_PTRUINT_T)pFanin->pCopy] = pCube[k]; } fprintf( pFile, "%s %s\n", pCubeIn, pCubeOut ); } @@ -174,7 +174,7 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) { pFanin = Abc_ObjFanin0Ntk(pFanin); assert( Abc_ObjIsCi(pFanin) ); - pCubeIn[(int)(PORT_PTRUINT_T)pFanin->pCopy] = '-'; + pCubeIn[(int)(ABC_PTRUINT_T)pFanin->pCopy] = '-'; } Extra_ProgressBarUpdate( pProgress, i, NULL ); } @@ -184,8 +184,8 @@ int Io_WritePlaOne( FILE * pFile, Abc_Ntk_t * pNtk ) // clean the CI nodes Abc_NtkForEachCi( pNtk, pNode, i ) pNode->pCopy = NULL; - free( pCubeIn ); - free( pCubeOut ); + ABC_FREE( pCubeIn ); + ABC_FREE( pCubeOut ); return 1; } diff --git a/src/base/io/ioWriteVerilog.c b/src/base/io/ioWriteVerilog.c index 41932dca..f2ac1b1d 100644 --- a/src/base/io/ioWriteVerilog.c +++ b/src/base/io/ioWriteVerilog.c @@ -549,7 +549,7 @@ void Io_WriteVerilogObjects( FILE * pFile, Abc_Ntk_t * pNtk ) fprintf( pFile, ";\n" ); // clear the input names Abc_ObjForEachFanin( pObj, pFanin, k ) - free( Hop_IthVar(pNtk->pManFunc, k)->pData ); + ABC_FREE( Hop_IthVar(pNtk->pManFunc, k)->pData ); } Vec_VecFree( vLevels ); } |