summaryrefslogtreecommitdiffstats
path: root/src/aig/csw/cswCore.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-01-30 20:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2008-01-30 20:01:00 -0800
commit0c6505a26a537dc911b6566f82d759521e527c08 (patch)
treef2687995efd4943fe3b1307fce7ef5942d0a57b3 /src/aig/csw/cswCore.c
parent4d30a1e4f1edecff86d5066ce4653a370e59e5e1 (diff)
downloadabc-0c6505a26a537dc911b6566f82d759521e527c08.tar.gz
abc-0c6505a26a537dc911b6566f82d759521e527c08.tar.bz2
abc-0c6505a26a537dc911b6566f82d759521e527c08.zip
Version abc80130_2
Diffstat (limited to 'src/aig/csw/cswCore.c')
-rw-r--r--src/aig/csw/cswCore.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/aig/csw/cswCore.c b/src/aig/csw/cswCore.c
new file mode 100644
index 00000000..20893058
--- /dev/null
+++ b/src/aig/csw/cswCore.c
@@ -0,0 +1,94 @@
+/**CFile****************************************************************
+
+ FileName [cswCore.c]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [Cut sweeping.]
+
+ Synopsis []
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - July 11, 2007.]
+
+ Revision [$Id: cswCore.c,v 1.00 2007/07/11 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+#include "cswInt.h"
+
+////////////////////////////////////////////////////////////////////////
+/// DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Aig_Man_t * Csw_Sweep( Aig_Man_t * pAig, int nCutsMax, int nLeafMax, int fVerbose )
+{
+ Csw_Man_t * p;
+ Aig_Man_t * pRes;
+ Aig_Obj_t * pObj, * pObjNew, * pObjRes;
+ int i, clk;
+clk = clock();
+ // start the manager
+ p = Csw_ManStart( pAig, nCutsMax, nLeafMax, fVerbose );
+ // set elementary cuts at the PIs
+ Aig_ManForEachPi( p->pManRes, pObj, i )
+ {
+ Csw_ObjPrepareCuts( p, pObj, 1 );
+ Csw_ObjAddRefs( p, pObj, Aig_ManPi(p->pManAig,i)->nRefs );
+ }
+ // process the nodes
+ Aig_ManForEachNode( pAig, pObj, i )
+ {
+ // create the new node
+ pObjNew = Aig_And( p->pManRes, Csw_ObjChild0Equiv(p, pObj), Csw_ObjChild1Equiv(p, pObj) );
+ // check if this node can be represented using another node
+// pObjRes = Csw_ObjSweep( p, Aig_Regular(pObjNew), pObj->nRefs > 1 );
+// pObjRes = Aig_NotCond( pObjRes, Aig_IsComplement(pObjNew) );
+ // try recursively if resubsitution is used
+ do {
+ pObjRes = Csw_ObjSweep( p, Aig_Regular(pObjNew), pObj->nRefs > 1 );
+ pObjRes = Aig_NotCond( pObjRes, Aig_IsComplement(pObjNew) );
+ pObjNew = pObjRes;
+ } while ( Csw_ObjCuts(p, Aig_Regular(pObjNew)) == NULL && !Aig_ObjIsConst1(Aig_Regular(pObjNew)) );
+ // save the resulting node
+ Csw_ObjSetEquiv( p, pObj, pObjRes );
+ // add to the reference counter
+ Csw_ObjAddRefs( p, Aig_Regular(pObjRes), pObj->nRefs );
+ }
+ // add the POs
+ Aig_ManForEachPo( pAig, pObj, i )
+ Aig_ObjCreatePo( p->pManRes, Csw_ObjChild0Equiv(p, pObj) );
+ // remove dangling nodes
+ Aig_ManCleanup( p->pManRes );
+ // return the resulting manager
+p->timeTotal = clock() - clk;
+p->timeOther = p->timeTotal - p->timeCuts - p->timeHash;
+ pRes = p->pManRes;
+ Csw_ManStop( p );
+ return pRes;
+}
+
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
+