summaryrefslogtreecommitdiffstats
path: root/src/aig/gia
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-10-31 17:00:06 -0400
committerAlan Mishchenko <alanmi@berkeley.edu>2013-10-31 17:00:06 -0400
commit615d249e0214a34e90a430038a1e2e75d232ef04 (patch)
treeaabcee0bb2c5a21054b01d763d787f64d362333f /src/aig/gia
parent695231148faf8651b0299db234607cc545b962d3 (diff)
downloadabc-615d249e0214a34e90a430038a1e2e75d232ef04.tar.gz
abc-615d249e0214a34e90a430038a1e2e75d232ef04.tar.bz2
abc-615d249e0214a34e90a430038a1e2e75d232ef04.zip
GIA sweeper: adding APIs to return valid probe ID and run a command line.
Diffstat (limited to 'src/aig/gia')
-rw-r--r--src/aig/gia/gia.h2
-rw-r--r--src/aig/gia/giaSweeper.c70
2 files changed, 72 insertions, 0 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 416ec8a0..36c53c71 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -1183,6 +1183,7 @@ extern int Gia_SweeperProbeCreate( Gia_Man_t * p, int iLit );
extern int Gia_SweeperProbeDelete( Gia_Man_t * p, int ProbeId );
extern int Gia_SweeperProbeUpdate( Gia_Man_t * p, int ProbeId, int iLitNew );
extern int Gia_SweeperProbeLit( Gia_Man_t * p, int ProbeId );
+extern Vec_Int_t * Gia_SweeperCollectValidProbeIds( Gia_Man_t * p );
extern int Gia_SweeperCondPop( Gia_Man_t * p );
extern void Gia_SweeperCondPush( Gia_Man_t * p, int ProbeId );
extern Vec_Int_t * Gia_SweeperCondVector( Gia_Man_t * p );
@@ -1192,6 +1193,7 @@ extern Gia_Man_t * Gia_SweeperExtractUserLogic( Gia_Man_t * p, Vec_Int_t
extern Gia_Man_t * Gia_SweeperCleanup( Gia_Man_t * p, char * pCommLime );
extern Vec_Int_t * Gia_SweeperGraft( Gia_Man_t * pDst, Vec_Int_t * vProbes, Gia_Man_t * pSrc );
extern int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int nWords, int nConfs, int fVerbose );
+extern int Gia_SweeperRun( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int fVerbose );
/*=== giaSwitch.c ============================================================*/
extern float Gia_ManEvaluateSwitching( Gia_Man_t * p );
extern float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne );
diff --git a/src/aig/gia/giaSweeper.c b/src/aig/gia/giaSweeper.c
index 1794d051..30d56dde 100644
--- a/src/aig/gia/giaSweeper.c
+++ b/src/aig/gia/giaSweeper.c
@@ -283,6 +283,30 @@ int Gia_SweeperProbeLit( Gia_Man_t * p, int ProbeId )
/**Function*************************************************************
+ Synopsis [This procedure returns indexes of all currently defined valid probes.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Vec_Int_t * Gia_SweeperCollectValidProbeIds( Gia_Man_t * p )
+{
+ Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
+ Vec_Int_t * vProbeIds = Vec_IntAlloc( 1000 );
+ int iLit, ProbeId;
+ Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
+ {
+ if ( iLit < 0 ) continue;
+ Vec_IntPush( vProbeIds, ProbeId );
+ }
+ return vProbeIds;
+}
+
+/**Function*************************************************************
+
Synopsis []
Description []
@@ -1034,6 +1058,52 @@ int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, in
/**Function*************************************************************
+ Synopsis [Executes given command line for the logic defined by the probes.]
+
+ Description [ ]
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Gia_SweeperRun( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int fVerbose )
+{
+ Gia_Man_t * pNew;
+ Vec_Int_t * vLits;
+ int ProbeId, i;
+ // sweeper is running
+ assert( Gia_SweeperIsRunning(p) );
+ // sweep the logic
+ pNew = Gia_SweeperExtractUserLogic( p, vProbeIds, NULL, NULL );
+ // execute command line
+ if ( pCommLime )
+ {
+ if ( fVerbose )
+ printf( "GIA manager statistics before and after applying \"%s\":\n", pCommLine );
+ if ( fVerbose )
+ Gia_ManPrintStats( pNew, NULL );
+ // set pNew to be current GIA in ABC
+ Abc_FrameUpdateGia( Abc_FrameGetGlobalFrame(), pNew );
+ // execute command line pCommLine using Abc_CmdCommandExecute()
+ Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), pCommLime );
+ // get pNew to be current GIA in ABC
+ pNew = Abc_FrameGetGia( Abc_FrameGetGlobalFrame() );
+ if ( fVerbose )
+ Gia_ManPrintStats( pNew, NULL );
+ }
+ // return logic back into the main manager
+ vLits = Gia_SweeperGraft( p, NULL, pNew );
+ Gia_ManStop( pNew );
+ // update the array of probes
+ Vec_IntForEachEntry( vProbeIds, ProbeId, i )
+ Gia_SweeperProbeUpdate( p, ProbeId, Vec_IntEntry(vLits, i) );
+ Vec_IntFree( vLits );
+ return 1;
+}
+
+/**Function*************************************************************
+
Synopsis [Sweeper sweeper test.]
Description []