Commit e73e5438 by Alan Mishchenko

Patching ABC for Yosys.

parent ee50e84e
CC := gcc CC := gcc
CXX := g++ CXX := g++
LD := $(CXX) LD := $(CXX)
...@@ -40,6 +41,7 @@ arch_flags : arch_flags.c ...@@ -40,6 +41,7 @@ arch_flags : arch_flags.c
ARCHFLAGS ?= $(shell $(CC) arch_flags.c -o arch_flags && ./arch_flags) ARCHFLAGS ?= $(shell $(CC) arch_flags.c -o arch_flags && ./arch_flags)
OPTFLAGS ?= -g -O #-DABC_NAMESPACE=xxx OPTFLAGS ?= -g -O #-DABC_NAMESPACE=xxx
MSG_PREFIX ?=
CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(OPTFLAGS) $(ARCHFLAGS) -Isrc CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(OPTFLAGS) $(ARCHFLAGS) -Isrc
...@@ -99,19 +101,19 @@ DEP := $(OBJ:.o=.d) ...@@ -99,19 +101,19 @@ DEP := $(OBJ:.o=.d)
# implicit rules # implicit rules
%.o: %.c %.o: %.c
@echo "\`\` Compiling:" $(LOCAL_PATH)/$< @echo "$(MSG_PREFIX)\`\` Compiling:" $(LOCAL_PATH)/$<
@$(CC) -c $(CFLAGS) $< -o $@ @$(CC) -c $(CFLAGS) $< -o $@
%.o: %.cc %.o: %.cc
@echo "\`\` Compiling:" $(LOCAL_PATH)/$< @echo "$(MSG_PREFIX)\`\` Compiling:" $(LOCAL_PATH)/$<
@$(CXX) -c $(CXXFLAGS) $< -o $@ @$(CXX) -c $(CXXFLAGS) $< -o $@
%.d: %.c %.d: %.c
@echo "\`\` Dependency:" $(LOCAL_PATH)/$< @echo "$(MSG_PREFIX)\`\` Dependency:" $(LOCAL_PATH)/$<
@./depends.sh $(CC) `dirname $*.c` $(CFLAGS) $*.c > $@ @./depends.sh $(CC) `dirname $*.c` $(CFLAGS) $*.c > $@
%.d: %.cc %.d: %.cc
@echo "\`\` Generating dependency:" $(LOCAL_PATH)/$< @echo "$(MSG_PREFIX)\`\` Generating dependency:" $(LOCAL_PATH)/$<
@./depends.sh $(CXX) `dirname $*.cc` $(CXXFLAGS) $*.cc > $@ @./depends.sh $(CXX) `dirname $*.cc` $(CXXFLAGS) $*.cc > $@
-include $(DEP) -include $(DEP)
...@@ -121,21 +123,21 @@ DEP := $(OBJ:.o=.d) ...@@ -121,21 +123,21 @@ DEP := $(OBJ:.o=.d)
depend: $(DEP) depend: $(DEP)
clean: clean:
@echo "\`\` Cleaning up..." @echo "$(MSG_PREFIX)\`\` Cleaning up..."
@rm -rvf $(PROG) lib$(PROG).a $(OBJ) $(GARBAGE) $(OBJ:.o=.d) @rm -rvf $(PROG) lib$(PROG).a $(OBJ) $(GARBAGE) $(OBJ:.o=.d)
tags: tags:
etags `find . -type f -regex '.*\.\(c\|h\)'` etags `find . -type f -regex '.*\.\(c\|h\)'`
$(PROG): $(OBJ) $(PROG): $(OBJ)
@echo "\`\` Building binary:" $(notdir $@) @echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
@$(LD) -o $@ $^ $(LIBS) @$(LD) -o $@ $^ $(LIBS)
lib$(PROG).a: $(OBJ) lib$(PROG).a: $(OBJ)
@echo "\`\` Linking:" $(notdir $@) @echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@)
@ar rv $@ $? @ar rv $@ $?
@ranlib $@ @ranlib $@
docs: docs:
@echo "\`\` Building documentation." $(notdir $@) @echo "$(MSG_PREFIX)\`\` Building documentation." $(notdir $@)
@doxygen doxygen.conf @doxygen doxygen.conf
...@@ -6162,7 +6162,6 @@ usage: ...@@ -6162,7 +6162,6 @@ usage:
Abc_Print( -2, " Professor Tsutomu Sasao (sasao@cse.kyutech.ac.jp) at Kyushu Institute\n"); Abc_Print( -2, " Professor Tsutomu Sasao (sasao@cse.kyutech.ac.jp) at Kyushu Institute\n");
Abc_Print( -2, " of Technology. This work received Takeda Techno-Entrepreneurship Award:\n"); Abc_Print( -2, " of Technology. This work received Takeda Techno-Entrepreneurship Award:\n");
Abc_Print( -2, " http://www.lsi-cad.com/sasao/photo/takeda.html\n"); Abc_Print( -2, " http://www.lsi-cad.com/sasao/photo/takeda.html\n");
Abc_Print( -2, "\t \n");
return 1; return 1;
} }
...@@ -6244,7 +6243,6 @@ usage: ...@@ -6244,7 +6243,6 @@ usage:
Abc_Print( -2, "\t-a : toggle multi-input XOR vs multi-input AND [default = %s]\n", fAnd? "AND": "XOR" ); Abc_Print( -2, "\t-a : toggle multi-input XOR vs multi-input AND [default = %s]\n", fAnd? "AND": "XOR" );
Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t \n");
return 1; return 1;
} }
...@@ -9390,6 +9388,12 @@ int Abc_CommandEspresso( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -9390,6 +9388,12 @@ int Abc_CommandEspresso( Abc_Frame_t * pAbc, int argc, char ** argv )
int fVerbose; int fVerbose;
extern void Abc_NtkEspresso( Abc_Ntk_t * pNtk, int fVerbose ); extern void Abc_NtkEspresso( Abc_Ntk_t * pNtk, int fVerbose );
if ( argc == 2 && !strcmp(argv[1], "-h") )
{
Abc_Print( -2, "The espresso command is currently disabled.\n" );
return 1;
}
Abc_Print( -1, "This command is currently disabled.\n" ); Abc_Print( -1, "This command is currently disabled.\n" );
return 0; return 0;
...@@ -12525,7 +12529,7 @@ int Abc_CommandNpnLoad( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -12525,7 +12529,7 @@ int Abc_CommandNpnLoad( Abc_Frame_t * pAbc, int argc, char ** argv )
char * pFileName; char * pFileName;
int c; int c;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -12565,7 +12569,7 @@ int Abc_CommandNpnSave( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -12565,7 +12569,7 @@ int Abc_CommandNpnSave( Abc_Frame_t * pAbc, int argc, char ** argv )
char * pFileName; char * pFileName;
int c; int c;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -12607,7 +12611,7 @@ int Abc_CommandSendAig( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -12607,7 +12611,7 @@ int Abc_CommandSendAig( Abc_Frame_t * pAbc, int argc, char ** argv )
int c, fAndSpace = 1, fAbsNetlist = 0; int c, fAndSpace = 1, fAbsNetlist = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "a" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -12617,6 +12621,8 @@ int Abc_CommandSendAig( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -12617,6 +12621,8 @@ int Abc_CommandSendAig( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'b': case 'b':
fAbsNetlist ^= 1; fAbsNetlist ^= 1;
break; break;
case 'h':
goto usage;
default: default:
goto usage; goto usage;
} }
...@@ -12682,7 +12688,7 @@ int Abc_CommandSendStatus( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -12682,7 +12688,7 @@ int Abc_CommandSendStatus( Abc_Frame_t * pAbc, int argc, char ** argv )
extern int Gia_ManToBridgeResult( FILE * pFile, int Result, Abc_Cex_t * pCex, int iPoProved ); extern int Gia_ManToBridgeResult( FILE * pFile, int Result, Abc_Cex_t * pCex, int iPoProved );
int c; int c;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -13947,12 +13953,6 @@ int Abc_CommandRecDump2( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13947,12 +13953,6 @@ int Abc_CommandRecDump2( Abc_Frame_t * pAbc, int argc, char ** argv )
//pNtk = Abc_FrameReadNtk(pAbc); //pNtk = Abc_FrameReadNtk(pAbc);
// set defaults // set defaults
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
if ( !Abc_NtkRecIsRunning2() )
{
Abc_Print( -1, "The AIG subgraph recording is not started.\n" );
return 1;
}
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
switch ( c ) switch ( c )
...@@ -13963,6 +13963,12 @@ int Abc_CommandRecDump2( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13963,6 +13963,12 @@ int Abc_CommandRecDump2( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage; goto usage;
} }
} }
if ( !Abc_NtkRecIsRunning2() )
{
Abc_Print( -1, "The AIG subgraph recording is not started.\n" );
return 1;
}
pGia = Abc_NtkRecGetGia(); pGia = Abc_NtkRecGetGia();
pArgvNew = argv + globalUtilOptind; pArgvNew = argv + globalUtilOptind;
nArgcNew = argc - globalUtilOptind; nArgcNew = argc - globalUtilOptind;
...@@ -16991,6 +16997,12 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -16991,6 +16997,12 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
int fFastButConservative; int fFastButConservative;
int maxDelay; int maxDelay;
if ( argc == 2 && !strcmp(argv[1], "-h") )
{
Abc_Print( -2, "The fretime command is temporarily disabled.\n" );
return 1;
}
Abc_Print( -1, "This command is temporarily disabled.\n" ); Abc_Print( -1, "This command is temporarily disabled.\n" );
return 0; return 0;
// extern Abc_Ntk_t* Abc_FlowRetime_MinReg( Abc_Ntk_t * pNtk, int fVerbose, // extern Abc_Ntk_t* Abc_FlowRetime_MinReg( Abc_Ntk_t * pNtk, int fVerbose,
...@@ -498,12 +498,13 @@ int CmdCommandUnalias( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -498,12 +498,13 @@ int CmdCommandUnalias( Abc_Frame_t * pAbc, int argc, char **argv )
******************************************************************************/ ******************************************************************************/
int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv ) int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
int fPrintAll; int fPrintAll, fDetails;
int c; int c;
fPrintAll = 0; fPrintAll = 0;
fDetails = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "adh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -512,6 +513,9 @@ int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -512,6 +513,9 @@ int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv )
fPrintAll ^= 1; fPrintAll ^= 1;
break; break;
break; break;
case 'd':
fDetails ^= 1;
break;
case 'h': case 'h':
goto usage; goto usage;
break; break;
...@@ -523,13 +527,14 @@ int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -523,13 +527,14 @@ int CmdCommandHelp( Abc_Frame_t * pAbc, int argc, char **argv )
if ( argc != globalUtilOptind ) if ( argc != globalUtilOptind )
goto usage; goto usage;
CmdCommandPrint( pAbc, fPrintAll ); CmdCommandPrint( pAbc, fPrintAll, fDetails );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: help [-a] [-h]\n" ); fprintf( pAbc->Err, "usage: help [-a] [-d] [-h]\n" );
fprintf( pAbc->Err, " prints the list of available commands by group\n" ); fprintf( pAbc->Err, " prints the list of available commands by group\n" );
fprintf( pAbc->Err, " -a toggle printing hidden commands [default = %s]\n", fPrintAll? "yes": "no" ); fprintf( pAbc->Err, " -a toggle printing hidden commands [default = %s]\n", fPrintAll? "yes": "no" );
fprintf( pAbc->Err, " -d print usage details to all commands [default = %s]\n", fDetails? "yes": "no" );
fprintf( pAbc->Err, " -h print the command usage\n" ); fprintf( pAbc->Err, " -h print the command usage\n" );
return 1; return 1;
} }
...@@ -885,6 +890,9 @@ int CmdCommandUnsetVariable( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -885,6 +890,9 @@ int CmdCommandUnsetVariable( Abc_Frame_t * pAbc, int argc, char **argv )
******************************************************************************/ ******************************************************************************/
int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv ) int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
if ( argc == 2 && !strcmp(argv[1], "-h") )
goto usage;
if ( pAbc->pNtkCur == NULL ) if ( pAbc->pNtkCur == NULL )
{ {
fprintf( pAbc->Out, "Empty network.\n" ); fprintf( pAbc->Out, "Empty network.\n" );
...@@ -896,6 +904,7 @@ int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -896,6 +904,7 @@ int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv )
if ( argc == 1 ) if ( argc == 1 )
return CmdCommandRecall( pAbc, argc, argv ); return CmdCommandRecall( pAbc, argc, argv );
usage:
fprintf( pAbc->Err, "usage: undo\n" ); fprintf( pAbc->Err, "usage: undo\n" );
fprintf( pAbc->Err, " sets the current network to be the previously saved network\n" ); fprintf( pAbc->Err, " sets the current network to be the previously saved network\n" );
return 1; return 1;
...@@ -921,13 +930,6 @@ int CmdCommandRecall( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -921,13 +930,6 @@ int CmdCommandRecall( Abc_Frame_t * pAbc, int argc, char **argv )
char * pValue; char * pValue;
int iStepStart, iStepStop; int iStepStart, iStepStop;
if ( pAbc->pNtkCur == NULL )
{
fprintf( pAbc->Out, "Empty network.\n" );
return 0;
}
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
...@@ -940,6 +942,12 @@ int CmdCommandRecall( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -940,6 +942,12 @@ int CmdCommandRecall( Abc_Frame_t * pAbc, int argc, char **argv )
} }
} }
if ( pAbc->pNtkCur == NULL )
{
fprintf( pAbc->Out, "Empty network.\n" );
return 0;
}
// get the number of networks to save // get the number of networks to save
pValue = Cmd_FlagReadByName( pAbc, "savesteps" ); pValue = Cmd_FlagReadByName( pAbc, "savesteps" );
// if the value of steps to save is not set, assume 1-level undo // if the value of steps to save is not set, assume 1-level undo
...@@ -1034,12 +1042,6 @@ int CmdCommandEmpty( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1034,12 +1042,6 @@ int CmdCommandEmpty( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
int c; int c;
if ( pAbc->pNtkCur == NULL )
{
fprintf( pAbc->Out, "Empty network.\n" );
return 0;
}
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{ {
...@@ -1052,6 +1054,12 @@ int CmdCommandEmpty( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1052,6 +1054,12 @@ int CmdCommandEmpty( Abc_Frame_t * pAbc, int argc, char **argv )
} }
} }
if ( pAbc->pNtkCur == NULL )
{
fprintf( pAbc->Out, "Empty network.\n" );
return 0;
}
Abc_FrameDeleteAllNetworks( pAbc ); Abc_FrameDeleteAllNetworks( pAbc );
Abc_FrameRestart( pAbc ); Abc_FrameRestart( pAbc );
return 0; return 0;
...@@ -1635,6 +1643,13 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1635,6 +1643,13 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv )
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
if ( argc == 1 )
goto usage;
if ( strcmp( argv[1], "-h" ) == 0 )
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage;
if ( pNtk == NULL ) if ( pNtk == NULL )
{ {
fprintf( pErr, "Empty network.\n" ); fprintf( pErr, "Empty network.\n" );
...@@ -1647,13 +1662,6 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1647,13 +1662,6 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv )
goto usage; goto usage;
} }
if ( argc == 1 )
goto usage;
if ( strcmp( argv[1], "-h" ) == 0 )
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage;
// get the names from the resource file // get the names from the resource file
if ( Cmd_FlagReadByName(pAbc, "siswin") ) if ( Cmd_FlagReadByName(pAbc, "siswin") )
pNameWin = Cmd_FlagReadByName(pAbc, "siswin"); pNameWin = Cmd_FlagReadByName(pAbc, "siswin");
...@@ -1739,7 +1747,6 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1739,7 +1747,6 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "\n" );
fprintf( pErr, "Usage: sis [-h] <com>\n"); fprintf( pErr, "Usage: sis [-h] <com>\n");
fprintf( pErr, " invokes SIS command for the current ABC network\n" ); fprintf( pErr, " invokes SIS command for the current ABC network\n" );
fprintf( pErr, " (the executable of SIS should be in the same directory)\n" ); fprintf( pErr, " (the executable of SIS should be in the same directory)\n" );
...@@ -1778,6 +1785,13 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1778,6 +1785,13 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv )
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
if ( argc == 1 )
goto usage;
if ( strcmp( argv[1], "-h" ) == 0 )
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage;
if ( pNtk == NULL ) if ( pNtk == NULL )
{ {
fprintf( pErr, "Empty network.\n" ); fprintf( pErr, "Empty network.\n" );
...@@ -1790,13 +1804,6 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1790,13 +1804,6 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv )
goto usage; goto usage;
} }
if ( argc == 1 )
goto usage;
if ( strcmp( argv[1], "-h" ) == 0 )
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage;
// get the names from the resource file // get the names from the resource file
if ( Cmd_FlagReadByName(pAbc, "mvsiswin") ) if ( Cmd_FlagReadByName(pAbc, "mvsiswin") )
pNameWin = Cmd_FlagReadByName(pAbc, "mvsiswin"); pNameWin = Cmd_FlagReadByName(pAbc, "mvsiswin");
...@@ -1882,7 +1889,6 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1882,7 +1889,6 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "\n" );
fprintf( pErr, "Usage: mvsis [-h] <com>\n"); fprintf( pErr, "Usage: mvsis [-h] <com>\n");
fprintf( pErr, " invokes MVSIS command for the current ABC network\n" ); fprintf( pErr, " invokes MVSIS command for the current ABC network\n" );
fprintf( pErr, " (the executable of MVSIS should be in the same directory)\n" ); fprintf( pErr, " (the executable of MVSIS should be in the same directory)\n" );
...@@ -1992,23 +1998,23 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1992,23 +1998,23 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv )
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
if ( pNtk == NULL ) if ( argc > 1 )
{ {
fprintf( pErr, "Empty network.\n" ); if ( strcmp( argv[1], "-h" ) == 0 )
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage; goto usage;
} }
if ( strcmp( argv[0], "capo" ) != 0 ) if ( pNtk == NULL )
{ {
fprintf( pErr, "Wrong command: \"%s\".\n", argv[0] ); fprintf( pErr, "Empty network.\n" );
goto usage; goto usage;
} }
if ( argc > 1 ) if ( strcmp( argv[0], "capo" ) != 0 )
{ {
if ( strcmp( argv[1], "-h" ) == 0 ) fprintf( pErr, "Wrong command: \"%s\".\n", argv[0] );
goto usage;
if ( strcmp( argv[1], "-?" ) == 0 )
goto usage; goto usage;
} }
...@@ -2125,7 +2131,6 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -2125,7 +2131,6 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "\n" );
fprintf( pErr, "Usage: capo [-h] <com>\n"); fprintf( pErr, "Usage: capo [-h] <com>\n");
fprintf( pErr, " peforms placement of the current network using Capo\n" ); fprintf( pErr, " peforms placement of the current network using Capo\n" );
fprintf( pErr, " a Capo binary should be present in the same directory\n" ); fprintf( pErr, " a Capo binary should be present in the same directory\n" );
...@@ -2244,8 +2249,28 @@ usage: ...@@ -2244,8 +2249,28 @@ usage:
******************************************************************************/ ******************************************************************************/
int CmdCommandVersion( Abc_Frame_t * pAbc, int argc, char **argv ) int CmdCommandVersion( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
int c;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{
switch ( c )
{
case 'h':
goto usage;
default:
goto usage;
}
}
printf("%s\n", Abc_UtilsGetVersion(pAbc)); printf("%s\n", Abc_UtilsGetVersion(pAbc));
return 0; return 0;
usage:
fprintf( pAbc->Err, "usage: version [-h]\n" );
fprintf( pAbc->Err, " print the version string\n" );
fprintf( pAbc->Err, " -h : print the command usage\n");
return 1;
} }
......
...@@ -77,7 +77,7 @@ extern FILE * CmdFileOpen( Abc_Frame_t * pAbc, char * sFileName, char * sMod ...@@ -77,7 +77,7 @@ extern FILE * CmdFileOpen( Abc_Frame_t * pAbc, char * sFileName, char * sMod
extern void CmdFreeArgv( int argc, char ** argv ); extern void CmdFreeArgv( int argc, char ** argv );
extern char ** CmdAddToArgv( int argc, char ** argv ); extern char ** CmdAddToArgv( int argc, char ** argv );
extern void CmdCommandFree( Abc_Command * pCommand ); extern void CmdCommandFree( Abc_Command * pCommand );
extern void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll ); extern void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll, int fDetails );
extern void CmdPrintTable( st__table * tTable, int fAliases ); extern void CmdPrintTable( st__table * tTable, int fAliases );
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -543,16 +543,17 @@ void CmdCommandFree( Abc_Command * pCommand ) ...@@ -543,16 +543,17 @@ void CmdCommandFree( Abc_Command * pCommand )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll ) void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll, int fDetails )
{ {
const char *key; const char *key;
char *value; char *value;
st__generator * gen; st__generator * gen;
Abc_Command ** ppCommands; Abc_Command ** ppCommands;
Abc_Command * pCommands; Abc_Command * pCommands;
int nCommands, i; int nCommands, iGroupStart, i, j;
char * sGroupCur; char * sGroupCur;
int LenghtMax, nColumns, iCom = 0; int LenghtMax, nColumns, iCom = 0;
FILE *backupErr = pAbc->Err;
// put all commands into one array // put all commands into one array
nCommands = st__count( pAbc->tCommands ); nCommands = st__count( pAbc->tCommands );
...@@ -584,6 +585,8 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll ) ...@@ -584,6 +585,8 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll )
// print the command by group // print the command by group
sGroupCur = NULL; sGroupCur = NULL;
iGroupStart = 0;
pAbc->Err = pAbc->Out;
for ( i = 0; i < nCommands; i++ ) for ( i = 0; i < nCommands; i++ )
if ( sGroupCur && strcmp( sGroupCur, ppCommands[i]->sGroup ) == 0 ) if ( sGroupCur && strcmp( sGroupCur, ppCommands[i]->sGroup ) == 0 )
{ // this command belongs to the same group as the previous one { // this command belongs to the same group as the previous one
...@@ -595,6 +598,22 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll ) ...@@ -595,6 +598,22 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll )
else else
{ // this command starts the new group of commands { // this command starts the new group of commands
// start the new group // start the new group
if ( fDetails && i != iGroupStart )
{ // print help messages for all commands in the previous groups
fprintf( pAbc->Out, "\n" );
for ( j = iGroupStart; j < i; j++ )
{
fprintf( pAbc->Out, "\n" );
// fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
char *tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
(void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
(void) Cmd_CommandExecute( pAbc, tmp_cmd );
ABC_FREE(tmp_cmd);
}
fprintf( pAbc->Out, "\n" );
fprintf( pAbc->Out, " ----------------------------------------------------------------------" );
iGroupStart = i;
}
fprintf( pAbc->Out, "\n" ); fprintf( pAbc->Out, "\n" );
fprintf( pAbc->Out, "\n" ); fprintf( pAbc->Out, "\n" );
fprintf( pAbc->Out, "%s commands:\n", ppCommands[i]->sGroup ); fprintf( pAbc->Out, "%s commands:\n", ppCommands[i]->sGroup );
...@@ -605,6 +624,20 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll ) ...@@ -605,6 +624,20 @@ void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll )
// reset the command counter // reset the command counter
iCom = 1; iCom = 1;
} }
if ( fDetails && i != iGroupStart )
{ // print help messages for all commands in the previous groups
fprintf( pAbc->Out, "\n" );
for ( j = iGroupStart; j < i; j++ )
{
fprintf( pAbc->Out, "\n" );
// fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
char *tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
(void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
(void) Cmd_CommandExecute( pAbc, tmp_cmd );
ABC_FREE(tmp_cmd);
}
}
pAbc->Err = backupErr;
fprintf( pAbc->Out, "\n" ); fprintf( pAbc->Out, "\n" );
ABC_FREE( ppCommands ); ABC_FREE( ppCommands );
} }
......
...@@ -161,7 +161,7 @@ int Fpga_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -161,7 +161,7 @@ int Fpga_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "\nusage: read_lut [-vh]\n"); fprintf( pErr, "usage: read_lut [-vh]\n");
fprintf( pErr, "\t read the LUT library from the file\n" ); fprintf( pErr, "\t read the LUT library from the file\n" );
fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") ); fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t-h : print the command usage\n");
...@@ -231,7 +231,7 @@ int Fpga_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -231,7 +231,7 @@ int Fpga_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "\nusage: print_lut [-vh]\n"); fprintf( pErr, "usage: print_lut [-vh]\n");
fprintf( pErr, "\t print the current LUT library\n" ); fprintf( pErr, "\t print the current LUT library\n" );
fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") ); fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t-h : print the command usage\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment