From: Clifford Wolf Date: Sun, 17 Nov 2013 12:26:31 +0000 (+0100) Subject: Added -v option and some minor driver cleanups X-Git-Tag: yosys-0.2.0~367 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d52eb0ddb843afc67ec4bc23a3b25c6f74ef489;p=yosys.git Added -v option and some minor driver cleanups --- diff --git a/kernel/driver.cc b/kernel/driver.cc index 05a0c48a8..87109f53b 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -453,7 +453,7 @@ int main(int argc, char **argv) } int opt; - while ((opt = getopt(argc, argv, "VSm:f:b:o:p:l:qts:c:")) != -1) + while ((opt = getopt(argc, argv, "VSm:f:b:o:p:l:qv:ts:c:")) != -1) { switch (opt) { @@ -466,6 +466,7 @@ int main(int argc, char **argv) passes_commands.push_back("proc"); passes_commands.push_back("opt"); passes_commands.push_back("memory"); + passes_commands.push_back("opt"); passes_commands.push_back("techmap"); passes_commands.push_back("opt"); break; @@ -499,6 +500,10 @@ int main(int argc, char **argv) case 'q': log_errfile = stderr; break; + case 'v': + log_errfile = stderr; + log_verbose_level = atoi(optarg); + break; case 't': log_time = true; break; @@ -512,12 +517,15 @@ int main(int argc, char **argv) break; default: fprintf(stderr, "\n"); - fprintf(stderr, "Usage: %s [-V] [-S] [-q] [-t] [-l logfile] [-o ] [-f ] [{-s|-c} ]\n", argv[0]); - fprintf(stderr, " %*s[-p [-p ..]] [-b ] [-m ] [ [..]]\n", int(strlen(argv[0])+1), ""); + fprintf(stderr, "Usage: %s [-V] [-S] [-q] [-v [-t] [-l ] [-o ] [-f ]\n", argv[0]); + fprintf(stderr, " %*s[{-s|-c} ] [-p [-p ..]] [-b ] [-m ] [ [..]]\n", int(strlen(argv[0])+1), ""); fprintf(stderr, "\n"); fprintf(stderr, " -q\n"); fprintf(stderr, " quiet operation. only write error messages to console\n"); fprintf(stderr, "\n"); + fprintf(stderr, " -v \n"); + fprintf(stderr, " print log headers up to level to the console. (implies -q)\n"); + fprintf(stderr, "\n"); fprintf(stderr, " -t\n"); fprintf(stderr, " annotate all log messages with a time stamp\n"); fprintf(stderr, "\n"); @@ -552,13 +560,13 @@ int main(int argc, char **argv) fprintf(stderr, "transformation of the input to a gate-level netlist. This can be helpful when\n"); fprintf(stderr, "e.g. using yosys as a pre-processor for a tool that can't understand full verilog.\n"); fprintf(stderr, "\n"); - fprintf(stderr, " -b 'verilog -noattr' -p hierarchy -p proc -p opt -p memory -p techmap -p opt\n"); + fprintf(stderr, " -b 'verilog -noattr' -p hierarchy -p proc -p opt -p memory -p opt -p techmap -p opt\n"); fprintf(stderr, "\n"); fprintf(stderr, "For more complex synthesis jobs it is recommended to use the read_* and write_*\n"); fprintf(stderr, "commands in a script file instead of specifying input and output files on the\n"); fprintf(stderr, "command line.\n"); fprintf(stderr, "\n"); - fprintf(stderr, "When no commands, script files and input files are specified on the command\n"); + fprintf(stderr, "When no commands, script files or input files are specified on the command\n"); fprintf(stderr, "line, yosys automatically enters the interactive command mode. Use the 'help'\n"); fprintf(stderr, "command to get information on the individual commands.\n"); fprintf(stderr, "\n"); diff --git a/kernel/log.cc b/kernel/log.cc index 9bf8705e3..779f93737 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -32,6 +32,7 @@ std::vector log_files; FILE *log_errfile = NULL; bool log_time = false; bool log_cmd_error_throw = false; +int log_verbose_level; std::vector header_count; std::list string_buf; @@ -101,6 +102,14 @@ void logv_header(const char *format, va_list ap) log(" "); logv(format, ap); log_flush(); + + if (int(header_count.size()) <= log_verbose_level && log_errfile != NULL) { + for (int c : header_count) + fprintf(log_errfile, "%d.", c); + fprintf(log_errfile, " "); + vfprintf(log_errfile, format, ap); + fflush(log_errfile); + } } void logv_error(const char *format, va_list ap) diff --git a/kernel/log.h b/kernel/log.h index a1b129aa1..dbfb6103e 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -28,6 +28,7 @@ extern std::vector log_files; extern FILE *log_errfile; extern bool log_time; extern bool log_cmd_error_throw; +extern int log_verbose_level; std::string stringf(const char *fmt, ...);