summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaDup.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-07-20 13:52:39 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-07-20 13:52:39 -0700
commitf09afdf24c28d5e7f093151380a84ca21b69f8f2 (patch)
treea1bf0011b9b1ecfdf07338fa7cb393faa7857f39 /src/aig/gia/giaDup.c
parentaa78ce56e73427a2a30669a2bbedacc3bb8caa9d (diff)
downloadabc-f09afdf24c28d5e7f093151380a84ca21b69f8f2.tar.gz
abc-f09afdf24c28d5e7f093151380a84ca21b69f8f2.tar.bz2
abc-f09afdf24c28d5e7f093151380a84ca21b69f8f2.zip
Added switch &trim -c to additionally remove direct connections (POs fed by PIs).
Diffstat (limited to 'src/aig/gia/giaDup.c')
-rw-r--r--src/aig/gia/giaDup.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c
index 520385b8..3c64575e 100644
--- a/src/aig/gia/giaDup.c
+++ b/src/aig/gia/giaDup.c
@@ -1005,6 +1005,58 @@ Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fD
/**Function*************************************************************
+ Synopsis [Removes POs driven by PIs and PIs without fanout.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Gia_Man_t * Gia_ManDupTrimmed2( Gia_Man_t * p )
+{
+ Gia_Man_t * pNew;
+ Gia_Obj_t * pObj;
+ int i;
+ // start new manager
+ pNew = Gia_ManStart( Gia_ManObjNum(p) );
+ pNew->pName = Abc_UtilStrsav( p->pName );
+ // check if there are PIs to be added
+ Gia_ManCreateRefs( p );
+ // discount references of POs
+ Gia_ManForEachPo( p, pObj, i )
+ Gia_ObjRefFanin0Dec( p, pObj );
+ // check if PIs are left
+ Gia_ManForEachPi( p, pObj, i )
+ if ( Gia_ObjRefs(p, pObj) )
+ break;
+ if ( i == Gia_ManPiNum(p) ) // there is no PIs - add dummy PI
+ Gia_ManAppendCi(pNew);
+ // add the ROs
+ Gia_ManFillValue( p );
+ Gia_ManConst0(p)->Value = 0;
+ Gia_ManForEachCi( p, pObj, i )
+ if ( Gia_ObjRefs(p, pObj) || Gia_ObjIsRo(p, pObj) )
+ pObj->Value = Gia_ManAppendCi(pNew);
+ Gia_ManForEachAnd( p, pObj, i )
+ pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
+ // check if there are POs to be added
+ Gia_ManForEachPo( p, pObj, i )
+ if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) && !Gia_ObjIsPi(p, Gia_ObjFanin0(pObj)) )
+ break;
+ if ( i == Gia_ManPoNum(p) ) // there is no POs - add dummy PO
+ Gia_ManAppendCo( pNew, 0 );
+ Gia_ManForEachCo( p, pObj, i )
+ if ( (!Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) && !Gia_ObjIsPi(p, Gia_ObjFanin0(pObj))) || Gia_ObjIsRi(p, pObj) )
+ Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
+ Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
+ assert( !Gia_ManHasDangling( pNew ) );
+ return pNew;
+}
+
+/**Function*************************************************************
+
Synopsis [Duplicates AIG in the DFS order while putting CIs first.]
Description []