aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2022-11-28 19:03:27 +0100
committerJannis Harder <me@jix.one>2022-12-02 14:36:19 +0100
commited02d52f30d3c2b3d6a4ba0e8234cc07c78889dc (patch)
treedc5d08a53f3361f1c0c5e3edca75030a8d5c6de1 /kernel
parenta64ed824ed6fadf24cf2871d7752f63ab6613c8b (diff)
downloadyosys-ed02d52f30d3c2b3d6a4ba0e8234cc07c78889dc.tar.gz
yosys-ed02d52f30d3c2b3d6a4ba0e8234cc07c78889dc.tar.bz2
yosys-ed02d52f30d3c2b3d6a4ba0e8234cc07c78889dc.zip
tee: Allow logging command output to a given scratchpad value
Diffstat (limited to 'kernel')
-rw-r--r--kernel/log.cc6
-rw-r--r--kernel/log.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/kernel/log.cc b/kernel/log.cc
index af8c422b8..25d198744 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -40,6 +40,7 @@ YOSYS_NAMESPACE_BEGIN
std::vector<FILE*> log_files;
std::vector<std::ostream*> log_streams;
+std::vector<std::string> log_scratchpads;
std::map<std::string, std::set<std::string>> log_hdump;
std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
dict<std::string, LogExpectedItem> log_expect_log, log_expect_warning, log_expect_error;
@@ -158,6 +159,11 @@ void logv(const char *format, va_list ap)
for (auto f : log_streams)
*f << str;
+ RTLIL::Design *design = yosys_get_design();
+ if (design != nullptr)
+ for (auto &scratchpad : log_scratchpads)
+ design->scratchpad[scratchpad].append(str);
+
static std::string linebuffer;
static bool log_warn_regex_recusion_guard = false;
diff --git a/kernel/log.h b/kernel/log.h
index 822816cb4..35368a683 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -133,6 +133,7 @@ struct log_cmd_error_exception { };
extern std::vector<FILE*> log_files;
extern std::vector<std::ostream*> log_streams;
+extern std::vector<std::string> log_scratchpads;
extern std::map<std::string, std::set<std::string>> log_hdump;
extern std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
extern std::set<std::string> log_warnings, log_experimentals, log_experimentals_ignored;