src/base/temp.c File Reference

Go to the source code of this file.

Functions

int Abc_CommandOrder (Abc_Frame_t *pAbc, int argc, char **argv)

Function Documentation

int Abc_CommandOrder ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)

Function*************************************************************

Synopsis [Command procedure to allow for static BDD variable ordering.]

Description [This procedure should be integrated in "abc\src\base\abci\abc.c" similar to how procedure Abc_CommandReorder() is currently integrated.]

SideEffects []

SeeAlso []

Definition at line 14 of file temp.c.

00015 {
00016     FILE * pOut, * pErr, * pFile;
00017     Abc_Ntk_t * pNtk;
00018     char * pFileName;
00019     int c;
00020     int fReverse;
00021     int fVerbose;
00022     extern void Abc_NtkImplementCiOrder( Abc_Ntk_t * pNtk, char * pFileName, int fReverse, int fVerbose );
00023     extern void Abc_NtkFindCiOrder( Abc_Ntk_t * pNtk, int fReverse, int fVerbose );
00024 
00025     pNtk = Abc_FrameReadNtk(pAbc);
00026     pOut = Abc_FrameReadOut(pAbc);
00027     pErr = Abc_FrameReadErr(pAbc);
00028 
00029     // set defaults
00030     fReverse = 0;
00031     fVerbose = 0;
00032     Extra_UtilGetoptReset();
00033     while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF )
00034     {
00035         switch ( c )
00036         {
00037         case 'r':
00038             fReverse ^= 1;
00039             break;
00040         case 'v':
00041             fVerbose ^= 1;
00042             break;
00043         case 'h':
00044             goto usage;
00045         default:
00046             goto usage;
00047         }
00048     }
00049 
00050     if ( pNtk == NULL )
00051     {
00052         fprintf( pErr, "Empty network.\n" );
00053         return 1;
00054     }
00055 
00056     // if the var order file is given, implement this order
00057     pFileName = NULL;
00058     if ( argc == globalUtilOptind + 1 )
00059     {
00060         pFileName = argv[globalUtilOptind];
00061         pFile = fopen( pFileName, "r" );
00062         if ( pFile == NULL )
00063         {
00064             fprintf( pErr, "Cannot open file \"%s\" with the BDD variable order.\n", pFileName );
00065             return 1;
00066         }
00067         fclose( pFile );
00068     }
00069     if ( pFileName )
00070         Abc_NtkImplementCiOrder( pNtk, pFileName, fReverse, fVerbose );
00071     else
00072         Abc_NtkFindCiOrder( pNtk, fReverse, fVerbose );
00073     return 0;
00074 
00075 usage:
00076     fprintf( pErr, "usage: order [-rvh] <file>\n" );
00077     fprintf( pErr, "\t         computes a good static CI variable order\n" );
00078     fprintf( pErr, "\t-r     : toggle reverse ordering [default = %s]\n", fReverse? "yes": "no" );  
00079     fprintf( pErr, "\t-v     : prints verbose information [default = %s]\n", fVerbose? "yes": "no" );  
00080     fprintf( pErr, "\t-h     : print the command usage\n");
00081     fprintf( pErr, "\t<file> : (optional) file with the given variable order\n" );  
00082     return 1;
00083 }


Generated on Tue Jan 5 12:18:49 2010 for abc70930 by  doxygen 1.6.1