Commit bb86d914 by Alan Mishchenko

New demitering features.

parent 3ab9683d
......@@ -170,6 +170,7 @@ extern int Saig_ManDemiterSimple( Aig_Man_t * p, Aig_Man_t ** ppAi
extern int Saig_ManDemiterSimpleDiff( Aig_Man_t * p, Aig_Man_t ** ppAig0, Aig_Man_t ** ppAig1 );
extern int Saig_ManDemiterDual( Aig_Man_t * p, Aig_Man_t ** ppAig0, Aig_Man_t ** ppAig1 );
extern int Ssw_SecSpecialMiter( Aig_Man_t * p0, Aig_Man_t * p1, int nFrames, int fVerbose );
extern int Saig_ManDemiterNew( Aig_Man_t * pMan );
/*=== saigOutdec.c ==========================================================*/
extern Aig_Man_t * Saig_ManDecPropertyOutput( Aig_Man_t * pAig, int nLits, int fVerbose );
/*=== saigPhase.c ==========================================================*/
......
......@@ -1213,6 +1213,100 @@ int Ssw_SecSpecialMiter( Aig_Man_t * p0, Aig_Man_t * p1, int nFrames, int fVerbo
return RetValue;
}
/**Function*************************************************************
Synopsis [Performs demitering of the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Saig_ManDemiterNew( Aig_Man_t * pMan )
{
Vec_Ptr_t * vSuper, * vSupp0, * vSupp1;
Aig_Obj_t * pObj, * pTemp, * pFan0, * pFan1;
int i, k;
vSuper = Vec_PtrAlloc( 100 );
Saig_ManForEachPo( pMan, pObj, i )
{
if ( pMan->nConstrs && i >= pMan->nConstrs )
break;
printf( "Output %3d : ", i );
if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
{
if ( !Aig_ObjFaninC0(pObj) )
printf( "Const1\n" );
else
printf( "Const0\n" );
continue;
}
if ( !Aig_ObjIsNode(Aig_ObjFanin0(pObj)) )
{
printf( "Terminal\n" );
continue;
}
// check AND
if ( !Aig_ObjFaninC0(pObj) )
{
printf( "AND " );
if ( Aig_ObjRecognizeExor(Aig_ObjFanin0(pObj), &pFan0, &pFan1) )
printf( " Yes" );
else
printf( " No" );
printf( "\n" );
continue;
}
// check OR
Aig_ObjCollectSuper( Aig_ObjFanin0(pObj), vSuper );
printf( "OR with %d inputs ", Vec_PtrSize(vSuper) );
if ( Vec_PtrSize(vSuper) == 2 )
{
if ( Aig_ObjRecognizeExor(Aig_ObjFanin0(pObj), &pFan0, &pFan1) )
{
printf( " Yes" );
printf( "\n" );
vSupp0 = Aig_Support( pMan, Aig_Regular(pFan0) );
Vec_PtrForEachEntry( Aig_Obj_t *, vSupp0, pTemp, k )
if ( Saig_ObjIsLo(pMan, pTemp) )
printf( " %d", Aig_ObjPioNum(pTemp) );
printf( "\n" );
Vec_PtrFree( vSupp0 );
vSupp1 = Aig_Support( pMan, Aig_Regular(pFan1) );
Vec_PtrForEachEntry( Aig_Obj_t *, vSupp1, pTemp, k )
if ( Saig_ObjIsLo(pMan, pTemp) )
printf( " %d", Aig_ObjPioNum(pTemp) );
printf( "\n" );
Vec_PtrFree( vSupp1 );
}
else
printf( " No" );
printf( "\n" );
continue;
}
/*
Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pTemp, k )
if ( Aig_ObjRecognizeExor(Aig_Regular(pTemp), &pFan0, &pFan1) )
{
printf( " Yes" );
if ( Aig_IsComplement(pTemp) )
pFan0 = Aig_Not(pFan0);
}
else
printf( " No" );
*/
printf( "\n" );
}
Vec_PtrFree( vSuper );
return 1;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
......@@ -5519,6 +5519,8 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv )
extern int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk );
extern int Abc_NtkDarDemiterDual( Abc_Ntk_t * pNtk, int fVerbose );
extern int Abc_NtkDarDemiterNew( Abc_Ntk_t * pNtk );
// set defaults
fDual = 0;
fSeq = 1;
......@@ -5540,7 +5542,7 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv )
default:
goto usage;
}
}
}
if ( pNtk == NULL )
{
......@@ -5554,14 +5556,16 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
if ( (Abc_NtkPoNum(pNtk) & 1) )
{
Abc_Print( -1, "The number of POs should be even.\n" );
return 0;
}
// Abc_NtkDarDemiterNew( pNtk );
// return 0;
if ( fDual )
{
if ( (Abc_NtkPoNum(pNtk) & 1) )
{
Abc_Print( -1, "The number of POs should be even.\n" );
return 0;
}
if ( !Abc_NtkDarDemiterDual( pNtk, fVerbose ) )
{
Abc_Print( -1, "Demitering has failed.\n" );
......
......@@ -2063,6 +2063,59 @@ int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk )
SeeAlso []
***********************************************************************/
int Abc_NtkDarDemiterNew( Abc_Ntk_t * pNtk )
{
char * pFileNameGeneric, pFileName0[1000], pFileName1[1000];
Aig_Man_t * pMan, * pPart0, * pPart1;//, * pMiter;
// derive the AIG manager
pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( pMan == NULL )
{
printf( "Converting network into AIG has failed.\n" );
return 0;
}
Saig_ManDemiterNew( pMan );
Aig_ManStop( pMan );
return 1;
// if ( !Saig_ManDemiterSimple( pMan, &pPart0, &pPart1 ) )
if ( !Saig_ManDemiterSimpleDiff( pMan, &pPart0, &pPart1 ) )
{
printf( "Demitering has failed.\n" );
return 0;
}
// create file names
pFileNameGeneric = Extra_FileNameGeneric( pNtk->pSpec );
sprintf( pFileName0, "%s%s", pFileNameGeneric, "_part0.aig" );
sprintf( pFileName1, "%s%s", pFileNameGeneric, "_part1.aig" );
ABC_FREE( pFileNameGeneric );
// dump files
Ioa_WriteAiger( pPart0, pFileName0, 0, 0 );
Ioa_WriteAiger( pPart1, pFileName1, 0, 0 );
printf( "Demitering produced two files \"%s\" and \"%s\".\n", pFileName0, pFileName1 );
// create two-level miter
// pMiter = Saig_ManCreateMiterTwo( pPart0, pPart1, 2 );
// Aig_ManDumpBlif( pMiter, "miter01.blif", NULL, NULL );
// Aig_ManStop( pMiter );
// printf( "The new miter is written into file \"%s\".\n", "miter01.blif" );
Aig_ManStop( pPart0 );
Aig_ManStop( pPart1 );
Aig_ManStop( pMan );
return 1;
}
/**Function*************************************************************
Synopsis [Gives the current ABC network to AIG manager for processing.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NtkDarDemiterDual( Abc_Ntk_t * pNtk, int fVerbose )
{
char * pFileNameGeneric, pFileName0[1000], pFileName1[1000];
......
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