mirror of https://github.com/YosysHQ/abc.git
Reconstruction of structural choices.
This commit is contained in:
parent
9478c17288
commit
745376d505
|
|
@ -4162,6 +4162,80 @@ Gia_Man_t * Gia_ManDupLevelized( Gia_Man_t * p )
|
|||
return pNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManDupChoicesTest( Gia_Man_t * p, Gia_Man_t * pNew )
|
||||
{
|
||||
Gia_ManCreateRefs( p );
|
||||
Gia_ManMarkFanoutDrivers( p );
|
||||
Gia_Obj_t * pObj; int i;
|
||||
int ChoiceCounts[2][1000] = {{0}};
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
if ( Gia_ObjSibl(p, i) && pObj->fMark0 )
|
||||
{
|
||||
Gia_Obj_t * pSibl, * pPrev; int Size = 1;
|
||||
for ( pPrev = pObj, pSibl = Gia_ObjSiblObj(p, i); pSibl; pPrev = pSibl, pSibl = Gia_ObjSiblObj(p, Gia_ObjId(p, pSibl)) )
|
||||
Size++;
|
||||
assert( Size < 1000 );
|
||||
ChoiceCounts[0][Size]++;
|
||||
}
|
||||
Gia_ManCleanMark0( p );
|
||||
int nSize = 1;
|
||||
Gia_ManForEachAnd( pNew, pObj, i )
|
||||
if ( Gia_ObjRefNumId(p, i) == 0 )
|
||||
nSize++;
|
||||
else if ( nSize > 1 ) {
|
||||
assert( nSize < 1000 );
|
||||
ChoiceCounts[1][nSize]++;
|
||||
nSize = 1;
|
||||
}
|
||||
printf( "Choice counting statistics:\n" );
|
||||
for ( i = 0; i < 1000; i++ )
|
||||
if ( ChoiceCounts[0][i] || ChoiceCounts[1][i] )
|
||||
printf( "%3d : %6d %6d\n", i, ChoiceCounts[0][i], ChoiceCounts[1][i] );
|
||||
}
|
||||
void Gia_ManDupChoices_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj )
|
||||
{
|
||||
if ( ~pObj->Value )
|
||||
return;
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
Gia_ManDupChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
Gia_ManDupChoices_rec( pNew, p, Gia_ObjFanin1(pObj) );
|
||||
Gia_Obj_t * pSibl = Gia_ObjSiblObj(p, Gia_ObjId(p, pObj));
|
||||
if ( pSibl ) Gia_ManDupChoices_rec( pNew, p, pSibl );
|
||||
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||
if ( pSibl ) pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(pObj->Value)-1;
|
||||
}
|
||||
Gia_Man_t * Gia_ManDupChoices( Gia_Man_t * p )
|
||||
{
|
||||
//Gia_ManPrintChoices( p );
|
||||
assert( p->pSibls );
|
||||
Gia_Obj_t * pObj; int i;
|
||||
Gia_Man_t * pNew = Gia_ManStart( Gia_ManObjNum(p) );
|
||||
pNew->pName = Abc_UtilStrsav( p->pName );
|
||||
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
|
||||
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
|
||||
Gia_ManFillValue(p);
|
||||
Gia_ManForEachCi( p, pObj, i )
|
||||
pObj->Value = Gia_ManAppendCi(pNew);
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
Gia_ManDupChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
|
||||
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
|
||||
//Gia_ManDupChoicesTest( p, pNew );
|
||||
return pNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
|
|||
|
|
@ -36126,21 +36126,26 @@ usage:
|
|||
***********************************************************************/
|
||||
int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
extern Gia_Man_t * Gia_ManDupChoices( Gia_Man_t * p );
|
||||
Gia_Man_t * pTemp;
|
||||
int c;
|
||||
int fNormal = 0;
|
||||
int fChoices = 0;
|
||||
int fRevFans = 0;
|
||||
int fRevOuts = 0;
|
||||
int fLeveled = 0;
|
||||
int fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "nfolvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "ncfolvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'n':
|
||||
fNormal ^= 1;
|
||||
break;
|
||||
case 'c':
|
||||
fChoices ^= 1;
|
||||
break;
|
||||
case 'f':
|
||||
fRevFans ^= 1;
|
||||
break;
|
||||
|
|
@ -36164,7 +36169,9 @@ int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Abc_CommandAbc9Dfs(): There is no AIG.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( fLeveled )
|
||||
if ( fChoices )
|
||||
pTemp = Gia_ManDupChoices( pAbc->pGia );
|
||||
else if ( fLeveled )
|
||||
pTemp = Gia_ManDupLevelized( pAbc->pGia );
|
||||
else if ( fNormal )
|
||||
pTemp = Gia_ManDupOrderAiger( pAbc->pGia );
|
||||
|
|
@ -36174,9 +36181,10 @@ int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &dfs [-nfolvh]\n" );
|
||||
Abc_Print( -2, "usage: &dfs [-ncfolvh]\n" );
|
||||
Abc_Print( -2, "\t orders objects in the DFS order\n" );
|
||||
Abc_Print( -2, "\t-n : toggle using normalized ordering [default = %s]\n", fNormal? "yes": "no" );
|
||||
Abc_Print( -2, "\t-c : toggle using ordering for AIG with choices [default = %s]\n", fChoices? "yes": "no" );
|
||||
Abc_Print( -2, "\t-f : toggle using reverse fanin traversal order [default = %s]\n", fRevFans? "yes": "no" );
|
||||
Abc_Print( -2, "\t-o : toggle using reverse output traversal order [default = %s]\n", fRevOuts? "yes": "no" );
|
||||
Abc_Print( -2, "\t-l : toggle using levelized order [default = %s]\n", fLeveled? "yes": "no" );
|
||||
|
|
@ -57706,6 +57714,14 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
goto usage;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Gia_Obj_t * pObj; int i;
|
||||
Gia_ManCreateRefs(pAbc->pGia);
|
||||
Gia_ManForEachAnd( pAbc->pGia, pObj, i )
|
||||
if ( !Gia_ObjIsLut(pAbc->pGia, i) && Gia_ObjRefNum(pAbc->pGia, pObj) > 1 )
|
||||
printf( "%d ", Gia_ObjRefNum(pAbc->pGia, pObj) );
|
||||
printf( "\n" );
|
||||
return 0;
|
||||
|
||||
extern void cadical_solver_test();
|
||||
cadical_solver_test();
|
||||
|
|
@ -57713,7 +57729,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
extern void kissat_solver_test();
|
||||
kissat_solver_test();
|
||||
return 0;
|
||||
|
||||
*/
|
||||
if ( pAbc->pGia == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" );
|
||||
|
|
|
|||
Loading…
Reference in New Issue