diff options
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 909 |
1 files changed, 2 insertions, 907 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 08104383..b170bfc4 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -213,22 +213,6 @@ static int Abc_CommandFraigClean ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandFraigSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigDress ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecStop ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecPs ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecAdd ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecUse ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecFilter ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandRecStart2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecStop2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecPs2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecAdd2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecDump2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecMerge2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandRecFilter2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); - static int Abc_CommandRecStart3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecStop3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecPs3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -782,22 +766,6 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Fraiging", "fraig_sweep", Abc_CommandFraigSweep, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "dress", Abc_CommandFraigDress, 1 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_start", Abc_CommandRecStart, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_stop", Abc_CommandRecStop, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_add", Abc_CommandRecAdd, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_ps", Abc_CommandRecPs, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_use", Abc_CommandRecUse, 1 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_filter", Abc_CommandRecFilter, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_merge", Abc_CommandRecMerge, 0 ); - - Cmd_CommandAdd( pAbc, "Choicing", "rec_start2", Abc_CommandRecStart2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_stop2", Abc_CommandRecStop2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_ps2", Abc_CommandRecPs2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_add2", Abc_CommandRecAdd2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_dump2", Abc_CommandRecDump2, 1 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_filter2", Abc_CommandRecFilter2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_merge2", Abc_CommandRecMerge2, 0 ); - Cmd_CommandAdd( pAbc, "Choicing", "rec_start3", Abc_CommandRecStart3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_stop3", Abc_CommandRecStop3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_ps3", Abc_CommandRecPs3, 0 ); @@ -1053,10 +1021,6 @@ void Abc_End( Abc_Frame_t * pAbc ) Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia ); if ( Abc_FrameGetGlobalFrame()->pGia2 ) Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia2 ); - if ( Abc_NtkRecIsRunning() ) - Abc_NtkRecStop(); - if ( Abc_NtkRecIsRunning2() ) - Abc_NtkRecStop2(); if ( Abc_NtkRecIsRunning3() ) Abc_NtkRecStop3(); } @@ -13345,856 +13309,6 @@ usage: return 1; } - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecStart( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c; - int nVars; - int nCuts; - int fTrim; - - pNtk = Abc_FrameReadNtk(pAbc); - // set defaults - nVars = 6; - nCuts = 32; - fTrim = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCth" ) ) != EOF ) - { - switch ( c ) - { - case 'K': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); - goto usage; - } - nVars = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nVars < 1 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nCuts = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nCuts < 1 ) - goto usage; - break; - case 't': - fTrim ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !(nVars >= 3 && nVars <= 16) ) - { - Abc_Print( -1, "The range of allowed values is 3 <= K <= 16.\n" ); - return 0; - } - if ( Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "The AIG subgraph recording is already started.\n" ); - return 0; - } - if ( pNtk && !Abc_NtkIsStrash(pNtk) ) - { - Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); - return 0; - } - Abc_NtkRecStart( pNtk, nVars, nCuts, fTrim ); - return 0; - -usage: - Abc_Print( -2, "usage: rec_start [-K num] [-C num] [-th]\n" ); - Abc_Print( -2, "\t starts recording AIG subgraphs (should be called for\n" ); - Abc_Print( -2, "\t an empty network or after reading in a previous record)\n" ); - Abc_Print( -2, "\t-K num : the largest number of inputs [default = %d]\n", nVars ); - Abc_Print( -2, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCuts ); - Abc_Print( -2, "\t-t : toggles the use of trimming [default = %s]\n", fTrim? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecStop( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works only after calling \"rec_start\".\n" ); - return 0; - } - Abc_NtkRecStop(); - return 0; - -usage: - Abc_Print( -2, "usage: rec_stop [-h]\n" ); - Abc_Print( -2, "\t cleans the internal storage for AIG subgraphs\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecPs( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c, fPrintLib = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "ph" ) ) != EOF ) - { - switch ( c ) - { - case 'p': - fPrintLib ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); - return 0; - } - Abc_NtkRecPs(fPrintLib); - return 0; - -usage: - Abc_Print( -2, "usage: rec_ps [-h]\n" ); - Abc_Print( -2, "\t prints statistics about the recorded AIG subgraphs\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecAdd( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c; - int fUseSOPB = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "gh" ) ) != EOF ) - { - switch ( c ) - { - case 'g': - fUseSOPB = 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkIsStrash(pNtk) ) - { - Abc_Print( -1, "This command works for AIGs.\n" ); - return 0; - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works for AIGs after calling \"rec_start\".\n" ); - return 0; - } - Abc_NtkRecAdd( pNtk, fUseSOPB); - return 0; - -usage: - Abc_Print( -2, "usage: rec_add [-h]\n" ); - Abc_Print( -2, "\t adds subgraphs from the current network to the set\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecUse( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Abc_Ntk_t * pNtk, * pNtkRes; - int c; - - pNtk = Abc_FrameReadNtk(pAbc); - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); - return 0; - } - // get the new network - pNtkRes = Abc_NtkRecUse(); - if ( pNtkRes == NULL ) - { - Abc_Print( -1, "Transforming internal AIG subgraphs into an AIG with choices has failed.\n" ); - return 1; - } - // replace the current network - Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); - return 0; - -usage: - Abc_Print( -2, "usage: rec_use [-h]\n" ); - Abc_Print( -2, "\t transforms internal storage into an AIG with choices\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecFilter( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c, nLimit = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Fh" ) ) != EOF ) - { - switch ( c ) - { - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - nLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nLimit < 0 ) - goto usage; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); - return 0; - } - if (!Abc_NtkRecIsInTrimMode()) - Abc_Print( 0, "This command works fine only in trim mode. Please call \"rec_start -t\" first.\n" ); - - Abc_NtkRecFilter(nLimit); - return 0; - -usage: - Abc_Print( -2, "usage: rec_filter [-h]\n" ); - Abc_Print( -2, "\t filter the library of the recorder\n" ); - Abc_Print( -2, "\t-F num : the limit number of function class [default = %d]\n", nLimit ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Abc_Ntk_t * pNtk; - int c; - - pNtk = Abc_FrameReadNtk(pAbc); - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); - return 0; - } - Abc_NtkRecLibMerge(pNtk); - return 0; - -usage: - Abc_Print( -2, "usage: rec_merge [-h]\n" ); - Abc_Print( -2, "\t merge libraries\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecStart2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - //Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - char * FileName, * pTemp; - char ** pArgvNew; - int nArgcNew; - FILE * pFile; - Gia_Man_t * pGia = NULL; - int c; - int nVars; - int nCuts; - int fTrim; - - //pNtk = Abc_FrameReadNtk(pAbc); - // set defaults - nVars = 6; - nCuts = 32; - fTrim = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCth" ) ) != EOF ) - { - switch ( c ) - { - case 'K': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); - goto usage; - } - nVars = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nVars < 1 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nCuts = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nCuts < 1 ) - goto usage; - break; - case 't': - fTrim ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !(nVars >= 3 && nVars <= 16) ) - { - Abc_Print( -1, "The range of allowed values is 3 <= K <= 16.\n" ); - return 0; - } - if ( Abc_NtkRecIsRunning() ) - { - Abc_Print( -1, "The AIG subgraph recording is already started.\n" ); - return 0; - } -// if ( pNtk && !Abc_NtkIsStrash(pNtk) ) -// { -// Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); -// return 0; -// } - pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - if ( nArgcNew != 1 ) - Abc_Print( 1, "File name is not given on the command line. Start a new record.\n" ); - else - { - // get the input file name - FileName = pArgvNew[0]; - // fix the wrong symbol - for ( pTemp = FileName; *pTemp; pTemp++ ) - if ( *pTemp == '>' ) - *pTemp = '\\'; - if ( (pFile = fopen( FileName, "r" )) == NULL ) - { - Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); - if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) - Abc_Print( 1, "Did you mean \"%s\"?", FileName ); - Abc_Print( 1, "\n" ); - return 1; - } - fclose( pFile ); - pGia = Gia_AigerRead( FileName, 1, 0 ); - if ( pGia == NULL ) - { - Abc_Print( -1, "Reading AIGER has failed.\n" ); - return 0; - } - } - Abc_NtkRecStart2( pGia, nVars, nCuts, fTrim ); - return 0; - -usage: - Abc_Print( -2, "usage: rec_start2 [-K num] [-C num] [-th]\n" ); - Abc_Print( -2, "\t starts recording AIG subgraphs (should be called for\n" ); - Abc_Print( -2, "\t an empty network or after reading in a previous record)\n" ); - Abc_Print( -2, "\t-K num : the largest number of inputs [default = %d]\n", nVars ); - Abc_Print( -2, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCuts ); - Abc_Print( -2, "\t-t : toggles the use of trimming [default = %s]\n", fTrim? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecStop2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "This command works only after calling \"rec_start2\".\n" ); - return 0; - } - Abc_NtkRecStop2(); - return 0; - -usage: - Abc_Print( -2, "usage: rec_stop2 [-h]\n" ); - Abc_Print( -2, "\t cleans the internal storage for AIG subgraphs\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecPs2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c, fPrintLib = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "ph" ) ) != EOF ) - { - switch ( c ) - { - case 'p': - fPrintLib ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start2\".\n" ); - return 0; - } - Abc_NtkRecPs2(fPrintLib); - return 0; - -usage: - Abc_Print( -2, "usage: rec_ps2 [-h]\n" ); - Abc_Print( -2, "\t prints statistics about the recorded AIG subgraphs\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecAdd2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c; - int fUseSOPB = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "gh" ) ) != EOF ) - { - switch ( c ) - { - case 'g': - fUseSOPB = 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkIsStrash(pNtk) ) - { - Abc_Print( -1, "This command works for AIGs.\n" ); - return 0; - } - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "This command works for AIGs after calling \"rec_start2\".\n" ); - return 0; - } - Abc_NtkRecAdd2( pNtk, fUseSOPB); - return 0; - -usage: - Abc_Print( -2, "usage: rec_add2 [-h]\n" ); - Abc_Print( -2, "\t adds subgraphs from the current network to the set\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecDump2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - //Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - char * FileName; - char ** pArgvNew; - int nArgcNew; - Gia_Man_t * pGia; - int c; - - //pNtk = Abc_FrameReadNtk(pAbc); - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "The AIG subgraph recording is not started.\n" ); - return 1; - } - pGia = Abc_NtkRecGetGia(); - pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - if ( nArgcNew != 1 ) - { - Abc_Print( -1, "File name is not given on the command line.\n" ); - return 1; - } - else if(Gia_ManPoNum(pGia) == 0) - { - Abc_Print( 0, "No structure in the library.\n" ); - return 1; - } - else - { - // get the input file name - FileName = pArgvNew[0]; - Gia_AigerWrite( pGia, FileName, 0, 0 ); - } - return 0; - -usage: - Abc_Print( -2, "usage: rec_dump2 [-h] <file>\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecFilter2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ -// Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int c, nLimit = 0; - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Fh" ) ) != EOF ) - { - switch ( c ) - { - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - nLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nLimit < 0 ) - goto usage; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start2\".\n" ); - return 0; - } - if (!Abc_NtkRecIsInTrimMode2()) - Abc_Print( 0, "This command works fine only in trim mode. Please call \"rec_start2 -t\" first.\n" ); - - Abc_NtkRecFilter2(nLimit); - return 0; - -usage: - Abc_Print( -2, "usage: rec_filter2 [-h]\n" ); - Abc_Print( -2, "\t filter the library of the recorder\n" ); - Abc_Print( -2, "\t-F num : the limit number of function class [default = %d]\n", nLimit ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandRecMerge2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - int c; - char * FileName, * pTemp; - char ** pArgvNew; - int nArgcNew; - FILE * pFile; - Gia_Man_t * pGia = NULL; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( !Abc_NtkRecIsRunning2() ) - { - Abc_Print( -1, "This command works for AIGs only after calling \"rec_start2\".\n" ); - return 0; - } - pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - if ( nArgcNew != 1 ) - { - Abc_Print( -1, "File name is not given on the command line.\n" ); - return 1; - } - else - { - // get the input file name - FileName = pArgvNew[0]; - // fix the wrong symbol - for ( pTemp = FileName; *pTemp; pTemp++ ) - if ( *pTemp == '>' ) - *pTemp = '\\'; - if ( (pFile = fopen( FileName, "r" )) == NULL ) - { - Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); - if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) - Abc_Print( 1, "Did you mean \"%s\"?", FileName ); - Abc_Print( 1, "\n" ); - return 1; - } - fclose( pFile ); - pGia = Gia_AigerRead( FileName, 0, 0 ); - if ( pGia == NULL ) - { - Abc_Print( -1, "Reading AIGER has failed.\n" ); - return 0; - } - } - Abc_NtkRecLibMerge2(pGia); - return 0; - -usage: - Abc_Print( -2, "usage: rec_merge2 [-h]\n" ); - Abc_Print( -2, "\t merge libraries\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - - /**Function************************************************************* Synopsis [] @@ -15969,33 +15083,14 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->fUserRecLib ) { - if ( Abc_NtkRecIsRunning() + Abc_NtkRecIsRunning2() + Abc_NtkRecIsRunning3() != 1 ) - { - printf( "Exactly one LMS manager should be running.\n" ); - return 0; - } - if ( Abc_NtkRecIsRunning3() && Abc_NtkRecInputNum3() != pPars->nLutSize ) + assert( Abc_NtkRecIsRunning3() ); + if ( Abc_NtkRecInputNum3() != pPars->nLutSize ) { printf( "The number of library inputs (%d) different from the K parameters (%d).\n", Abc_NtkRecInputNum3(), pPars->nLutSize ); return 0; } } -/* - // modify for LUT structures - if ( pPars->pLutStruct ) - { - if ( pPars->nLutSize == -1 ) - { - Abc_Print( -1, "Please specify the maximum cut size (-K <num>) when LUT structure is used.\n" ); - return 1; - } - pPars->fTruth = 1; - pPars->fExpRed = 0; - pPars->fUsePerm = 1; - pPars->pLutLib = NULL; - } -*/ // complain if truth tables are requested but the cut size is too large if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE ) { |