Skip to content

Commit b9074a7

Browse files
committed
Adding verbose mode to &permute.
1 parent 7691e2e commit b9074a7

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/aig/gia/giaDup.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,23 +1103,31 @@ Vec_Int_t * Gia_ManCreatePerm( int n )
11031103
}
11041104
return vPerm;
11051105
}
1106-
Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p )
1106+
Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p, int fVerbose )
11071107
{
11081108
Vec_Int_t * vPiPerm = Gia_ManCreatePerm( Gia_ManCiNum(p) );
11091109
Vec_Int_t * vPoPerm = Gia_ManCreatePerm( Gia_ManCoNum(p) );
11101110
Gia_Man_t * pNew;
11111111
Gia_Obj_t * pObj;
1112-
int i;
1112+
int i, fCompl = 0;
11131113
pNew = Gia_ManStart( Gia_ManObjNum(p) );
11141114
pNew->pName = Abc_UtilStrsav( p->pName );
11151115
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
11161116
Gia_ManConst0(p)->Value = 0;
1117-
Gia_ManForEachPi( p, pObj, i )
1118-
Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi(pNew) ^ (Abc_Random(0) & 1);
1117+
if ( fVerbose ) printf( "Input NP transform: " );
1118+
Gia_ManForEachPi( p, pObj, i ) {
1119+
Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi(pNew) ^ (fCompl = (Abc_Random(0) & 1));
1120+
if ( fVerbose ) printf( "%s%d ", fCompl ? "~":"", Vec_IntEntry(vPiPerm,i) );
1121+
}
1122+
if ( fVerbose ) printf( "\n" );
11191123
Gia_ManForEachAnd( p, pObj, i )
11201124
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1121-
Gia_ManForEachPo( p, pObj, i )
1122-
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, Vec_IntEntry(vPoPerm,i))) ^ (Abc_Random(0) & 1) );
1125+
if ( fVerbose ) printf( "Output NP transform: " );
1126+
Gia_ManForEachPo( p, pObj, i ) {
1127+
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, Vec_IntEntry(vPoPerm,i))) ^ (fCompl = (Abc_Random(0) & 1)) );
1128+
if ( fVerbose ) printf( "%s%d ", fCompl ? "~":"", Vec_IntEntry(vPoPerm,i) );
1129+
}
1130+
if ( fVerbose ) printf( "\n" );
11231131
Vec_IntFree( vPiPerm );
11241132
Vec_IntFree( vPoPerm );
11251133
return pNew;

src/base/abci/abc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48156,7 +48156,7 @@ int Abc_CommandAbc9Posplit( Abc_Frame_t * pAbc, int argc, char ** argv )
4815648156
***********************************************************************/
4815748157
int Abc_CommandAbc9Permute( Abc_Frame_t * pAbc, int argc, char ** argv )
4815848158
{
48159-
extern Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p );
48159+
extern Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p, int fVerbose );
4816048160
Gia_Man_t * pTemp;
4816148161
int c, RandSeed = 0, fVerbose = 0;
4816248162
Extra_UtilGetoptReset();
@@ -48197,7 +48197,7 @@ int Abc_CommandAbc9Permute( Abc_Frame_t * pAbc, int argc, char ** argv )
4819748197
Abc_Random(1);
4819848198
for ( c = 0; c < RandSeed; c++ )
4819948199
Abc_Random(0);
48200-
pTemp = Gia_ManDupRandPerm( pAbc->pGia );
48200+
pTemp = Gia_ManDupRandPerm( pAbc->pGia, fVerbose );
4820148201
Abc_FrameUpdateGia( pAbc, pTemp );
4820248202
return 0;
4820348203

0 commit comments

Comments
 (0)