summaryrefslogtreecommitdiffstats
path: root/src/aig/ntl
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2009-04-24 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2009-04-24 08:01:00 -0700
commitd7a048d738381651b53340684e26f06b78b8a78c (patch)
tree82f7bea9d0750a388494e6fffceb61cfeff969b7 /src/aig/ntl
parent77fab468ad32d15de5c065c211f6f74371670940 (diff)
downloadabc-d7a048d738381651b53340684e26f06b78b8a78c.tar.gz
abc-d7a048d738381651b53340684e26f06b78b8a78c.tar.bz2
abc-d7a048d738381651b53340684e26f06b78b8a78c.zip
Version abc90424
Diffstat (limited to 'src/aig/ntl')
-rw-r--r--src/aig/ntl/ntl.h8
-rw-r--r--src/aig/ntl/ntlFraig.c4
-rw-r--r--src/aig/ntl/ntlInsert.c36
-rw-r--r--src/aig/ntl/ntlMan.c3
-rw-r--r--src/aig/ntl/ntlUtil.c62
5 files changed, 110 insertions, 3 deletions
diff --git a/src/aig/ntl/ntl.h b/src/aig/ntl/ntl.h
index 0a44d2dc..c8d38331 100644
--- a/src/aig/ntl/ntl.h
+++ b/src/aig/ntl/ntl.h
@@ -162,9 +162,10 @@ struct Ntl_Net_t_
int iTemp; // other data
};
Ntl_Obj_t * pDriver; // driver of the net
- int NetId; // unique ID of the net
- char nVisits; // the number of times the net is visited
- char fMark; // temporary mark
+ unsigned NetId : 28; // unique ID of the net
+ unsigned nVisits : 2; // the number of times the net is visted
+ unsigned fMark : 1; // temporary mark
+ unsigned fFixed : 1; // the fixed net
char pName[0]; // the name of this net
};
@@ -392,6 +393,7 @@ extern ABC_DLL int Ntl_ModelSeqLeafNum( Ntl_Mod_t * p );
extern ABC_DLL int Ntl_ModelSeqRootNum( Ntl_Mod_t * p );
extern ABC_DLL int Ntl_ModelCheckNetsAreNotMarked( Ntl_Mod_t * pModel );
extern ABC_DLL void Ntl_ModelClearNets( Ntl_Mod_t * pModel );
+extern ABC_DLL void Ntl_ManRemoveUselessNets( Ntl_Man_t * p );
#ifdef __cplusplus
}
diff --git a/src/aig/ntl/ntlFraig.c b/src/aig/ntl/ntlFraig.c
index 405ec83f..70f97d89 100644
--- a/src/aig/ntl/ntlFraig.c
+++ b/src/aig/ntl/ntlFraig.c
@@ -422,6 +422,8 @@ Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVe
// collapse the AIG
pAig = Ntl_ManExtract( p );
+//Ntl_ManPrintStats( p );
+//Aig_ManPrintStats( pAig );
pNew = Ntl_ManInsertAig( p, pAig );
pAigCol = Ntl_ManCollapseSeq( pNew, 0 );
if ( pAigCol == NULL )
@@ -429,6 +431,8 @@ Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVe
Aig_ManStop( pAig );
return pNew;
}
+//Ntl_ManPrintStats( pNew );
+//Aig_ManPrintStats( pAigCol );
// perform SCL for the given design
pTemp = Aig_ManScl( pAigCol, fLatchConst, fLatchEqual, fVerbose );
diff --git a/src/aig/ntl/ntlInsert.c b/src/aig/ntl/ntlInsert.c
index 21f2d246..eb967bdc 100644
--- a/src/aig/ntl/ntlInsert.c
+++ b/src/aig/ntl/ntlInsert.c
@@ -245,6 +245,42 @@ Ntl_Man_t * Ntl_ManInsertAig( Ntl_Man_t * p, Aig_Man_t * pAig )
/**Function*************************************************************
+ Synopsis [Find drivers of the given net.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Ntl_ManFindDriver( Ntl_Man_t * p, char * pName )
+{
+ Ntl_Mod_t * pRoot;
+ Ntl_Obj_t * pNode;
+ Ntl_Net_t * pNet, * pNetThis;
+ int i, k;
+ pRoot = Ntl_ManRootModel( p );
+ pNetThis = Ntl_ModelFindNet( pRoot, pName );
+ printf( "\n*** Net %d \"%s\":\n", pNetThis->NetId, pName );
+ // mark from the nodes
+ Ntl_ModelForEachPo( pRoot, pNode, i )
+ if ( pNetThis == Ntl_ObjFanin0(pNode) )
+ printf( "driven by PO %d\n", i );
+ Ntl_ModelForEachNode( pRoot, pNode, i )
+ Ntl_ObjForEachFanin( pNode, pNet, k )
+ if ( pNetThis == pNet )
+ printf( "driven by node %d with %d fanins and %d fanouts\n (%s)\n",
+ pNode->Id, Ntl_ObjFaninNum(pNode), Ntl_ObjFanoutNum(pNode), Ntl_ObjFanout(pNode,0)->pName );
+ Ntl_ModelForEachBox( pRoot, pNode, i )
+ Ntl_ObjForEachFanin( pNode, pNet, k )
+ if ( pNetThis == pNet )
+ printf( "driven by box %d with %d fanins and %d fanouts\n (%s)\n",
+ pNode->Id, Ntl_ObjFaninNum(pNode), Ntl_ObjFanoutNum(pNode), Ntl_ObjFanout(pNode,0)->pName );
+}
+
+/**Function*************************************************************
+
Synopsis [Inserts the given mapping into the netlist.]
Description []
diff --git a/src/aig/ntl/ntlMan.c b/src/aig/ntl/ntlMan.c
index 552d5c15..4c9bb311 100644
--- a/src/aig/ntl/ntlMan.c
+++ b/src/aig/ntl/ntlMan.c
@@ -460,6 +460,8 @@ Ntl_Mod_t * Ntl_ModelStartFrom( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld )
}
else
pNet->pCopy = NULL;
+ if ( pNet->pCopy )
+ ((Ntl_Net_t *)pNet->pCopy)->fFixed = pNet->fFixed;
}
Ntl_ModelForEachObj( pModelOld, pObj, i )
{
@@ -511,6 +513,7 @@ Ntl_Mod_t * Ntl_ModelDup( Ntl_Man_t * pManNew, Ntl_Mod_t * pModelOld )
Ntl_ModelForEachNet( pModelOld, pNet, i )
{
pNet->pCopy = Ntl_ModelFindOrCreateNet( pModelNew, pNet->pName );
+ ((Ntl_Net_t *)pNet->pCopy)->fFixed = pNet->fFixed;
if ( pNet->pDriver == NULL )
{
assert( !pModelOld->attrWhite );
diff --git a/src/aig/ntl/ntlUtil.c b/src/aig/ntl/ntlUtil.c
index 9c3d4e42..6d1b6c83 100644
--- a/src/aig/ntl/ntlUtil.c
+++ b/src/aig/ntl/ntlUtil.c
@@ -657,6 +657,68 @@ void Ntl_ModelClearNets( Ntl_Mod_t * pModel )
}
}
+/**Function*************************************************************
+
+ Synopsis [Removes nets without fanins and fanouts.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Ntl_ManRemoveUselessNets( Ntl_Man_t * p )
+{
+ Ntl_Mod_t * pRoot;
+ Ntl_Obj_t * pNode;
+ Ntl_Net_t * pNet;
+ int i, k, Counter;
+ pRoot = Ntl_ManRootModel( p );
+ Ntl_ModelForEachNet( pRoot, pNet, i )
+ pNet->fMark = 0;
+ Ntl_ModelForEachPi( pRoot, pNode, i )
+ {
+ pNet = Ntl_ObjFanout0(pNode);
+ pNet->fMark = 1;
+ }
+ Ntl_ModelForEachPo( pRoot, pNode, i )
+ {
+ pNet = Ntl_ObjFanin0(pNode);
+ pNet->fMark = 1;
+ }
+ Ntl_ModelForEachNode( pRoot, pNode, i )
+ {
+ Ntl_ObjForEachFanin( pNode, pNet, k )
+ pNet->fMark = 1;
+ Ntl_ObjForEachFanout( pNode, pNet, k )
+ pNet->fMark = 1;
+ }
+ Ntl_ModelForEachBox( pRoot, pNode, i )
+ {
+ Ntl_ObjForEachFanin( pNode, pNet, k )
+ pNet->fMark = 1;
+ Ntl_ObjForEachFanout( pNode, pNet, k )
+ pNet->fMark = 1;
+ }
+ Counter = 0;
+ Ntl_ModelForEachNet( pRoot, pNet, i )
+ {
+ if ( pNet->fMark )
+ {
+ pNet->fMark = 0;
+ continue;
+ }
+ if ( pNet->fFixed )
+ continue;
+ Ntl_ModelDeleteNet( pRoot, pNet );
+ Vec_PtrWriteEntry( pRoot->vNets, pNet->NetId, NULL );
+ Counter++;
+ }
+ if ( Counter )
+ printf( "Deleted %d nets without fanins/fanouts.\n", Counter );
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////