summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abcHaig.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/abci/abcHaig.c')
-rw-r--r--src/base/abci/abcHaig.c179
1 files changed, 3 insertions, 176 deletions
diff --git a/src/base/abci/abcHaig.c b/src/base/abci/abcHaig.c
index d3513bbe..a4731095 100644
--- a/src/base/abci/abcHaig.c
+++ b/src/base/abci/abcHaig.c
@@ -19,6 +19,7 @@
***********************************************************************/
#include "abc.h"
+#include "hop.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
@@ -30,127 +31,6 @@
/**Function*************************************************************
- Synopsis [Start history AIG.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Abc_NtkHaigStart( Abc_Ntk_t * pNtk )
-{
- Hop_Man_t * p;
- Abc_Obj_t * pObj, * pTemp;
- int i;
- assert( Abc_NtkIsStrash(pNtk) );
- // check if the package is already started
- if ( pNtk->pHaig )
- {
- Abc_NtkHaigStop( pNtk );
- assert( pNtk->pHaig == NULL );
- printf( "Warning: Previous history AIG was removed.\n" );
- }
- // make sure the data is clean
- Abc_NtkForEachObj( pNtk, pObj, i )
- assert( pObj->pEquiv == NULL );
- // start the HOP package
- p = Hop_ManStart();
- p->vObjs = Vec_PtrAlloc( 4096 );
- Vec_PtrPush( p->vObjs, Hop_ManConst1(p) );
- // map the constant node
- Abc_AigConst1(pNtk)->pEquiv = Hop_ManConst1(p);
- // map the CIs
- Abc_NtkForEachCi( pNtk, pObj, i )
- pObj->pEquiv = Hop_ObjCreatePi(p);
- // map the internal nodes
- Abc_NtkForEachNode( pNtk, pObj, i )
- pObj->pEquiv = Hop_And( p, Abc_ObjChild0Equiv(pObj), Abc_ObjChild1Equiv(pObj) );
- // map the choice nodes
- if ( Abc_NtkGetChoiceNum( pNtk ) )
- {
- // print warning about choice nodes
- printf( "Warning: The choice nodes in the original AIG are converted into HAIG.\n" );
- Abc_NtkForEachNode( pNtk, pObj, i )
- {
- if ( !Abc_AigNodeIsChoice( pObj ) )
- continue;
- for ( pTemp = pObj->pData; pTemp; pTemp = pTemp->pData )
- Hop_ObjCreateChoice( pObj->pEquiv, pTemp->pEquiv );
- }
- }
- // make sure everything is okay
- if ( !Hop_ManCheck(p) )
- {
- printf( "Abc_NtkHaigStart: Check for History AIG has failed.\n" );
- Hop_ManStop(p);
- return 0;
- }
- pNtk->pHaig = p;
- return 1;
-}
-
-/**Function*************************************************************
-
- Synopsis [Stops history AIG.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Abc_NtkHaigStop( Abc_Ntk_t * pNtk )
-{
- Abc_Obj_t * pObj;
- int i;
- assert( Abc_NtkIsStrash(pNtk) );
- if ( pNtk->pHaig == NULL )
- {
- printf( "Warning: History AIG is not allocated.\n" );
- return 1;
- }
- Abc_NtkForEachObj( pNtk, pObj, i )
- pObj->pEquiv = NULL;
- Hop_ManStop( pNtk->pHaig );
- pNtk->pHaig = NULL;
- return 1;
-}
-
-/**Function*************************************************************
-
- Synopsis [Transfers the HAIG to the new network.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Abc_NtkHaigTranfer( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew )
-{
- Abc_Obj_t * pObj;
- int i;
- if ( pNtkOld->pHaig == NULL )
- return;
- // transfer the package
- assert( pNtkNew->pHaig == NULL );
- pNtkNew->pHaig = pNtkOld->pHaig;
- pNtkOld->pHaig = NULL;
- // transfer constant pointer
- Abc_AigConst1(pNtkOld)->pCopy->pEquiv = Abc_AigConst1(pNtkOld)->pEquiv;
- // transfer the CI pointers
- Abc_NtkForEachCi( pNtkOld, pObj, i )
- pObj->pCopy->pEquiv = pObj->pEquiv;
-}
-
-
-
-/**Function*************************************************************
-
Synopsis [Collects the nodes in the classes.]
Description []
@@ -467,10 +347,10 @@ Abc_Ntk_t * Abc_NtkHaigRecreateAig( Abc_Ntk_t * pNtk, Hop_Man_t * p )
assert( p->nCreated == Vec_PtrSize(p->vObjs) );
// start the new network
- pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
+ pNtkAig = Abc_NtkStartFrom( pNtk, ABC_TYPE_STRASH, ABC_FUNC_AIG );
// transfer new nodes to the PIs of HOP
- Hop_ManConst1(p)->pNext = (Hop_Obj_t *)Abc_AigConst1( pNtkAig );
+ Hop_ManConst1(p)->pNext = (Hop_Obj_t *)Abc_AigConst1( pNtkAig->pManFunc );
Hop_ManForEachPi( p, pObj, i )
pObj->pNext = (Hop_Obj_t *)Abc_NtkCi( pNtkAig, i );
@@ -636,59 +516,6 @@ int Abc_NtkHaigResetReprs( Hop_Man_t * p )
return nFanouts;
}
-/**Function*************************************************************
-
- Synopsis [Stops history AIG.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Abc_Ntk_t * Abc_NtkHaigUse( Abc_Ntk_t * pNtk )
-{
- Hop_Man_t * pMan, * pManTemp;
- Abc_Ntk_t * pNtkAig;
- Abc_Obj_t * pObj;
- int i;
-
- // check if HAIG is available
- assert( Abc_NtkIsStrash(pNtk) );
- if ( pNtk->pHaig == NULL )
- {
- printf( "Warning: History AIG is not available.\n" );
- return NULL;
- }
- // convert HOP package into AIG with choices
- // print HAIG stats
-// Hop_ManPrintStats( pMan ); // USES DATA!!!
-
- // add the POs
- Abc_NtkForEachCo( pNtk, pObj, i )
- Hop_ObjCreatePo( pNtk->pHaig, Abc_ObjChild0Equiv(pObj) );
-
- // clean the old network
- Abc_NtkForEachObj( pNtk, pObj, i )
- pObj->pEquiv = NULL;
- pMan = pNtk->pHaig;
- pNtk->pHaig = 0;
-
- // iteratively reconstruct the HOP manager to create choice nodes
- while ( Abc_NtkHaigResetReprs( pMan ) )
- {
- pMan = Abc_NtkHaigReconstruct( pManTemp = pMan );
- Hop_ManStop( pManTemp );
- }
-
- // traverse in the topological order and create new AIG
- pNtkAig = Abc_NtkHaigRecreateAig( pNtk, pMan );
- Hop_ManStop( pMan );
-
- // free HAIG
- return pNtkAig;
-}
/**Function*************************************************************