summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2021-04-09 13:46:52 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2021-04-09 13:46:52 -0700
commit75981f7feebc4065980f99551654ac101edb4afa (patch)
tree9141ccff39f549a89f7838774f7b2dae13b51157
parent796c29039a4983e92bf12051d73326758127162e (diff)
downloadabc-75981f7feebc4065980f99551654ac101edb4afa.tar.gz
abc-75981f7feebc4065980f99551654ac101edb4afa.tar.bz2
abc-75981f7feebc4065980f99551654ac101edb4afa.zip
Computing sum of PO support sizes.
-rw-r--r--src/aig/gia/giaUtil.c59
-rw-r--r--src/base/abci/abc.c3
2 files changed, 61 insertions, 1 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index 2762dbac..3dcefcec 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -2495,6 +2495,65 @@ void Gia_ComputeTest()
fclose( pFile );
}
+
+/**Function*************************************************************
+
+ Synopsis [Computes sum total of support size of primary outputs.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Gia_ManSumTotalOfSupportSizes( Gia_Man_t * p )
+{
+ Gia_Obj_t * pObj;
+ Vec_Wec_t * vSupps = Vec_WecStart( Gia_ManObjNum(p) );
+ int i, nResult = 0;
+ for ( i = 0; i < Gia_ManCiNum(p); i++ )
+ Vec_IntPush( Vec_WecEntry(vSupps, 1+i), i );
+ Gia_ManForEachAnd( p, pObj, i )
+ Vec_IntTwoMerge2( Vec_WecEntry(vSupps, Gia_ObjFaninId0(pObj, i)), Vec_WecEntry(vSupps, Gia_ObjFaninId1(pObj, i)), Vec_WecEntry(vSupps, i) );
+ Gia_ManForEachCo( p, pObj, i )
+ nResult += Vec_IntSize( Vec_WecEntry(vSupps, Gia_ObjFaninId0p(p, pObj)) );
+ Vec_WecFree( vSupps );
+ return nResult;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Computes sum total of support size of primary outputs.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Gia_ManSumTotalOfSupportSizes2( Gia_Man_t * p )
+{
+ Vec_Wrd_t * vSims = Vec_WrdStart( Gia_ManObjNum(p) );
+ int r, nResult = 0, nRounds = (Gia_ManCiNum(p) + 63)/64;
+ for ( r = 0; r < nRounds; r++ )
+ {
+ Gia_Obj_t * pObj;
+ int i, Limit = r == nRounds-1 ? Gia_ManCiNum(p) % 64 : 64;
+ for ( i = 0; i < Limit; i++ )
+ Vec_WrdWriteEntry( vSims, 1+64*r+i, (word)1 << i );
+ Gia_ManForEachAnd( p, pObj, i )
+ Vec_WrdWriteEntry( vSims, i, Vec_WrdEntry(vSims, Gia_ObjFaninId0(pObj, i)) | Vec_WrdEntry(vSims, Gia_ObjFaninId1(pObj, i)) );
+ Gia_ManForEachCo( p, pObj, i )
+ nResult += Abc_TtCountOnes( Vec_WrdEntry(vSims, Gia_ObjFaninId0p(p, pObj)) );
+ for ( i = 0; i < Limit; i++ )
+ Vec_WrdWriteEntry( vSims, 1+64*r+i, 0 );
+ }
+ Vec_WrdFree( vSims );
+ return nResult;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index df7ae5ab..417c7909 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -48387,6 +48387,7 @@ usage:
int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Gia_RsbEnumerateWindows( Gia_Man_t * p, int nInputsMax, int nLevelsMax );
+ extern int Gia_ManSumTotalOfSupportSizes( Gia_Man_t * p );
int c, fVerbose = 0;
int nFrames = 5;
int fSwitch = 0;
@@ -48449,7 +48450,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
// }
// Abc_FrameUpdateGia( pAbc, Abc_Procedure(pAbc->pGia) );
// Gia_ManTryResub( pAbc->pGia );
- Gia_RsbEnumerateWindows( pAbc->pGia, 6, 5 );
+ printf( "AIG in \"%s\" has the sum of output support sizes equal to %d.\n", pAbc->pGia->pSpec, Gia_ManSumTotalOfSupportSizes(pAbc->pGia) );
return 0;
usage:
Abc_Print( -2, "usage: &test [-FW num] [-svh]\n" );