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 );
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_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 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 );
......
......@@ -309,9 +309,10 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
int fShowMem = 0;
int fDistrib = 0;
int fTwoSides = 0;
int fAllObjects = 0;
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "cmardtvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "cmardtovh" ) ) != EOF )
{
switch ( c )
{
......@@ -333,6 +334,9 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 't':
fTwoSides ^= 1;
break;
case 'o':
fAllObjects ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -356,9 +360,11 @@ int Abc_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_NtkPrintNodes( pNtk, WLC_OBJ_ARI_ADD );
if ( fShowMem )
Wlc_NtkPrintMemory( pNtk );
if ( fAllObjects )
Wlc_NtkPrintObjects( pNtk );
return 0;
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-c : toggle printing cones [default = %s]\n", fShowCones? "yes": "no" );
Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" );
......@@ -366,6 +372,7 @@ usage:
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-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-h : print the command usage\n");
return 1;
......
......@@ -334,6 +334,8 @@ int Wlc_NtkCreateLevelsRev( Wlc_Ntk_t * p )
Vec_IntWriteEntry( &p->vLevels, i, LevelMax - Wlc_ObjLevelId(p, i) );
Wlc_NtkForEachCi( p, pObj, i )
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;
}
......@@ -624,31 +626,31 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fTwoSides, int fVerbose )
void Wlc_NtkPrintNode( Wlc_Ntk_t * p, Wlc_Obj_t * 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 )
{
printf( " PI\n" );
printf( "PI\n" );
return;
}
if ( pObj->Type == WLC_OBJ_FO )
{
printf( " FO\n" );
printf( "FO\n" );
return;
}
if ( pObj->Type == WLC_OBJ_CONST )
printf( " " );
else
if ( pObj->Type != WLC_OBJ_CONST )
{
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 )
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
printf( " " );
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
printf( " " );
}
else
printf( " " );
printf( " : " );
printf( "%-12s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
if ( pObj->Type == WLC_OBJ_CONST )
......@@ -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] );
}
}
void Wlc_NtkPrintObjects( Wlc_Ntk_t * p )
{
Wlc_Obj_t * pObj; int i;
Wlc_NtkForEachObj( p, pObj, i )
Wlc_NtkPrintNode( p, pObj );
}
/**Function*************************************************************
......@@ -928,6 +936,7 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq )
}
if ( p->pSpec )
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
if ( Wlc_NtkHasNameId(p) )
Wlc_NtkTransferNames( pNew, p );
if ( Vec_IntSize(&p->vPoPairs) )
Vec_IntAppend( &pNew->vPoPairs, &p->vPoPairs );
......
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