summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-01-26 22:22:22 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2017-01-26 22:22:22 -0800
commitc2b805dc85fa3c6e96cac04fa1d8ea182e9aab62 (patch)
tree7aaac0b835e1fad82b8983a164e7e2f39193388a /src
parent64d7119ddc7fb1720542b8071f490763466a5d31 (diff)
downloadabc-c2b805dc85fa3c6e96cac04fa1d8ea182e9aab62.tar.gz
abc-c2b805dc85fa3c6e96cac04fa1d8ea182e9aab62.tar.bz2
abc-c2b805dc85fa3c6e96cac04fa1d8ea182e9aab62.zip
Adding visualization of word-level networks Wlc_Ntk_t.
Diffstat (limited to 'src')
-rw-r--r--src/base/wlc/wlc.h2
-rw-r--r--src/base/wlc/wlcCom.c28
-rw-r--r--src/base/wlc/wlcNtk.c15
3 files changed, 31 insertions, 14 deletions
diff --git a/src/base/wlc/wlc.h b/src/base/wlc/wlc.h
index b898078f..d51b699c 100644
--- a/src/base/wlc/wlc.h
+++ b/src/base/wlc/wlc.h
@@ -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 Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq );
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 Wlc_Ntk_t * Wlc_NtkDupSingleNodes( Wlc_Ntk_t * p );
extern void Wlc_NtkShortNames( Wlc_Ntk_t * p );
diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c
index 9f36ad56..82321d3b 100644
--- a/src/base/wlc/wlcCom.c
+++ b/src/base/wlc/wlcCom.c
@@ -364,10 +364,10 @@ usage:
int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
{
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;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "Osvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "ORisvh" ) ) != EOF )
{
switch ( c )
{
@@ -382,6 +382,20 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( iOutput < 0 )
goto usage;
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':
fSeq ^= 1;
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" );
pName = Wlc_NtkNewName( pNtk, iOutput, fSeq );
- Wlc_NtkMarkCone( pNtk, iOutput, fSeq );
+ Wlc_NtkMarkCone( pNtk, iOutput, Range, fSeq, fAllPis );
pNtk = Wlc_NtkDupDfs( pNtk, 1, fSeq );
ABC_FREE( pNtk->pName );
pNtk->pName = Abc_UtilStrsav( pName );
Wlc_AbcUpdateNtk( pAbc, pNtk );
return 0;
usage:
- Abc_Print( -2, "usage: %%cone [-O num] [-svh]\n" );
- Abc_Print( -2, "\t extracts cone of the given word-level output\n" );
- Abc_Print( -2, "\t-O num : zero-based index of the word-level output to extract [default = %d]\n", iOutput );
+ Abc_Print( -2, "usage: %%cone [-OR num] [-isvh]\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 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-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
diff --git a/src/base/wlc/wlcNtk.c b/src/base/wlc/wlcNtk.c
index 822c2eb5..bd00a570 100644
--- a/src/base/wlc/wlcNtk.c
+++ b/src/base/wlc/wlcNtk.c
@@ -314,7 +314,7 @@ void Wlc_NtkCollectStats( Wlc_Ntk_t * p, int nObjs[2][WLC_OBJ_NUMBER] )
return;
for ( n = 0; n < 2; n++ )
{
- Wlc_NtkMarkCone( p, n, 1 );
+ Wlc_NtkMarkCone( p, n, 1, 1, 0 );
Wlc_NtkForEachObj( p, pObj, i )
if ( pObj->Mark )
nObjs[n][pObj->Type]++;
@@ -325,7 +325,7 @@ int Wlc_NtkCountRealPis( Wlc_Ntk_t * p )
{
Wlc_Obj_t * pObj;
int i, Count = 0;
- Wlc_NtkMarkCone( p, -1, 1 );
+ Wlc_NtkMarkCone( p, -1, -1, 1, 0 );
Wlc_NtkForEachPi( p, pObj, i )
Count += pObj->Mark;
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_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;
Wlc_Obj_t * pObj;
int i, CiId, CoId;
Wlc_NtkCleanMarks( p );
-// Wlc_NtkForEachPi( p, pObj, i )
-// pObj->Mark = 1;
+ if ( fAllPis )
+ Wlc_NtkForEachPi( p, pObj, i )
+ pObj->Mark = 1;
vFlops = Vec_IntAlloc( 100 );
Wlc_NtkForEachCo( p, pObj, i )
- if ( iCoId == -1 || i == iCoId )
+ if ( iCoId == -1 || (i >= iCoId && i < iCoId + Range) )
Wlc_NtkMarkCone_rec( p, pObj, vFlops );
if ( fSeq )
Vec_IntForEachEntry( vFlops, CiId, i )
@@ -885,7 +886,7 @@ void Wlc_NtkProfileCones( Wlc_Ntk_t * p )
int i, nPis, nFos, nNodes, nAdders, nMults;
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 );
printf( "Cone %5d : ", i );
printf( "PI = %4d ", nPis );