summaryrefslogtreecommitdiffstats
path: root/src/aig
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-11-11 15:11:44 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2014-11-11 15:11:44 -0800
commit96fa84ad776294294da325875a0984882e3bd373 (patch)
treee9394bc722f475bf294896863deda67fbad8f83f /src/aig
parent2a028aa147837e83e226a025e0c8d244c59716df (diff)
downloadabc-96fa84ad776294294da325875a0984882e3bd373.tar.gz
abc-96fa84ad776294294da325875a0984882e3bd373.tar.bz2
abc-96fa84ad776294294da325875a0984882e3bd373.zip
Added switch -i to &filter to use FIs instead of FOs.
Diffstat (limited to 'src/aig')
-rw-r--r--src/aig/gia/gia.h2
-rw-r--r--src/aig/gia/giaEquiv.c30
2 files changed, 21 insertions, 11 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index c39ace32..c89969c4 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -1160,7 +1160,7 @@ extern int Gia_ManCountChoiceNodes( Gia_Man_t * p );
extern int Gia_ManCountChoices( Gia_Man_t * p );
extern int Gia_ManFilterEquivsForSpeculation( Gia_Man_t * pGia, char * pName1, char * pName2, int fLatchA, int fLatchB );
extern int Gia_ManFilterEquivsUsingParts( Gia_Man_t * pGia, char * pName1, char * pName2 );
-extern void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlopsWith );
+extern void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlopsWith, int fUseRiDrivers );
/*=== giaFanout.c =========================================================*/
extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout );
extern void Gia_ObjRemoveFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout );
diff --git a/src/aig/gia/giaEquiv.c b/src/aig/gia/giaEquiv.c
index 72626857..71b32d7d 100644
--- a/src/aig/gia/giaEquiv.c
+++ b/src/aig/gia/giaEquiv.c
@@ -2144,21 +2144,32 @@ int Gia_ManFilterEquivsUsingParts( Gia_Man_t * pGia, char * pName1, char * pName
SeeAlso []
***********************************************************************/
-void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlopsWith )
+void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlopsWith, int fUseRiDrivers )
{
- Vec_Int_t * vNodes;
- Gia_Obj_t * pObj;
+ Gia_Obj_t * pObjR;
+ Vec_Int_t * vNodes, * vFfIds;
int i, k, iObj, iNext, iPrev, iRepr;
int iLitsOld = 0, iLitsNew = 0;
assert( fFlopsOnly ^ fFlopsWith );
vNodes = Vec_IntAlloc( 100 );
- // remove all noo-flop constants
+ // select nodes "flop" node IDs
+ vFfIds = Vec_IntStart( Gia_ManObjNum(pGia) );
+ if ( fUseRiDrivers )
+ {
+ Gia_ManForEachRi( pGia, pObjR, i )
+ Vec_IntWriteEntry( vFfIds, Gia_ObjFaninId0p(pGia, pObjR), 1 );
+ }
+ else
+ {
+ Gia_ManForEachRo( pGia, pObjR, i )
+ Vec_IntWriteEntry( vFfIds, Gia_ObjId(pGia, pObjR), 1 );
+ }
+ // remove all non-flop constants
Gia_ManForEachConst( pGia, i )
{
iLitsOld++;
- pObj = Gia_ManObj( pGia, i );
assert( pGia->pNexts[i] == 0 );
- if ( !Gia_ObjIsRo(pGia, pObj) )
+ if ( !Vec_IntEntry(vFfIds, i) )
Gia_ObjUnsetRepr( pGia, i );
else
iLitsNew++;
@@ -2171,8 +2182,7 @@ void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlo
Vec_IntClear( vNodes );
Gia_ClassForEachObj( pGia, i, iObj )
{
- pObj = Gia_ManObj( pGia, iObj );
- if ( Gia_ObjIsRo(pGia, pObj) )
+ if ( Vec_IntEntry(vFfIds, iObj) )
Vec_IntPush( vNodes, iObj );
iLitsOld++;
}
@@ -2207,8 +2217,7 @@ void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlo
int fSeenFlop = 0;
Gia_ClassForEachObj( pGia, i, iObj )
{
- pObj = Gia_ManObj( pGia, iObj );
- if ( Gia_ObjIsRo(pGia, pObj) )
+ if ( Vec_IntEntry(vFfIds, iObj) )
fSeenFlop = 1;
iLitsOld++;
iLitsNew++;
@@ -2230,6 +2239,7 @@ void Gia_ManFilterEquivsUsingLatches( Gia_Man_t * pGia, int fFlopsOnly, int fFlo
}
}
Vec_IntFree( vNodes );
+ Vec_IntFree( vFfIds );
Abc_Print( 1, "The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
}