diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-12-12 19:10:33 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-12-12 19:10:33 -0800 |
commit | 23af7f903603b6bbeb94b0128938361ed9955dd9 (patch) | |
tree | d2017066cfa21a8b9fd4e280cbe531244b581377 /src | |
parent | be874a7abe0d2b5351883a0cb2455d88715dd607 (diff) | |
download | abc-23af7f903603b6bbeb94b0128938361ed9955dd9.tar.gz abc-23af7f903603b6bbeb94b0128938361ed9955dd9.tar.bz2 abc-23af7f903603b6bbeb94b0128938361ed9955dd9.zip |
Added command &read_blif to read hierarchical BLIF directly into the &-space.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abc/abcHieCec.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/base/abc/abcHieCec.c b/src/base/abc/abcHieCec.c index 59134360..151badfb 100644 --- a/src/base/abc/abcHieCec.c +++ b/src/base/abc/abcHieCec.c @@ -283,6 +283,49 @@ Gia_Man_t * Abc_NtkDeriveFlatGia( Abc_Ntk_t * pNtk ) return pGia; } +/**Function************************************************************* + + Synopsis [Count the number of instances and I/O pins in the hierarchy.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkCountInstances_rec( Abc_Ntk_t * pNtk, int * pCountInst, int * pCountPins ) +{ + Vec_Ptr_t * vOrder = (Vec_Ptr_t *)pNtk->pData; + Abc_Obj_t * pObj; + int i; + *pCountInst += 1; + *pCountPins += Abc_NtkPiNum(pNtk) + Abc_NtkPoNum(pNtk); + Vec_PtrForEachEntry( Abc_Obj_t *, vOrder, pObj, i ) + if ( Abc_ObjIsBox(pObj) ) + Abc_NtkCountInstances_rec( (Abc_Ntk_t *)pObj->pData, pCountInst, pCountPins ); +} + +/**Function************************************************************* + + Synopsis [Count the number of instances and I/O pins in the hierarchy.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkCountInstances( Abc_Ntk_t * pNtk ) +{ + int CountInst = 0, CountPins = 0; + assert( Abc_NtkIsNetlist(pNtk) ); + assert( !Abc_NtkLatchNum(pNtk) ); + // recursively flatten hierarchy + Abc_NtkCountInstances_rec( pNtk, &CountInst, &CountPins ); + printf( "Instances = %10d. I/O pins = %10d.\n", CountInst, CountPins ); +} /**Function************************************************************* @@ -332,6 +375,10 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose ) pGia = Abc_NtkDeriveFlatGia( pNtk ); Abc_PrintTime( 1, "Deriving GIA", clock() - clk ); + clk = clock(); + Abc_NtkCountInstances( pNtk ); + Abc_PrintTime( 1, "Gather stats", clock() - clk ); + // clean nodes/boxes of all nodes Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i ) Vec_PtrFree( (Vec_Ptr_t *)pModel->pData ); |