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_
void * pLutLib; // LUT library
word nHashHit; // hash table hit
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
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_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_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 )
{
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 );
p->pObjs = ABC_REALLOC( Gia_Obj_t, p->pObjs, 2 * 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 )
***********************************************************************/
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 );
p->nHTable = 0;
}
......@@ -195,6 +207,8 @@ void Gia_ManHashResize( Gia_Man_t * p )
Counter2 = Gia_ManAndNum(p);
assert( Counter == Counter2 );
ABC_FREE( pHTableOld );
if ( p->fVerbose )
printf( "Resizing GIA hash table: %d -> %d.\n", nHTableOld, p->nHTable );
}
/**Function********************************************************************
......
......@@ -70,7 +70,6 @@ Gia_Man_t * Gia_ManStart( int nObjsMax )
***********************************************************************/
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 );
assert( p->pManTime == NULL );
Vec_PtrFreeFree( p->vNamesIn );
......
......@@ -686,14 +686,14 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose )
assert( Abc_NtkIsNetlist(pNtk) );
assert( !Abc_NtkLatchNum(pNtk) );
/*
if ( pNtk->pDesign != NULL )
{
clk = clock();
Abc_NtkCountNodes( pNtk );
Abc_PrintTime( 1, "Count nodes", clock() - clk );
}
*/
// print stats
if ( fVerbose )
Abc_NtkPrintBoxInfo( pNtk );
......
......@@ -568,11 +568,18 @@ extern int Abc_NtkCheckRecursive( Abc_Ntk_t * pNtk );
***********************************************************************/
void Au_NtkDeriveFlatGia_rec( Gia_Man_t * pGia, Au_Ntk_t * p )
{
{
Au_Obj_t * pObj, * pTerm;
int i, k;
Au_NtkForEachPi( p, pTerm, i )
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 )
{
if ( Au_ObjIsNode(pObj) )
......@@ -635,6 +642,7 @@ Gia_Man_t * Au_NtkDeriveFlatGia( Au_Ntk_t * p )
pGia = Gia_ManStart( (1<<16) );
pGia->pName = Gia_UtilStrsav( Au_NtkName(p) );
Gia_ManHashAlloc( pGia );
Gia_ManFlipVerbose( pGia );
// create PIs
Au_NtkForEachPi( p, pTerm, i )
Au_ObjSetCopy( pTerm, Gia_ManAppendCi(pGia) );
......@@ -725,7 +733,6 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
clk2 += clock() - clk1;
vModels = Abc_NtkCollectHie( pRoot );
// Vec_PtrForEachEntry( Abc_Ntk_t *, pLib->vModules, pMod, i )
Vec_PtrForEachEntry( Abc_Ntk_t *, vModels, pMod, i )
{
vOrder = Abc_NtkDfsBoxes( pMod );
......@@ -742,7 +749,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
Au_ManPrintStats( pMan );
if ( !Abc_NtkCheckRecursive(pRoot) )
// if ( !Abc_NtkCheckRecursive(pRoot) )
{
clk1 = clock();
pGia = Au_NtkDeriveFlatGia( (Au_Ntk_t *)pRoot->pData );
......@@ -750,9 +757,9 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
// printf( "GIA objects max = %d.\n", pMan->nGiaObjMax );
}
clk1 = clock();
Au_NtkSuppSizeTest( (Au_Ntk_t *)pRoot->pData );
clk4 = clock() - clk1;
// clk1 = clock();
// Au_NtkSuppSizeTest( (Au_Ntk_t *)pRoot->pData );
// clk4 = clock() - clk1;
clk1 = clock();
Au_ManDelete( pMan );
......@@ -761,7 +768,7 @@ Gia_Man_t * Au_ManDeriveTest( Abc_Ntk_t * pRoot )
Abc_PrintTime( 1, "Time all ", clock() - clk );
Abc_PrintTime( 1, "Time new ", clk2 );
Abc_PrintTime( 1, "Time GIA ", clk3 );
Abc_PrintTime( 1, "Time supp", clk4 );
// Abc_PrintTime( 1, "Time supp", clk4 );
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