Commit 1c665557 by Alan Mishchenko

Memory abstraction.

parent 09810301
...@@ -395,6 +395,7 @@ extern void Wlc_NtkPrintNode( Wlc_Ntk_t * p, Wlc_Obj_t * pObj ); ...@@ -395,6 +395,7 @@ extern void Wlc_NtkPrintNode( Wlc_Ntk_t * p, Wlc_Obj_t * pObj );
extern void Wlc_NtkPrintNodeArray( Wlc_Ntk_t * p, Vec_Int_t * vArray ); extern void Wlc_NtkPrintNodeArray( Wlc_Ntk_t * p, Vec_Int_t * vArray );
extern void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type ); extern void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type );
extern void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fTwoSides, int fVerbose ); extern void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fTwoSides, int fVerbose );
extern void Wlc_NtkPrintObjects( Wlc_Ntk_t * p );
extern void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p ); extern void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p );
extern char * Wlc_NtkNewName( Wlc_Ntk_t * p, int iCoId, int fSeq ); extern char * Wlc_NtkNewName( Wlc_Ntk_t * p, int iCoId, int fSeq );
extern Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq ); extern Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq );
......
...@@ -309,9 +309,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -309,9 +309,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
int fShowMem = 0; int fShowMem = 0;
int fDistrib = 0; int fDistrib = 0;
int fTwoSides = 0; int fTwoSides = 0;
int fAllObjects = 0;
int c, fVerbose = 0; int c, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "cmardtvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "cmardtovh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -333,6 +334,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -333,6 +334,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 't': case 't':
fTwoSides ^= 1; fTwoSides ^= 1;
break; break;
case 'o':
fAllObjects ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -356,9 +360,11 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -356,9 +360,11 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD ); Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD );
if ( fShowMem ) if ( fShowMem )
Wlc_NtkPrintMemory( pNtk ); Wlc_NtkPrintMemory( pNtk );
if ( fAllObjects )
Wlc_NtkPrintObjects( pNtk );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: %%ps [-cmardtvh]\n" ); Abc_Print( -2, "usage: %%ps [-cmardtovh]\n" );
Abc_Print( -2, "\t prints statistics\n" ); Abc_Print( -2, "\t prints statistics\n" );
Abc_Print( -2, "\t-c : toggle printing cones [default = %s]\n", fShowCones? "yes": "no" ); Abc_Print( -2, "\t-c : toggle printing cones [default = %s]\n", fShowCones? "yes": "no" );
Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" ); Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" );
...@@ -366,6 +372,7 @@ usage: ...@@ -366,6 +372,7 @@ usage:
Abc_Print( -2, "\t-r : toggle printing memories [default = %s]\n", fShowMem? "yes": "no" ); Abc_Print( -2, "\t-r : toggle printing memories [default = %s]\n", fShowMem? "yes": "no" );
Abc_Print( -2, "\t-d : toggle printing distrubition [default = %s]\n", fDistrib? "yes": "no" ); Abc_Print( -2, "\t-d : toggle printing distrubition [default = %s]\n", fDistrib? "yes": "no" );
Abc_Print( -2, "\t-t : toggle printing stats for LHS and RHS [default = %s]\n", fTwoSides? "yes": "no" ); Abc_Print( -2, "\t-t : toggle printing stats for LHS and RHS [default = %s]\n", fTwoSides? "yes": "no" );
Abc_Print( -2, "\t-o : toggle printing all objects [default = %s]\n", fAllObjects?"yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -334,6 +334,8 @@ int Wlc_NtkCreateLevelsRev( Wlc_Ntk_t * p ) ...@@ -334,6 +334,8 @@ int Wlc_NtkCreateLevelsRev( Wlc_Ntk_t * p )
Vec_IntWriteEntry( &p->vLevels, i, LevelMax - Wlc_ObjLevelId(p, i) ); Vec_IntWriteEntry( &p->vLevels, i, LevelMax - Wlc_ObjLevelId(p, i) );
Wlc_NtkForEachCi( p, pObj, i ) Wlc_NtkForEachCi( p, pObj, i )
Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), 0 ); Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), 0 );
//Wlc_NtkForEachObj( p, pObj, i )
// printf( "%d -> %d\n", i, Wlc_ObjLevelId(p, i) );
return LevelMax; return LevelMax;
} }
...@@ -624,36 +626,36 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fTwoSides, int fVerbose ) ...@@ -624,36 +626,36 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fTwoSides, int fVerbose )
void Wlc_NtkPrintNode( Wlc_Ntk_t * p, Wlc_Obj_t * pObj ) void Wlc_NtkPrintNode( Wlc_Ntk_t * p, Wlc_Obj_t * pObj )
{ {
printf( "%8d : ", Wlc_ObjId(p, pObj) ); printf( "%8d : ", Wlc_ObjId(p, pObj) );
printf( "%3d%s", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s" : " " ); printf( "%6d%s = ", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s" : " " );
if ( pObj->Type == WLC_OBJ_PI ) if ( pObj->Type == WLC_OBJ_PI )
{ {
printf( " PI\n" ); printf( "PI\n" );
return; return;
} }
if ( pObj->Type == WLC_OBJ_FO ) if ( pObj->Type == WLC_OBJ_FO )
{ {
printf( " FO\n" ); printf( "FO\n" );
return; return;
} }
if ( pObj->Type == WLC_OBJ_CONST ) if ( pObj->Type != WLC_OBJ_CONST )
printf( " " );
else
{ {
printf( " = %3d%s %5s ", Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin0(p, pObj)) ? "s" : " ", Wlc_Names[(int)pObj->Type] ); printf( "%6d%s %5s ", Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin0(p, pObj)) ? "s" : " ", Wlc_Names[(int)pObj->Type] );
if ( Wlc_ObjFaninNum(pObj) > 1 ) if ( Wlc_ObjFaninNum(pObj) > 1 )
printf( "%3d%s ", Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin1(p, pObj)) ? "s" : " " ); printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin1(p, pObj)) ? "s" : " " );
else else
printf( " " ); printf( " " );
if ( Wlc_ObjFaninNum(pObj) > 2 ) if ( Wlc_ObjFaninNum(pObj) > 2 )
printf( "%3d%s ", Wlc_ObjRange(Wlc_ObjFanin2(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin2(p, pObj)) ? "s" : " " ); printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin2(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin2(p, pObj)) ? "s" : " " );
else else
printf( " " ); printf( " " );
} }
else
printf( " " );
printf( " : " ); printf( " : " );
printf( "%-12s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) ); printf( "%-12s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
if ( pObj->Type == WLC_OBJ_CONST ) if ( pObj->Type == WLC_OBJ_CONST )
{ {
printf( " = %d\'%sh", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s":"" ); printf( " = %d\'%sh", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s":"" );
if ( pObj->fXConst ) if ( pObj->fXConst )
{ {
int k; int k;
...@@ -723,6 +725,12 @@ void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fTwoSides, int fVerbose ...@@ -723,6 +725,12 @@ void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fTwoSides, int fVerbose
printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] ); printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] );
} }
} }
void Wlc_NtkPrintObjects( Wlc_Ntk_t * p )
{
Wlc_Obj_t * pObj; int i;
Wlc_NtkForEachObj( p, pObj, i )
Wlc_NtkPrintNode( p, pObj );
}
/**Function************************************************************* /**Function*************************************************************
...@@ -928,7 +936,8 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq ) ...@@ -928,7 +936,8 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq )
} }
if ( p->pSpec ) if ( p->pSpec )
pNew->pSpec = Abc_UtilStrsav( p->pSpec ); pNew->pSpec = Abc_UtilStrsav( p->pSpec );
Wlc_NtkTransferNames( pNew, p ); if ( Wlc_NtkHasNameId(p) )
Wlc_NtkTransferNames( pNew, p );
if ( Vec_IntSize(&p->vPoPairs) ) if ( Vec_IntSize(&p->vPoPairs) )
Vec_IntAppend( &pNew->vPoPairs, &p->vPoPairs ); Vec_IntAppend( &pNew->vPoPairs, &p->vPoPairs );
return pNew; return pNew;
......
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