aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-04-24 17:12:34 +0200
committerClifford Wolf <clifford@clifford.at>2016-04-24 17:12:34 +0200
commit9aa4b3309c35d842e2b1a04172745a5e34a3c445 (patch)
treeed30da93562604fe43956d5cafba0f2a445d25cb /kernel
parent09ffebb9959510cacdc04c926800223235f50313 (diff)
downloadyosys-9aa4b3309c35d842e2b1a04172745a5e34a3c445.tar.gz
yosys-9aa4b3309c35d842e2b1a04172745a5e34a3c445.tar.bz2
yosys-9aa4b3309c35d842e2b1a04172745a5e34a3c445.zip
Added "yosys -D ALL"
Diffstat (limited to 'kernel')
-rw-r--r--kernel/driver.cc23
-rw-r--r--kernel/log.cc4
-rw-r--r--kernel/log.h1
3 files changed, 22 insertions, 6 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc
index 0844eaa2e..45cdd461d 100644
--- a/kernel/driver.cc
+++ b/kernel/driver.cc
@@ -216,6 +216,7 @@ int main(int argc, char **argv)
printf(" -D <header_id>[:<filename>]\n");
printf(" dump the design when printing the specified log header to a file.\n");
printf(" yosys_dump_<header_id>.il is used as filename if none is specified.\n");
+ printf(" Use 'ALL' as <header_id> to dump at every header.\n");
printf("\n");
printf(" -V\n");
printf(" print version information and exit\n");
@@ -322,13 +323,23 @@ int main(int argc, char **argv)
case 'D':
{
auto args = split_tokens(optarg, ":");
- if (GetSize(args) == 1)
- args.push_back("yosys_dump_" + args[0] + ".il");
- if (GetSize(args) != 2) {
- fprintf(stderr, "Invalid number of tokens in -D.\n");
- exit(1);
+ if (!args.empty() && args[0] == "ALL") {
+ if (GetSize(args) != 1) {
+ fprintf(stderr, "Invalid number of tokens in -D ALL.\n");
+ exit(1);
+ }
+ log_hdump_all = true;
+ } else {
+ if (!args.empty() && !args[0].empty() && args[0].back() == '.')
+ args[0].pop_back();
+ if (GetSize(args) == 1)
+ args.push_back("yosys_dump_" + args[0] + ".il");
+ if (GetSize(args) != 2) {
+ fprintf(stderr, "Invalid number of tokens in -D.\n");
+ exit(1);
+ }
+ log_hdump[args[0]].insert(args[1]);
}
- log_hdump[args[0]].insert(args[1]);
}
break;
default:
diff --git a/kernel/log.cc b/kernel/log.cc
index f2b343dff..fe84184a5 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -41,6 +41,7 @@ YOSYS_NAMESPACE_BEGIN
std::vector<FILE*> log_files;
std::vector<std::ostream*> log_streams;
std::map<std::string, std::set<std::string>> log_hdump;
+bool log_hdump_all = false;
FILE *log_errfile = NULL;
SHA1 *log_hasher = NULL;
@@ -159,6 +160,9 @@ void logv_header(RTLIL::Design *design, const char *format, va_list ap)
logv(format, ap);
log_flush();
+ if (log_hdump_all)
+ log_hdump[header_id].insert("yosys_dump_" + header_id + ".il");
+
if (log_hdump.count(header_id) && design != nullptr)
for (auto &filename : log_hdump.at(header_id)) {
log("Dumping current design to '%s'.\n", filename.c_str());
diff --git a/kernel/log.h b/kernel/log.h
index 6090f8273..c265bae42 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -48,6 +48,7 @@ struct log_cmd_error_exception { };
extern std::vector<FILE*> log_files;
extern std::vector<std::ostream*> log_streams;
extern std::map<std::string, std::set<std::string>> log_hdump;
+extern bool log_hdump_all;
extern FILE *log_errfile;
extern SHA1 *log_hasher;