Commit 0695ec54 by Alan Mishchenko

New hierarchy manager plus additional printout in the GIA package.

parent ca28f77f
...@@ -152,6 +152,7 @@ struct Gia_Man_t_ ...@@ -152,6 +152,7 @@ struct Gia_Man_t_
void * pLutLib; // LUT library void * pLutLib; // LUT library
word nHashHit; // hash table hit word nHashHit; // hash table hit
word nHashMiss; // hash table miss word nHashMiss; // hash table miss
int fVerbose; // verbose reports
}; };
...@@ -303,6 +304,7 @@ static inline int Gia_ManObjNum( Gia_Man_t * p ) { return p->nObjs ...@@ -303,6 +304,7 @@ static inline int Gia_ManObjNum( Gia_Man_t * p ) { return p->nObjs
static inline int Gia_ManAndNum( Gia_Man_t * p ) { return p->nObjs - Vec_IntSize(p->vCis) - Vec_IntSize(p->vCos) - 1; } static inline int Gia_ManAndNum( Gia_Man_t * p ) { return p->nObjs - Vec_IntSize(p->vCis) - Vec_IntSize(p->vCos) - 1; }
static inline int Gia_ManCandNum( Gia_Man_t * p ) { return Gia_ManCiNum(p) + Gia_ManAndNum(p); } static inline int Gia_ManCandNum( Gia_Man_t * p ) { return Gia_ManCiNum(p) + Gia_ManAndNum(p); }
static inline int Gia_ManConstrNum( Gia_Man_t * p ) { return p->nConstrs; } static inline int Gia_ManConstrNum( Gia_Man_t * p ) { return p->nConstrs; }
static inline void Gia_ManFlipVerbose( Gia_Man_t * p ) { p->fVerbose ^= 1; }
static inline Gia_Obj_t * Gia_ManConst0( Gia_Man_t * p ) { return p->pObjs; } static inline Gia_Obj_t * Gia_ManConst0( Gia_Man_t * p ) { return p->pObjs; }
static inline Gia_Obj_t * Gia_ManConst1( Gia_Man_t * p ) { return Gia_Not(Gia_ManConst0(p)); } static inline Gia_Obj_t * Gia_ManConst1( Gia_Man_t * p ) { return Gia_Not(Gia_ManConst0(p)); }
...@@ -428,7 +430,8 @@ static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p ) ...@@ -428,7 +430,8 @@ static inline Gia_Obj_t * Gia_ManAppendObj( Gia_Man_t * p )
{ {
if ( p->nObjs == p->nObjsAlloc ) if ( p->nObjs == p->nObjsAlloc )
{ {
// printf("Reallocing %d.\n", 2 * p->nObjsAlloc ); if ( p->fVerbose )
printf("Extending GIA object storage: %d -> %d.\n", p->nObjsAlloc, 2 * p->nObjsAlloc );
assert( p->nObjsAlloc > 0 ); assert( p->nObjsAlloc > 0 );
p->pObjs = ABC_REALLOC( Gia_Obj_t, p->pObjs, 2 * p->nObjsAlloc ); p->pObjs = ABC_REALLOC( Gia_Obj_t, p->pObjs, 2 * p->nObjsAlloc );
memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Gia_Obj_t) * p->nObjsAlloc ); memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Gia_Obj_t) * p->nObjsAlloc );
......
...@@ -151,6 +151,18 @@ void Gia_ManHashStart( Gia_Man_t * p ) ...@@ -151,6 +151,18 @@ void Gia_ManHashStart( Gia_Man_t * p )
***********************************************************************/ ***********************************************************************/
void Gia_ManHashStop( Gia_Man_t * p ) void Gia_ManHashStop( Gia_Man_t * p )
{ {
int i, Ent, Counter;
printf( "Hash table hits = %12u. Hash table misses = %12u.\n", (int)p->nHashHit, (int)p->nHashMiss );
printf( "Hash table size = %12u. Object count = %12u.\n", p->nHTable, p->nObjs );
for ( i = 0; i < Abc_MinInt(p->nHTable, 1000); i++ )
{
Counter = 0;
for ( Ent = Gia_Lit2Var(p->pHTable[i]); Ent; Ent = Gia_Lit2Var(Gia_ManObj(p, Ent)->Value) )
Counter++;
printf( "%d ", Counter );
}
printf( "\n" );
ABC_FREE( p->pHTable ); ABC_FREE( p->pHTable );
p->nHTable = 0; p->nHTable = 0;
} }
...@@ -195,6 +207,8 @@ void Gia_ManHashResize( Gia_Man_t * p ) ...@@ -195,6 +207,8 @@ void Gia_ManHashResize( Gia_Man_t * p )
Counter2 = Gia_ManAndNum(p); Counter2 = Gia_ManAndNum(p);
assert( Counter == Counter2 ); assert( Counter == Counter2 );
ABC_FREE( pHTableOld ); ABC_FREE( pHTableOld );
if ( p->fVerbose )
printf( "Resizing GIA hash table: %d -> %d.\n", nHTableOld, p->nHTable );
} }
/**Function******************************************************************** /**Function********************************************************************
......
...@@ -70,7 +70,6 @@ Gia_Man_t * Gia_ManStart( int nObjsMax ) ...@@ -70,7 +70,6 @@ Gia_Man_t * Gia_ManStart( int nObjsMax )
***********************************************************************/ ***********************************************************************/
void Gia_ManStop( Gia_Man_t * p ) void Gia_ManStop( Gia_Man_t * p )
{ {
// printf( "Hash table hits = %12u. Hash table misses = %12u.\n", (int)p->nHashHit, (int)p->nHashMiss );
Tim_ManStopP( (Tim_Man_t **)&p->pManTime ); Tim_ManStopP( (Tim_Man_t **)&p->pManTime );
assert( p->pManTime == NULL ); assert( p->pManTime == NULL );
Vec_PtrFreeFree( p->vNamesIn ); Vec_PtrFreeFree( p->vNamesIn );
......
...@@ -686,14 +686,14 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose ) ...@@ -686,14 +686,14 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose )
assert( Abc_NtkIsNetlist(pNtk) ); assert( Abc_NtkIsNetlist(pNtk) );
assert( !Abc_NtkLatchNum(pNtk) ); assert( !Abc_NtkLatchNum(pNtk) );
/*
if ( pNtk->pDesign != NULL ) if ( pNtk->pDesign != NULL )
{ {
clk = clock(); clk = clock();
Abc_NtkCountNodes( pNtk ); Abc_NtkCountNodes( pNtk );
Abc_PrintTime( 1, "Count nodes", clock() - clk ); Abc_PrintTime( 1, "Count nodes", clock() - clk );
} }
*/
// print stats // print stats
if ( fVerbose ) if ( fVerbose )
Abc_NtkPrintBoxInfo( pNtk ); Abc_NtkPrintBoxInfo( pNtk );
......
...@@ -573,6 +573,13 @@ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p ) ...@@ -573,6 +573,13 @@ void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p )
int i, k; int i, k;
Au_NtkForEachPi( p, pTerm, i ) Au_NtkForEachPi( p, pTerm, i )
assert( Au_ObjCopy(pTerm) >= 0 ); assert( Au_ObjCopy(pTerm) >= 0 );
if ( strcmp(Au_NtkName(p), "ref_egcd") == 0 )
{
printf( "Replacing one instance of recursive model \"%s\" by a black box.\n", "ref_egcd" );
Au_NtkForEachPo( p, pTerm, i )
Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) );
return;
}
Au_NtkForEachObj( p, pObj, i ) Au_NtkForEachObj( p, pObj, i )
{ {
if ( Au_ObjIsNode(pObj) ) if ( Au_ObjIsNode(pObj) )
...@@ -635,6 +642,7 @@ Gia_Man_t * Au_NtkDeriveFlatGia( Au_Ntk_t * p ) ...@@ -635,6 +642,7 @@ Gia_Man_t * Au_NtkDeriveFlatGia( Au_Ntk_t * p )
pGia = Gia_ManStart( (1<<16) ); pGia = Gia_ManStart( (1<<16) );
pGia->pName = Gia_UtilStrsav( Au_NtkName(p) ); pGia->pName = Gia_UtilStrsav( Au_NtkName(p) );
Gia_ManHashAlloc( pGia ); Gia_ManHashAlloc( pGia );
Gia_ManFlipVerbose( pGia );
// create PIs // create PIs
Au_NtkForEachPi( p, pTerm, i ) Au_NtkForEachPi( p, pTerm, i )
Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) ); Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) );
...@@ -725,7 +733,6 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) ...@@ -725,7 +733,6 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
clk2 += clock() - clk1; clk2 += clock() - clk1;
vModels = Abc_NtkCollectHie( pRoot ); vModels = Abc_NtkCollectHie( pRoot );
// Vec_PtrForEachEntry( Abc_Ntk_t *, pLib->vModules, pMod, i )
Vec_PtrForEachEntry( Abc_Ntk_t *, vModels, pMod, i ) Vec_PtrForEachEntry( Abc_Ntk_t *, vModels, pMod, i )
{ {
vOrder = Abc_NtkDfsBoxes( pMod ); vOrder = Abc_NtkDfsBoxes( pMod );
...@@ -742,7 +749,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) ...@@ -742,7 +749,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
Au_ManPrintStats( pMan ); Au_ManPrintStats( pMan );
if ( !Abc_NtkCheckRecursive(pRoot) ) // if ( !Abc_NtkCheckRecursive(pRoot) )
{ {
clk1 = clock(); clk1 = clock();
pGia = Au_NtkDeriveFlatGia( (Au_Ntk_t *)pRoot->pData ); pGia = Au_NtkDeriveFlatGia( (Au_Ntk_t *)pRoot->pData );
...@@ -750,9 +757,9 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) ...@@ -750,9 +757,9 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
// printf( "GIA objects max = %d.\n", pMan->nGiaObjMax ); // printf( "GIA objects max = %d.\n", pMan->nGiaObjMax );
} }
clk1 = clock(); // clk1 = clock();
Au_NtkSuppSizeTest( (Au_Ntk_t *)pRoot->pData ); // Au_NtkSuppSizeTest( (Au_Ntk_t *)pRoot->pData );
clk4 = clock() - clk1; // clk4 = clock() - clk1;
clk1 = clock(); clk1 = clock();
Au_ManDelete( pMan ); Au_ManDelete( pMan );
...@@ -761,7 +768,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot ) ...@@ -761,7 +768,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
Abc_PrintTime( 1, "Time all ", clock() - clk ); Abc_PrintTime( 1, "Time all ", clock() - clk );
Abc_PrintTime( 1, "Time new ", clk2 ); Abc_PrintTime( 1, "Time new ", clk2 );
Abc_PrintTime( 1, "Time GIA ", clk3 ); Abc_PrintTime( 1, "Time GIA ", clk3 );
Abc_PrintTime( 1, "Time supp", clk4 ); // Abc_PrintTime( 1, "Time supp", clk4 );
return pGia; return pGia;
} }
......
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