Commit fdf0fb27 by Alan Mishchenko

Adding command &permute.

parent 9f6e1feb
......@@ -936,6 +936,51 @@ Gia_Man_t * Gia_ManDupPermFlopGap( Gia_Man_t * p, Vec_Int_t * vFfMask )
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupPiPerm( Gia_Man_t * p )
{
Gia_Man_t * pNew, * pOne;
Gia_Obj_t * pObj;
int i;
Gia_ManRandom(1);
pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
Gia_ManHashAlloc( pNew );
Gia_ManConst0(p)->Value = 0;
Gia_ManForEachCi( p, pObj, i )
pObj->Value = Gia_ManAppendCi( pNew );
Gia_ManForEachAnd( p, pObj, i )
{
int iLit0 = Gia_ObjFanin0Copy(pObj);
int iLit1 = Gia_ObjFanin1Copy(pObj);
int iPlace0 = Gia_ManRandom(0) % Gia_ManCiNum(p);
int iPlace1 = Gia_ManRandom(0) % Gia_ManCiNum(p);
if ( Abc_Lit2Var(iLit0) <= Gia_ManCiNum(p) )
iLit0 = Abc_Var2Lit( iPlace0+1, Abc_LitIsCompl(iLit0) );
if ( Abc_Lit2Var(iLit1) <= Gia_ManCiNum(p) )
iLit1 = Abc_Var2Lit( iPlace1+1, Abc_LitIsCompl(iLit1) );
pObj->Value = Gia_ManHashAnd( pNew, iLit0, iLit1 );
}
Gia_ManForEachCo( p, pObj, i )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManHashStop( pNew );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
pNew = Gia_ManCleanup( pOne = pNew );
Gia_ManStop( pOne );
return pNew;
}
/**Function*************************************************************
Synopsis [Appends second AIG without any changes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo )
{
Gia_Obj_t * pObj;
......
......@@ -475,6 +475,7 @@ static int Abc_CommandAbc9Dch ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9Rpm ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9BackReach ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Posplit ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Permute ( Abc_Frame_t * pAbc, int argc, char ** argv );
#ifdef ABC_USE_CUDD
static int Abc_CommandAbc9ReachM ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9ReachP ( Abc_Frame_t * pAbc, int argc, char ** argv );
......@@ -1174,6 +1175,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&rpm", Abc_CommandAbc9Rpm, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&back_reach", Abc_CommandAbc9BackReach, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&posplit", Abc_CommandAbc9Posplit, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&permute", Abc_CommandAbc9Permute, 0 );
#ifdef ABC_USE_CUDD
Cmd_CommandAdd( pAbc, "ABC9", "&reachm", Abc_CommandAbc9ReachM, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&reachp", Abc_CommandAbc9ReachP, 0 );
......@@ -39715,6 +39717,53 @@ usage:
return 1;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandAbc9Permute( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Gia_Man_t * Gia_ManDupPiPerm( Gia_Man_t * p );
Gia_Man_t * pTemp;
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_CommandAbc9Posplit(): There is no AIG.\n" );
return 1;
}
pTemp = Gia_ManDupPiPerm( pAbc->pGia );
Abc_FrameUpdateGia( pAbc, pTemp );
return 0;
usage:
Abc_Print( -2, "usage: &permute [-vh]\n" );
Abc_Print( -2, "\t permutes primary inputs\n" );
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;
}
#ifdef ABC_USE_CUDD
/**Function*************************************************************
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