summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abc.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-03-06 11:53:07 +0100
committerAlan Mishchenko <alanmi@berkeley.edu>2012-03-06 11:53:07 +0100
commitf7c7cb5c657058a60d7f7f92b68877c0e14ffb51 (patch)
tree3edb99a1a54612cd7184d51c85f67f95f563e262 /src/base/abci/abc.c
parent5ad0fea6060e84269bdd37526d97d0d70f5e70c5 (diff)
downloadabc-f7c7cb5c657058a60d7f7f92b68877c0e14ffb51.tar.gz
abc-f7c7cb5c657058a60d7f7f92b68877c0e14ffb51.tar.bz2
abc-f7c7cb5c657058a60d7f7f92b68877c0e14ffb51.zip
Adding switch '-n' to 'permute' to derive random topological ordering of internal nodes.
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r--src/base/abci/abc.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index c4d5df4c..079d1336 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -16962,12 +16962,15 @@ usage:
***********************************************************************/
int Abc_CommandPermute( Abc_Frame_t * pAbc, int argc, char ** argv )
{
+ extern Abc_Ntk_t * Abc_NtkRestrashRandom( Abc_Ntk_t * pNtk );
Abc_Ntk_t * pNtk = pAbc->pNtkCur, * pNtkRes = NULL;
int fInputs = 1;
int fOutputs = 1;
- int c, fFlops = 1;
+ int fFlops = 1;
+ int fNodes = 1;
+ int c;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "iofh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "iofnh" ) ) != EOF )
{
switch ( c )
{
@@ -16980,6 +16983,9 @@ int Abc_CommandPermute( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'f':
fFlops ^= 1;
break;
+ case 'n':
+ fNodes ^= 1;
+ break;
case 'h':
goto usage;
default:
@@ -16992,7 +16998,15 @@ int Abc_CommandPermute( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Empty network.\n" );
return 1;
}
- pNtkRes = Abc_NtkDup( pNtk );
+ if ( fNodes && !Abc_NtkIsStrash(pNtk) )
+ {
+ Abc_Print( -1, "To permute nodes, the network should be structurally hashed.\n" );
+ return 1;
+ }
+ if ( fNodes )
+ pNtkRes = Abc_NtkRestrashRandom( pNtk );
+ else
+ pNtkRes = Abc_NtkDup( pNtk );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Command \"permute\" has failed.\n" );
@@ -17003,11 +17017,12 @@ int Abc_CommandPermute( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
- Abc_Print( -2, "usage: permute [-iofh]\n" );
+ Abc_Print( -2, "usage: permute [-iofnh]\n" );
Abc_Print( -2, "\t performs random permutation of inputs/outputs/flops\n" );
Abc_Print( -2, "\t-i : toggle permuting primary inputs [default = %s]\n", fInputs? "yes": "no" );
Abc_Print( -2, "\t-o : toggle permuting primary outputs [default = %s]\n", fOutputs? "yes": "no" );
Abc_Print( -2, "\t-f : toggle permuting flip-flops [default = %s]\n", fFlops? "yes": "no" );
+ Abc_Print( -2, "\t-n : toggle deriving new topological ordering of nodes [default = %s]\n", fNodes? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}