summaryrefslogtreecommitdiffstats
path: root/src/aig/nwk
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-05-07 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-05-07 08:01:00 -0700
commit6175fcb8026bae3db5b4280b655131322d7944da (patch)
tree41889f98814c981dcadcc5ce0f1990b74981cd49 /src/aig/nwk
parent436d5d2103b2cfec6a6deb5bbba72ce8e820f785 (diff)
downloadabc-6175fcb8026bae3db5b4280b655131322d7944da.tar.gz
abc-6175fcb8026bae3db5b4280b655131322d7944da.tar.bz2
abc-6175fcb8026bae3db5b4280b655131322d7944da.zip
Version abc80507
Diffstat (limited to 'src/aig/nwk')
-rw-r--r--src/aig/nwk/nwk.h1
-rw-r--r--src/aig/nwk/nwkMap.c5
-rw-r--r--src/aig/nwk/nwkUtil.c56
3 files changed, 53 insertions, 9 deletions
diff --git a/src/aig/nwk/nwk.h b/src/aig/nwk/nwk.h
index c36f3498..b0edd243 100644
--- a/src/aig/nwk/nwk.h
+++ b/src/aig/nwk/nwk.h
@@ -285,6 +285,7 @@ extern void Nwk_ObjPrint( Nwk_Obj_t * pObj );
extern void Nwk_ManDumpBlif( Nwk_Man_t * pNtk, char * pFileName, Vec_Ptr_t * vCiNames, Vec_Ptr_t * vCoNames );
extern void Nwk_ManPrintFanioNew( Nwk_Man_t * pNtk );
extern void Nwk_ManCleanMarks( Nwk_Man_t * pNtk );
+extern void Nwk_ManMinimumBase( Nwk_Man_t * pNtk, int fVerbose );
#ifdef __cplusplus
}
diff --git a/src/aig/nwk/nwkMap.c b/src/aig/nwk/nwkMap.c
index 45d56eb5..88e08413 100644
--- a/src/aig/nwk/nwkMap.c
+++ b/src/aig/nwk/nwkMap.c
@@ -146,7 +146,7 @@ If_Man_t * Nwk_ManToIf( Aig_Man_t * p, If_Par_t * pPars, Vec_Ptr_t * vAigToIf )
/**Function*************************************************************
- Synopsis [Recursively derives the truth table for the cut.]
+ Synopsis [Recursively derives the local AIG for the cut.]
Description []
@@ -193,7 +193,7 @@ Hop_Obj_t * Nwk_NodeIfToHop2_rec( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj
/**Function*************************************************************
- Synopsis [Derives the truth table for one cut.]
+ Synopsis [Derives the local AIG for the cut.]
Description []
@@ -309,6 +309,7 @@ Nwk_Man_t * Nwk_ManFromIf( If_Man_t * pIfMan, Aig_Man_t * p, Vec_Ptr_t * vAigToI
}
Vec_PtrFree( vIfToAig );
pNtk->pManTime = Tim_ManDup( pIfMan->pManTim, 0 );
+ Nwk_ManMinimumBase( pNtk, 0 );
assert( Nwk_ManCheck( pNtk ) );
return pNtk;
}
diff --git a/src/aig/nwk/nwkUtil.c b/src/aig/nwk/nwkUtil.c
index 1ef0af67..14f7632f 100644
--- a/src/aig/nwk/nwkUtil.c
+++ b/src/aig/nwk/nwkUtil.c
@@ -56,7 +56,7 @@ void Nwk_ManIncrementTravId( Nwk_Man_t * pNtk )
/**Function*************************************************************
- Synopsis [Reads the maximum number of fanins.]
+ Synopsis [Reads the maximum number of fanins of a node.]
Description []
@@ -100,7 +100,7 @@ int Nwk_ManGetTotalFanins( Nwk_Man_t * pNtk )
/**Function*************************************************************
- Synopsis []
+ Synopsis [Returns the number of true PIs.]
Description []
@@ -120,7 +120,7 @@ int Nwk_ManPiNum( Nwk_Man_t * pNtk )
/**Function*************************************************************
- Synopsis []
+ Synopsis [Returns the number of true POs.]
Description []
@@ -140,7 +140,7 @@ int Nwk_ManPoNum( Nwk_Man_t * pNtk )
/**Function*************************************************************
- Synopsis [Reads the number of BDD nodes.]
+ Synopsis [Reads the number of AIG nodes.]
Description []
@@ -211,7 +211,7 @@ int Nwk_NodeCompareLevelsDecrease( Nwk_Obj_t ** pp1, Nwk_Obj_t ** pp2 )
/**Function*************************************************************
- Synopsis [Deletes the node.]
+ Synopsis [Prints the objects.]
Description []
@@ -242,7 +242,7 @@ void Nwk_ObjPrint( Nwk_Obj_t * pObj )
/**Function*************************************************************
- Synopsis [Deletes the node.]
+ Synopsis [Dumps the BLIF file for the network.]
Description []
@@ -449,7 +449,7 @@ void Nwk_ManPrintFanioNew( Nwk_Man_t * pNtk )
/**Function*************************************************************
- Synopsis []
+ Synopsis [Cleans the temporary marks of the nodes.]
Description []
@@ -466,6 +466,48 @@ void Nwk_ManCleanMarks( Nwk_Man_t * pMan )
pObj->MarkA = pObj->MarkB = 0;
}
+/**Function*************************************************************
+
+ Synopsis [Minimizes the support of all nodes.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Nwk_ManMinimumBase( Nwk_Man_t * pNtk, int fVerbose )
+{
+ unsigned * pTruth;
+ Vec_Int_t * vTruth;
+ Nwk_Obj_t * pObj, * pFanin, * pObjNew;
+ int uSupp, nSuppSize, i, k, Counter = 0;
+ vTruth = Vec_IntAlloc( 1 << 16 );
+ Nwk_ManForEachNode( pNtk, pObj, i )
+ {
+ pTruth = Hop_ManConvertAigToTruth( pNtk->pManHop, Hop_Regular(pObj->pFunc), Nwk_ObjFaninNum(pObj), vTruth, 0 );
+ nSuppSize = Kit_TruthSupportSize(pTruth, Nwk_ObjFaninNum(pObj));
+ if ( nSuppSize == Nwk_ObjFaninNum(pObj) )
+ continue;
+ Counter++;
+ uSupp = Kit_TruthSupport( pTruth, Nwk_ObjFaninNum(pObj) );
+ // create new node with the given support
+ pObjNew = Nwk_ManCreateNode( pNtk, nSuppSize, Nwk_ObjFanoutNum(pObj) );
+ Nwk_ObjForEachFanin( pObj, pFanin, k )
+ if ( uSupp & (1 << k) )
+ Nwk_ObjAddFanin( pObjNew, pFanin );
+ pObjNew->pFunc = Hop_Remap( pNtk->pManHop, pObj->pFunc, uSupp, Nwk_ObjFaninNum(pObj) );
+ if ( fVerbose )
+ printf( "Reducing node %d fanins from %d to %d.\n",
+ pObj->Id, Nwk_ObjFaninNum(pObj), Nwk_ObjFaninNum(pObjNew) );
+ Nwk_ObjReplace( pObj, pObjNew );
+ }
+ if ( fVerbose && Counter )
+ printf( "Support minimization reduced support of %d nodes.\n", Counter );
+ Vec_IntFree( vTruth );
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////