summaryrefslogtreecommitdiffstats
path: root/src/opt/cut
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/cut
parentf0e77f6797c0504b0da25a56152b707d3357f386 (diff)
downloadabc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip
initial commit of public abc
Diffstat (limited to 'src/opt/cut')
-rw-r--r--src/opt/cut/abcCut.c9
-rw-r--r--src/opt/cut/cut.h16
-rw-r--r--src/opt/cut/cutApi.c11
-rw-r--r--src/opt/cut/cutCut.c5
-rw-r--r--src/opt/cut/cutExpand.c5
-rw-r--r--src/opt/cut/cutInt.h8
-rw-r--r--src/opt/cut/cutList.h8
-rw-r--r--src/opt/cut/cutMan.c5
-rw-r--r--src/opt/cut/cutMerge.c5
-rw-r--r--src/opt/cut/cutNode.c27
-rw-r--r--src/opt/cut/cutOracle.c17
-rw-r--r--src/opt/cut/cutPre22.c7
-rw-r--r--src/opt/cut/cutSeq.c5
-rw-r--r--src/opt/cut/cutTruth.c5
14 files changed, 104 insertions, 29 deletions
diff --git a/src/opt/cut/abcCut.c b/src/opt/cut/abcCut.c
index 9bbd5790..3b80fe8d 100644
--- a/src/opt/cut/abcCut.c
+++ b/src/opt/cut/abcCut.c
@@ -21,6 +21,9 @@
#include "abc.h"
#include "cut.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -102,7 +105,7 @@ Cut_Man_t * Abc_NtkCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams )
vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
vChoices = Vec_IntAlloc( 100 );
pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(vNodes) );
- Vec_PtrForEachEntry( vNodes, pObj, i )
+ Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
{
// when we reached a CO, it is time to deallocate the cuts
if ( Abc_ObjIsCo(pObj) )
@@ -176,7 +179,7 @@ void Abc_NtkCutsOracle( Abc_Ntk_t * pNtk, Cut_Oracle_t * p )
// compute cuts for internal nodes
vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
- Vec_PtrForEachEntry( vNodes, pObj, i )
+ Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
{
// when we reached a CO, it is time to deallocate the cuts
if ( Abc_ObjIsCo(pObj) )
@@ -490,3 +493,5 @@ void Abc_NtkPrintCuts_( void * p, Abc_Ntk_t * pNtk, int fSeq )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cut.h b/src/opt/cut/cut.h
index 394138db..6c497675 100644
--- a/src/opt/cut/cut.h
+++ b/src/opt/cut/cut.h
@@ -21,6 +21,7 @@
#ifndef __CUT_H__
#define __CUT_H__
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -29,9 +30,10 @@
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
-#ifdef __cplusplus
-extern "C" {
-#endif
+
+
+ABC_NAMESPACE_HEADER_START
+
#define CUT_SIZE_MIN 3 // the min K of the K-feasible cut computation
#define CUT_SIZE_MAX 12 // the max K of the K-feasible cut computation
@@ -155,9 +157,11 @@ extern int Cut_CellIsRunning();
extern void Cut_CellDumpToFile();
extern int Cut_CellTruthLookup( unsigned * pTruth, int nVars );
-#ifdef __cplusplus
-}
-#endif
+
+
+ABC_NAMESPACE_HEADER_END
+
+
#endif
diff --git a/src/opt/cut/cutApi.c b/src/opt/cut/cutApi.c
index 980c6b12..1b20437d 100644
--- a/src/opt/cut/cutApi.c
+++ b/src/opt/cut/cutApi.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -43,7 +46,7 @@ Cut_Cut_t * Cut_NodeReadCutsNew( Cut_Man_t * p, int Node )
{
if ( Node >= p->vCutsNew->nSize )
return NULL;
- return Vec_PtrEntry( p->vCutsNew, Node );
+ return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node );
}
/**Function*************************************************************
@@ -60,7 +63,7 @@ Cut_Cut_t * Cut_NodeReadCutsNew( Cut_Man_t * p, int Node )
Cut_Cut_t * Cut_NodeReadCutsOld( Cut_Man_t * p, int Node )
{
assert( Node < p->vCutsOld->nSize );
- return Vec_PtrEntry( p->vCutsOld, Node );
+ return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsOld, Node );
}
/**Function*************************************************************
@@ -77,7 +80,7 @@ Cut_Cut_t * Cut_NodeReadCutsOld( Cut_Man_t * p, int Node )
Cut_Cut_t * Cut_NodeReadCutsTemp( Cut_Man_t * p, int Node )
{
assert( Node < p->vCutsTemp->nSize );
- return Vec_PtrEntry( p->vCutsTemp, Node );
+ return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsTemp, Node );
}
/**Function*************************************************************
@@ -195,3 +198,5 @@ void Cut_NodeFreeCuts( Cut_Man_t * p, int Node )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutCut.c b/src/opt/cut/cutCut.c
index 94147278..bd0a70b1 100644
--- a/src/opt/cut/cutCut.c
+++ b/src/opt/cut/cutCut.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -357,3 +360,5 @@ void Cut_CutPrintMerge( Cut_Cut_t * pCut, Cut_Cut_t * pCut0, Cut_Cut_t * pCut1 )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutExpand.c b/src/opt/cut/cutExpand.c
index d389ef7a..4885f879 100644
--- a/src/opt/cut/cutExpand.c
+++ b/src/opt/cut/cutExpand.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -182,3 +185,5 @@ void Cut_TruthCompose( Cut_Cut_t * pCutF, int Node, Cut_Cut_t * pCutT, Cut_Cut_t
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutInt.h b/src/opt/cut/cutInt.h
index 17f268c7..4705c019 100644
--- a/src/opt/cut/cutInt.h
+++ b/src/opt/cut/cutInt.h
@@ -21,6 +21,7 @@
#ifndef __CUT_INT_H__
#define __CUT_INT_H__
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -31,6 +32,9 @@
#include "cut.h"
#include "cutList.h"
+ABC_NAMESPACE_HEADER_START
+
+
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
@@ -149,6 +153,10 @@ extern int Cut_TableReadTime( Cut_HashTable_t * pTable );
extern void Cut_TruthComputeOld( Cut_Cut_t * pCut, Cut_Cut_t * pCut0, Cut_Cut_t * pCut1, int fCompl0, int fCompl1 );
extern void Cut_TruthCompute( Cut_Man_t * p, Cut_Cut_t * pCut, Cut_Cut_t * pCut0, Cut_Cut_t * pCut1, int fCompl0, int fCompl1 );
+
+
+ABC_NAMESPACE_HEADER_END
+
#endif
////////////////////////////////////////////////////////////////////////
diff --git a/src/opt/cut/cutList.h b/src/opt/cut/cutList.h
index a03ec9d5..0f0ccedf 100644
--- a/src/opt/cut/cutList.h
+++ b/src/opt/cut/cutList.h
@@ -21,6 +21,10 @@
#ifndef __CUT_LIST_H__
#define __CUT_LIST_H__
+
+ABC_NAMESPACE_HEADER_START
+
+
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
@@ -199,6 +203,10 @@ static inline Cut_Cut_t * Cut_ListFinish( Cut_List_t * p )
return pHead;
}
+
+
+ABC_NAMESPACE_HEADER_END
+
#endif
////////////////////////////////////////////////////////////////////////
diff --git a/src/opt/cut/cutMan.c b/src/opt/cut/cutMan.c
index 28264e33..4a9f8f4b 100644
--- a/src/opt/cut/cutMan.c
+++ b/src/opt/cut/cutMan.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -313,3 +316,5 @@ void Cut_ManIncrementDagNodes( Cut_Man_t * p )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutMerge.c b/src/opt/cut/cutMerge.c
index d8a9989c..66c8cadd 100644
--- a/src/opt/cut/cutMerge.c
+++ b/src/opt/cut/cutMerge.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -655,3 +658,5 @@ Cut_Cut_t * Cut_CutMergeTwo5( Cut_Man_t * p, Cut_Cut_t * pCut0, Cut_Cut_t * pCut
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutNode.c b/src/opt/cut/cutNode.c
index 633219fd..010e1e00 100644
--- a/src/opt/cut/cutNode.c
+++ b/src/opt/cut/cutNode.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -490,20 +493,20 @@ int Cut_NodeMapping( Cut_Man_t * p, Cut_Cut_t * pCuts, int Node, int Node0, int
// get the fanin cuts
Delay0 = Vec_IntEntry( p->vDelays2, Node0 );
Delay1 = Vec_IntEntry( p->vDelays2, Node1 );
- pCut0 = (Delay0 == 0) ? Vec_PtrEntry( p->vCutsNew, Node0 ) : Vec_PtrEntry( p->vCutsMax, Node0 );
- pCut1 = (Delay1 == 0) ? Vec_PtrEntry( p->vCutsNew, Node1 ) : Vec_PtrEntry( p->vCutsMax, Node1 );
+ pCut0 = (Delay0 == 0) ? (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node0 ) : (Cut_Cut_t *)Vec_PtrEntry( p->vCutsMax, Node0 );
+ pCut1 = (Delay1 == 0) ? (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node1 ) : (Cut_Cut_t *)Vec_PtrEntry( p->vCutsMax, Node1 );
if ( Delay0 == Delay1 )
Delay = (Delay0 == 0) ? Delay0 + 1: Delay0;
else if ( Delay0 > Delay1 )
{
Delay = Delay0;
- pCut1 = Vec_PtrEntry( p->vCutsNew, Node1 );
+ pCut1 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node1 );
assert( pCut1->nLeaves == 1 );
}
else // if ( Delay0 < Delay1 )
{
Delay = Delay1;
- pCut0 = Vec_PtrEntry( p->vCutsNew, Node0 );
+ pCut0 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node0 );
assert( pCut0->nLeaves == 1 );
}
// merge the cuts
@@ -544,7 +547,7 @@ int Cut_ManMappingArea_rec( Cut_Man_t * p, int Node )
int i, Counter;
if ( p->vCutsMax == NULL )
return 0;
- pCut = Vec_PtrEntry( p->vCutsMax, Node );
+ pCut = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsMax, Node );
if ( pCut == NULL || pCut->nLeaves == 1 )
return 0;
Counter = 0;
@@ -729,7 +732,7 @@ Cut_Cut_t * Cut_NodeUnionCuts( Cut_Man_t * p, Vec_Int_t * vNodes )
Vec_IntForEachEntryStart( vNodes, Node, k, i+1 )
Cut_NodeFreeCuts( p, Node );
// recycle the saved cuts of other nodes
- Vec_PtrForEachEntry( p->vTemp, pList, k )
+ Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, k )
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
goto finish;
@@ -737,7 +740,7 @@ Cut_Cut_t * Cut_NodeUnionCuts( Cut_Man_t * p, Vec_Int_t * vNodes )
}
}
// collect larger cuts next
- Vec_PtrForEachEntry( p->vTemp, pList, i )
+ Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, i )
{
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
{
@@ -756,7 +759,7 @@ Cut_Cut_t * Cut_NodeUnionCuts( Cut_Man_t * p, Vec_Int_t * vNodes )
Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
// recycle the saved cuts of other nodes
- Vec_PtrForEachEntryStart( p->vTemp, pList, k, i+1 )
+ Vec_PtrForEachEntryStart( Cut_Cut_t *, p->vTemp, pList, k, i+1 )
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
goto finish;
@@ -885,7 +888,7 @@ Cut_Cut_t * Cut_NodeUnionCutsSeq( Cut_Man_t * p, Vec_Int_t * vNodes, int CutSetN
Vec_IntForEachEntryStart( vNodes, Node, k, i+1 )
Cut_NodeFreeCuts( p, Node );
// recycle the saved cuts of other nodes
- Vec_PtrForEachEntry( p->vTemp, pList, k )
+ Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, k )
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
goto finish;
@@ -893,7 +896,7 @@ Cut_Cut_t * Cut_NodeUnionCutsSeq( Cut_Man_t * p, Vec_Int_t * vNodes, int CutSetN
}
}
// collect larger cuts next
- Vec_PtrForEachEntry( p->vTemp, pList, i )
+ Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, i )
{
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
{
@@ -925,7 +928,7 @@ Cut_Cut_t * Cut_NodeUnionCutsSeq( Cut_Man_t * p, Vec_Int_t * vNodes, int CutSetN
Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
// recycle the saved cuts of other nodes
- Vec_PtrForEachEntryStart( p->vTemp, pList, k, i+1 )
+ Vec_PtrForEachEntryStart( Cut_Cut_t *, p->vTemp, pList, k, i+1 )
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
Cut_CutRecycle( p, pCut );
goto finish;
@@ -997,3 +1000,5 @@ int Cut_CutListVerify( Cut_Cut_t * pList )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutOracle.c b/src/opt/cut/cutOracle.c
index 32798f4f..f7883e3f 100644
--- a/src/opt/cut/cutOracle.c
+++ b/src/opt/cut/cutOracle.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -133,7 +136,7 @@ void Cut_OracleStop( Cut_Oracle_t * p )
ABC_PRT( "Total time ", p->timeTotal );
}
- Vec_PtrForEachEntry( p->vCutsNew, pCut, i )
+ Vec_PtrForEachEntry( Cut_Cut_t *, p->vCutsNew, pCut, i )
if ( p->vCuts0 ) Vec_PtrFree( p->vCuts0 );
if ( p->vCuts1 ) Vec_PtrFree( p->vCuts1 );
@@ -327,8 +330,8 @@ Cut_Cut_t * Cut_OracleComputeCuts( Cut_Oracle_t * p, int Node, int Node0, int No
int clk = clock();
// get the cuts of the children
- pList0 = Vec_PtrEntry( p->vCutsNew, Node0 );
- pList1 = Vec_PtrEntry( p->vCutsNew, Node1 );
+ pList0 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node0 );
+ pList1 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node1 );
assert( pList0 && pList1 );
// get the complemented attribute of the cut
@@ -355,8 +358,8 @@ Cut_Cut_t * Cut_OracleComputeCuts( Cut_Oracle_t * p, int Node, int Node0, int No
for ( i = 1; i < nCuts; i++ )
{
Entry = Vec_IntEntry( p->vCutPairs, iCutStart + i );
- pCut0 = Vec_PtrEntry( p->vCuts0, Entry & 0xFFFF );
- pCut1 = Vec_PtrEntry( p->vCuts1, Entry >> 16 );
+ pCut0 = (Cut_Cut_t *)Vec_PtrEntry( p->vCuts0, Entry & 0xFFFF );
+ pCut1 = (Cut_Cut_t *)Vec_PtrEntry( p->vCuts1, Entry >> 16 );
pCut = Cut_CutMerge( p, pCut0, pCut1 );
*ppTail = pCut;
ppTail = &pCut->pNext;
@@ -387,7 +390,7 @@ p->timeTotal += clock() - clk;
void Cut_OracleFreeCuts( Cut_Oracle_t * p, int Node )
{
Cut_Cut_t * pList, * pCut, * pCut2;
- pList = Vec_PtrEntry( p->vCutsNew, Node );
+ pList = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node );
if ( pList == NULL )
return;
Cut_ListForEachCutSafe( pList, pCut, pCut2 )
@@ -422,3 +425,5 @@ void Cut_OracleTryDroppingCuts( Cut_Oracle_t * p, int Node )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutPre22.c b/src/opt/cut/cutPre22.c
index bda612f7..fdb9bd8c 100644
--- a/src/opt/cut/cutPre22.c
+++ b/src/opt/cut/cutPre22.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -773,7 +776,7 @@ Cut_CMan_t * Cut_CManStart()
p = ABC_ALLOC( Cut_CMan_t, 1 );
memset( p, 0, sizeof(Cut_CMan_t) );
// start the table and the memory manager
- p->tTable = st_init_table(st_ptrcmp,st_ptrhash);
+ p->tTable = st_init_table(st_ptrcmp, st_ptrhash);;
p->pMem = Extra_MmFixedStart( sizeof(Cut_Cell_t) );
// set elementary truth tables
for ( k = 0; k < CUT_CELL_MVAR; k++ )
@@ -986,3 +989,5 @@ int Cut_CellTruthLookup( unsigned * pTruth, int nVars )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutSeq.c b/src/opt/cut/cutSeq.c
index d36f94f7..3f671d24 100644
--- a/src/opt/cut/cutSeq.c
+++ b/src/opt/cut/cutSeq.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -225,3 +228,5 @@ void Cut_NodeOldTransferToNew( Cut_Man_t * p, int Node )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/opt/cut/cutTruth.c b/src/opt/cut/cutTruth.c
index 6ecf20e4..3cbee3f6 100644
--- a/src/opt/cut/cutTruth.c
+++ b/src/opt/cut/cutTruth.c
@@ -20,6 +20,9 @@
#include "cutInt.h"
+ABC_NAMESPACE_IMPL_START
+
+
/*
Truth tables computed in this package are represented as bit-strings
stored in the cut data structure. Cuts of any number of inputs have
@@ -225,3 +228,5 @@ void Cut_TruthCompute( Cut_Man_t * p, Cut_Cut_t * pCut, Cut_Cut_t * pCut0, Cut_C
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+