Commit 46ab68ba by Alan Mishchenko

Cleanup and bug fixing in hierarchy handling.

parent b94b8102
...@@ -668,6 +668,7 @@ extern ABC_DLL void Abc_NtkConvertDcLatches( Abc_Ntk_t * pNtk ); ...@@ -668,6 +668,7 @@ extern ABC_DLL void Abc_NtkConvertDcLatches( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Ptr_t * Abc_NtkConverLatchNamesIntoNumbers( Abc_Ntk_t * pNtk ); extern ABC_DLL Vec_Ptr_t * Abc_NtkConverLatchNamesIntoNumbers( Abc_Ntk_t * pNtk );
/*=== abcLib.c ==========================================================*/ /*=== abcLib.c ==========================================================*/
extern ABC_DLL Abc_Des_t * Abc_DesCreate( char * pName ); extern ABC_DLL Abc_Des_t * Abc_DesCreate( char * pName );
extern ABC_DLL void Abc_DesCleanManPointer( Abc_Des_t * p, void * pMan );
extern ABC_DLL void Abc_DesFree( Abc_Des_t * p, Abc_Ntk_t * pNtk ); extern ABC_DLL void Abc_DesFree( Abc_Des_t * p, Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_DesPrint( Abc_Des_t * p ); extern ABC_DLL void Abc_DesPrint( Abc_Des_t * p );
extern ABC_DLL int Abc_DesAddModel( Abc_Des_t * p, Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_DesAddModel( Abc_Des_t * p, Abc_Ntk_t * pNtk );
......
...@@ -308,7 +308,11 @@ Abc_Ntk_t * Abc_NtkFromBarBufs( Abc_Ntk_t * pNtkBase, Abc_Ntk_t * pNtk ) ...@@ -308,7 +308,11 @@ Abc_Ntk_t * Abc_NtkFromBarBufs( Abc_Ntk_t * pNtkBase, Abc_Ntk_t * pNtk )
Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pObj->pCopy->pNtk, Abc_ObjFanin0(pObj)) ); Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pObj->pCopy->pNtk, Abc_ObjFanin0(pObj)) );
// transfer net names // transfer net names
Abc_NtkForEachCi( pNtk, pObj, i ) Abc_NtkForEachCi( pNtk, pObj, i )
{
if ( Abc_ObjFanoutNum(pObj->pCopy) == 0 ) // handle PI without fanout
Abc_ObjAddFanin( Abc_NtkCreateNet(pObj->pCopy->pNtk), pObj->pCopy );
Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanout0(pObj->pCopy)->Id, Abc_ObjFanout0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanout0(pObj)), NULL ); Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanout0(pObj->pCopy)->Id, Abc_ObjFanout0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanout0(pObj)), NULL );
}
Abc_NtkForEachCo( pNtk, pObj, i ) Abc_NtkForEachCo( pNtk, pObj, i )
Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanin0(pObj->pCopy)->Id, Abc_ObjFanin0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanin0(pObj)), NULL ); Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanin0(pObj->pCopy)->Id, Abc_ObjFanin0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanin0(pObj)), NULL );
return pNtkNew; return pNtkNew;
......
...@@ -58,6 +58,30 @@ Abc_Des_t * Abc_DesCreate( char * pName ) ...@@ -58,6 +58,30 @@ Abc_Des_t * Abc_DesCreate( char * pName )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Removes all pointers to the manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_DesCleanManPointer( Abc_Des_t * p, void * pMan )
{
Abc_Ntk_t * pTemp;
int i;
if ( p == NULL )
return;
if ( p->pManFunc == pMan )
p->pManFunc = NULL;
Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
if ( pTemp->pManFunc == pMan )
pTemp->pManFunc = NULL;
}
/**Function*************************************************************
Synopsis [Frees the library.] Synopsis [Frees the library.]
Description [] Description []
...@@ -83,9 +107,8 @@ void Abc_DesFree( Abc_Des_t * p, Abc_Ntk_t * pNtkSave ) ...@@ -83,9 +107,8 @@ void Abc_DesFree( Abc_Des_t * p, Abc_Ntk_t * pNtkSave )
{ {
if ( pNtk == pNtkSave ) if ( pNtk == pNtkSave )
continue; continue;
// pNtk->pManFunc = NULL;
pNtk->pDesign = NULL; pNtk->pDesign = NULL;
if ( pNtkSave && pNtk->pManFunc == pNtkSave->pManFunc ) if ( (pNtkSave && pNtk->pManFunc == pNtkSave->pManFunc) || (pNtk->pManFunc == p->pManFunc) )
pNtk->pManFunc = NULL; pNtk->pManFunc = NULL;
Abc_NtkDelete( pNtk ); Abc_NtkDelete( pNtk );
} }
......
...@@ -1327,10 +1327,7 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk ) ...@@ -1327,10 +1327,7 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
// free node attributes // free node attributes
Vec_PtrForEachEntry( Abc_Obj_t *, pNtk->vAttrs, pAttrMan, i ) Vec_PtrForEachEntry( Abc_Obj_t *, pNtk->vAttrs, pAttrMan, i )
if ( pAttrMan ) if ( pAttrMan )
{
//printf( "deleting attr\n" );
Vec_AttFree( (Vec_Att_t *)pAttrMan, 1 ); Vec_AttFree( (Vec_Att_t *)pAttrMan, 1 );
}
assert( pNtk->pSCLib == NULL ); assert( pNtk->pSCLib == NULL );
Vec_IntFreeP( &pNtk->vGates ); Vec_IntFreeP( &pNtk->vGates );
Vec_PtrFree( pNtk->vAttrs ); Vec_PtrFree( pNtk->vAttrs );
......
...@@ -102,7 +102,6 @@ extern ABC_DLL void * Abc_FrameReadLibBox(); ...@@ -102,7 +102,6 @@ extern ABC_DLL void * Abc_FrameReadLibBox();
extern ABC_DLL void * Abc_FrameReadLibGen(); extern ABC_DLL void * Abc_FrameReadLibGen();
extern ABC_DLL void * Abc_FrameReadLibGen2(); extern ABC_DLL void * Abc_FrameReadLibGen2();
extern ABC_DLL void * Abc_FrameReadLibSuper(); extern ABC_DLL void * Abc_FrameReadLibSuper();
extern ABC_DLL void * Abc_FrameReadLibVer();
extern ABC_DLL void * Abc_FrameReadLibScl(); extern ABC_DLL void * Abc_FrameReadLibScl();
extern ABC_DLL void * Abc_FrameReadManDd(); extern ABC_DLL void * Abc_FrameReadManDd();
extern ABC_DLL void * Abc_FrameReadManDec(); extern ABC_DLL void * Abc_FrameReadManDec();
......
...@@ -56,7 +56,6 @@ void * Abc_FrameReadLibBox() { return s_GlobalFr ...@@ -56,7 +56,6 @@ void * Abc_FrameReadLibBox() { return s_GlobalFr
void * Abc_FrameReadLibGen() { return s_GlobalFrame->pLibGen; } void * Abc_FrameReadLibGen() { return s_GlobalFrame->pLibGen; }
void * Abc_FrameReadLibGen2() { return s_GlobalFrame->pLibGen2; } void * Abc_FrameReadLibGen2() { return s_GlobalFrame->pLibGen2; }
void * Abc_FrameReadLibSuper() { return s_GlobalFrame->pLibSuper; } void * Abc_FrameReadLibSuper() { return s_GlobalFrame->pLibSuper; }
void * Abc_FrameReadLibVer() { return s_GlobalFrame->pLibVer; }
void * Abc_FrameReadLibScl() { return s_GlobalFrame->pLibScl; } void * Abc_FrameReadLibScl() { return s_GlobalFrame->pLibScl; }
void * Abc_FrameReadManDd() { if ( s_GlobalFrame->dd == NULL ) s_GlobalFrame->dd = Cudd_Init( 0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); return s_GlobalFrame->dd; } void * Abc_FrameReadManDd() { if ( s_GlobalFrame->dd == NULL ) s_GlobalFrame->dd = Cudd_Init( 0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); return s_GlobalFrame->dd; }
void * Abc_FrameReadManDec() { if ( s_GlobalFrame->pManDec == NULL ) s_GlobalFrame->pManDec = Dec_ManStart(); return s_GlobalFrame->pManDec; } void * Abc_FrameReadManDec() { if ( s_GlobalFrame->pManDec == NULL ) s_GlobalFrame->pManDec = Dec_ManStart(); return s_GlobalFrame->pManDec; }
...@@ -82,7 +81,6 @@ void Abc_FrameSetLibBox( void * pLib ) { s_GlobalFrame->pL ...@@ -82,7 +81,6 @@ void Abc_FrameSetLibBox( void * pLib ) { s_GlobalFrame->pL
void Abc_FrameSetLibGen( void * pLib ) { s_GlobalFrame->pLibGen = pLib; } void Abc_FrameSetLibGen( void * pLib ) { s_GlobalFrame->pLibGen = pLib; }
void Abc_FrameSetLibGen2( void * pLib ) { s_GlobalFrame->pLibGen2 = pLib; } void Abc_FrameSetLibGen2( void * pLib ) { s_GlobalFrame->pLibGen2 = pLib; }
void Abc_FrameSetLibSuper( void * pLib ) { s_GlobalFrame->pLibSuper = pLib; } void Abc_FrameSetLibSuper( void * pLib ) { s_GlobalFrame->pLibSuper = pLib; }
void Abc_FrameSetLibVer( void * pLib ) { s_GlobalFrame->pLibVer = pLib; }
void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateValue( s_GlobalFrame, pFlag, pValue ); } void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateValue( s_GlobalFrame, pFlag, pValue ); }
void Abc_FrameSetCex( Abc_Cex_t * pCex ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->pCex = pCex; } void Abc_FrameSetCex( Abc_Cex_t * pCex ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->pCex = pCex; }
void Abc_FrameSetNFrames( int nFrames ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->nFrames = nFrames; } void Abc_FrameSetNFrames( int nFrames ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->nFrames = nFrames; }
...@@ -189,7 +187,6 @@ void Abc_FrameDeallocate( Abc_Frame_t * p ) ...@@ -189,7 +187,6 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
if ( p->vCexVec ) Vec_PtrFreeFree( p->vCexVec ); if ( p->vCexVec ) Vec_PtrFreeFree( p->vCexVec );
if ( p->vPoEquivs ) Vec_VecFree( (Vec_Vec_t *)p->vPoEquivs ); if ( p->vPoEquivs ) Vec_VecFree( (Vec_Vec_t *)p->vPoEquivs );
if ( p->vStatuses ) Vec_IntFree( p->vStatuses ); if ( p->vStatuses ) Vec_IntFree( p->vStatuses );
if ( p->pLibVer ) Abc_DesFree( (Abc_Des_t *)p->pLibVer, NULL );
if ( p->pManDec ) Dec_ManStop( (Dec_Man_t *)p->pManDec ); if ( p->pManDec ) Dec_ManStop( (Dec_Man_t *)p->pManDec );
if ( p->dd ) Extra_StopManager( p->dd ); if ( p->dd ) Extra_StopManager( p->dd );
if ( p->vStore ) Vec_PtrFree( p->vStore ); if ( p->vStore ) Vec_PtrFree( p->vStore );
......
...@@ -92,7 +92,6 @@ struct Abc_Frame_t_ ...@@ -92,7 +92,6 @@ struct Abc_Frame_t_
void * pLibGen; // the current genlib void * pLibGen; // the current genlib
void * pLibGen2; // the current genlib void * pLibGen2; // the current genlib
void * pLibSuper; // the current supergate library void * pLibSuper; // the current supergate library
void * pLibVer; // the current Verilog library
void * pLibScl; // the current Liberty library void * pLibScl; // the current Liberty library
// timing constraints // timing constraints
char * pDrivingCell; // name of the driving cell char * pDrivingCell; // name of the driving cell
......
...@@ -1743,12 +1743,6 @@ int Ver_ParseBox( Ver_Man_t * pMan, Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkBox ) ...@@ -1743,12 +1743,6 @@ int Ver_ParseBox( Ver_Man_t * pMan, Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkBox )
pNode->pCopy = (Abc_Obj_t *)vBundles; pNode->pCopy = (Abc_Obj_t *)vBundles;
while ( 1 ) while ( 1 )
{ {
/*
if ( Ver_StreamGetLineNumber(pMan->pReader) == 5967 )
{
int x = 0;
}
*/
// allocate the bundle (formal name + array of actual nets) // allocate the bundle (formal name + array of actual nets)
pBundle = ABC_ALLOC( Ver_Bundle_t, 1 ); pBundle = ABC_ALLOC( Ver_Bundle_t, 1 );
pBundle->pNameFormal = NULL; pBundle->pNameFormal = NULL;
...@@ -2073,6 +2067,21 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox ) ...@@ -2073,6 +2067,21 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox )
Abc_NtkForEachPo( pNtkBox, pTerm, i ) Abc_NtkForEachPo( pNtkBox, pTerm, i )
Abc_ObjFanin0(pTerm)->pCopy = NULL; Abc_ObjFanin0(pTerm)->pCopy = NULL;
*/ */
// check the number of actual nets is the same as the number of formal nets
if ( Vec_PtrSize(vBundles) > Abc_NtkPiNum(pNtkBox) + Abc_NtkPoNum(pNtkBox) )
{
sprintf( pMan->sError, "The number of actual IOs (%d) is bigger than the number of formal IOs (%d) when instantiating network %s in box %s.",
Vec_PtrSize(vBundles), Abc_NtkPiNum(pNtkBox) + Abc_NtkPoNum(pNtkBox), pNtkBox->pName, Abc_ObjName(pBox) );
// free the bundling
Vec_PtrForEachEntry( Ver_Bundle_t *, vBundles, pBundle, k )
Ver_ParseFreeBundle( pBundle );
Vec_PtrFree( vBundles );
pBox->pCopy = NULL;
Ver_ParsePrintErrorMessage( pMan );
return 0;
}
// check if some of them do not have formal names // check if some of them do not have formal names
Vec_PtrForEachEntry( Ver_Bundle_t *, vBundles, pBundle, k ) Vec_PtrForEachEntry( Ver_Bundle_t *, vBundles, pBundle, k )
if ( pBundle->pNameFormal == NULL ) if ( pBundle->pNameFormal == NULL )
...@@ -2090,6 +2099,11 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox ) ...@@ -2090,6 +2099,11 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox )
{ {
sprintf( pMan->sError, "The number of actual IOs (%d) is different from the number of formal IOs (%d) when instantiating network %s in box %s.", sprintf( pMan->sError, "The number of actual IOs (%d) is different from the number of formal IOs (%d) when instantiating network %s in box %s.",
Vec_PtrSize(vBundles), Abc_NtkPiNum(pNtkBox) + Abc_NtkPoNum(pNtkBox), pNtkBox->pName, Abc_ObjName(pBox) ); Vec_PtrSize(vBundles), Abc_NtkPiNum(pNtkBox) + Abc_NtkPoNum(pNtkBox), pNtkBox->pName, Abc_ObjName(pBox) );
// free the bundling
Vec_PtrForEachEntry( Ver_Bundle_t *, vBundles, pBundle, k )
Ver_ParseFreeBundle( pBundle );
Vec_PtrFree( vBundles );
pBox->pCopy = NULL;
Ver_ParsePrintErrorMessage( pMan ); Ver_ParsePrintErrorMessage( pMan );
return 0; return 0;
} }
...@@ -2235,6 +2249,11 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox ) ...@@ -2235,6 +2249,11 @@ int Ver_ParseConnectBox( Ver_Man_t * pMan, Abc_Obj_t * pBox )
{ {
sprintf( pMan->sError, "It looks like formal output %s is driving a constant net (%s) when instantiating network %s in box %s.", sprintf( pMan->sError, "It looks like formal output %s is driving a constant net (%s) when instantiating network %s in box %s.",
pBundle->pNameFormal, Abc_ObjName(pNetAct), pNtkBox->pName, Abc_ObjName(pBox) ); pBundle->pNameFormal, Abc_ObjName(pNetAct), pNtkBox->pName, Abc_ObjName(pBox) );
// free the bundling
Vec_PtrForEachEntry( Ver_Bundle_t *, vBundles, pBundle, k )
Ver_ParseFreeBundle( pBundle );
Vec_PtrFree( vBundles );
pBox->pCopy = NULL;
Ver_ParsePrintErrorMessage( pMan ); Ver_ParsePrintErrorMessage( pMan );
return 0; return 0;
} }
...@@ -2826,13 +2845,14 @@ void Ver_ParsePrintLog( Ver_Man_t * pMan ) ...@@ -2826,13 +2845,14 @@ void Ver_ParsePrintLog( Ver_Man_t * pMan )
***********************************************************************/ ***********************************************************************/
int Ver_ParseAttachBoxes( Ver_Man_t * pMan ) int Ver_ParseAttachBoxes( Ver_Man_t * pMan )
{ {
int fPrintLog = 0;
Abc_Ntk_t * pNtk = NULL; Abc_Ntk_t * pNtk = NULL;
Ver_Bundle_t * pBundle; Ver_Bundle_t * pBundle;
Vec_Ptr_t * vUndefs; Vec_Ptr_t * vUndefs;
int i, RetValue, Counter, nMaxBoxSize; int i, RetValue, Counter, nMaxBoxSize;
// print the log file // print the log file
if ( pMan->pDesign->vModules && Vec_PtrSize(pMan->pDesign->vModules) > 1 ) if ( fPrintLog && pMan->pDesign->vModules && Vec_PtrSize(pMan->pDesign->vModules) > 1 )
Ver_ParsePrintLog( pMan ); Ver_ParsePrintLog( pMan );
// connect defined boxes // connect defined boxes
......
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