From b9074a754ba7860b852049eb82d857de88945848 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 26 Nov 2025 17:58:28 -0800 Subject: [PATCH] Adding verbose mode to &permute. --- src/aig/gia/giaDup.c | 20 ++++++++++++++------ src/base/abci/abc.c | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c index ea58ba8b2..c88ec06e7 100644 --- a/src/aig/gia/giaDup.c +++ b/src/aig/gia/giaDup.c @@ -1103,23 +1103,31 @@ Vec_Int_t * Gia_ManCreatePerm( int n ) } return vPerm; } -Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p ) +Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p, int fVerbose ) { Vec_Int_t * vPiPerm = Gia_ManCreatePerm( Gia_ManCiNum(p) ); Vec_Int_t * vPoPerm = Gia_ManCreatePerm( Gia_ManCoNum(p) ); Gia_Man_t * pNew; Gia_Obj_t * pObj; - int i; + int i, fCompl = 0; pNew = Gia_ManStart( Gia_ManObjNum(p) ); pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); Gia_ManConst0(p)->Value = 0; - Gia_ManForEachPi( p, pObj, i ) - Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi(pNew) ^ (Abc_Random(0) & 1); + if ( fVerbose ) printf( "Input NP transform: " ); + Gia_ManForEachPi( p, pObj, i ) { + Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi(pNew) ^ (fCompl = (Abc_Random(0) & 1)); + if ( fVerbose ) printf( "%s%d ", fCompl ? "~":"", Vec_IntEntry(vPiPerm,i) ); + } + if ( fVerbose ) printf( "\n" ); Gia_ManForEachAnd( p, pObj, i ) pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); - Gia_ManForEachPo( p, pObj, i ) - Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, Vec_IntEntry(vPoPerm,i))) ^ (Abc_Random(0) & 1) ); + if ( fVerbose ) printf( "Output NP transform: " ); + Gia_ManForEachPo( p, pObj, i ) { + Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, Vec_IntEntry(vPoPerm,i))) ^ (fCompl = (Abc_Random(0) & 1)) ); + if ( fVerbose ) printf( "%s%d ", fCompl ? "~":"", Vec_IntEntry(vPoPerm,i) ); + } + if ( fVerbose ) printf( "\n" ); Vec_IntFree( vPiPerm ); Vec_IntFree( vPoPerm ); return pNew; diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 75130bedd..9ce0dc107 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -48156,7 +48156,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Permute( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p ); + extern Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p, int fVerbose ); Gia_Man_t * pTemp; int c, RandSeed = 0, fVerbose = 0; Extra_UtilGetoptReset(); @@ -48197,7 +48197,7 @@ int Abc_CommandAbc9Permute( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Random(1); for ( c = 0; c < RandSeed; c++ ) Abc_Random(0); - pTemp = Gia_ManDupRandPerm( pAbc->pGia ); + pTemp = Gia_ManDupRandPerm( pAbc->pGia, fVerbose ); Abc_FrameUpdateGia( pAbc, pTemp ); return 0;