summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abcPrint.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/base/abci/abcPrint.c
parent4d30a1e4f1edecff86d5066ce4653a370e59e5e1 (diff)
downloadabc-0c6505a26a537dc911b6566f82d759521e527c08.tar.gz
abc-0c6505a26a537dc911b6566f82d759521e527c08.tar.bz2
abc-0c6505a26a537dc911b6566f82d759521e527c08.zip
Version abc80130_2
Diffstat (limited to 'src/base/abci/abcPrint.c')
-rw-r--r--src/base/abci/abcPrint.c536
1 files changed, 492 insertions, 44 deletions
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c
index 41b9288e..4003a6d6 100644
--- a/src/base/abci/abcPrint.c
+++ b/src/base/abci/abcPrint.c
@@ -20,13 +20,24 @@
#include "abc.h"
#include "dec.h"
+#include "main.h"
+#include "mio.h"
+//#include "seq.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
+//extern int s_TotalNodes = 0;
+//extern int s_TotalChanges = 0;
+
+int s_MappingTime = 0;
+int s_MappingMem = 0;
+int s_ResubTime = 0;
+int s_ResynTime = 0;
+
////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFITIONS ///
+/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
@@ -44,57 +55,171 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
{
int Num;
- fprintf( pFile, "%-13s:", pNtk->pName );
- fprintf( pFile, " i/o = %4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
+// if ( Abc_NtkIsStrash(pNtk) )
+// Abc_AigCountNext( pNtk->pManFunc );
- if ( !Abc_NtkIsSeq(pNtk) )
- fprintf( pFile, " lat = %4d", Abc_NtkLatchNum(pNtk) );
+ fprintf( pFile, "%-13s:", pNtk->pName );
+ if ( Abc_NtkAssertNum(pNtk) )
+ fprintf( pFile, " i/o/a = %5d/%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkAssertNum(pNtk) );
else
- fprintf( pFile, " lat = %4d", Abc_NtkSeqLatchNum(pNtk) );
-
+ fprintf( pFile, " i/o = %5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
+ fprintf( pFile, " lat = %4d", Abc_NtkLatchNum(pNtk) );
if ( Abc_NtkIsNetlist(pNtk) )
{
fprintf( pFile, " net = %5d", Abc_NtkNetNum(pNtk) );
- fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) );
+ fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) );
+ fprintf( pFile, " wbox = %3d", Abc_NtkWhiteboxNum(pNtk) );
+ fprintf( pFile, " bbox = %3d", Abc_NtkBlackboxNum(pNtk) );
}
else if ( Abc_NtkIsStrash(pNtk) )
- {
+ {
fprintf( pFile, " and = %5d", Abc_NtkNodeNum(pNtk) );
if ( Num = Abc_NtkGetChoiceNum(pNtk) )
fprintf( pFile, " (choice = %d)", Num );
if ( Num = Abc_NtkGetExorNum(pNtk) )
fprintf( pFile, " (exor = %d)", Num );
+// if ( Num2 = Abc_NtkGetMuxNum(pNtk) )
+// fprintf( pFile, " (mux = %d)", Num2-Num );
+// if ( Num2 )
+// fprintf( pFile, " (other = %d)", Abc_NtkNodeNum(pNtk)-3*Num2 );
}
- else if ( Abc_NtkIsSeq(pNtk) )
- fprintf( pFile, " and = %5d", Abc_NtkNodeNum(pNtk) );
else
+ {
fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) );
+ fprintf( pFile, " edge = %6d", Abc_NtkGetTotalFanins(pNtk) );
+ }
- if ( Abc_NtkHasSop(pNtk) )
+ if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) )
+ {
+ }
+ else if ( Abc_NtkHasSop(pNtk) )
{
+
fprintf( pFile, " cube = %5d", Abc_NtkGetCubeNum(pNtk) );
// fprintf( pFile, " lit(sop) = %5d", Abc_NtkGetLitNum(pNtk) );
if ( fFactored )
fprintf( pFile, " lit(fac) = %5d", Abc_NtkGetLitFactNum(pNtk) );
}
+ else if ( Abc_NtkHasAig(pNtk) )
+ fprintf( pFile, " aig = %5d", Abc_NtkGetAigNodeNum(pNtk) );
else if ( Abc_NtkHasBdd(pNtk) )
- fprintf( pFile, " bdd = %5d", Abc_NtkGetBddNodeNum(pNtk) );
+ fprintf( pFile, " bdd = %5d", Abc_NtkGetBddNodeNum(pNtk) );
else if ( Abc_NtkHasMapping(pNtk) )
{
fprintf( pFile, " area = %5.2f", Abc_NtkGetMappedArea(pNtk) );
fprintf( pFile, " delay = %5.2f", Abc_NtkDelayTrace(pNtk) );
}
- else if ( !Abc_NtkHasAig(pNtk) )
+ else if ( !Abc_NtkHasBlackbox(pNtk) )
{
assert( 0 );
}
if ( Abc_NtkIsStrash(pNtk) )
- fprintf( pFile, " lev = %3d", Abc_AigGetLevelNum(pNtk) );
- else if ( !Abc_NtkIsSeq(pNtk) )
- fprintf( pFile, " lev = %3d", Abc_NtkGetLevelNum(pNtk) );
+ fprintf( pFile, " lev = %3d", Abc_AigLevel(pNtk) );
+ else
+ fprintf( pFile, " lev = %3d", Abc_NtkLevel(pNtk) );
fprintf( pFile, "\n" );
+
+// Abc_NtkCrossCut( pNtk );
+
+ // print the statistic into a file
+/*
+ {
+ FILE * pTable;
+ pTable = fopen( "ibm/seq_stats.txt", "a+" );
+// fprintf( pTable, "%s ", pNtk->pName );
+// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
+ fprintf( pTable, "\n" );
+ fclose( pTable );
+ }
+*/
+
+/*
+ // print the statistic into a file
+ {
+ FILE * pTable;
+ pTable = fopen( "stats.txt", "a+" );
+ fprintf( pTable, "%s ", pNtk->pSpec );
+ fprintf( pTable, "%.0f ", Abc_NtkGetMappedArea(pNtk) );
+ fprintf( pTable, "%.2f ", Abc_NtkDelayTrace(pNtk) );
+ fprintf( pTable, "\n" );
+ fclose( pTable );
+ }
+*/
+
+/*
+ // print the statistic into a file
+ {
+ FILE * pTable;
+ pTable = fopen( "x/stats_new.txt", "a+" );
+ fprintf( pTable, "%s ", pNtk->pName );
+// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
+// fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
+ fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
+// fprintf( pTable, "%.2f", (float)(s_ResynTime)/(float)(CLOCKS_PER_SEC) );
+ fprintf( pTable, "\n" );
+ fclose( pTable );
+
+ s_ResynTime = 0;
+ }
+*/
+
+/*
+ // print the statistic into a file
+ {
+ static int Counter = 0;
+ extern int timeRetime;
+ FILE * pTable;
+ Counter++;
+ pTable = fopen( "a/ret__stats.txt", "a+" );
+ fprintf( pTable, "%s ", pNtk->pName );
+ fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
+ fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
+ if ( Counter % 4 == 0 )
+ fprintf( pTable, "\n" );
+ fclose( pTable );
+ }
+*/
+
+/*
+ // print the statistic into a file
+ {
+ static int Counter = 0;
+ extern int timeRetime;
+ FILE * pTable;
+ Counter++;
+ pTable = fopen( "d/stats.txt", "a+" );
+ fprintf( pTable, "%s ", pNtk->pName );
+// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
+// fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
+ fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
+ fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
+ fprintf( pTable, "\n" );
+ fclose( pTable );
+ }
+*/
+
+/*
+ s_TotalNodes += Abc_NtkNodeNum(pNtk);
+ printf( "Total nodes = %6d %6.2f Mb Changes = %6d.\n",
+ s_TotalNodes, s_TotalNodes * 20.0 / (1<<20), s_TotalChanges );
+*/
+
+// if ( Abc_NtkHasSop(pNtk) )
+// printf( "The total number of cube pairs = %d.\n", Abc_NtkGetCubePairNum(pNtk) );
}
/**Function*************************************************************
@@ -116,6 +241,7 @@ void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk )
fprintf( pFile, "Primary inputs (%d): ", Abc_NtkPiNum(pNtk) );
Abc_NtkForEachPi( pNtk, pObj, i )
fprintf( pFile, " %s", Abc_ObjName(pObj) );
+// fprintf( pFile, " %s(%d)", Abc_ObjName(pObj), Abc_ObjFanoutNum(pObj) );
fprintf( pFile, "\n" );
fprintf( pFile, "Primary outputs (%d):", Abc_NtkPoNum(pNtk) );
@@ -125,7 +251,8 @@ void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk )
fprintf( pFile, "Latches (%d): ", Abc_NtkLatchNum(pNtk) );
Abc_NtkForEachLatch( pNtk, pObj, i )
- fprintf( pFile, " %s", Abc_ObjName(pObj) );
+ fprintf( pFile, " %s(%s=%s)", Abc_ObjName(pObj),
+ Abc_ObjName(Abc_ObjFanout0(pObj)), Abc_ObjName(Abc_ObjFanin0(pObj)) );
fprintf( pFile, "\n" );
}
@@ -144,34 +271,38 @@ void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk )
{
Abc_Obj_t * pLatch, * pFanin;
int i, Counter0, Counter1, Counter2;
- int Init0, Init1, Init2;
+ int InitNums[4], Init;
+ assert( !Abc_NtkIsNetlist(pNtk) );
if ( Abc_NtkLatchNum(pNtk) == 0 )
{
fprintf( pFile, "The network is combinational.\n" );
return;
}
- assert( !Abc_NtkIsNetlist(pNtk) );
-
- Init0 = Init1 = Init2 = 0;
+ for ( i = 0; i < 4; i++ )
+ InitNums[i] = 0;
Counter0 = Counter1 = Counter2 = 0;
-
Abc_NtkForEachLatch( pNtk, pLatch, i )
{
- if ( Abc_LatchIsInit0(pLatch) )
- Init0++;
- else if ( Abc_LatchIsInit1(pLatch) )
- Init1++;
- else if ( Abc_LatchIsInitDc(pLatch) )
- Init2++;
+ Init = Abc_LatchInit( pLatch );
+ assert( Init < 4 );
+ InitNums[Init]++;
+
+ pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
+ if ( Abc_NtkIsLogic(pNtk) )
+ {
+ if ( !Abc_NodeIsConst(pFanin) )
+ continue;
+ }
+ else if ( Abc_NtkIsStrash(pNtk) )
+ {
+ if ( !Abc_AigNodeIsConst(pFanin) )
+ continue;
+ }
else
assert( 0 );
- pFanin = Abc_ObjFanin0(pLatch);
- if ( !Abc_ObjIsNode(pFanin) || !Abc_NodeIsConst(pFanin) )
- continue;
-
// the latch input is a constant node
Counter0++;
if ( Abc_LatchIsInitDc(pLatch) )
@@ -187,18 +318,15 @@ void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk )
}
else
{
- if ( Abc_LatchIsInit1(pLatch) == Abc_NodeIsConst1(pLatch) )
+ if ( Abc_LatchIsInit1(pLatch) == Abc_NodeIsConst1(Abc_ObjFanin0(Abc_ObjFanin0(pLatch))) )
Counter2++;
}
}
-// fprintf( pFile, "%-15s: ", pNtk->pName );
-// fprintf( pFile, "L = %5d: 0 = %4d. 1 = %3d. DC = %4d. ", Abc_NtkLatchNum(pNtk), Init0, Init1, Init2 );
-// fprintf( pFile, "Con = %3d. DC = %3d. Mat = %3d. ", Counter0, Counter1, Counter2 );
-// fprintf( pFile, "SFeed = %2d.\n", Abc_NtkCountSelfFeedLatches(pNtk) );
fprintf( pFile, "%-15s: ", pNtk->pName );
- fprintf( pFile, "Lat = %5d: 0 = %4d. 1 = %3d. DC = %4d. \n", Abc_NtkLatchNum(pNtk), Init0, Init1, Init2 );
- fprintf( pFile, "Con = %3d. DC = %3d. Mat = %3d. ", Counter0, Counter1, Counter2 );
- fprintf( pFile, "SFeed = %2d.\n", Abc_NtkCountSelfFeedLatches(pNtk) );
+ fprintf( pFile, "Latch = %6d. No = %4d. Zero = %4d. One = %4d. DC = %4d.\n",
+ Abc_NtkLatchNum(pNtk), InitNums[0], InitNums[1], InitNums[2], InitNums[3] );
+ fprintf( pFile, "Const fanin = %3d. DC init = %3d. Matching init = %3d. ", Counter0, Counter1, Counter2 );
+ fprintf( pFile, "Self-feed latches = %2d.\n", -1 ); //Abc_NtkCountSelfFeedLatches(pNtk) );
}
/**Function*************************************************************
@@ -230,6 +358,7 @@ void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk )
nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
else
nFanouts = Abc_ObjFanoutNum(pNode);
+// nFanouts = Abc_NodeMffcSize(pNode);
if ( nFanins > vFanins->nSize || nFanouts > vFanouts->nSize )
{
nOldSize = vFanins->nSize;
@@ -301,6 +430,26 @@ void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode )
/**Function*************************************************************
+ Synopsis [Prints the MFFCs of the nodes.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkPrintMffc( FILE * pFile, Abc_Ntk_t * pNtk )
+{
+ Abc_Obj_t * pNode;
+ int i;
+ extern void Abc_NodeMffsConeSuppPrint( Abc_Obj_t * pNode );
+ Abc_NtkForEachNode( pNtk, pNode, i )
+ Abc_NodeMffsConeSuppPrint( pNode );
+}
+
+/**Function*************************************************************
+
Synopsis [Prints the factored form of one node.]
Description []
@@ -371,10 +520,26 @@ void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames )
SeeAlso []
***********************************************************************/
-void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile )
+void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListNodes )
{
Abc_Obj_t * pNode;
- int i, Length;
+ int i, k, Length;
+
+ if ( fListNodes )
+ {
+ int nLevels;
+ nLevels = Abc_NtkLevel(pNtk);
+ printf( "Nodes by level:\n" );
+ for ( i = 0; i <= nLevels; i++ )
+ {
+ printf( "%2d : ", i );
+ Abc_NtkForEachNode( pNtk, pNode, k )
+ if ( (int)pNode->Level == i )
+ printf( " %s", Abc_ObjName(pNode) );
+ printf( "\n" );
+ }
+ return;
+ }
// print the delay profile
if ( fProfile && Abc_NtkHasMapping(pNtk) )
@@ -416,7 +581,7 @@ void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile )
int nOutsSum, nOutsTotal;
if ( !Abc_NtkIsStrash(pNtk) )
- Abc_NtkGetLevelNum(pNtk);
+ Abc_NtkLevel(pNtk);
LevelMax = 0;
Abc_NtkForEachCo( pNtk, pNode, i )
@@ -498,6 +663,289 @@ void Abc_NodePrintLevel( FILE * pFile, Abc_Obj_t * pNode )
fprintf( pFile, "\n" );
}
+/**Function*************************************************************
+
+ Synopsis [Prints the factored form of one node.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NodePrintKMap( Abc_Obj_t * pNode, int fUseRealNames )
+{
+ Vec_Ptr_t * vNamesIn;
+ if ( fUseRealNames )
+ {
+ vNamesIn = Abc_NodeGetFaninNames(pNode);
+ Extra_PrintKMap( stdout, pNode->pNtk->pManFunc, pNode->pData, Cudd_Not(pNode->pData),
+ Abc_ObjFaninNum(pNode), NULL, 0, (char **)vNamesIn->pArray );
+ Abc_NodeFreeNames( vNamesIn );
+ }
+ else
+ Extra_PrintKMap( stdout, pNode->pNtk->pManFunc, pNode->pData, Cudd_Not(pNode->pData),
+ Abc_ObjFaninNum(pNode), NULL, 0, NULL );
+
+}
+
+/**Function*************************************************************
+
+ Synopsis [Prints statistics about gates used in the network.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
+{
+ Abc_Obj_t * pObj;
+ int fHasBdds, i;
+ int CountConst, CountBuf, CountInv, CountAnd, CountOr, CountOther, CounterTotal;
+ char * pSop;
+
+ if ( fUseLibrary && Abc_NtkHasMapping(pNtk) )
+ {
+ stmm_table * tTable;
+ stmm_generator * gen;
+ char * pName;
+ int * pCounter, Counter;
+ double Area, AreaTotal;
+
+ // count the gates by name
+ CounterTotal = 0;
+ tTable = stmm_init_table(strcmp, stmm_strhash);
+ Abc_NtkForEachNode( pNtk, pObj, i )
+ {
+ if ( i == 0 ) continue;
+ if ( !stmm_find_or_add( tTable, Mio_GateReadName(pObj->pData), (char ***)&pCounter ) )
+ *pCounter = 0;
+ (*pCounter)++;
+ CounterTotal++;
+ }
+ // print the gates
+ AreaTotal = Abc_NtkGetMappedArea(pNtk);
+ stmm_foreach_item( tTable, gen, (char **)&pName, (char **)&Counter )
+ {
+ Area = Counter * Mio_GateReadArea(Mio_LibraryReadGateByName(pNtk->pManFunc,pName));
+ printf( "%-12s = %8d %10.2f %6.2f %%\n", pName, Counter, Area, 100.0 * Area / AreaTotal );
+ }
+ printf( "%-12s = %8d %10.2f %6.2f %%\n", "TOTAL", CounterTotal, AreaTotal, 100.0 );
+ stmm_free_table( tTable );
+ return;
+ }
+
+ if ( Abc_NtkIsAigLogic(pNtk) )
+ return;
+
+ // transform logic functions from BDD to SOP
+ if ( fHasBdds = Abc_NtkIsBddLogic(pNtk) )
+ {
+ if ( !Abc_NtkBddToSop(pNtk, 0) )
+ {
+ printf( "Abc_NtkPrintGates(): Converting to SOPs has failed.\n" );
+ return;
+ }
+ }
+
+ // get hold of the SOP of the node
+ CountConst = CountBuf = CountInv = CountAnd = CountOr = CountOther = CounterTotal = 0;
+ Abc_NtkForEachNode( pNtk, pObj, i )
+ {
+ if ( i == 0 ) continue;
+ if ( Abc_NtkHasMapping(pNtk) )
+ pSop = Mio_GateReadSop(pObj->pData);
+ else
+ pSop = pObj->pData;
+ // collect the stats
+ if ( Abc_SopIsConst0(pSop) || Abc_SopIsConst1(pSop) )
+ CountConst++;
+ else if ( Abc_SopIsBuf(pSop) )
+ CountBuf++;
+ else if ( Abc_SopIsInv(pSop) )
+ CountInv++;
+ else if ( !Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop) || Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop) )
+ CountAnd++;
+ else if ( Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop) || !Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop) )
+ CountOr++;
+ else
+ CountOther++;
+ CounterTotal++;
+ }
+ printf( "Const = %8d %6.2f %%\n", CountConst , 100.0 * CountConst / CounterTotal );
+ printf( "Buffer = %8d %6.2f %%\n", CountBuf , 100.0 * CountBuf / CounterTotal );
+ printf( "Inverter = %8d %6.2f %%\n", CountInv , 100.0 * CountInv / CounterTotal );
+ printf( "And = %8d %6.2f %%\n", CountAnd , 100.0 * CountAnd / CounterTotal );
+ printf( "Or = %8d %6.2f %%\n", CountOr , 100.0 * CountOr / CounterTotal );
+ printf( "Other = %8d %6.2f %%\n", CountOther , 100.0 * CountOther / CounterTotal );
+ printf( "TOTAL = %8d %6.2f %%\n", CounterTotal, 100.0 * CounterTotal / CounterTotal );
+
+ // convert the network back into BDDs if this is how it was
+ if ( fHasBdds )
+ Abc_NtkSopToBdd(pNtk);
+}
+
+/**Function*************************************************************
+
+ Synopsis [Prints statistics about gates used in the network.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk )
+{
+ Vec_Ptr_t * vNodes1, * vNodes2;
+ Abc_Obj_t * pObj1, * pObj2, * pNode1, * pNode2;
+ int i, k, m, n, Counter;
+
+ // print the template
+ printf( "Statistics about sharing of logic nodes among the CO pairs.\n" );
+ printf( "(CO1,CO2)=NumShared : " );
+ // go though the CO pairs
+ Abc_NtkForEachCo( pNtk, pObj1, i )
+ {
+ vNodes1 = Abc_NtkDfsNodes( pNtk, &pObj1, 1 );
+ // mark the nodes
+ Vec_PtrForEachEntry( vNodes1, pNode1, m )
+ pNode1->fMarkA = 1;
+ // go through the second COs
+ Abc_NtkForEachCo( pNtk, pObj2, k )
+ {
+ if ( i >= k )
+ continue;
+ vNodes2 = Abc_NtkDfsNodes( pNtk, &pObj2, 1 );
+ // count the number of marked
+ Counter = 0;
+ Vec_PtrForEachEntry( vNodes2, pNode2, n )
+ Counter += pNode2->fMarkA;
+ // print
+ printf( "(%d,%d)=%d ", i, k, Counter );
+ Vec_PtrFree( vNodes2 );
+ }
+ // unmark the nodes
+ Vec_PtrForEachEntry( vNodes1, pNode1, m )
+ pNode1->fMarkA = 0;
+ Vec_PtrFree( vNodes1 );
+ }
+ printf( "\n" );
+}
+
+/**Function*************************************************************
+
+ Synopsis [Prints info for each output cone.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk )
+{
+ Vec_Ptr_t * vSupp, * vNodes;
+ Abc_Obj_t * pObj;
+ int i;
+ printf( "Structural support info:\n" );
+ Abc_NtkForEachCo( pNtk, pObj, i )
+ {
+ vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
+ vNodes = Abc_NtkDfsNodes( pNtk, &pObj, 1 );
+ printf( "%20s : Cone = %5d. Supp = %5d.\n",
+ Abc_ObjName(pObj), vNodes->nSize, vSupp->nSize );
+ Vec_PtrFree( vNodes );
+ Vec_PtrFree( vSupp );
+ }
+}
+
+/**Function*************************************************************
+
+ Synopsis [Prints information about the object.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_ObjPrint( FILE * pFile, Abc_Obj_t * pObj )
+{
+ Abc_Obj_t * pFanin;
+ int i;
+ fprintf( pFile, "Object %5d : ", pObj->Id );
+ switch ( pObj->Type )
+ {
+ case ABC_OBJ_NONE:
+ fprintf( pFile, "NONE " );
+ break;
+ case ABC_OBJ_CONST1:
+ fprintf( pFile, "Const1 " );
+ break;
+ case ABC_OBJ_PIO:
+ fprintf( pFile, "PIO " );
+ break;
+ case ABC_OBJ_PI:
+ fprintf( pFile, "PI " );
+ break;
+ case ABC_OBJ_PO:
+ fprintf( pFile, "PO " );
+ break;
+ case ABC_OBJ_BI:
+ fprintf( pFile, "BI " );
+ break;
+ case ABC_OBJ_BO:
+ fprintf( pFile, "BO " );
+ break;
+ case ABC_OBJ_ASSERT:
+ fprintf( pFile, "Assert " );
+ break;
+ case ABC_OBJ_NET:
+ fprintf( pFile, "Net " );
+ break;
+ case ABC_OBJ_NODE:
+ fprintf( pFile, "Node " );
+ break;
+ case ABC_OBJ_LATCH:
+ fprintf( pFile, "Latch " );
+ break;
+ case ABC_OBJ_WHITEBOX:
+ fprintf( pFile, "Whitebox" );
+ break;
+ case ABC_OBJ_BLACKBOX:
+ fprintf( pFile, "Blackbox" );
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ // print the fanins
+ fprintf( pFile, " Fanins ( " );
+ Abc_ObjForEachFanin( pObj, pFanin, i )
+ fprintf( pFile, "%d ", pFanin->Id );
+ fprintf( pFile, ") " );
+/*
+ fprintf( pFile, " Fanouts ( " );
+ Abc_ObjForEachFanout( pObj, pFanin, i )
+ fprintf( pFile, "%d(%c) ", pFanin->Id, Abc_NodeIsTravIdCurrent(pFanin)? '+' : '-' );
+ fprintf( pFile, ") " );
+*/
+ // print the logic function
+ if ( Abc_ObjIsNode(pObj) && Abc_NtkIsSopLogic(pObj->pNtk) )
+ fprintf( pFile, " %s", pObj->pData );
+ else
+ fprintf( pFile, "\n" );
+}
+
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////