Commit 96fa84ad by Alan Mishchenko

Added switch -i to &filter to use FIs instead of FOs.

parent 2a028aa1
......@@ -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 );
......
......@@ -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 );
}
......
......@@ -30253,10 +30253,10 @@ usage:
int Abc_CommandAbc9Filter( Abc_Frame_t * pAbc, int argc, char ** argv )
{
char * pFileName1 = NULL, * pFileName2 = NULL;
int fFlopsOnly = 0, fFlopsWith = 0;
int fFlopsOnly = 0, fFlopsWith = 0, fUseRiDrivers = 0;
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "fgvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "fgivh" ) ) != EOF )
{
switch ( c )
{
......@@ -30266,6 +30266,9 @@ int Abc_CommandAbc9Filter( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'g':
fFlopsWith ^= 1;
break;
case 'i':
fUseRiDrivers ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -30292,7 +30295,7 @@ int Abc_CommandAbc9Filter( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// filter using one of the choices
if ( fFlopsOnly ^ fFlopsWith )
Gia_ManFilterEquivsUsingLatches( pAbc->pGia, fFlopsOnly, fFlopsWith );
Gia_ManFilterEquivsUsingLatches( pAbc->pGia, fFlopsOnly, fFlopsWith, fUseRiDrivers );
// get the input file name
if ( argc == globalUtilOptind + 2 )
{
......@@ -30307,11 +30310,12 @@ int Abc_CommandAbc9Filter( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &filter [-fgvh] <PartA_FileName> <PartB_FileName>\n" );
Abc_Print( -2, "usage: &filter [-fgivh] <PartA_FileName> <PartB_FileName>\n" );
Abc_Print( -2, "\t performs filtering of equivalence classes\n" );
Abc_Print( -2, "\t (if Parts A/B are given, removes classes composed of one part)\n" );
Abc_Print( -2, "\t-f : toggle removing all elements except flops [default = %s]\n", fFlopsOnly? "yes": "no" );
Abc_Print( -2, "\t-g : toggle removing removing classes without flops [default = %s]\n", fFlopsWith? "yes": "no" );
Abc_Print( -2, "\t-g : toggle removing classes without flops [default = %s]\n", fFlopsWith? "yes": "no" );
Abc_Print( -2, "\t-i : toggle using flop inputs instead of flop outputs [default = %s]\n", fUseRiDrivers? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment