summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/aig/gia/giaUtil.c40
-rw-r--r--src/base/abci/abc.c49
2 files changed, 89 insertions, 0 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index ad89dfe8..0f9f69de 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -2382,6 +2382,46 @@ void Gia_ManDumpFiles( Gia_Man_t * p, int nCexesT, int nCexesV )
}
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Gia_Man_t * Gia_ManDupWithMuxPos( Gia_Man_t * p )
+{
+ Vec_Int_t * vPoints = Vec_IntAlloc( 1000 );
+ Gia_Obj_t * pObj, * pCtrl, * pData0, * pData1;
+ Gia_Man_t * pNew = Gia_ManDup( p ); int i, iObj;
+ assert( Gia_ManRegNum(pNew) == 0 );
+ Gia_ManForEachCo( pNew, pObj, i )
+ Gia_ObjFanin0(pObj)->fMark0 = 1;
+ Gia_ManForEachAnd( pNew, pObj, i )
+ {
+ if ( !Gia_ObjIsMuxType(pObj) )
+ continue;
+ pCtrl = Gia_ObjRecognizeMux( pObj, &pData1, &pData0 );
+ pCtrl = Gia_Regular(pCtrl);
+ pData1 = Gia_Regular(pData1);
+ pData0 = Gia_Regular(pData0);
+ if ( Gia_ObjIsAnd(pObj) && !pObj->fMark0 ) Vec_IntPush( vPoints, Gia_ObjId(pNew, pObj) );
+ if ( Gia_ObjIsAnd(pCtrl) && !pCtrl->fMark0 ) Vec_IntPush( vPoints, Gia_ObjId(pNew, pCtrl) );
+ if ( Gia_ObjIsAnd(pData1) && !pData1->fMark0 ) Vec_IntPush( vPoints, Gia_ObjId(pNew, pData1) );
+ if ( Gia_ObjIsAnd(pData0) && !pData0->fMark0 ) Vec_IntPush( vPoints, Gia_ObjId(pNew, pData0) );
+ }
+ Gia_ManCleanMark0( pNew );
+ Vec_IntUniqify( vPoints );
+ Vec_IntForEachEntry( vPoints, iObj, i )
+ Gia_ManAppendCo( pNew, Abc_Var2Lit(iObj, 0) );
+ Vec_IntFree( vPoints );
+ return pNew;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 51b84ad9..48be4f55 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -396,6 +396,7 @@ static int Abc_CommandAbc9PFan ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9PSig ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Status ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9MuxProfile ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandAbc9MuxPos ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9PrintTruth ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Unate ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Rex2Gia ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1104,6 +1105,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&psig", Abc_CommandAbc9PSig, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&status", Abc_CommandAbc9Status, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&profile", Abc_CommandAbc9MuxProfile, 0 );
+ Cmd_CommandAdd( pAbc, "ABC9", "&muxpos", Abc_CommandAbc9MuxPos, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&print_truth", Abc_CommandAbc9PrintTruth, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&unate", Abc_CommandAbc9Unate, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&rex2gia", Abc_CommandAbc9Rex2Gia, 0 );
@@ -31269,6 +31271,53 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9MuxPos( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern Gia_Man_t * Gia_ManDupWithMuxPos( Gia_Man_t * p );
+ Gia_Man_t * pGia;
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9MuxPos(): There is no AIG.\n" );
+ return 1;
+ }
+ pGia = Gia_ManDupWithMuxPos( pAbc->pGia );
+ Abc_FrameUpdateGia( pAbc, pGia );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &muxpos [-vh]\n" );
+ Abc_Print( -2, "\t create additional POs to preserve MUXes\n" );
+ Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandAbc9PrintTruth( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern word Gia_LutComputeTruth6Simple( Gia_Man_t * p, int iPo );