diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-07-25 19:34:28 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-07-25 19:34:28 -0700 |
commit | 0806dd227ce57522de07d0a618bd7f3fe93da7fb (patch) | |
tree | ce0741d80217db8c17662bd08d881e62f5faa753 /src/base/cba | |
parent | e0630f83f5d69707c6345251cbebec0911a15fb3 (diff) | |
download | abc-0806dd227ce57522de07d0a618bd7f3fe93da7fb.tar.gz abc-0806dd227ce57522de07d0a618bd7f3fe93da7fb.tar.bz2 abc-0806dd227ce57522de07d0a618bd7f3fe93da7fb.zip |
Updates to the Cba data-structure.
Diffstat (limited to 'src/base/cba')
-rw-r--r-- | src/base/cba/cba.h | 1 | ||||
-rw-r--r-- | src/base/cba/cbaCom.c | 8 | ||||
-rw-r--r-- | src/base/cba/cbaNtk.c | 66 |
3 files changed, 58 insertions, 17 deletions
diff --git a/src/base/cba/cba.h b/src/base/cba/cba.h index b97b7083..e79660e3 100644 --- a/src/base/cba/cba.h +++ b/src/base/cba/cba.h @@ -822,6 +822,7 @@ static inline void Cba_ManPrintStats( Cba_Man_t * p, int nModules, int fVerbose /*=== cbaCba.c ===============================================================*/ /*=== cbaCom.c ===============================================================*/ /*=== cbaNtk.c ===============================================================*/ +extern int Cba_NtkCheckComboLoop( Cba_Ntk_t * p ); extern int Cba_ManIsTopOrder( Cba_Man_t * p, int(* pFuncIsSeq)(Cba_Ntk_t*, int) ); extern Vec_Int_t * Cba_NtkCollectDfs( Cba_Ntk_t * p ); extern Cba_Man_t * Cba_ManCollapse( Cba_Man_t * p, int TypeBuf ); diff --git a/src/base/cba/cbaCom.c b/src/base/cba/cbaCom.c index 21db2e90..23cc869b 100644 --- a/src/base/cba/cbaCom.c +++ b/src/base/cba/cbaCom.c @@ -28,6 +28,7 @@ ABC_NAMESPACE_IMPL_START /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// +/* static int Cba_CommandRead ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Cba_CommandWrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Cba_CommandPs ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -36,6 +37,7 @@ static int Cba_CommandGet ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Cba_CommandClp ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Cba_CommandCec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Cba_CommandTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); +*/ static inline Cba_Man_t * Cba_AbcGetMan( Abc_Frame_t * pAbc ) { return (Cba_Man_t *)pAbc->pAbcCba; } static inline void Cba_AbcFreeMan( Abc_Frame_t * pAbc ) { if ( pAbc->pAbcCba ) Cba_ManFree(Cba_AbcGetMan(pAbc)); } @@ -58,6 +60,7 @@ static inline void Cba_AbcUpdateMan( Abc_Frame_t * pAbc, Cba_Man_t * p ) ******************************************************************************/ void Cba_Init( Abc_Frame_t * pAbc ) { +/* Cmd_CommandAdd( pAbc, "New word level", "@read", Cba_CommandRead, 0 ); Cmd_CommandAdd( pAbc, "New word level", "@write", Cba_CommandWrite, 0 ); Cmd_CommandAdd( pAbc, "New word level", "@ps", Cba_CommandPs, 0 ); @@ -66,6 +69,7 @@ void Cba_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "New word level", "@clp", Cba_CommandClp, 0 ); Cmd_CommandAdd( pAbc, "New word level", "@cec", Cba_CommandCec, 0 ); Cmd_CommandAdd( pAbc, "New word level", "@test", Cba_CommandTest, 0 ); +*/ } /**Function******************************************************************** @@ -85,6 +89,8 @@ void Cba_End( Abc_Frame_t * pAbc ) } +#if 0 + /**Function******************************************************************** Synopsis [] @@ -696,6 +702,8 @@ usage: return 1; } +#endif + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/base/cba/cbaNtk.c b/src/base/cba/cbaNtk.c index 8812cbac..a5491dc2 100644 --- a/src/base/cba/cbaNtk.c +++ b/src/base/cba/cbaNtk.c @@ -84,6 +84,49 @@ int Cba_ManIsTopOrder( Cba_Man_t * p, int(* pFuncIsSeq)(Cba_Ntk_t*, int) ) /**Function************************************************************* + Synopsis [Collects user boxes in the DFS order.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Cba_NtkCheckComboLoop_rec( Cba_Ntk_t * p, int iObj ) +{ + int k, iFin, iFanin; + if ( Cba_ObjIsPi(p, iObj) ) + return 1; + if ( Cba_ObjCopy(p, iObj) == 1 ) // visited + return 1; + if ( Cba_ObjCopy(p, iObj) == 0 ) // loop + return 0; + Cba_ObjSetCopy( p, iObj, 0 ); + Cba_ObjForEachFinFaninReal( p, iObj, iFin, iFanin, k ) +// if ( !Clr_NtkObjIsSeq(p, iFanin) ) + if ( !Cba_NtkCheckComboLoop_rec( p, iFanin ) ) + return 0; + //Cba_ObjSetCopy( p, iObj, 1 ); + Vec_IntSetEntry( &p->vObjCopy, iObj, 1 ); + return 1; +} +int Cba_NtkCheckComboLoop( Cba_Ntk_t * p ) +{ + int iObj; + Cba_NtkCleanObjCopies( p ); // -1 = not visited; 0 = on the path; 1 = finished + Cba_NtkForEachBox( p, iObj ) +// if ( !Clr_NtkObjIsSeq(p, iObj) ) + if ( !Cba_NtkCheckComboLoop_rec( p, iObj ) ) + { + printf( "Cyclic dependency of user boxes is detected.\n" ); + return 0; + } + return 1; +} + +/**Function************************************************************* + Synopsis [Collect nodes in the DFS order.] Description [] @@ -585,6 +628,8 @@ void Cba_NtkInsertGroup( Cba_Ntk_t * p, Vec_Int_t * vObjs, Cba_Ntk_t * pSyn ) } // connect output fons Cba_NtkCleanFonCopies( p ); + if ( Cba_NtkHasFonNames(p) ) + Vec_IntFillExtra( &p->vFonName, Cba_NtkFonNum(p) + 1, 0 ); Cba_NtkForEachPoDriverFon( pSyn, iObj, iFon, k ) { assert( Cba_FonIsReal(Cba_FonCopy(pSyn, iFon)) ); @@ -598,27 +643,12 @@ void Cba_NtkInsertGroup( Cba_Ntk_t * p, Vec_Int_t * vObjs, Cba_Ntk_t * pSyn ) } Vec_IntFree( vFonOuts ); // delete nodes - Vec_IntForEachEntry( vObjs, iObj, k ) - Cba_ObjDelete( p, iObj ); +// Vec_IntForEachEntry( vObjs, iObj, k ) +// Cba_ObjDelete( p, iObj ); // update fins pointing to output fons to point to the new fons - if ( Cba_NtkHasFonNames(p) ) - Vec_IntFillExtra( &p->vFonName, Cba_NtkFonNum(p) + 1, 0 ); Cba_NtkForEachFinFon( p, iFon, iFin ) if ( Cba_FonIsReal(iFon) && Cba_FonCopy(p, iFon) ) - { Cba_PatchFinFon( p, iFin, Cba_FonCopy(p, iFon) ); -/* - if ( Cba_NtkHasFonNames(p) && Cba_FonIsReal(Cba_FonCopy(p, iFon)) ) - { - if ( !Cba_FonName(p, Cba_FonCopy(p, iFon)) ) - { - Cba_FonSetName( p, Cba_FonCopy(p, iFon), Cba_FonName(p, iFon) ); - Cba_FonCleanName( p, iFon ); - } - } -*/ - } - Cba_NtkMissingFonNames( p, "j" ); /* // duplicate in DFS order @@ -633,6 +663,8 @@ Cba_Man_t * Cba_ManInsertGroup( Cba_Man_t * p, Vec_Int_t * vObjs, Cba_Ntk_t * pS { extern Vec_Int_t * Clr_NtkCollectDfs( Cba_Ntk_t * p ); Cba_NtkInsertGroup( Cba_ManRoot(p), vObjs, pSyn ); +// if ( Cba_NtkCheckComboLoop( Cba_ManRoot(p) ) ) +// printf( "There is no combo loop!\n" ); return Cba_ManDup( p, Clr_NtkCollectDfs ); } |