39static int CmdCommandTime (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
40static int CmdCommandSleep (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
41static int CmdCommandEcho (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
42static int CmdCommandQuit (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
43static int CmdCommandAbcrc (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
44static int CmdCommandHistory (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
45static int CmdCommandAlias (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
46static int CmdCommandUnalias (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
47static int CmdCommandHelp (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
48static int CmdCommandSource (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
49static int CmdCommandSetVariable (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
50static int CmdCommandUnsetVariable (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
51static int CmdCommandUndo (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
52static int CmdCommandRecall (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
53static int CmdCommandEmpty (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
55static int CmdCommandScanDir (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
56static int CmdCommandRenameFiles (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
57static int CmdCommandLs (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
58static int CmdCommandScrGen (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
60static int CmdCommandScrGenLinux (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
62static int CmdCommandVersion (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
63static int CmdCommandSGen (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
64static int CmdCommandSis (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
65static int CmdCommandMvsis (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
66static int CmdCommandCapo (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
67static int CmdCommandStarter (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
68static int CmdCommandAutoTuner (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
90 pAbc->aHistory = Vec_PtrAlloc( 100 );
104 Cmd_CommandAdd( pAbc,
"Basic",
"unset", CmdCommandUnsetVariable, 0 );
110 Cmd_CommandAdd( pAbc,
"Basic",
"renamefiles", CmdCommandRenameFiles, 0 );
114 Cmd_CommandAdd( pAbc,
"Basic",
"scrgen", CmdCommandScrGenLinux, 0 );
122 Cmd_CommandAdd( pAbc,
"Various",
"starter", CmdCommandStarter, 0 );
123 Cmd_CommandAdd( pAbc,
"Various",
"autotuner", CmdCommandAutoTuner, 0 );
142 char * pKey, * pValue;
149 st__foreach_item( pAbc->tCommands, gen, (
const char **)&pKey, (
char **)&pValue )
153 st__foreach_item( pAbc->tAliases, gen, (
const char **)&pKey, (
char **)&pValue )
157 st__foreach_item( pAbc->tFlags, gen, (
const char **)&pKey, (
char **)&pValue )
161 Vec_PtrFreeFree( pAbc->aHistory );
177int CmdCommandTime(
Abc_Frame_t * pAbc,
int argc,
char **argv )
200 pAbc->TimeTotal += pAbc->TimeCommand;
201 pAbc->TimeCommand = 0.0;
211 pAbc->TimeTotal += pAbc->TimeCommand;
212 fprintf( pAbc->Out,
"elapse: %3.2f seconds, total: %3.2f seconds\n",
213 pAbc->TimeCommand, pAbc->TimeTotal );
222 pAbc->TimeCommand = 0.0;
226 fprintf( pAbc->Err,
"usage: time [-ch]\n" );
227 fprintf( pAbc->Err,
" \t\tprint the runtime since the last call\n" );
228 fprintf( pAbc->Err,
" -c \t\tclears the elapsed time without printing it\n" );
229 fprintf( pAbc->Err,
" -h \t\tprint the command usage\n" );
244int CmdCommandSleep(
Abc_Frame_t * pAbc,
int argc,
char **argv )
247 char * pFileName = NULL;
257 Abc_Print( -1,
"Command line switch \"-N\" should be followed by an integer.\n" );
275 while ( (pFile = fopen(pFileName,
"rb")) == NULL );
280 clkStop = Abc_Clock() + nSecs * CLOCKS_PER_SEC;
281 while ( Abc_Clock() < clkStop );
285 fprintf( pAbc->Err,
"usage: sleep [-N <num>] [-h] <file_name>\n" );
286 fprintf( pAbc->Err,
"\t puts ABC to sleep for some time\n" );
287 fprintf( pAbc->Err,
"\t-N num : time duration in seconds [default = %d]\n", nSecs );
288 fprintf( pAbc->Err,
"\t-h : toggle printing the command usage\n" );
289 fprintf( pAbc->Err,
"\t<file_name> : (optional) waiting begins after the file is created\n" );
303int CmdCommandEcho(
Abc_Frame_t * pAbc,
int argc,
char **argv )
325 if (pAbc->Out == stdout){
327 Abc_Print( 1,
"%s ", argv[i] );
329 Abc_Print( 1,
"\n" );
333 fprintf( pAbc->Out,
"%s ", argv[i] );
335 fprintf( pAbc->Out,
"\n" );
337 fflush ( pAbc->Out );
342 fprintf( pAbc->Err,
"usage: echo [-h] string \n" );
343 fprintf( pAbc->Err,
" -n \t\tsuppress newline at the end\n" );
344 fprintf( pAbc->Err,
" -h \t\tprint the command usage\n" );
359int CmdCommandQuit(
Abc_Frame_t * pAbc,
int argc,
char **argv )
384 fprintf( pAbc->Err,
"usage: quit [-sh]\n" );
385 fprintf( pAbc->Err,
" -h print the command usage\n" );
386 fprintf( pAbc->Err,
" -s frees all the memory before quitting\n" );
401int CmdCommandAbcrc(
Abc_Frame_t * pAbc,
int argc,
char **argv )
421 fprintf( pAbc->Err,
"usage: abcrc [-h]\n" );
422 fprintf( pAbc->Err,
" -h sources \"abc.rc\" from the current/parent/grandparent directory\n" );
437int CmdCommandHistory(
Abc_Frame_t * pAbc,
int argc,
char **argv )
439 char * pName, * pStr = NULL;
457 if ( pStr && pStr[0] >=
'1' && pStr[0] <=
'9' )
458 nPrints = atoi(pStr), pStr = NULL;
460 if ( pStr == NULL ) {
462 fprintf( pAbc->Out,
"%2d : %s\n", Vec_PtrSize(pAbc->aHistory)-i, pName );
466 if (
strstr(pName, pStr) )
467 fprintf( pAbc->Out,
"%2d : %s\n", Vec_PtrSize(pAbc->aHistory)-i, pName );
472 fprintf( pAbc->Err,
"usage: history [-h] <num>\n" );
473 fprintf( pAbc->Err,
"\t lists the last commands entered on the command line\n" );
474 fprintf( pAbc->Err,
"\t-h : print the command usage\n" );
475 fprintf( pAbc->Err,
"\t<num> : the maximum number of entries to show [default = %d]\n", nPrints );
490int CmdCommandAlias(
Abc_Frame_t * pAbc,
int argc,
char **argv )
516 else if ( argc == 2 )
531 fprintf( pAbc->Err,
"usage: alias [-h] [command [string]]\n" );
532 fprintf( pAbc->Err,
" -h \t\tprint the command usage\n" );
547int CmdCommandUnalias(
Abc_Frame_t * pAbc,
int argc,
char **argv )
572 for ( i = 1; i < argc; i++ )
583 fprintf( pAbc->Err,
"usage: unalias [-h] alias_names\n" );
584 fprintf( pAbc->Err,
" -h \t\tprint the command usage\n" );
599int CmdCommandHelp(
Abc_Frame_t * pAbc,
int argc,
char **argv )
601 int fPrintAll, fDetails;
634 fprintf( pAbc->Err,
"usage: help [-a] [-d] [-h]\n" );
635 fprintf( pAbc->Err,
" prints the list of available commands by group\n" );
636 fprintf( pAbc->Err,
" -a toggle printing hidden commands [default = %s]\n", fPrintAll?
"yes":
"no" );
637 fprintf( pAbc->Err,
" -d print usage details to all commands [default = %s]\n", fDetails?
"yes":
"no" );
638 fprintf( pAbc->Err,
" -h print the command usage\n" );
653int CmdCommandSource(
Abc_Frame_t * pAbc,
int argc,
char **argv )
655 int c, echo, prompt, silent, interactive, quit_count, lp_count;
657 int lp_file_index, did_subst;
658 char *prompt_string, *real_filename, line[
ABC_MAX_STR], *command;
661 interactive = silent = prompt = echo = 0;
706 char * pFileName, * pTemp;
709 pFileName = argv[lp_file_index];
711 for ( pTemp = pFileName; *pTemp; pTemp++ )
717 fp =
CmdFileOpen( pAbc, pFileName,
"r", &real_filename, silent );
731 if ( prompt_string == NULL )
732 prompt_string =
"abc> ";
737 prompt_string = NULL;
748 if ( quit_count++ < 5 )
750 fprintf( pAbc->Err,
"\nUse \"quit\" to leave ABC.\n" );
765 fprintf( pAbc->Out,
"abc - > %s", line );
768 if ( command == NULL )
777 fprintf( pAbc->Out,
"%s\n", command );
780 if ( command != line )
784 if ( interactive && *line !=
'\0' )
787 if ( pAbc->Hst != NULL )
789 fprintf( pAbc->Hst,
"%s\n", line );
797 while ( status == 0 );
804 "** cmd error: aborting 'source %s'\n",
812 while ( ( status == 0 ) && ( lp_count <= 0 ) );
817 fprintf( pAbc->Err,
"usage: source [-psxh] <file_name>\n" );
818 fprintf( pAbc->Err,
"\t-p supply prompt before reading each line [default = %s]\n", prompt?
"yes":
"no" );
819 fprintf( pAbc->Err,
"\t-s silently ignore nonexistent file [default = %s]\n", silent?
"yes":
"no" );
820 fprintf( pAbc->Err,
"\t-x echo each line as it is executed [default = %s]\n", echo?
"yes":
"no" );
821 fprintf( pAbc->Err,
"\t-h print the command usage\n" );
836int CmdCommandSetVariable(
Abc_Frame_t * pAbc,
int argc,
char **argv )
838 char *flag_value, *
value;
853 if ( argc == 0 || argc > 3 )
857 else if ( argc == 1 )
875 if (
strcmp( argv[1],
"abcout" ) == 0 )
877 if ( pAbc->Out != stdout )
879 if (
strcmp( flag_value,
"" ) == 0 )
881 pAbc->Out =
CmdFileOpen( pAbc, flag_value,
"w", NULL, 0 );
882 if ( pAbc->Out == NULL )
885 setvbuf( pAbc->Out, (
char * ) NULL, _IOLBF, 0 );
888 if (
strcmp( argv[1],
"abcerr" ) == 0 )
890 if ( pAbc->Err != stderr )
892 if (
strcmp( flag_value,
"" ) == 0 )
894 pAbc->Err =
CmdFileOpen( pAbc, flag_value,
"w", NULL, 0 );
895 if ( pAbc->Err == NULL )
898 setvbuf( pAbc->Err, (
char * ) NULL, _IOLBF, 0 );
901 if (
strcmp( argv[1],
"history" ) == 0 )
903 if ( pAbc->Hst != NULL )
905 if (
strcmp( flag_value,
"" ) == 0 )
909 pAbc->Hst =
CmdFileOpen( pAbc, flag_value,
"w", NULL, 0 );
910 if ( pAbc->Hst == NULL )
918 fprintf( pAbc->Err,
"usage: set [-h] <name> <value>\n" );
919 fprintf( pAbc->Err,
"\t sets the value of parameter <name>\n" );
920 fprintf( pAbc->Err,
"\t-h : print the command usage\n" );
936int CmdCommandUnsetVariable(
Abc_Frame_t * pAbc,
int argc,
char **argv )
961 for ( i = 1; i < argc; i++ )
974 fprintf( pAbc->Err,
"usage: unset [-h] <name> \n" );
975 fprintf( pAbc->Err,
"\t removes the value of parameter <name>\n" );
976 fprintf( pAbc->Err,
"\t-h : print the command usage\n" );
991int CmdCommandUndo(
Abc_Frame_t * pAbc,
int argc,
char **argv )
993 if ( argc == 2 && !
strcmp(argv[1],
"-h") )
996 if ( pAbc->pNtkCur == NULL )
998 fprintf( pAbc->Out,
"Empty network.\n" );
1005 return CmdCommandRecall( pAbc, argc, argv );
1008 fprintf( pAbc->Err,
"usage: undo\n" );
1009 fprintf( pAbc->Err,
" sets the current network to be the previously saved network\n" );
1025int CmdCommandRecall(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1028 int iStep, iStepFound;
1031 int iStepStart, iStepStop;
1045 if ( pAbc->pNtkCur == NULL )
1047 fprintf( pAbc->Out,
"Empty network.\n" );
1054 if ( pValue == NULL )
1057 nNetsToSave = atoi(pValue);
1064 pNtk = Abc_NtkBackup(pAbc->pNtkCur);
1066 fprintf( pAbc->Out,
"There is no previously saved network.\n" );
1074 iStep = atoi(argv[1]);
1076 if ( iStep >= pAbc->nSteps )
1078 iStepStart = pAbc->nSteps - nNetsToSave;
1079 if ( iStepStart <= 0 )
1081 iStepStop = pAbc->nSteps;
1082 if ( iStepStop <= 0 )
1084 if ( iStepStart == iStepStop )
1085 fprintf( pAbc->Out,
"Can only recall step %d.\n", iStepStop );
1087 fprintf( pAbc->Out,
"Can only recall steps %d-%d.\n", iStepStart, iStepStop );
1089 else if ( iStep < 0 )
1090 fprintf( pAbc->Out,
"Cannot recall step %d.\n", iStep );
1091 else if ( iStep == 0 )
1098 for ( pNtk = pAbc->pNtkCur; pNtk; pNtk = Abc_NtkBackup(pNtk) )
1099 if ( (iStepFound = Abc_NtkStep(pNtk)) == iStep )
1103 iStepStart = iStepFound;
1104 if ( iStepStart <= 0 )
1106 iStepStop = pAbc->nSteps;
1107 if ( iStepStop <= 0 )
1109 if ( iStepStart == iStepStop )
1110 fprintf( pAbc->Out,
"Can only recall step %d.\n", iStepStop );
1112 fprintf( pAbc->Out,
"Can only recall steps %d-%d.\n", iStepStart, iStepStop );
1122 fprintf( pAbc->Err,
"usage: recall -h <num>\n" );
1123 fprintf( pAbc->Err,
" set the current network to be one of the previous networks\n" );
1124 fprintf( pAbc->Err,
"<num> : level to return to [default = previous]\n" );
1125 fprintf( pAbc->Err,
" -h : print the command usage\n");
1141int CmdCommandEmpty(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1162 fprintf( pAbc->Err,
"usage: empty [-h]\n" );
1163 fprintf( pAbc->Err,
" removes all the currently stored networks\n" );
1164 fprintf( pAbc->Err,
" -h : print the command usage\n");
1182int CmdCommandUndo(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1199 pNtkTemp = pAbc->pNtk;
1200 pAbc->pNtk = pAbc->pNtkSaved;
1201 pAbc->pNtkSaved = pNtkTemp;
1204 pNtkTemp = Cmd_HistoryGetSnapshot(pAbc,
id);
1206 fprintf( pAbc->Err,
"Snapshot %d does not exist\n",
id);
1208 pAbc->pNtk =
Abc_NtkDup(pNtkTemp, Abc_NtkMan(pNtkTemp));
1212 fprintf( pAbc->Err,
"usage: undo\n" );
1213 fprintf( pAbc->Err,
" swaps the current network and the backup network\n" );
1235int CmdCommandScanDir(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1237 struct _finddata_t c_file;
1238 char * pDirStr = NULL;
1239 char* pDirCur = NULL;
1251 fprintf( pAbc->Err,
"Command line switch \"-D\" should be followed by a string.\n" );
1265 if( (pDirCur = _getcwd( NULL, 0 )) == NULL )
1267 printf(
"Cannot read current directory\n" );
1270 if ( _chdir(pDirStr) )
1272 printf(
"Cannot change to directory: %s\n", pDirStr );
1277 if( (hFile = _findfirst(
"*.txt", &c_file )) == -1L )
1280 printf(
"No .txt files in the current directory.\n" );
1282 printf(
"No .txt files in directory: %s\n", pDirStr );
1288 FILE * pFile = fopen( c_file.name,
"rb" );
1289 char * pStr1 =
"Property UNDECIDED. Time =";
1290 char * pStr2 =
"Property proved. Time =";
1291 char * pStr3 =
"Time =";
1292 char * pBuffer, * pPlace, * pThis, * pThat;
1296 sprintf( FileName,
"%s", c_file.name );
1297 pThis =
strrchr( FileName,
'_' );
1298 pThat =
strchr( FileName,
'.' );
1299 if ( pThis == NULL || pThat == NULL || pThis >= pThat )
1307 if ( pFile == NULL )
1309 printf(
"Cannot open file %s\n", c_file.name );
1314 pPlace =
strstr( pBuffer, pStr1 );
1315 if ( pPlace == NULL )
1317 pPlace =
strstr( pBuffer, pStr2 );
1318 if ( pPlace == NULL )
1320 pPlace =
strstr( pBuffer, pStr3 );
1321 if ( pPlace == NULL )
1328 pPlace +=
strlen( pStr3 );
1331 pPlace +=
strlen( pStr2 );
1334 pPlace +=
strlen( pStr1 );
1335 sscanf( pPlace,
"%f", &Time );
1336 printf(
"%s %.2f\n", pThis, Time );
1339 while( _findnext( hFile, &c_file ) == 0 );
1340 _findclose( hFile );
1344 if ( _chdir(pDirCur) )
1347 printf(
"Cannot change to directory: %s\n", pDirCur );
1355 fprintf( pAbc->Err,
"usage: scandir [-D string]\n" );
1356 fprintf( pAbc->Err,
" performs custom scanning of the files in the given directory\n" );
1357 fprintf( pAbc->Err,
"\t-D str : the directory to read files from [default = current]\n" );
1374int CmfFindNumber(
char * pName )
1377 for ( pTemp = pName; *pTemp; pTemp++ )
1378 if ( *pTemp ==
'.' )
1382 for ( --pTemp; pTemp > pName; pTemp-- )
1383 if ( *pTemp <
'0' || *pTemp >
'9' )
1388 if ( *pTemp ==
'.' )
1390 return atoi( pTemp );
1404void CnfDupFileUnzip(
char * pOldName )
1407 char pNewName[1000];
1412 sprintf( pNewName,
"%s.v", pOldName );
1413 pFile = fopen( pNewName,
"wb" );
1414 fwrite( pBuffer, nFileSize, 1, pFile );
1430int CmdCommandRenameFiles(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1432 struct _finddata_t c_file;
1434 char pNewName[1000];
1435 char * pDirStr = NULL;
1436 char * pDirCur = NULL;
1437 char * pNameNew = NULL;
1438 char * pNameExt = NULL;
1439 int c, i, nBase = 0;
1448 fprintf( pAbc->Err,
"Command line switch \"-D\" should be followed by a string.\n" );
1457 fprintf( pAbc->Err,
"Command line switch \"-E\" should be followed by a string.\n" );
1466 fprintf( pAbc->Err,
"Command line switch \"-N\" should be followed by a string.\n" );
1475 fprintf( pAbc->Err,
"Command line switch \"-B\" should be followed by a positive integer.\n" );
1488 if ( pNameExt == NULL )
1490 printf(
"Extension of the files should be given on the command line.\n" );
1496 if( (pDirCur = _getcwd( NULL, 0 )) == NULL )
1498 printf(
"Cannot read current directory\n" );
1501 if ( _chdir(pDirStr) )
1503 printf(
"Cannot change to directory: %s\n", pDirStr );
1508 sprintf( pNewName,
"*.%s", pNameExt );
1509 if( (hFile = _findfirst( pNewName, &c_file )) == -1L )
1512 printf(
"No .aig files in the current directory.\n" );
1514 printf(
"No .aig files in directory: %s\n", pDirStr );
1518 char * pName, * pOldName;
1519 int nDigits, * pOrder;
1520 Vec_Ptr_t * vNames = Vec_PtrAlloc( 1000 );
1521 Vec_Int_t * vNums = Vec_IntAlloc( 1000 );
1524 Vec_PtrPush( vNames, Abc_UtilStrsav(c_file.name) );
1525 }
while( _findnext( hFile, &c_file ) == 0 );
1526 _findclose( hFile );
1530 Vec_IntPush( vNums, CmfFindNumber(pName) );
1531 if ( Vec_IntEntryLast(vNums) < 0 )
1533 printf(
"Directory \"%s\" contains file (%s) with extension %s without number\n", pDirStr, pName, pNameExt );
1534 Vec_PtrFreeFree( vNames );
1535 Vec_IntFree( vNums );
1543 nDigits = Abc_Base10Log( nBase + Vec_IntEntry(vNums, pOrder[Vec_IntSize(vNums)-1]) + 1 );
1544 for ( i = 0; i < Vec_IntSize(vNums); i++ )
1546 pOldName = (
char *)Vec_PtrEntry( vNames, pOrder[i] );
1547 sprintf( pNewName,
"%s%0*d.%s", pNameNew ? pNameNew :
"", nDigits, nBase+Vec_IntEntry(vNums, pOrder[i]), pNameExt );
1548 rename( pOldName, pNewName );
1549 printf(
"%s -> %s\n", pOldName, pNewName );
1553 Vec_PtrFreeFree( vNames );
1554 Vec_IntFree( vNums );
1559 if ( _chdir(pDirCur) )
1562 printf(
"Cannot change to directory: %s\n", pDirCur );
1570 fprintf( pAbc->Err,
"usage: renamefiles [-DEN str] [-B num]\n" );
1571 fprintf( pAbc->Err,
" performs renaming of files in the given directory\n" );
1572 fprintf( pAbc->Err,
"\t-D str : the directory to read files from [default = current]\n" );
1573 fprintf( pAbc->Err,
"\t-E str : the extension of files to look for [default = none]\n" );
1574 fprintf( pAbc->Err,
"\t-N str : the root of the resulting files [default = none]\n" );
1575 fprintf( pAbc->Err,
"\t-B num : the base number for all files [default = %d]\n", nBase );
1591int CmdCommandLs(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1593 struct _finddata_t c_file;
1599 int fPrintedNewLine;
1619 if( (hFile = _findfirst( ((fOnlyBLIF)?
"*.mv":
"*.*"), &c_file )) == -1L )
1622 fprintf( pAbc->Out,
"No *.mv files in the current directory.\n" );
1624 fprintf( pAbc->Out,
"No files in the current directory.\n" );
1630 fprintf( pAbc->Out,
" File Date Size | File Date Size \n" );
1631 fprintf( pAbc->Out,
" ----------------------------------------------------------------------------- \n" );
1634 strcpy( Buffer, ctime( &(c_file.time_write) ) );
1636 fprintf( pAbc->Out,
" %-17s %.24s%7ld", c_file.name, Buffer+4, c_file.size );
1637 if ( ++Counter % 2 == 0 )
1639 fprintf( pAbc->Out,
"\n" );
1640 fPrintedNewLine = 1;
1644 fprintf( pAbc->Out,
" |" );
1645 fPrintedNewLine = 0;
1648 while( _findnext( hFile, &c_file ) == 0 );
1654 fprintf( pAbc->Out,
" %-18s", c_file.name );
1655 if ( ++Counter % 4 == 0 )
1657 fprintf( pAbc->Out,
"\n" );
1658 fPrintedNewLine = 1;
1662 fprintf( pAbc->Out,
" " );
1663 fPrintedNewLine = 0;
1666 while( _findnext( hFile, &c_file ) == 0 );
1668 if ( !fPrintedNewLine )
1669 fprintf( pAbc->Out,
"\n" );
1670 _findclose( hFile );
1675 fprintf( pAbc->Err,
"usage: ls [-l] [-b]\n" );
1676 fprintf( pAbc->Err,
" print the file names in the current directory\n" );
1677 fprintf( pAbc->Err,
" -l : print in the long format [default = short]\n" );
1678 fprintf( pAbc->Err,
" -b : print only .mv files [default = all]\n" );
1694int CmdCommandScrGen(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1696 struct _finddata_t c_file;
1698 FILE * pFile = NULL;
1699 char * pFileStr =
"test.s";
1700 char * pDirStr = NULL;
1701 char * pComStr =
"ps";
1702 char * pWriteStr = NULL;
1703 char Buffer[1000], Line[2000];
1704 int nFileNameMax, nFileNameCur;
1718 fprintf( pAbc->Err,
"Command line switch \"-F\" should be followed by a string.\n" );
1727 fprintf( pAbc->Err,
"Command line switch \"-D\" should be followed by a string.\n" );
1736 fprintf( pAbc->Err,
"Command line switch \"-C\" should be followed by a string.\n" );
1745 fprintf( pAbc->Err,
"Command line switch \"-W\" should be followed by a string.\n" );
1762 if ( pDirStr == NULL )
1765 if ( _getcwd( Buffer, 1000 ) == NULL )
1767 printf(
"Cannot get the current directory.\n" );
1771 pFile = fopen( pFileStr,
"w" );
1774 if ( _chdir(pDirStr) )
1776 printf(
"Cannot change to directory: %s\n", pDirStr );
1781 pFile = fopen( pFileStr,
"w" );
1782 if ( pFile == NULL )
1784 printf(
"Cannot open file %s.\n", pFileStr );
1785 if ( pDirStr && _chdir(Buffer) )
1787 printf(
"Cannot change to the current directory: %s\n", Buffer );
1794 if( (hFile = _findfirst(
"*.*", &c_file )) == -1L )
1797 printf(
"No files in the current directory.\n" );
1799 printf(
"No files in directory: %s\n", pDirStr );
1800 if ( pDirStr && _chdir(Buffer) )
1802 printf(
"Cannot change to the current directory: %s\n", Buffer );
1813 nFileNameCur =
strlen(c_file.name);
1814 if ( c_file.name[nFileNameCur-1] ==
'.' )
1816 if ( nFileNameCur > 2 &&
1817 c_file.name[nFileNameCur-1] ==
's' &&
1818 c_file.name[nFileNameCur-2] ==
'.' )
1820 if ( nFileNameCur > 4 &&
1821 c_file.name[nFileNameCur-1] ==
't' &&
1822 c_file.name[nFileNameCur-2] ==
'x' &&
1823 c_file.name[nFileNameCur-3] ==
't' &&
1824 c_file.name[nFileNameCur-4] ==
'.' )
1826 if ( nFileNameMax < nFileNameCur )
1827 nFileNameMax = nFileNameCur;
1829 while( _findnext( hFile, &c_file ) == 0 );
1830 _findclose( hFile );
1835 if( (hFile = _findfirst(
"*.*", &c_file )) == -1L )
1838 printf(
"No files in the current directory.\n" );
1840 printf(
"No files in directory: %s\n", pDirStr );
1842 fprintf( pFile,
"# Script file produced by ABC on %s\n",
Extra_TimeStamp() );
1843 fprintf( pFile,
"# Command line was: scrgen -F %s -D %s -C \"%s\"%s%s\n",
1844 pFileStr, pDirStr, pComStr, pWriteStr?
" -W ":
"", pWriteStr?pWriteStr:
"" );
1848 nFileNameCur =
strlen(c_file.name);
1849 if ( c_file.name[nFileNameCur-1] ==
'.' )
1851 if ( nFileNameCur > 2 &&
1852 c_file.name[nFileNameCur-1] ==
's' &&
1853 c_file.name[nFileNameCur-2] ==
'.' )
1855 if ( nFileNameCur > 4 &&
1856 c_file.name[nFileNameCur-1] ==
't' &&
1857 c_file.name[nFileNameCur-2] ==
'x' &&
1858 c_file.name[nFileNameCur-3] ==
't' &&
1859 c_file.name[nFileNameCur-4] ==
'.' )
1861 sprintf( Line,
"r %s%s%-*s ; %s", pDirStr?pDirStr:
"", pDirStr?
"/":
"", nFileNameMax, c_file.name, pComStr );
1862 for ( c = (
int)
strlen(Line)-1; c >= 0; c-- )
1863 if ( Line[c] ==
'\\' )
1865 fprintf( pFile,
"%s", Line );
1868 sprintf( Line,
" ; w %s/%-*s", pWriteStr, nFileNameMax, c_file.name );
1869 for ( c = (
int)
strlen(Line)-1; c >= 0; c-- )
1870 if ( Line[c] ==
'\\' )
1872 fprintf( pFile,
"%s", Line );
1874 fprintf( pFile,
"\n" );
1876 while( _findnext( hFile, &c_file ) == 0 );
1877 _findclose( hFile );
1880 if ( pDirStr && _chdir(Buffer) )
1882 printf(
"Cannot change to the current directory: %s\n", Buffer );
1888 printf(
"Script file \"%s\" was saved in the current directory.\n", pFileStr );
1890 printf(
"Script file \"%s\" was saved in directory: %s\n", pFileStr, pDirStr );
1894 fprintf( pAbc->Err,
"usage: scrgen -F <str> -R <str> -C <str> -W <str> -ch\n" );
1895 fprintf( pAbc->Err,
"\t generates script for running ABC\n" );
1896 fprintf( pAbc->Err,
"\t-F str : the name of the script file [default = \"test.s\"]\n" );
1897 fprintf( pAbc->Err,
"\t-R str : the directory to read files from [default = current]\n" );
1898 fprintf( pAbc->Err,
"\t-C str : the sequence of commands to run [default = \"ps\"]\n" );
1899 fprintf( pAbc->Err,
"\t-W str : the directory to write the resulting files [default = no writing]\n" );
1900 fprintf( pAbc->Err,
"\t-c : toggle placing file in current/target dir [default = %s]\n", fUseCurrent?
"current":
"target" );
1901 fprintf( pAbc->Err,
"\t-h : print the command usage\n\n");
1902 fprintf( pAbc->Err,
"\tExample : scrgen -F test1.s -R a/in -C \"ps; st; ps\" -W a/out\n" );
1911 struct dirent **namelist;
1912 int num_files = scandir(pDirStr, &namelist, NULL, alphasort);
1913 if (num_files == -1) {
1914 printf(
"Error opening directory.\n");
1917 for (
int i = 0; i < num_files; i++) {
1918 char * pExt =
strstr(namelist[i]->d_name,
".");
1921 Vec_PtrPush( vRes, Abc_UtilStrsav(namelist[i]->d_name) );
1928int CmdCommandScrGenLinux(
Abc_Frame_t * pAbc,
int argc,
char **argv )
1931 FILE * pFile = NULL;
1932 char * pFileStr = (
char *)
"test.s";
1933 char * pDirStr = (
char *)
".";
1934 char * pComStr = (
char *)
"ps";
1935 char * pWriteStr = NULL;
1936 char * pWriteExt = NULL;
1937 char Line[2000], * pName;
1950 fprintf( pAbc->Err,
"Command line switch \"-F\" should be followed by a string.\n" );
1959 fprintf( pAbc->Err,
"Command line switch \"-D\" should be followed by a string.\n" );
1968 fprintf( pAbc->Err,
"Command line switch \"-C\" should be followed by a string.\n" );
1977 fprintf( pAbc->Err,
"Command line switch \"-W\" should be followed by a string.\n" );
1986 fprintf( pAbc->Err,
"Command line switch \"-E\" should be followed by a string.\n" );
1999 pFile = fopen( pFileStr,
"w" );
2000 if ( pFile == NULL )
2002 printf(
"Cannot open output file %s.\n", pFileStr );
2006 if ( !vNames || !Vec_PtrSize(vNames) )
2009 printf(
"It looks like the directory \"%s\" does not contain any relevant files.\n", pDirStr );
2010 Vec_PtrFreeP(&vNames);
2015 if ( nFileNameMax <
strlen(pName) )
2016 nFileNameMax =
strlen(pName);
2018 int fAndSpace = pComStr[0] ==
'&';
2019 fprintf( pFile,
"# Script file produced by ABC on %s\n",
Extra_TimeStamp() );
2020 fprintf( pFile,
"# Command line was: scrgen -F %s -D %s -C \"%s\"%s%s%s%s\n",
2021 pFileStr, pDirStr, pComStr,
2022 pWriteStr?
" -W ":
"", pWriteStr?pWriteStr:
"",
2023 pWriteExt?
" -E ":
"", pWriteExt?pWriteExt:
"" );
2025 char * pExt =
strstr(pName,
".");
2028 sprintf( Line,
"%s%sread %s%s%-*s ; %s", fBatch ?
"./abc -q \"":
"", fAndSpace ?
"&" :
"", pDirStr?pDirStr:
"", pDirStr?
"/":
"", nFileNameMax, pName, pComStr );
2029 for ( c = (
int)
strlen(Line)-1; c >= 0; c-- )
2030 if ( Line[c] ==
'\\' )
2032 fprintf( pFile,
"%s", Line );
2036 sprintf( Line,
" ; %swrite %s/%-*s", fAndSpace ?
"&" :
"", pWriteStr, nFileNameMax, pFNameOut );
2037 for ( c = (
int)
strlen(Line)-1; c >= 0; c-- )
2038 if ( Line[c] ==
'\\' )
2040 fprintf( pFile,
"%s", Line );
2043 fprintf( pFile,
"\"" );
2044 fprintf( pFile,
"\n" );
2048 printf(
"Script file \"%s\" with command lines for %d files.\n", pFileStr, Vec_PtrSize(vNames) );
2049 Vec_PtrFreeFree( vNames );
2053 fprintf( pAbc->Err,
"usage: scrgen -F <str> -R <str> -C <str> -W <str> -E <str> -bh\n" );
2054 fprintf( pAbc->Err,
"\t generates script for running ABC\n" );
2055 fprintf( pAbc->Err,
"\t-F str : the name of the script file [default = \"test.s\"]\n" );
2056 fprintf( pAbc->Err,
"\t-R str : the directory to read files from [default = current]\n" );
2057 fprintf( pAbc->Err,
"\t-C str : the sequence of commands to run [default = \"ps\"]\n" );
2058 fprintf( pAbc->Err,
"\t-W str : the directory to write the resulting files [default = no writing]\n" );
2059 fprintf( pAbc->Err,
"\t-E str : the output files extension (with \".\") [default = the same as input files]\n" );
2060 fprintf( pAbc->Err,
"\t-b : toggles adding batch mode support [default = %s]\n", fBatch?
"yes":
"no" );
2061 fprintf( pAbc->Err,
"\t-h : print the command usage\n\n");
2062 fprintf( pAbc->Err,
"\tExample : scrgen -F test1.s -R a/in -C \"ps; st; ps\" -W a/out -E .blif\n" );
2070#define unlink _unlink
2084int CmdCommandSis(
Abc_Frame_t * pAbc,
int argc,
char **argv )
2087 FILE * pOut, * pErr;
2088 Abc_Ntk_t * pNtk, * pNtkNew, * pNetlist;
2089 char * pNameWin =
"sis.exe";
2090 char * pNameUnix =
"sis";
2091 char Command[1000], Buffer[100];
2101 if (
strcmp( argv[1],
"-h" ) == 0 )
2103 if (
strcmp( argv[1],
"-?" ) == 0 )
2108 fprintf( pErr,
"Empty network.\n" );
2112 if (
strcmp( argv[0],
"sis" ) != 0 )
2114 fprintf( pErr,
"Wrong command: \"%s\".\n", argv[0] );
2125 if ( (pFile = fopen( pNameWin,
"r" )) )
2126 pSisName = pNameWin;
2127 else if ( (pFile = fopen( pNameUnix,
"r" )) )
2128 pSisName = pNameUnix;
2129 else if ( pFile == NULL )
2131 fprintf( pErr,
"Cannot find \"%s\" or \"%s\" in the current directory.\n", pNameWin, pNameUnix );
2136 if ( Abc_NtkIsMappedLogic(pNtk) )
2139 printf(
"The current network is unmapped before calling SIS.\n" );
2143 if ( Abc_NtkIsLogic(pNtk) )
2146 if ( pNetlist == NULL )
2148 fprintf( pErr,
"Cannot produce the intermediate network.\n" );
2155 sprintf( Command,
"%s -x -c ", pSisName );
2156 strcat ( Command,
"\"" );
2157 strcat ( Command,
"read_blif _sis_in.blif" );
2158 strcat ( Command,
"; " );
2159 for ( i = 1; i < argc; i++ )
2161 sprintf( Buffer,
" %s", argv[i] );
2162 strcat( Command, Buffer );
2165 strcat( Command,
"write_blif _sis_out.blif" );
2171 fprintf( pErr,
"The following command has returned non-zero exit status:\n" );
2172 fprintf( pErr,
"\"%s\"\n", Command );
2173 unlink(
"_sis_in.blif" );
2178 if ( (pFile = fopen(
"_sis_out.blif",
"r" )) == NULL )
2180 fprintf( pErr,
"Cannot open SIS output file \"%s\".\n",
"_sis_out.blif" );
2181 unlink(
"_sis_in.blif" );
2198 unlink(
"_sis_in.blif" );
2199 unlink(
"_sis_out.blif" );
2203 fprintf( pErr,
"Usage: sis [-h] <com>\n");
2204 fprintf( pErr,
" invokes SIS command for the current ABC network\n" );
2205 fprintf( pErr,
" (the executable of SIS should be in the same directory)\n" );
2206 fprintf( pErr,
" -h : print the command usage\n" );
2207 fprintf( pErr,
" <com> : a SIS command (or a semicolon-separated list of commands in quotes)\n" );
2208 fprintf( pErr,
" Example 1: sis eliminate 0\n" );
2209 fprintf( pErr,
" Example 2: sis \"ps; rd; fx; ps\"\n" );
2210 fprintf( pErr,
" Example 3: sis source script.rugged\n" );
2226int CmdCommandMvsis(
Abc_Frame_t * pAbc,
int argc,
char **argv )
2229 FILE * pOut, * pErr;
2230 Abc_Ntk_t * pNtk, * pNtkNew, * pNetlist;
2231 char Command[1000], Buffer[100];
2232 char * pNameWin =
"mvsis.exe";
2233 char * pNameUnix =
"mvsis";
2243 if (
strcmp( argv[1],
"-h" ) == 0 )
2245 if (
strcmp( argv[1],
"-?" ) == 0 )
2250 fprintf( pErr,
"Empty network.\n" );
2254 if (
strcmp( argv[0],
"mvsis" ) != 0 )
2256 fprintf( pErr,
"Wrong command: \"%s\".\n", argv[0] );
2267 if ( (pFile = fopen( pNameWin,
"r" )) )
2268 pMvsisName = pNameWin;
2269 else if ( (pFile = fopen( pNameUnix,
"r" )) )
2270 pMvsisName = pNameUnix;
2271 else if ( pFile == NULL )
2273 fprintf( pErr,
"Cannot find \"%s\" or \"%s\" in the current directory.\n", pNameWin, pNameUnix );
2278 if ( Abc_NtkIsMappedLogic(pNtk) )
2281 printf(
"The current network is unmapped before calling MVSIS.\n" );
2285 if ( Abc_NtkIsLogic(pNtk) )
2288 if ( pNetlist == NULL )
2290 fprintf( pErr,
"Cannot produce the intermediate network.\n" );
2297 sprintf( Command,
"%s -x -c ", pMvsisName );
2298 strcat ( Command,
"\"" );
2299 strcat ( Command,
"read_blif _mvsis_in.blif" );
2300 strcat ( Command,
"; " );
2301 for ( i = 1; i < argc; i++ )
2303 sprintf( Buffer,
" %s", argv[i] );
2304 strcat( Command, Buffer );
2307 strcat( Command,
"write_blif _mvsis_out.blif" );
2313 fprintf( pErr,
"The following command has returned non-zero exit status:\n" );
2314 fprintf( pErr,
"\"%s\"\n", Command );
2315 unlink(
"_mvsis_in.blif" );
2320 if ( (pFile = fopen(
"_mvsis_out.blif",
"r" )) == NULL )
2322 fprintf( pErr,
"Cannot open MVSIS output file \"%s\".\n",
"_mvsis_out.blif" );
2323 unlink(
"_mvsis_in.blif" );
2340 unlink(
"_mvsis_in.blif" );
2341 unlink(
"_mvsis_out.blif" );
2345 fprintf( pErr,
"Usage: mvsis [-h] <com>\n");
2346 fprintf( pErr,
" invokes MVSIS command for the current ABC network\n" );
2347 fprintf( pErr,
" (the executable of MVSIS should be in the same directory)\n" );
2348 fprintf( pErr,
" -h : print the command usage\n" );
2349 fprintf( pErr,
" <com> : a MVSIS command (or a semicolon-separated list of commands in quotes)\n" );
2350 fprintf( pErr,
" Example 1: mvsis fraig_sweep\n" );
2351 fprintf( pErr,
" Example 2: mvsis \"ps; fxu; ps\"\n" );
2352 fprintf( pErr,
" Example 3: mvsis source mvsis.rugged\n" );
2372 char * pProgNameGnuplotWin =
"wgnuplot.exe";
2373 char * pProgNameGnuplotUnix =
"gnuplot";
2374 char * pProgNameGnuplot = NULL;
2377 if ( (pFile = fopen( pPlotFileName,
"r" )) == NULL )
2379 fprintf( stdout,
"Cannot open the plot file \"%s\".\n\n", pPlotFileName );
2393 if ( (pFile = fopen( pProgNameGnuplotWin,
"r" )) )
2394 pProgNameGnuplot = pProgNameGnuplotWin;
2395 else if ( (pFile = fopen( pProgNameGnuplotUnix,
"r" )) )
2396 pProgNameGnuplot = pProgNameGnuplotUnix;
2397 else if ( pFile == NULL )
2399 fprintf( stdout,
"Cannot find \"%s\" or \"%s\" in the current directory.\n", pProgNameGnuplotWin, pProgNameGnuplotUnix );
2406 if ( _spawnl( _P_NOWAIT, pProgNameGnuplot, pProgNameGnuplot, pPlotFileName, NULL ) == -1 )
2408 fprintf( stdout,
"Cannot find \"%s\".\n", pProgNameGnuplot );
2414 sprintf( Command,
"%s %s ", pProgNameGnuplot, pPlotFileName );
2418 if (
system( Command ) == -1 )
2421 fprintf( stdout,
"Cannot execute \"%s\".\n", Command );
2439int CmdCommandCapo(
Abc_Frame_t * pAbc,
int argc,
char **argv )
2442 FILE * pOut, * pErr;
2444 char Command[1000], Buffer[100];
2445 char * pProgNameCapoWin =
"capo.exe";
2446 char * pProgNameCapoUnix =
"capo";
2447 char * pProgNameGnuplotWin =
"wgnuplot.exe";
2448 char * pProgNameGnuplotUnix =
"gnuplot";
2449 char * pProgNameCapo;
2450 char * pProgNameGnuplot;
2451 char * pPlotFileName;
2460 if (
strcmp( argv[1],
"-h" ) == 0 )
2462 if (
strcmp( argv[1],
"-?" ) == 0 )
2468 fprintf( pErr,
"Empty network.\n" );
2472 if (
strcmp( argv[0],
"capo" ) != 0 )
2474 fprintf( pErr,
"Wrong command: \"%s\".\n", argv[0] );
2485 if ( (pFile = fopen( pProgNameCapoWin,
"r" )) )
2486 pProgNameCapo = pProgNameCapoWin;
2487 else if ( (pFile = fopen( pProgNameCapoUnix,
"r" )) )
2488 pProgNameCapo = pProgNameCapoUnix;
2489 else if ( pFile == NULL )
2491 fprintf( pErr,
"Cannot find \"%s\" or \"%s\" in the current directory.\n", pProgNameCapoWin, pProgNameCapoUnix );
2496 if ( Abc_NtkIsMappedLogic(pNtk) )
2499 printf(
"The current network is unmapped before calling Capo.\n" );
2503 if ( Abc_NtkIsLogic(pNtk) )
2506 if ( pNetlist == NULL )
2508 fprintf( pErr,
"Cannot produce the intermediate network.\n" );
2515 sprintf( Command,
"%s -f _capo_in.blif -log out.txt ", pProgNameCapo );
2516 pPlotFileName = NULL;
2517 for ( i = 1; i < argc; i++ )
2519 sprintf( Buffer,
" %s", argv[i] );
2520 strcat( Command, Buffer );
2521 if ( !
strcmp( argv[i],
"-plot" ) )
2522 pPlotFileName = argv[i+1];
2528 fprintf( pErr,
"The following command has returned non-zero exit status:\n" );
2529 fprintf( pErr,
"\"%s\"\n", Command );
2530 unlink(
"_capo_in.blif" );
2534 unlink(
"_capo_in.blif" );
2535 if ( pPlotFileName == NULL )
2539 sprintf( Buffer,
"%s.plt", pPlotFileName );
2540 pPlotFileName = Buffer;
2543 if ( (pFile = fopen( pPlotFileName,
"r" )) == NULL )
2545 fprintf( pErr,
"Cannot open the plot file \"%s\".\n\n", pPlotFileName );
2557 pProgNameGnuplot = NULL;
2558 if ( (pFile = fopen( pProgNameGnuplotWin,
"r" )) )
2559 pProgNameGnuplot = pProgNameGnuplotWin;
2560 else if ( (pFile = fopen( pProgNameGnuplotUnix,
"r" )) )
2561 pProgNameGnuplot = pProgNameGnuplotUnix;
2562 else if ( pFile == NULL )
2564 fprintf( pErr,
"Cannot find \"%s\" or \"%s\" in the current directory.\n", pProgNameGnuplotWin, pProgNameGnuplotUnix );
2571 if ( _spawnl( _P_NOWAIT, pProgNameGnuplot, pProgNameGnuplot, pPlotFileName, NULL ) == -1 )
2573 fprintf( stdout,
"Cannot find \"%s\".\n", pProgNameGnuplot );
2578 sprintf( Command,
"%s %s ", pProgNameGnuplot, pPlotFileName );
2581 fprintf( stdout,
"Cannot execute \"%s\".\n", Command );
2592 fprintf( pErr,
"Usage: capo [-h] <com>\n");
2593 fprintf( pErr,
" peforms placement of the current network using Capo\n" );
2594 fprintf( pErr,
" a Capo binary should be present in the same directory\n" );
2595 fprintf( pErr,
" (if plotting, the Gnuplot binary should also be present)\n" );
2596 fprintf( pErr,
" -h : print the command usage\n" );
2597 fprintf( pErr,
" <com> : a Capo command\n" );
2598 fprintf( pErr,
" Example 1: capo\n" );
2599 fprintf( pErr,
" (performs placement with default options)\n" );
2600 fprintf( pErr,
" Example 2: capo -AR <aspec_ratio> -WS <whitespace_percentage> -save\n" );
2601 fprintf( pErr,
" (specifies the aspect ratio [default = 1.0] and\n" );
2602 fprintf( pErr,
" the whitespace percentage [0%%; 100%%) [default = 15%%])\n" );
2603 fprintf( pErr,
" Example 3: capo -plot <base_fileName>\n" );
2604 fprintf( pErr,
" (produces <base_fileName.plt> and visualize it using Gnuplot)\n" );
2605 fprintf( pErr,
" Example 4: capo -help\n" );
2606 fprintf( pErr,
" (prints the default usage message of the Capo binary)\n" );
2607 fprintf( pErr,
" Please refer to the Capo webpage for additional information:\n" );
2608 fprintf( pErr,
" http://vlsicad.eecs.umich.edu/BK/PDtools/\n" );
2623int CmdCommandStarter(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
2625 extern void Cmd_RunStarter(
char * pFileName,
char * pBinary,
char * pCommand,
int nCores,
int fVerbose );
2628 char * pCommand = NULL;
2639 Abc_Print( -1,
"Command line switch \"-N\" should be followed by an integer.\n" );
2650 Abc_Print( -1,
"Command line switch \"-C\" should be followed by a string (possibly in quotes).\n" );
2667 Abc_Print( -2,
"The file name should be given on the command line.\n" );
2672 if ( (pFile =
Io_FileOpen( pFileName,
"open_path",
"rb", 0 )) == NULL )
2675 Abc_Print( -2,
"Cannot open input file \"%s\". ", pFileName );
2677 Abc_Print( -2,
"Did you mean \"%s\"?", pFileName );
2678 Abc_Print( -2,
"\n" );
2683 Cmd_RunStarter( pFileName, pAbc->sBinary, pCommand, nCores, fVerbose );
2687 Abc_Print( -2,
"usage: starter [-P num] [-C cmd] [-vh] <file>\n" );
2688 Abc_Print( -2,
"\t runs command lines listed in <file> concurrently on <num> CPUs\n" );
2689 Abc_Print( -2,
"\t-P num : the number of concurrent jobs including the controller [default = %d]\n", nCores );
2690 Abc_Print( -2,
"\t-C cmd : (optional) ABC command line to execute on benchmarks in <file>\n" );
2691 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
2692 Abc_Print( -2,
"\t-h : print the command usage\n");
2693 Abc_Print( -2,
"\t<file> : file name with ABC command lines (or benchmark names, if <cmd> is given)\n");
2708int CmdCommandAutoTuner(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
2710 extern void Cmd_RunAutoTuner(
char * pConfig,
char * pFileList,
int nCores );
2712 char * pFileConf = NULL;
2713 char * pFileList = NULL;
2725 Abc_Print( -1,
"Command line switch \"-N\" should be followed by an integer.\n" );
2736 Abc_Print( -1,
"Command line switch \"-C\" should be followed by a string (possibly in quotes).\n" );
2745 Abc_Print( -1,
"Command line switch \"-F\" should be followed by a string (possibly in quotes).\n" );
2760 if ( pFileConf == NULL )
2762 Abc_Print( -2,
"File containing configuration for autotuning is not given.\n" );
2765 if ( pFileList == NULL )
2767 Abc_Print( -2,
"File contining list of files for autotuning is not given.\n" );
2771 pFileName = pFileConf;
2772 if ( (pFile =
Io_FileOpen( pFileName,
"open_path",
"rb", 0 )) == NULL )
2775 Abc_Print( -2,
"Cannot open configuration file \"%s\". ", pFileName );
2777 Abc_Print( -2,
"Did you mean \"%s\"?", pFileName );
2778 Abc_Print( -2,
"\n" );
2783 pFileName = pFileList;
2784 if ( (pFile =
Io_FileOpen( pFileName,
"open_path",
"rb", 0 )) == NULL )
2787 Abc_Print( -2,
"Cannot open the file list \"%s\". ", pFileName );
2789 Abc_Print( -2,
"Did you mean \"%s\"?", pFileName );
2790 Abc_Print( -2,
"\n" );
2799 Abc_Print( -2,
"usage: autotuner [-N num] [-C file] [-F file] [-vh]\n" );
2800 Abc_Print( -2,
"\t performs autotuning\n" );
2801 Abc_Print( -2,
"\t-N num : the number of concurrent jobs including the controller [default = %d]\n", nCores );
2802 Abc_Print( -2,
"\t-C cmd : configuration file with settings for autotuning\n" );
2803 Abc_Print( -2,
"\t-F cmd : list of AIGER files to be used for autotuning\n" );
2804 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
2805 Abc_Print( -2,
"\t-h : print the command usage\n");
2820int CmdCommandVersion(
Abc_Frame_t * pAbc,
int argc,
char **argv )
2840 fprintf( pAbc->Err,
"usage: version [-h]\n" );
2841 fprintf( pAbc->Err,
" print the version string\n" );
2842 fprintf( pAbc->Err,
" -h : print the command usage\n");
2857int CmdCommandSGen(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
2871 Abc_Print( -1,
"Command line switch \"-N\" should be followed by an integer.\n" );
2882 Abc_Print( -1,
"Command line switch \"-I\" should be followed by a string (possibly in quotes).\n" );
2899 Abc_Print( -2,
"There is no current network.\n" );
2904 Abc_Print( -2,
"The current network is not an AIG.\n" );
2911 Abc_Print( -2,
"usage: sgen [-N num] [-I num] [-vh]\n" );
2912 Abc_Print( -2,
"\t experiment with script generation\n" );
2913 Abc_Print( -2,
"\t-N num : the number of commands to use [default = %d]\n", nParts );
2914 Abc_Print( -2,
"\t-I num : the number of iterations to perform [default = %d]\n", nIters );
2915 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
2916 Abc_Print( -2,
"\t-h : print the command usage\n");
ABC_DLL int Abc_NtkMapToSop(Abc_Ntk_t *pNtk)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL Abc_Ntk_t * Abc_NtkToNetlist(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
int * Abc_QuickSortCost(int *pCosts, int nSize, int fDecrease)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
ABC_DLL void Abc_FrameDeleteAllNetworks(Abc_Frame_t *p)
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
ABC_DLL FILE * Abc_FrameReadErr(Abc_Frame_t *p)
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
ABC_DLL FILE * Abc_FrameReadOut(Abc_Frame_t *p)
ABC_DLL void Abc_FrameRestart(Abc_Frame_t *p)
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START typedef signed char value
ABC_NAMESPACE_IMPL_START void CmdCommandAliasAdd(Abc_Frame_t *pAbc, char *sName, int argc, char **argv)
DECLARATIONS ///.
void CmdCommandAliasFree(Abc_Alias *pAlias)
void CmdCommandAliasPrint(Abc_Frame_t *pAbc, Abc_Alias *pAlias)
void Cmd_RunAutoTuner(char *pConfig, char *pFileList, int nCores)
FILE * CmdFileOpen(Abc_Frame_t *pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent)
void CmdCommandFree(Abc_Command *pCommand)
char * CmdHistorySubstitution(Abc_Frame_t *pAbc, char *line, int *changed)
void CmdCommandPrint(Abc_Frame_t *pAbc, int fPrintAll, int fDetails)
void CmdPrintTable(st__table *tTable, int fAliases)
ABC_NAMESPACE_IMPL_START void Cmd_RunStarter(char *pFileName, char *pBinary, char *pCommand, int nCores, int fVerbose)
DECLARATIONS ///.
void Cmd_CommandSGen(Abc_Frame_t *pAbc, int nParts, int nIters, int fVerbose)
void Gia_ManGnuplotShow(char *pPlotFileName)
void Cmd_Init(Abc_Frame_t *pAbc)
FUNCTION DEFINITIONS ///.
void Cmd_End(Abc_Frame_t *pAbc)
int Cmd_CommandAbcLoadPlugIn(Abc_Frame_t *pAbc, int argc, char **argv)
Vec_Ptr_t * CmdReturnFileNames(char *pDirStr)
char * Cmd_FlagReadByName(Abc_Frame_t *pAbc, char *flag)
DECLARATIONS ///.
void Cmd_HistoryWrite(Abc_Frame_t *p, int Limit)
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
void Cmd_HistoryRead(Abc_Frame_t *p)
typedefABC_NAMESPACE_HEADER_START struct MvCommand Abc_Command
INCLUDES ///.
void Cmd_HistoryAddCommand(Abc_Frame_t *pAbc, const char *command)
FUNCTION DEFINITIONS ///.
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
void Io_WriteBlif(Abc_Ntk_t *pNtk, char *pFileName, int fWriteLatches, int fBb2Wb, int fSeq)
FILE * Io_FileOpen(const char *FileName, const char *PathVar, const char *Mode, int fVerbose)
Abc_Ntk_t * Io_Read(char *pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs)
char * Io_MvLoadFileBz2(char *pFileName, long *pnFileSize)
ABC_DLL void Abc_UtilsSource(Abc_Frame_t *pAbc)
ABC_DLL char * Abc_UtilsGetVersion(Abc_Frame_t *pAbc)
FUNCTION DEFINITIONS ///.
int st__delete(st__table *table, const char **keyp, char **value)
int st__strhash(const char *string, int modulus)
int st__lookup(st__table *table, const char *key, char **value)
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
int st__insert(st__table *table, const char *key, char *value)
void st__free_table(st__table *table)
#define st__foreach_item(table, gen, key, value)
ABC_NAMESPACE_IMPL_START int Util_SignalSystem(const char *cmd)
DECLARATIONS ///.
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.