summaryrefslogtreecommitdiffstats
path: root/src/opt/fxu
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2010-11-01 01:35:04 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2010-11-01 01:35:04 -0700
commit6130e39b18b5f53902e4eab14f6d5cdde5219563 (patch)
tree0db0628479a1b750e9af1f66cb8379ebd0913d31 /src/opt/fxu
parentf0e77f6797c0504b0da25a56152b707d3357f386 (diff)
downloadabc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip
initial commit of public abc
Diffstat (limited to 'src/opt/fxu')
-rw-r--r--src/opt/fxu/fxu.c5
-rw-r--r--src/opt/fxu/fxu.h32
-rw-r--r--src/opt/fxu/fxuCreate.c17
-rw-r--r--src/opt/fxu/fxuHeapD.c5
-rw-r--r--src/opt/fxu/fxuHeapS.c5
-rw-r--r--src/opt/fxu/fxuInt.h8
-rw-r--r--src/opt/fxu/fxuList.c5
-rw-r--r--src/opt/fxu/fxuMatrix.c5
-rw-r--r--src/opt/fxu/fxuPair.c5
-rw-r--r--src/opt/fxu/fxuPrint.c5
-rw-r--r--src/opt/fxu/fxuReduce.c11
-rw-r--r--src/opt/fxu/fxuSelect.c5
-rw-r--r--src/opt/fxu/fxuSingle.c9
-rw-r--r--src/opt/fxu/fxuUpdate.c9
14 files changed, 96 insertions, 30 deletions
diff --git a/src/opt/fxu/fxu.c b/src/opt/fxu/fxu.c
index 9102d289..264a7898 100644
--- a/src/opt/fxu/fxu.c
+++ b/src/opt/fxu/fxu.c
@@ -19,6 +19,9 @@
#include "fxuInt.h"
#include "fxu.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -252,3 +255,5 @@ void Fxu_MemRecycle( Fxu_Matrix * p, char * pItem, int nBytes )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxu.h b/src/opt/fxu/fxu.h
index b9a56b23..db855f3b 100644
--- a/src/opt/fxu/fxu.h
+++ b/src/opt/fxu/fxu.h
@@ -19,6 +19,7 @@
#ifndef __FXU_H__
#define __FXU_H__
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -29,31 +30,26 @@
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
-#ifdef __cplusplus
-extern "C" {
-#endif
+
+
+ABC_NAMESPACE_HEADER_START
+
////////////////////////////////////////////////////////////////////////
/// STRUCTURE DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
-#ifndef __cplusplus
-#ifndef bool
-#define bool int
-#endif
-#endif
-
typedef struct FxuDataStruct Fxu_Data_t;
// structure for the FX input/output data
struct FxuDataStruct
{
// user specified parameters
- bool fOnlyS; // set to 1 to have only single-cube divs
- bool fOnlyD; // set to 1 to have only double-cube divs
- bool fUse0; // set to 1 to have 0-weight also extracted
- bool fUseCompl; // set to 1 to have complement taken into account
- bool fVerbose; // set to 1 to have verbose output
+ int fOnlyS; // set to 1 to have only single-cube divs
+ int fOnlyD; // set to 1 to have only double-cube divs
+ int fUse0; // set to 1 to have 0-weight also extracted
+ int fUseCompl; // set to 1 to have complement taken into account
+ int fVerbose; // set to 1 to have verbose output
int nNodesExt; // the number of divisors to extract
int nSingleMax; // the max number of single-cube divisors to consider
int nPairsMax; // the max number of double-cube divisors to consider
@@ -81,9 +77,11 @@ struct FxuDataStruct
/*===== fxu.c ==========================================================*/
extern int Fxu_FastExtract( Fxu_Data_t * pData );
-#ifdef __cplusplus
-}
-#endif
+
+
+ABC_NAMESPACE_HEADER_END
+
+
#endif
diff --git a/src/opt/fxu/fxuCreate.c b/src/opt/fxu/fxuCreate.c
index 008cac46..3466b520 100644
--- a/src/opt/fxu/fxuCreate.c
+++ b/src/opt/fxu/fxuCreate.c
@@ -20,6 +20,9 @@
#include "fxuInt.h"
#include "fxu.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -71,7 +74,7 @@ Fxu_Matrix * Fxu_CreateMatrix( Fxu_Data_t * pData )
nPairsStore = 0;
nBitsMax = -1;
for ( i = 0; i < pData->nNodesOld; i++ )
- if ( (pSopCover = pData->vSops->pArray[i]) )
+ if ( (pSopCover = (char *)pData->vSops->pArray[i]) )
{
nCubes = Abc_SopGetCubeNum( pSopCover );
nFanins = Abc_SopGetVarNum( pSopCover );
@@ -109,7 +112,7 @@ Fxu_Matrix * Fxu_CreateMatrix( Fxu_Data_t * pData )
iCube = 0;
iPair = 0;
for ( i = 0; i < pData->nNodesOld; i++ )
- if ( (pSopCover = pData->vSops->pArray[i]) )
+ if ( (pSopCover = (char *)pData->vSops->pArray[i]) )
{
// get the number of cubes
nCubes = Abc_SopGetCubeNum( pSopCover );
@@ -136,14 +139,14 @@ Fxu_Matrix * Fxu_CreateMatrix( Fxu_Data_t * pData )
pOrder = ABC_ALLOC( int, nBitsMax );
// create the rows
for ( i = 0; i < pData->nNodesOld; i++ )
- if ( (pSopCover = pData->vSops->pArray[i]) )
+ if ( (pSopCover = (char *)pData->vSops->pArray[i]) )
{
// get the new var in the matrix
pVar = p->ppVars[2*i+1];
// here we sort the literals of the cover
// in the increasing order of the numbers of the corresponding nodes
// because literals should be added to the matrix in this order
- vFanins = pData->vFanins->pArray[i];
+ vFanins = (Vec_Int_t *)pData->vFanins->pArray[i];
s_pLits = vFanins->pArray;
// start the variable order
nFanins = Abc_SopGetVarNum( pSopCover );
@@ -272,7 +275,7 @@ void Fxu_CreateCovers( Fxu_Matrix * p, Fxu_Data_t * pData )
// go through the internal nodes
for ( n = 0; n < pData->nNodesOld; n++ )
- if ( (pSopCover = pData->vSops->pArray[n]) )
+ if ( (pSopCover = (char *)pData->vSops->pArray[n]) )
{
// get the number of this node
iNode = n;
@@ -358,7 +361,7 @@ void Fxu_CreateCoversNode( Fxu_Matrix * p, Fxu_Data_t * pData, int iNode, Fxu_Cu
// allocate room for the new cover
pSopCover = Abc_SopStart( pData->pManSop, nCubes, vInputsNew->nSize );
// set the correct polarity of the cover
- if ( iNode < pData->nNodesOld && Abc_SopGetPhase( pData->vSops->pArray[iNode] ) == 0 )
+ if ( iNode < pData->nNodesOld && Abc_SopGetPhase( (char *)pData->vSops->pArray[iNode] ) == 0 )
Abc_SopComplement( pSopCover );
// add the cubes
@@ -429,3 +432,5 @@ int Fxu_CreateMatrixLitCompare( int * ptrX, int * ptrY )
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuHeapD.c b/src/opt/fxu/fxuHeapD.c
index 9a8eb124..cb022fc4 100644
--- a/src/opt/fxu/fxuHeapD.c
+++ b/src/opt/fxu/fxuHeapD.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -443,3 +446,5 @@ void Fxu_HeapDoubleMoveDn( Fxu_HeapDouble * p, Fxu_Double * pDiv )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuHeapS.c b/src/opt/fxu/fxuHeapS.c
index 4a9bd3a4..ead8e914 100644
--- a/src/opt/fxu/fxuHeapS.c
+++ b/src/opt/fxu/fxuHeapS.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -442,3 +445,5 @@ void Fxu_HeapSingleMoveDn( Fxu_HeapSingle * p, Fxu_Single * pSingle )
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuInt.h b/src/opt/fxu/fxuInt.h
index 7483c896..96bec083 100644
--- a/src/opt/fxu/fxuInt.h
+++ b/src/opt/fxu/fxuInt.h
@@ -19,6 +19,7 @@
#ifndef __FXU_INT_H__
#define __FXU_INT_H__
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -26,6 +27,9 @@
#include "extra.h"
#include "vec.h"
+ABC_NAMESPACE_HEADER_START
+
+
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
@@ -531,6 +535,10 @@ extern int Fxu_HeapSingleReadMaxWeight( Fxu_HeapSingle * p );
extern Fxu_Single * Fxu_HeapSingleReadMax( Fxu_HeapSingle * p );
extern Fxu_Single * Fxu_HeapSingleGetMax( Fxu_HeapSingle * p );
+
+
+ABC_NAMESPACE_HEADER_END
+
#endif
////////////////////////////////////////////////////////////////////////
diff --git a/src/opt/fxu/fxuList.c b/src/opt/fxu/fxuList.c
index 52995804..7a7f27c8 100644
--- a/src/opt/fxu/fxuList.c
+++ b/src/opt/fxu/fxuList.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -520,3 +523,5 @@ void Fxu_ListDoubleAddPairPlace( Fxu_Double * pDiv, Fxu_Pair * pPair, Fxu_Pair *
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuMatrix.c b/src/opt/fxu/fxuMatrix.c
index 590370c9..a53de0a3 100644
--- a/src/opt/fxu/fxuMatrix.c
+++ b/src/opt/fxu/fxuMatrix.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -372,3 +375,5 @@ void Fxu_MatrixAddDivisor( Fxu_Matrix * p, Fxu_Cube * pCube1, Fxu_Cube * pCube2
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuPair.c b/src/opt/fxu/fxuPair.c
index 62cc792b..d040abe9 100644
--- a/src/opt/fxu/fxuPair.c
+++ b/src/opt/fxu/fxuPair.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -553,3 +556,5 @@ void Fxu_PairAdd( Fxu_Pair * pPair )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuPrint.c b/src/opt/fxu/fxuPrint.c
index 652a830e..d7a4d38a 100644
--- a/src/opt/fxu/fxuPrint.c
+++ b/src/opt/fxu/fxuPrint.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -193,3 +196,5 @@ void Fxu_MatrixPrintDivisorProfile( FILE * pFile, Fxu_Matrix * p )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuReduce.c b/src/opt/fxu/fxuReduce.c
index 6b892971..2321ec57 100644
--- a/src/opt/fxu/fxuReduce.c
+++ b/src/opt/fxu/fxuReduce.c
@@ -20,6 +20,9 @@
#include "fxuInt.h"
#include "fxu.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -40,7 +43,7 @@ static int Fxu_CountPairDiffs( char * pCover, unsigned char pDiffs[] );
number of pairs in existence. This procedure adds to the storage of
divisors exactly the given number of pairs (nPairsMax) while taking
first those pairs that have the smallest number of literals in their
- cube-ABC_FREE form.]
+ cube-free form.]
SideEffects []
@@ -69,7 +72,7 @@ int Fxu_PreprocessCubePairs( Fxu_Matrix * p, Vec_Ptr_t * vCovers, int nPairsTota
iPair = 0;
nBitsMax = -1;
for ( c = 0; c < vCovers->nSize; c++ )
- if ( (pSopCover = vCovers->pArray[c]) )
+ if ( (pSopCover = (char *)vCovers->pArray[c]) )
{
nFanins = Abc_SopGetVarNum(pSopCover);
// precompute the differences
@@ -135,7 +138,7 @@ int Fxu_PreprocessCubePairs( Fxu_Matrix * p, Vec_Ptr_t * vCovers, int nPairsTota
// collect the corresponding pairs and add the divisors
iPair = 0;
for ( c = 0; c < vCovers->nSize; c++ )
- if ( (pSopCover = vCovers->pArray[c]) )
+ if ( (pSopCover = (char *)vCovers->pArray[c]) )
{
// get the var
pVar = p->ppVars[2*c+1];
@@ -202,3 +205,5 @@ int Fxu_CountPairDiffs( char * pCover, unsigned char pDiffs[] )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuSelect.c b/src/opt/fxu/fxuSelect.c
index 20f5ab97..a4e260c7 100644
--- a/src/opt/fxu/fxuSelect.c
+++ b/src/opt/fxu/fxuSelect.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -601,3 +604,5 @@ int Fxu_SelectSCD( Fxu_Matrix * p, int WeightLimit, Fxu_Var ** ppVar1, Fxu_Var *
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuSingle.c b/src/opt/fxu/fxuSingle.c
index 6e90a2a2..b1cc2e63 100644
--- a/src/opt/fxu/fxuSingle.c
+++ b/src/opt/fxu/fxuSingle.c
@@ -19,6 +19,9 @@
#include "fxuInt.h"
#include "vec.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -100,8 +103,8 @@ void Fxu_MatrixComputeSingles( Fxu_Matrix * p, int fUse0, int nSingleMax )
for ( i = 0; i < Vec_PtrSize(vSingles); i += 3 )
{
Fxu_MatrixAddSingle( p,
- Vec_PtrEntry(vSingles,i),
- Vec_PtrEntry(vSingles,i+1),
+ (Fxu_Var *)Vec_PtrEntry(vSingles,i),
+ (Fxu_Var *)Vec_PtrEntry(vSingles,i+1),
(int)(ABC_PTRUINT_T)Vec_PtrEntry(vSingles,i+2) );
}
Vec_PtrFree( vSingles );
@@ -282,3 +285,5 @@ int Fxu_SingleCountCoincidence( Fxu_Matrix * p, Fxu_Var * pVar1, Fxu_Var * pVar2
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/fxu/fxuUpdate.c b/src/opt/fxu/fxuUpdate.c
index cdbe313d..74939896 100644
--- a/src/opt/fxu/fxuUpdate.c
+++ b/src/opt/fxu/fxuUpdate.c
@@ -18,6 +18,9 @@
#include "fxuInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -292,7 +295,7 @@ void Fxu_UpdateDoublePairs( Fxu_Matrix * p, Fxu_Double * pDouble, Fxu_Var * pVar
{
// get the pair
// pPair = p->pPairsTemp[i];
- pPair = p->vPairs->pArray[i];
+ pPair = (Fxu_Pair *)p->vPairs->pArray[i];
// out of the two cubes, select the one which comes earlier
pCubeUse = Fxu_PairMinCube( pPair );
pCubeRem = Fxu_PairMaxCube( pPair );
@@ -344,7 +347,7 @@ void Fxu_UpdateMatrixDoubleCreateCubes( Fxu_Matrix * p, Fxu_Cube * pCube1, Fxu_C
if ( pLit1 && pLit2 )
{
if ( pLit1->iVar == pLit2->iVar )
- { // skip the cube ABC_FREE part
+ { // skip the cube free part
pLit1 = pLit1->pHNext;
pLit2 = pLit2->pHNext;
nBase++;
@@ -804,3 +807,5 @@ void Fxu_UpdateAddNewSingles( Fxu_Matrix * p, Fxu_Var * pVar )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+