mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	Added -v<level> option and some minor driver cleanups
This commit is contained in:
		
							parent
							
								
									2df5cd87b2
								
							
						
					
					
						commit
						7d52eb0ddb
					
				
					 3 changed files with 23 additions and 5 deletions
				
			
		|  | @ -453,7 +453,7 @@ int main(int argc, char **argv) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	int opt; | 	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) | 		switch (opt) | ||||||
| 		{ | 		{ | ||||||
|  | @ -466,6 +466,7 @@ int main(int argc, char **argv) | ||||||
| 			passes_commands.push_back("proc"); | 			passes_commands.push_back("proc"); | ||||||
| 			passes_commands.push_back("opt"); | 			passes_commands.push_back("opt"); | ||||||
| 			passes_commands.push_back("memory"); | 			passes_commands.push_back("memory"); | ||||||
|  | 			passes_commands.push_back("opt"); | ||||||
| 			passes_commands.push_back("techmap"); | 			passes_commands.push_back("techmap"); | ||||||
| 			passes_commands.push_back("opt"); | 			passes_commands.push_back("opt"); | ||||||
| 			break; | 			break; | ||||||
|  | @ -499,6 +500,10 @@ int main(int argc, char **argv) | ||||||
| 		case 'q': | 		case 'q': | ||||||
| 			log_errfile = stderr; | 			log_errfile = stderr; | ||||||
| 			break; | 			break; | ||||||
|  | 		case 'v': | ||||||
|  | 			log_errfile = stderr; | ||||||
|  | 			log_verbose_level = atoi(optarg); | ||||||
|  | 			break; | ||||||
| 		case 't': | 		case 't': | ||||||
| 			log_time = true; | 			log_time = true; | ||||||
| 			break; | 			break; | ||||||
|  | @ -512,12 +517,15 @@ int main(int argc, char **argv) | ||||||
| 			break; | 			break; | ||||||
| 		default: | 		default: | ||||||
| 			fprintf(stderr, "\n"); | 			fprintf(stderr, "\n"); | ||||||
| 			fprintf(stderr, "Usage: %s [-V] [-S] [-q] [-t] [-l logfile] [-o <outfile>] [-f <frontend>] [{-s|-c} <scriptfile>]\n", argv[0]); | 			fprintf(stderr, "Usage: %s [-V] [-S] [-q] [-v <level>[-t] [-l <logfile>] [-o <outfile>] [-f <frontend>]\n", argv[0]); | ||||||
| 			fprintf(stderr, "       %*s[-p <pass> [-p ..]] [-b <backend>] [-m <module_file>] [<infile> [..]]\n", int(strlen(argv[0])+1), ""); | 			fprintf(stderr, "       %*s[{-s|-c} <scriptfile>] [-p <pass> [-p ..]] [-b <backend>] [-m <module_file>] [<infile> [..]]\n", int(strlen(argv[0])+1), ""); | ||||||
| 			fprintf(stderr, "\n"); | 			fprintf(stderr, "\n"); | ||||||
| 			fprintf(stderr, "    -q\n"); | 			fprintf(stderr, "    -q\n"); | ||||||
| 			fprintf(stderr, "        quiet operation. only write error messages to console\n"); | 			fprintf(stderr, "        quiet operation. only write error messages to console\n"); | ||||||
| 			fprintf(stderr, "\n"); | 			fprintf(stderr, "\n"); | ||||||
|  | 			fprintf(stderr, "    -v <level>\n"); | ||||||
|  | 			fprintf(stderr, "        print log headers up to level <level> to the console. (implies -q)\n"); | ||||||
|  | 			fprintf(stderr, "\n"); | ||||||
| 			fprintf(stderr, "    -t\n"); | 			fprintf(stderr, "    -t\n"); | ||||||
| 			fprintf(stderr, "        annotate all log messages with a time stamp\n"); | 			fprintf(stderr, "        annotate all log messages with a time stamp\n"); | ||||||
| 			fprintf(stderr, "\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, "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, "e.g. using yosys as a pre-processor for a tool that can't understand full verilog.\n"); | ||||||
| 			fprintf(stderr, "\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, "\n"); | ||||||
| 			fprintf(stderr, "For more complex synthesis jobs it is recommended to use the read_* and write_*\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, "commands in a script file instead of specifying input and output files on the\n"); | ||||||
| 			fprintf(stderr, "command line.\n"); | 			fprintf(stderr, "command line.\n"); | ||||||
| 			fprintf(stderr, "\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, "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, "command to get information on the individual commands.\n"); | ||||||
| 			fprintf(stderr, "\n"); | 			fprintf(stderr, "\n"); | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ std::vector<FILE*> log_files; | ||||||
| FILE *log_errfile = NULL; | FILE *log_errfile = NULL; | ||||||
| bool log_time = false; | bool log_time = false; | ||||||
| bool log_cmd_error_throw = false; | bool log_cmd_error_throw = false; | ||||||
|  | int log_verbose_level; | ||||||
| 
 | 
 | ||||||
| std::vector<int> header_count; | std::vector<int> header_count; | ||||||
| std::list<std::string> string_buf; | std::list<std::string> string_buf; | ||||||
|  | @ -101,6 +102,14 @@ void logv_header(const char *format, va_list ap) | ||||||
| 	log(" "); | 	log(" "); | ||||||
| 	logv(format, ap); | 	logv(format, ap); | ||||||
| 	log_flush(); | 	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) | void logv_error(const char *format, va_list ap) | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ extern std::vector<FILE*> log_files; | ||||||
| extern FILE *log_errfile; | extern FILE *log_errfile; | ||||||
| extern bool log_time; | extern bool log_time; | ||||||
| extern bool log_cmd_error_throw; | extern bool log_cmd_error_throw; | ||||||
|  | extern int log_verbose_level; | ||||||
| 
 | 
 | ||||||
| std::string stringf(const char *fmt, ...); | std::string stringf(const char *fmt, ...); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue