Commit 27c44fd6 by Alan Mishchenko

Switch &miter -y to convert a two-word miter into a dual-output miter.

parent 555ed0b1
......@@ -1209,6 +1209,7 @@ extern Gia_Man_t * Gia_ManMiter2( Gia_Man_t * p, char * pInit, int fVerb
extern Gia_Man_t * Gia_ManTransformMiter( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManTransformMiter2( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManTransformToDual( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManTransformTwoWord2DualOutput( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManChoiceMiter( Vec_Ptr_t * vGias );
extern Gia_Man_t * Gia_ManDupWithConstraints( Gia_Man_t * p, Vec_Int_t * vPoTypes );
extern Gia_Man_t * Gia_ManDupCones( Gia_Man_t * p, int * pPos, int nPos, int fTrimPis );
......
......@@ -2575,6 +2575,37 @@ Gia_Man_t * Gia_ManTransformToDual( Gia_Man_t * p )
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
return pNew;
}
Gia_Man_t * Gia_ManTransformTwoWord2DualOutput( Gia_Man_t * p )
{
Gia_Man_t * pNew, * pTemp;
Gia_Obj_t * pObj, * pObj2;
int i, nPart = Gia_ManPoNum(p)/2;
assert( (Gia_ManPoNum(p) & 1) == 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_ManHashAlloc( pNew );
Gia_ManForEachCi( p, pObj, i )
pObj->Value = Gia_ManAppendCi( pNew );
Gia_ManForEachAnd( p, pObj, i )
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
Gia_ManForEachPo( p, pObj, i )
{
if ( i == nPart )
break;
pObj2 = Gia_ManPo( p, nPart + i );
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj2) );
}
Gia_ManForEachRi( p, pObj, i )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManHashStop( pNew );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
pNew = Gia_ManCleanup( pTemp = pNew );
Gia_ManStop( pTemp );
return pNew;
}
/**Function*************************************************************
......
......@@ -30536,9 +30536,10 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv )
int fSeq = 0;
int fTrans = 0;
int fTransX = 0;
int fConvert = 0;
int fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Idstxvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "Idstxyvh" ) ) != EOF )
{
switch ( c )
{
......@@ -30565,6 +30566,9 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'x':
fTransX ^= 1;
break;
case 'y':
fConvert ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -30574,42 +30578,37 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
if ( fTrans )
if ( fTrans || fTransX || fConvert )
{
if ( (Gia_ManPoNum(pAbc->pGia) & 1) == 1 )
{
Abc_Print( -1, "Abc_CommandAbc9Miter(): The number of outputs should be even.\n" );
return 0;
}
if ( pAbc->pGia == NULL )
{
Abc_Print( -1, "Abc_CommandAbc9Miter(): There is no AIG.\n" );
return 1;
}
pAux = Gia_ManTransformMiter( pAbc->pGia );
Abc_FrameUpdateGia( pAbc, pAux );
Abc_Print( 1, "The miter (current AIG) is transformed by XORing POs pair-wise.\n" );
return 0;
}
if ( fTransX )
{
if ( (Gia_ManPoNum(pAbc->pGia) & 1) == 1 )
{
Abc_Print( -1, "Abc_CommandAbc9Miter(): The number of outputs should be even.\n" );
return 0;
}
if ( pAbc->pGia == NULL )
if ( fTrans )
{
Abc_Print( -1, "Abc_CommandAbc9Miter(): There is no AIG.\n" );
return 1;
pAux = Gia_ManTransformMiter( pAbc->pGia );
Abc_Print( 1, "The miter (current AIG) is transformed by XORing POs pair-wise.\n" );
}
else if ( fTransX )
{
pAux = Gia_ManTransformMiter2( pAbc->pGia );
Abc_Print( 1, "The miter (current AIG) is transformed by XORing POs of two word-level outputs.\n" );
}
else
{
pAux = Gia_ManTransformTwoWord2DualOutput( pAbc->pGia );
Abc_Print( 1, "The miter (current AIG) is transformed from two-word to dual-output.\n" );
}
pAux = Gia_ManTransformMiter2( pAbc->pGia );
Abc_FrameUpdateGia( pAbc, pAux );
Abc_Print( 1, "The miter (current AIG) is transformed by XORing POs of two word-level outputs.\n" );
return 0;
}
pArgvNew = argv + globalUtilOptind;
nArgcNew = argc - globalUtilOptind;
if ( nArgcNew != 1 )
......@@ -30646,13 +30645,14 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &miter [-I num] [-dstxvh] <file>\n" );
Abc_Print( -2, "usage: &miter [-I num] [-dstxyvh] <file>\n" );
Abc_Print( -2, "\t creates miter of two designs (current AIG vs. <file>)\n" );
Abc_Print( -2, "\t-I num : the number of last PIs to replicate [default = %d]\n", nInsDup );
Abc_Print( -2, "\t-d : toggle creating dual-output miter [default = %s]\n", fDualOut? "yes": "no" );
Abc_Print( -2, "\t-s : toggle creating sequential miter [default = %s]\n", fSeq? "yes": "no" );
Abc_Print( -2, "\t-t : toggle XORing pair-wise POs of the miter [default = %s]\n", fTrans? "yes": "no" );
Abc_Print( -2, "\t-x : toggle XORing POs of two word-level outputs [default = %s]\n", fTransX? "yes": "no" );
Abc_Print( -2, "\t-t : toggle XORing POs of dual-output miter [default = %s]\n", fTrans? "yes": "no" );
Abc_Print( -2, "\t-x : toggle XORing POs of two-word miter [default = %s]\n", fTransX? "yes": "no" );
Abc_Print( -2, "\t-y : toggle convering two-word miter into dual-output miter [default = %s]\n", fConvert? "yes": "no" );
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");
Abc_Print( -2, "\t<file> : AIGER file with the design to miter\n");
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