From 0871bffae307e0553e0c5186336189e8b55cf6a6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 15 Feb 2009 08:01:00 -0800 Subject: Version abc90215 --- src/map/super/super.h | 8 ++++---- src/map/super/superAnd.c | 44 ++++++++++++++++++++++---------------------- src/map/super/superGate.c | 40 ++++++++++++++++++++-------------------- 3 files changed, 46 insertions(+), 46 deletions(-) (limited to 'src/map/super') diff --git a/src/map/super/super.h b/src/map/super/super.h index a7169924..9f5e83ae 100644 --- a/src/map/super/super.h +++ b/src/map/super/super.h @@ -19,10 +19,6 @@ #ifndef __SUPER_H__ #define __SUPER_H__ -#ifdef __cplusplus -extern "C" { -#endif - //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -31,6 +27,10 @@ extern "C" { /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////// /// STRUCTURE DEFINITIONS /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/super/superAnd.c b/src/map/super/superAnd.c index 8e831952..3014d505 100644 --- a/src/map/super/superAnd.c +++ b/src/map/super/superAnd.c @@ -61,10 +61,10 @@ struct Super2_GateStruct_t_ // manipulation of complemented attributes -#define Super2_IsComplement(p) (((int)((PORT_PTRUINT_T) (p) & 01))) -#define Super2_Regular(p) ((Super2_Gate_t *)((PORT_PTRUINT_T)(p) & ~01)) -#define Super2_Not(p) ((Super2_Gate_t *)((PORT_PTRUINT_T)(p) ^ 01)) -#define Super2_NotCond(p,c) ((Super2_Gate_t *)((PORT_PTRUINT_T)(p) ^ (c))) +#define Super2_IsComplement(p) (((int)((ABC_PTRUINT_T) (p) & 01))) +#define Super2_Regular(p) ((Super2_Gate_t *)((ABC_PTRUINT_T)(p) & ~01)) +#define Super2_Not(p) ((Super2_Gate_t *)((ABC_PTRUINT_T)(p) ^ 01)) +#define Super2_NotCond(p,c) ((Super2_Gate_t *)((ABC_PTRUINT_T)(p) ^ (c))) // iterating through the gates in the library #define Super2_LibForEachGate( Lib, Gate ) \ @@ -132,7 +132,7 @@ clk = clock(); Super2_LibStop( pLibCur ); pLibCur = pLibNext; printf( "Level %d: Tried = %7d. Computed = %7d. ", Level, pMan->nTried, pLibCur->nGates ); -PRT( "Runtime", clock() - clk ); +ABC_PRT( "Runtime", clock() - clk ); fflush( stdout ); } @@ -163,7 +163,7 @@ fflush( stdout ); Super2_Man_t * Super2_ManStart() { Super2_Man_t * pMan; - pMan = ALLOC( Super2_Man_t, 1 ); + pMan = ABC_ALLOC( Super2_Man_t, 1 ); memset( pMan, 0, sizeof(Super2_Man_t) ); pMan->pMem = Extra_MmFixedStart( sizeof(Super2_Gate_t) ); pMan->tTable = stmm_init_table( st_ptrcmp, st_ptrhash ); @@ -185,7 +185,7 @@ void Super2_ManStop( Super2_Man_t * pMan ) { Extra_MmFixedStop( pMan->pMem ); stmm_free_table( pMan->tTable ); - free( pMan ); + ABC_FREE( pMan ); } /**Function************************************************************* @@ -202,7 +202,7 @@ void Super2_ManStop( Super2_Man_t * pMan ) Super2_Lib_t * Super2_LibStart() { Super2_Lib_t * pLib; - pLib = ALLOC( Super2_Lib_t, 1 ); + pLib = ABC_ALLOC( Super2_Lib_t, 1 ); memset( pLib, 0, sizeof(Super2_Lib_t) ); return pLib; } @@ -228,7 +228,7 @@ Super2_Lib_t * Super2_LibDup( Super2_Lib_t * pLib ) pLibNew->nGates = pLib->nGates; pLibNew->uMaskBit = pLib->uMaskBit; pLibNew->nGatesAlloc = 1000 + pLib->nGatesAlloc; - pLibNew->pGates = ALLOC( Super2_Gate_t *, pLibNew->nGatesAlloc ); + pLibNew->pGates = ABC_ALLOC( Super2_Gate_t *, pLibNew->nGatesAlloc ); memcpy( pLibNew->pGates, pLib->pGates, pLibNew->nGates * sizeof(Super2_Gate_t *) ); return pLibNew; } @@ -248,7 +248,7 @@ void Super2_LibAddGate( Super2_Lib_t * pLib, Super2_Gate_t * pGate ) { if ( pLib->nGates == pLib->nGatesAlloc ) { - pLib->pGates = REALLOC( Super2_Gate_t *, pLib->pGates, 3 * pLib->nGatesAlloc ); + pLib->pGates = ABC_REALLOC( Super2_Gate_t *, pLib->pGates, 3 * pLib->nGatesAlloc ); pLib->nGatesAlloc *= 3; } pLib->pGates[ pLib->nGates++ ] = pGate; @@ -267,8 +267,8 @@ void Super2_LibAddGate( Super2_Lib_t * pLib, Super2_Gate_t * pGate ) ***********************************************************************/ void Super2_LibStop( Super2_Lib_t * pLib ) { - free( pLib->pGates ); - free( pLib ); + ABC_FREE( pLib->pGates ); + ABC_FREE( pLib ); } /**Function************************************************************* @@ -297,7 +297,7 @@ Super2_Lib_t * Super2_LibFirst( Super2_Man_t * pMan, int nInputs ) pLib->nGates = nInputs + 1; pLib->nGatesAlloc = nInputs + 1; pLib->uMaskBit = (1 << (pLib->nMints-1)); - pLib->pGates = ALLOC( Super2_Gate_t *, nInputs + 1 ); + pLib->pGates = ABC_ALLOC( Super2_Gate_t *, nInputs + 1 ); // add the constant 0 pLib->pGates[0] = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); memset( pLib->pGates[0], 0, sizeof(Super2_Gate_t) ); @@ -306,7 +306,7 @@ Super2_Lib_t * Super2_LibFirst( Super2_Man_t * pMan, int nInputs ) { pLib->pGates[v+1] = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); memset( pLib->pGates[v+1], 0, sizeof(Super2_Gate_t) ); - pLib->pGates[v+1]->pTwo = (Super2_Gate_t *)(PORT_PTRUINT_T)v; + pLib->pGates[v+1]->pTwo = (Super2_Gate_t *)(ABC_PTRUINT_T)v; } // set up their truth tables @@ -347,7 +347,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) { uTruthR = ((pGate1->uTruth & pLibNew->uMaskBit)? Mask & ~pGate1->uTruth : pGate1->uTruth); - if ( stmm_lookup( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char **)&pGate2 ) ) + if ( stmm_lookup( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char **)&pGate2 ) ) { printf( "New gate:\n" ); Super2_LibWriteGate( stdout, pLibNew, pGate1 ); @@ -355,7 +355,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) Super2_LibWriteGate( stdout, pLibNew, pGate2 ); assert( 0 ); } - stmm_insert( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char *)(PORT_PTRUINT_T)pGate1 ); + stmm_insert( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char *)(ABC_PTRUINT_T)pGate1 ); } @@ -382,7 +382,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) uTruth = uTruth1 & uTruth2; uTruthR = ((uTruth & pLibNew->uMaskBit)? Mask & ~uTruth : uTruth); - if ( !stmm_find_or_add( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) + if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) { pGateNew = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); pGateNew->pOne = pGate1; @@ -396,7 +396,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) uTruth = uTruth1c & uTruth2; uTruthR = ((uTruth & pLibNew->uMaskBit)? Mask & ~uTruth : uTruth); - if ( !stmm_find_or_add( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) + if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) { pGateNew = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); pGateNew->pOne = Super2_Not(pGate1); @@ -410,7 +410,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) uTruth = uTruth1 & uTruth2c; uTruthR = ((uTruth & pLibNew->uMaskBit)? Mask & ~uTruth : uTruth); - if ( !stmm_find_or_add( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) + if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) { pGateNew = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); pGateNew->pOne = pGate1; @@ -424,7 +424,7 @@ Super2_Lib_t * Super2_LibCompute( Super2_Man_t * pMan, Super2_Lib_t * pLib ) uTruth = uTruth1c & uTruth2c; uTruthR = ((uTruth & pLibNew->uMaskBit)? Mask & ~uTruth : uTruth); - if ( !stmm_find_or_add( pMan->tTable, (char *)(PORT_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) + if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)uTruthR, (char ***)&ppGate ) ) { pGateNew = (Super2_Gate_t *)Extra_MmFixedEntryFetch( pMan->pMem ); pGateNew->pOne = Super2_Not(pGate1); @@ -475,7 +475,7 @@ clk = clock(); qsort( (void *)pLib->pGates, pLib->nGates, sizeof(Super2_Gate_t *), (int (*)(const void *, const void *)) Super2_LibCompareGates ); assert( Super2_LibCompareGates( pLib->pGates, pLib->pGates + pLib->nGates - 1 ) < 0 ); -PRT( "Sorting", clock() - clk ); +ABC_PRT( "Sorting", clock() - clk ); // start the file @@ -600,7 +600,7 @@ char * Super2_LibWriteGate_rec( Super2_Gate_t * pGate, int fInv, int Level ) } else { - pBuffer1[0] = (fInv? 'A' + ((int)(PORT_PTRUINT_T)pGate->pTwo): 'a' + ((int)(PORT_PTRUINT_T)pGate->pTwo)); + pBuffer1[0] = (fInv? 'A' + ((int)(ABC_PTRUINT_T)pGate->pTwo): 'a' + ((int)(ABC_PTRUINT_T)pGate->pTwo)); pBuffer1[1] = 0; } return pBuffer1; diff --git a/src/map/super/superGate.c b/src/map/super/superGate.c index c8aa02ba..7bc5e703 100644 --- a/src/map/super/superGate.c +++ b/src/map/super/superGate.c @@ -164,7 +164,7 @@ void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, float // stop the manager Super_ManStop( pMan ); - free( ppGates ); + ABC_FREE( ppGates ); return; } @@ -193,7 +193,7 @@ if ( fVerbose ) { printf( "Lev %d: Try =%12d. Add =%6d. Rem =%5d. Save =%6d. Lookups =%12d. Aliases =%12d. ", Level, pMan->nTried, pMan->nAdded, pMan->nRemoved, pMan->nAdded - pMan->nRemoved, pMan->nLookups, pMan->nAliases ); -PRT( "Time", clock() - clk ); +ABC_PRT( "Time", clock() - clk ); fflush( stdout ); } } @@ -209,7 +209,7 @@ fflush( stdout ); // stop the manager Super_ManStop( pMan ); - free( ppGates ); + ABC_FREE( ppGates ); } @@ -235,7 +235,7 @@ void Super_First( Super_Man_t * pMan, int nVarsMax ) pMan->nLevels = 0; // allocate room for the gates pMan->nGates = nVarsMax; - pMan->pGates = ALLOC( Super_Gate_t *, nVarsMax + 2 ); + pMan->pGates = ABC_ALLOC( Super_Gate_t *, nVarsMax + 2 ); // create the gates corresponding to the elementary variables for ( v = 0; v < nVarsMax; v++ ) { @@ -329,7 +329,7 @@ Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGat pProgress = Extra_ProgressBarStart( stdout, pMan->TimeLimit ); pMan->TimePrint = clock() + CLOCKS_PER_SEC; - ppGatesLimit = ALLOC( Super_Gate_t *, pMan->nGates ); + ppGatesLimit = ABC_ALLOC( Super_Gate_t *, pMan->nGates ); // go through the root gates // the root gates are sorted in the increasing gelay fTimeOut = 0; @@ -658,7 +658,7 @@ Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGat } done: Extra_ProgressBarStop( pProgress ); - free( ppGatesLimit ); + ABC_FREE( ppGatesLimit ); return pMan; } @@ -709,8 +709,8 @@ void Super_TranferGatesToArray( Super_Man_t * pMan ) unsigned Key; // put the gates fron the table into the array - free( pMan->pGates ); - pMan->pGates = ALLOC( Super_Gate_t *, pMan->nAdded ); + ABC_FREE( pMan->pGates ); + pMan->pGates = ABC_ALLOC( Super_Gate_t *, pMan->nAdded ); pMan->nGates = 0; stmm_foreach_item( pMan->tTable, gen, (char **)&Key, (char **)&pList ) { @@ -737,7 +737,7 @@ void Super_AddGateToTable( Super_Man_t * pMan, Super_Gate_t * pGate ) unsigned Key; // Key = pGate->uTruth[0] + 2003 * pGate->uTruth[1]; Key = pGate->uTruth[0] ^ pGate->uTruth[1]; - if ( !stmm_find_or_add( pMan->tTable, (char *)(PORT_PTRUINT_T)Key, (char ***)&ppList ) ) + if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)Key, (char ***)&ppList ) ) *ppList = NULL; pGate->pNext = *ppList; *ppList = pGate; @@ -778,7 +778,7 @@ bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, floa // get hold of the place where the entry is stored // Key = uTruth[0] + 2003 * uTruth[1]; Key = uTruth[0] ^ uTruth[1]; - if ( !stmm_find( pMan->tTable, (char *)(PORT_PTRUINT_T)Key, (char ***)&ppList ) ) + if ( !stmm_find( pMan->tTable, (char *)(ABC_PTRUINT_T)Key, (char ***)&ppList ) ) return 1; // the entry with this truth table is found pPrev = NULL; @@ -872,7 +872,7 @@ Super_Gate_t * Super_CreateGateNew( Super_Man_t * pMan, Mio_Gate_t * pRoot, Supe Super_Man_t * Super_ManStart() { Super_Man_t * pMan; - pMan = ALLOC( Super_Man_t, 1 ); + pMan = ABC_ALLOC( Super_Man_t, 1 ); memset( pMan, 0, sizeof(Super_Man_t) ); pMan->pMem = Extra_MmFixedStart( sizeof(Super_Gate_t) ); pMan->tTable = stmm_init_table( st_ptrcmp, st_ptrhash ); @@ -894,8 +894,8 @@ void Super_ManStop( Super_Man_t * pMan ) { Extra_MmFixedStop( pMan->pMem ); if ( pMan->tTable ) stmm_free_table( pMan->tTable ); - FREE( pMan->pGates ); - free( pMan ); + ABC_FREE( pMan->pGates ); + ABC_FREE( pMan ); } @@ -930,8 +930,8 @@ void Super_Write( Super_Man_t * pMan ) // the given limit, provided that the inputs are not consequtive. // For example, NAND2(a,c) is removed, but NAND2(a,b) is left, // because a and b are consequtive. - FREE( pMan->pGates ); - pMan->pGates = ALLOC( Super_Gate_t *, pMan->nAdded ); + ABC_FREE( pMan->pGates ); + pMan->pGates = ABC_ALLOC( Super_Gate_t *, pMan->nAdded ); pMan->nGates = 0; stmm_foreach_item( pMan->tTable, gen, (char **)&Key, (char **)&pGateRoot ) { @@ -961,7 +961,7 @@ clk = clock(); assert( Super_WriteCompare( pMan->pGates, pMan->pGates + pMan->nGates - 1 ) <= 0 ); if ( pMan->fVerbose ) { -PRT( "Sorting", clock() - clk ); +ABC_PRT( "Sorting", clock() - clk ); } @@ -971,7 +971,7 @@ clk = clock(); Super_WriteLibrary( pMan ); if ( pMan->fVerbose ) { -PRT( "Writing old format", clock() - clk ); +ABC_PRT( "Writing old format", clock() - clk ); } // write the tree-like structure of supergates @@ -979,7 +979,7 @@ clk = clock(); Super_WriteLibraryTree( pMan ); if ( pMan->fVerbose ) { -PRT( "Writing new format", clock() - clk ); +ABC_PRT( "Writing new format", clock() - clk ); } } @@ -1114,7 +1114,7 @@ void Super_WriteLibrary( Super_Man_t * pMan ) // get the file name pNameGeneric = Extra_FileNameGeneric( pMan->pName ); sprintf( FileName, "%s.super_old", pNameGeneric ); - free( pNameGeneric ); + ABC_FREE( pNameGeneric ); // count the number of unique functions pMan->nUnique = 1; @@ -1259,7 +1259,7 @@ void Super_WriteLibraryTree( Super_Man_t * pMan ) // get the file name pNameGeneric = Extra_FileNameGeneric( pMan->pName ); sprintf( FileName, "%s.super", pNameGeneric ); - free( pNameGeneric ); + ABC_FREE( pNameGeneric ); // write the elementary variables pFile = fopen( FileName, "w" ); -- cgit v1.2.3