diff options
Diffstat (limited to 'src/opt/rwr')
-rw-r--r-- | src/opt/rwr/rwr.h | 16 | ||||
-rw-r--r-- | src/opt/rwr/rwrDec.c | 2 | ||||
-rw-r--r-- | src/opt/rwr/rwrExp.c | 34 | ||||
-rw-r--r-- | src/opt/rwr/rwrMan.c | 28 | ||||
-rw-r--r-- | src/opt/rwr/rwrUtil.c | 18 |
5 files changed, 49 insertions, 49 deletions
diff --git a/src/opt/rwr/rwr.h b/src/opt/rwr/rwr.h index 64e916e2..5adc3b4b 100644 --- a/src/opt/rwr/rwr.h +++ b/src/opt/rwr/rwr.h @@ -21,10 +21,6 @@ #ifndef __RWR_H__ #define __RWR_H__ -#ifdef __cplusplus -extern "C" { -#endif - //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -36,6 +32,10 @@ extern "C" { /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// @@ -111,10 +111,10 @@ struct Rwr_Node_t_ // 24 bytes }; // manipulation of complemented attributes -static inline bool Rwr_IsComplement( Rwr_Node_t * p ) { return (bool)(((PORT_PTRUINT_T)p) & 01); } -static inline Rwr_Node_t * Rwr_Regular( Rwr_Node_t * p ) { return (Rwr_Node_t *)((PORT_PTRUINT_T)(p) & ~01); } -static inline Rwr_Node_t * Rwr_Not( Rwr_Node_t * p ) { return (Rwr_Node_t *)((PORT_PTRUINT_T)(p) ^ 01); } -static inline Rwr_Node_t * Rwr_NotCond( Rwr_Node_t * p, int c ) { return (Rwr_Node_t *)((PORT_PTRUINT_T)(p) ^ (c)); } +static inline bool Rwr_IsComplement( Rwr_Node_t * p ) { return (bool)(((ABC_PTRUINT_T)p) & 01); } +static inline Rwr_Node_t * Rwr_Regular( Rwr_Node_t * p ) { return (Rwr_Node_t *)((ABC_PTRUINT_T)(p) & ~01); } +static inline Rwr_Node_t * Rwr_Not( Rwr_Node_t * p ) { return (Rwr_Node_t *)((ABC_PTRUINT_T)(p) ^ 01); } +static inline Rwr_Node_t * Rwr_NotCond( Rwr_Node_t * p, int c ) { return (Rwr_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)); } //////////////////////////////////////////////////////////////////////// /// MACRO DEFINITIONS /// diff --git a/src/opt/rwr/rwrDec.c b/src/opt/rwr/rwrDec.c index ae01b896..81c7e307 100644 --- a/src/opt/rwr/rwrDec.c +++ b/src/opt/rwr/rwrDec.c @@ -49,7 +49,7 @@ void Rwr_ManPreprocess( Rwr_Man_t * p ) Rwr_Node_t * pNode; int i, k; // put the nodes into the structure - p->pMapInv = ALLOC( unsigned short, 222 ); + p->pMapInv = ABC_ALLOC( unsigned short, 222 ); memset( p->pMapInv, 0, sizeof(unsigned short) * 222 ); p->vClasses = Vec_VecStart( 222 ); for ( i = 0; i < p->nFuncs; i++ ) diff --git a/src/opt/rwr/rwrExp.c b/src/opt/rwr/rwrExp.c index 5729cdbc..543cae07 100644 --- a/src/opt/rwr/rwrExp.c +++ b/src/opt/rwr/rwrExp.c @@ -64,14 +64,14 @@ static Rwr_Man5_t * s_pManRwrExp5 = NULL; void Rwt_Man4ExploreStart() { Rwr_Man4_t * p; - p = ALLOC( Rwr_Man4_t, 1 ); + p = ABC_ALLOC( Rwr_Man4_t, 1 ); memset( p, 0, sizeof(Rwr_Man4_t) ); // canonical forms p->nFuncs = (1<<16); // canonical forms, phases, perms Extra_Truth4VarNPN( &p->puCanons, NULL, NULL, NULL ); // counters - p->pnCounts = ALLOC( int, p->nFuncs ); + p->pnCounts = ABC_ALLOC( int, p->nFuncs ); memset( p->pnCounts, 0, sizeof(int) * p->nFuncs ); s_pManRwrExp4 = p; } @@ -124,8 +124,8 @@ void Rwt_Man4ExplorePrint() printf( "Number of cuts considered = %8d.\n", nCuts ); printf( "Classes occurring at least once = %8d.\n", nClasses ); // print the distribution of classes - pDistrib = ALLOC( int, CountMax + 1 ); - pReprs = ALLOC( int, CountMax + 1 ); + pDistrib = ABC_ALLOC( int, CountMax + 1 ); + pReprs = ABC_ALLOC( int, CountMax + 1 ); memset( pDistrib, 0, sizeof(int)*(CountMax + 1) ); for ( i = 0; i < s_pManRwrExp4->nFuncs; i++ ) { @@ -141,8 +141,8 @@ void Rwt_Man4ExplorePrint() Extra_PrintBinary( stdout, (unsigned*)&(pReprs[i]), 16 ); printf( "\n" ); } - free( pDistrib ); - free( pReprs ); + ABC_FREE( pDistrib ); + ABC_FREE( pReprs ); // write into a file all classes above limit (5) CountWrite = 0; pFile = fopen( "npnclass_stats4.txt", "w" ); @@ -175,7 +175,7 @@ void Rwt_Man4ExplorePrint() void Rwt_Man5ExploreStart() { Rwr_Man5_t * p; - p = ALLOC( Rwr_Man5_t, 1 ); + p = ABC_ALLOC( Rwr_Man5_t, 1 ); memset( p, 0, sizeof(Rwr_Man5_t) ); p->tTableNN = stmm_init_table( st_numcmp, st_numhash ); p->tTableNPN = stmm_init_table( st_numcmp, st_numhash ); @@ -199,7 +199,7 @@ void Rwt_Man5ExploreStart() void Rwt_Man5ExploreCount( unsigned uTruth ) { int * pCounter; - if ( !stmm_find_or_add( s_pManRwrExp5->tTableNN, (char *)(PORT_PTRUINT_T)uTruth, (char***)&pCounter ) ) + if ( !stmm_find_or_add( s_pManRwrExp5->tTableNN, (char *)(ABC_PTRUINT_T)uTruth, (char***)&pCounter ) ) *pCounter = 0; (*pCounter)++; } @@ -240,8 +240,8 @@ void Rwt_Man5ExplorePrint() printf( "The largest number of occurence = %8d.\n", CountMax ); // print the distribution of classes - pDistrib = ALLOC( int, CountMax + 1 ); - pReprs = ALLOC( unsigned, CountMax + 1 ); + pDistrib = ABC_ALLOC( int, CountMax + 1 ); + pReprs = ABC_ALLOC( unsigned, CountMax + 1 ); memset( pDistrib, 0, sizeof(int)*(CountMax + 1) ); stmm_foreach_item( s_pManRwrExp5->tTableNN, gen, (char **)&uTruth, (char **)&Counter ) { @@ -257,8 +257,8 @@ void Rwt_Man5ExplorePrint() Extra_PrintBinary( stdout, pReprs + i, 32 ); printf( "\n" ); } - free( pDistrib ); - free( pReprs ); + ABC_FREE( pDistrib ); + ABC_FREE( pReprs ); // put them into an array @@ -271,7 +271,7 @@ void Rwt_Man5ExplorePrint() pFile = fopen( "nnclass_stats5.txt", "w" ); Vec_IntForEachEntry( vClassesNN, uTruth, i ) { - if ( !stmm_lookup( s_pManRwrExp5->tTableNN, (char *)(PORT_PTRUINT_T)uTruth, (char **)&Counter ) ) + if ( !stmm_lookup( s_pManRwrExp5->tTableNN, (char *)(ABC_PTRUINT_T)uTruth, (char **)&Counter ) ) { assert( 0 ); } @@ -288,16 +288,16 @@ clk = clock(); { int * pCounter; uTruthC = Extra_TruthCanonNPN( uTruth, 5 ); - if ( !stmm_find_or_add( s_pManRwrExp5->tTableNPN, (char *)(PORT_PTRUINT_T)uTruthC, (char***)&pCounter ) ) + if ( !stmm_find_or_add( s_pManRwrExp5->tTableNPN, (char *)(ABC_PTRUINT_T)uTruthC, (char***)&pCounter ) ) *pCounter = 0; - if ( !stmm_lookup( s_pManRwrExp5->tTableNN, (char *)(PORT_PTRUINT_T)uTruth, (char **)&Counter ) ) + if ( !stmm_lookup( s_pManRwrExp5->tTableNN, (char *)(ABC_PTRUINT_T)uTruth, (char **)&Counter ) ) { assert( 0 ); } (*pCounter) += Counter; } printf( "The numbe of NPN classes = %d.\n", stmm_count(s_pManRwrExp5->tTableNPN) ); -PRT( "Computing NPN classes", clock() - clk ); +ABC_PRT( "Computing NPN classes", clock() - clk ); // put them into an array vClassesNPN = Vec_IntAlloc( stmm_count(s_pManRwrExp5->tTableNPN) ); @@ -309,7 +309,7 @@ PRT( "Computing NPN classes", clock() - clk ); pFile = fopen( "npnclass_stats5.txt", "w" ); Vec_IntForEachEntry( vClassesNPN, uTruth, i ) { - if ( !stmm_lookup( s_pManRwrExp5->tTableNPN, (char *)(PORT_PTRUINT_T)uTruth, (char **)&Counter ) ) + if ( !stmm_lookup( s_pManRwrExp5->tTableNPN, (char *)(ABC_PTRUINT_T)uTruth, (char **)&Counter ) ) { assert( 0 ); } diff --git a/src/opt/rwr/rwrMan.c b/src/opt/rwr/rwrMan.c index 87a080c7..e7d21164 100644 --- a/src/opt/rwr/rwrMan.c +++ b/src/opt/rwr/rwrMan.c @@ -47,7 +47,7 @@ Rwr_Man_t * Rwr_ManStart( bool fPrecompute ) Rwr_Man_t * p; int clk = clock(); clk = clock(); - p = ALLOC( Rwr_Man_t, 1 ); + p = ABC_ALLOC( Rwr_Man_t, 1 ); memset( p, 0, sizeof(Rwr_Man_t) ); p->nFuncs = (1<<16); pManDec = Abc_FrameReadManDec(); @@ -58,7 +58,7 @@ clk = clock(); // initialize practical NPN classes p->pPractical = Rwr_ManGetPractical( p ); // create the table - p->pTable = ALLOC( Rwr_Node_t *, p->nFuncs ); + p->pTable = ABC_ALLOC( Rwr_Node_t *, p->nFuncs ); memset( p->pTable, 0, sizeof(Rwr_Node_t *) * p->nFuncs ); // create the elementary nodes p->pMmNode = Extra_MmFixedStart( sizeof(Rwr_Node_t) ); @@ -119,11 +119,11 @@ void Rwr_ManStop( Rwr_Man_t * p ) Vec_PtrFree( p->vFanins ); Vec_PtrFree( p->vFaninsCur ); Extra_MmFixedStop( p->pMmNode ); - FREE( p->pMapInv ); - free( p->pTable ); - free( p->pPractical ); - free( p->pPerms4 ); - free( p ); + ABC_FREE( p->pMapInv ); + ABC_FREE( p->pTable ); + ABC_FREE( p->pPractical ); + ABC_FREE( p->pPerms4 ); + ABC_FREE( p ); } /**Function************************************************************* @@ -151,13 +151,13 @@ void Rwr_ManPrintStats( Rwr_Man_t * p ) printf( "Nodes considered = %8d.\n", p->nNodesConsidered ); printf( "Nodes rewritten = %8d.\n", p->nNodesRewritten ); printf( "Gain = %8d. (%6.2f %%).\n", p->nNodesBeg-p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/p->nNodesBeg ); - PRT( "Start ", p->timeStart ); - PRT( "Cuts ", p->timeCut ); - PRT( "Resynthesis ", p->timeRes ); - PRT( " Mffc ", p->timeMffc ); - PRT( " Eval ", p->timeEval ); - PRT( "Update ", p->timeUpdate ); - PRT( "TOTAL ", p->timeTotal ); + ABC_PRT( "Start ", p->timeStart ); + ABC_PRT( "Cuts ", p->timeCut ); + ABC_PRT( "Resynthesis ", p->timeRes ); + ABC_PRT( " Mffc ", p->timeMffc ); + ABC_PRT( " Eval ", p->timeEval ); + ABC_PRT( "Update ", p->timeUpdate ); + ABC_PRT( "TOTAL ", p->timeTotal ); /* printf( "The scores are:\n" ); diff --git a/src/opt/rwr/rwrUtil.c b/src/opt/rwr/rwrUtil.c index b2add2bf..8da3b6eb 100644 --- a/src/opt/rwr/rwrUtil.c +++ b/src/opt/rwr/rwrUtil.c @@ -78,7 +78,7 @@ void Rwr_ManWriteToArray( Rwr_Man_t * p ) Extra_PrintHex( pFile, 0, 4 ); fprintf( pFile, " \n};\n" ); fclose( pFile ); - printf( "The number of nodes saved = %d. ", nEntries ); PRT( "Saving", clock() - clk ); + printf( "The number of nodes saved = %d. ", nEntries ); ABC_PRT( "Saving", clock() - clk ); } /**Function************************************************************* @@ -127,7 +127,7 @@ void Rwr_ManLoadFromArray( Rwr_Man_t * p, int fVerbose ) if ( fVerbose ) { printf( "The number of classes = %d. Canonical nodes = %d.\n", p->nClasses, p->nAdded ); - printf( "The number of nodes loaded = %d. ", nEntries ); PRT( "Loading", clock() - clk ); + printf( "The number of nodes loaded = %d. ", nEntries ); ABC_PRT( "Loading", clock() - clk ); } } @@ -151,7 +151,7 @@ void Rwr_ManWriteToFile( Rwr_Man_t * p, char * pFileName ) int i, nEntries, clk = clock(); // prepare the buffer nEntries = p->vForest->nSize - 5; - pBuffer = ALLOC( unsigned, nEntries * 2 ); + pBuffer = ABC_ALLOC( unsigned, nEntries * 2 ); for ( i = 0; i < nEntries; i++ ) { pNode = p->vForest->pArray[i+5]; @@ -164,9 +164,9 @@ void Rwr_ManWriteToFile( Rwr_Man_t * p, char * pFileName ) pFile = fopen( pFileName, "wb" ); fwrite( &nEntries, sizeof(int), 1, pFile ); fwrite( pBuffer, sizeof(unsigned), nEntries * 2, pFile ); - free( pBuffer ); + ABC_FREE( pBuffer ); fclose( pFile ); - printf( "The number of nodes saved = %d. ", nEntries ); PRT( "Saving", clock() - clk ); + printf( "The number of nodes saved = %d. ", nEntries ); ABC_PRT( "Saving", clock() - clk ); } /**Function************************************************************* @@ -196,7 +196,7 @@ void Rwr_ManLoadFromFile( Rwr_Man_t * p, char * pFileName ) return; } fread( &nEntries, sizeof(int), 1, pFile ); - pBuffer = ALLOC( unsigned, nEntries * 2 ); + pBuffer = ABC_ALLOC( unsigned, nEntries * 2 ); fread( pBuffer, sizeof(unsigned), nEntries * 2, pFile ); fclose( pFile ); // reconstruct the forest @@ -218,9 +218,9 @@ void Rwr_ManLoadFromFile( Rwr_Man_t * p, char * pFileName ) // Rwr_ManTryNode( p, p0, p1, Level, Volume ); Rwr_ManAddNode( p, p0, p1, fExor, Level, Volume + fExor ); } - free( pBuffer ); + ABC_FREE( pBuffer ); printf( "The number of classes = %d. Canonical nodes = %d.\n", p->nClasses, p->nAdded ); - printf( "The number of nodes loaded = %d. ", nEntries ); PRT( "Loading", clock() - clk ); + printf( "The number of nodes loaded = %d. ", nEntries ); ABC_PRT( "Loading", clock() - clk ); } @@ -260,7 +260,7 @@ char * Rwr_ManGetPractical( Rwr_Man_t * p ) { char * pPractical; int i; - pPractical = ALLOC( char, p->nFuncs ); + pPractical = ABC_ALLOC( char, p->nFuncs ); memset( pPractical, 0, sizeof(char) * p->nFuncs ); pPractical[0] = 1; for ( i = 1; ; i++ ) |