mirror of https://github.com/YosysHQ/abc.git
Adding visualization of word-level networks Wlc_Ntk_t.
This commit is contained in:
parent
64d7119ddc
commit
c2b805dc85
|
|
@ -293,7 +293,7 @@ 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 );
|
||||||
extern void Wlc_NtkCleanMarks( Wlc_Ntk_t * p );
|
extern void Wlc_NtkCleanMarks( Wlc_Ntk_t * p );
|
||||||
extern void Wlc_NtkMarkCone( Wlc_Ntk_t * p, int iCoId, int fSeq );
|
extern void Wlc_NtkMarkCone( Wlc_Ntk_t * p, int iCoId, int Range, int fSeq, int fAllPis );
|
||||||
extern void Wlc_NtkProfileCones( Wlc_Ntk_t * p );
|
extern void Wlc_NtkProfileCones( Wlc_Ntk_t * p );
|
||||||
extern Wlc_Ntk_t * Wlc_NtkDupSingleNodes( Wlc_Ntk_t * p );
|
extern Wlc_Ntk_t * Wlc_NtkDupSingleNodes( Wlc_Ntk_t * p );
|
||||||
extern void Wlc_NtkShortNames( Wlc_Ntk_t * p );
|
extern void Wlc_NtkShortNames( Wlc_Ntk_t * p );
|
||||||
|
|
|
||||||
|
|
@ -364,10 +364,10 @@ usage:
|
||||||
int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
|
int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
{
|
{
|
||||||
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
|
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
|
||||||
int c, iOutput = -1, fSeq = 0, fVerbose = 0;
|
int c, iOutput = -1, Range = 1, fAllPis = 0, fSeq = 0, fVerbose = 0;
|
||||||
char * pName;
|
char * pName;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Osvh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "ORisvh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -382,6 +382,20 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( iOutput < 0 )
|
if ( iOutput < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'R':
|
||||||
|
if ( globalUtilOptind >= argc )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" );
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
Range = atoi(argv[globalUtilOptind]);
|
||||||
|
globalUtilOptind++;
|
||||||
|
if ( Range < 0 )
|
||||||
|
goto usage;
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
fAllPis ^= 1;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
fSeq ^= 1;
|
fSeq ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -406,16 +420,18 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
}
|
}
|
||||||
printf( "Extracting output %d as a %s word-level network.\n", iOutput, fSeq ? "sequential" : "combinational" );
|
printf( "Extracting output %d as a %s word-level network.\n", iOutput, fSeq ? "sequential" : "combinational" );
|
||||||
pName = Wlc_NtkNewName( pNtk, iOutput, fSeq );
|
pName = Wlc_NtkNewName( pNtk, iOutput, fSeq );
|
||||||
Wlc_NtkMarkCone( pNtk, iOutput, fSeq );
|
Wlc_NtkMarkCone( pNtk, iOutput, Range, fSeq, fAllPis );
|
||||||
pNtk = Wlc_NtkDupDfs( pNtk, 1, fSeq );
|
pNtk = Wlc_NtkDupDfs( pNtk, 1, fSeq );
|
||||||
ABC_FREE( pNtk->pName );
|
ABC_FREE( pNtk->pName );
|
||||||
pNtk->pName = Abc_UtilStrsav( pName );
|
pNtk->pName = Abc_UtilStrsav( pName );
|
||||||
Wlc_AbcUpdateNtk( pAbc, pNtk );
|
Wlc_AbcUpdateNtk( pAbc, pNtk );
|
||||||
return 0;
|
return 0;
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: %%cone [-O num] [-svh]\n" );
|
Abc_Print( -2, "usage: %%cone [-OR num] [-isvh]\n" );
|
||||||
Abc_Print( -2, "\t extracts cone of the given word-level output\n" );
|
Abc_Print( -2, "\t extracts logic cone of one or more word-level outputs\n" );
|
||||||
Abc_Print( -2, "\t-O num : zero-based index of the word-level output to extract [default = %d]\n", iOutput );
|
Abc_Print( -2, "\t-O num : zero-based index of the first word-level output to extract [default = %d]\n", iOutput );
|
||||||
|
Abc_Print( -2, "\t-R num : total number of word-level outputs to extract [default = %d]\n", Range );
|
||||||
|
Abc_Print( -2, "\t-i : toggle using support composed of all primary inputs [default = %s]\n", fAllPis? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-s : toggle performing extracting sequential cones [default = %s]\n", fSeq? "yes": "no" );
|
Abc_Print( -2, "\t-s : toggle performing extracting sequential cones [default = %s]\n", fSeq? "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");
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ void Wlc_NtkCollectStats( Wlc_Ntk_t * p, int nObjs[2][WLC_OBJ_NUMBER] )
|
||||||
return;
|
return;
|
||||||
for ( n = 0; n < 2; n++ )
|
for ( n = 0; n < 2; n++ )
|
||||||
{
|
{
|
||||||
Wlc_NtkMarkCone( p, n, 1 );
|
Wlc_NtkMarkCone( p, n, 1, 1, 0 );
|
||||||
Wlc_NtkForEachObj( p, pObj, i )
|
Wlc_NtkForEachObj( p, pObj, i )
|
||||||
if ( pObj->Mark )
|
if ( pObj->Mark )
|
||||||
nObjs[n][pObj->Type]++;
|
nObjs[n][pObj->Type]++;
|
||||||
|
|
@ -325,7 +325,7 @@ int Wlc_NtkCountRealPis( Wlc_Ntk_t * p )
|
||||||
{
|
{
|
||||||
Wlc_Obj_t * pObj;
|
Wlc_Obj_t * pObj;
|
||||||
int i, Count = 0;
|
int i, Count = 0;
|
||||||
Wlc_NtkMarkCone( p, -1, 1 );
|
Wlc_NtkMarkCone( p, -1, -1, 1, 0 );
|
||||||
Wlc_NtkForEachPi( p, pObj, i )
|
Wlc_NtkForEachPi( p, pObj, i )
|
||||||
Count += pObj->Mark;
|
Count += pObj->Mark;
|
||||||
Wlc_NtkCleanMarks( p );
|
Wlc_NtkCleanMarks( p );
|
||||||
|
|
@ -859,17 +859,18 @@ void Wlc_NtkMarkCone_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFlops )
|
||||||
Wlc_ObjForEachFanin( pObj, iFanin, i )
|
Wlc_ObjForEachFanin( pObj, iFanin, i )
|
||||||
Wlc_NtkMarkCone_rec( p, Wlc_NtkObj(p, iFanin), vFlops );
|
Wlc_NtkMarkCone_rec( p, Wlc_NtkObj(p, iFanin), vFlops );
|
||||||
}
|
}
|
||||||
void Wlc_NtkMarkCone( Wlc_Ntk_t * p, int iCoId, int fSeq )
|
void Wlc_NtkMarkCone( Wlc_Ntk_t * p, int iCoId, int Range, int fSeq, int fAllPis )
|
||||||
{
|
{
|
||||||
Vec_Int_t * vFlops;
|
Vec_Int_t * vFlops;
|
||||||
Wlc_Obj_t * pObj;
|
Wlc_Obj_t * pObj;
|
||||||
int i, CiId, CoId;
|
int i, CiId, CoId;
|
||||||
Wlc_NtkCleanMarks( p );
|
Wlc_NtkCleanMarks( p );
|
||||||
// Wlc_NtkForEachPi( p, pObj, i )
|
if ( fAllPis )
|
||||||
// pObj->Mark = 1;
|
Wlc_NtkForEachPi( p, pObj, i )
|
||||||
|
pObj->Mark = 1;
|
||||||
vFlops = Vec_IntAlloc( 100 );
|
vFlops = Vec_IntAlloc( 100 );
|
||||||
Wlc_NtkForEachCo( p, pObj, i )
|
Wlc_NtkForEachCo( p, pObj, i )
|
||||||
if ( iCoId == -1 || i == iCoId )
|
if ( iCoId == -1 || (i >= iCoId && i < iCoId + Range) )
|
||||||
Wlc_NtkMarkCone_rec( p, pObj, vFlops );
|
Wlc_NtkMarkCone_rec( p, pObj, vFlops );
|
||||||
if ( fSeq )
|
if ( fSeq )
|
||||||
Vec_IntForEachEntry( vFlops, CiId, i )
|
Vec_IntForEachEntry( vFlops, CiId, i )
|
||||||
|
|
@ -885,7 +886,7 @@ void Wlc_NtkProfileCones( Wlc_Ntk_t * p )
|
||||||
int i, nPis, nFos, nNodes, nAdders, nMults;
|
int i, nPis, nFos, nNodes, nAdders, nMults;
|
||||||
Wlc_NtkForEachCo( p, pObj, i )
|
Wlc_NtkForEachCo( p, pObj, i )
|
||||||
{
|
{
|
||||||
Wlc_NtkMarkCone( p, i, 0 );
|
Wlc_NtkMarkCone( p, i, 1, 0, 0 );
|
||||||
nNodes = Wlc_NtkCountMarked( p, &nPis, &nFos, &nAdders, &nMults );
|
nNodes = Wlc_NtkCountMarked( p, &nPis, &nFos, &nAdders, &nMults );
|
||||||
printf( "Cone %5d : ", i );
|
printf( "Cone %5d : ", i );
|
||||||
printf( "PI = %4d ", nPis );
|
printf( "PI = %4d ", nPis );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue