aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-03-31 09:57:44 +0200
committerClifford Wolf <clifford@clifford.at>2016-03-31 09:57:44 +0200
commit6f1b6dc322bf6cceeadef7c666b8ff333ec6f2bf (patch)
tree2a3c811234c44050bdcdf64eed77dcdfd69213f7 /kernel
parente5dd5c0bcccd4e79921e6a28b550a5960a93ee07 (diff)
downloadyosys-6f1b6dc322bf6cceeadef7c666b8ff333ec6f2bf.tar.gz
yosys-6f1b6dc322bf6cceeadef7c666b8ff333ec6f2bf.tar.bz2
yosys-6f1b6dc322bf6cceeadef7c666b8ff333ec6f2bf.zip
Added log_dump() support for dict<> and pool<> containers
Diffstat (limited to 'kernel')
-rw-r--r--kernel/log.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/log.h b/kernel/log.h
index 28baf9886..c0be23b08 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -230,6 +230,32 @@ static inline void log_dump_args_worker(const char *p YS_ATTRIBUTE(unused)) { lo
void log_dump_val_worker(RTLIL::IdString v);
void log_dump_val_worker(RTLIL::SigSpec v);
+template<typename K, typename T, typename OPS>
+static inline void log_dump_val_worker(dict<K, T, OPS> &v) {
+ log("{");
+ bool first = true;
+ for (auto &it : v) {
+ log(first ? " " : ", ");
+ log_dump_val_worker(it.first);
+ log(": ");
+ log_dump_val_worker(it.second);
+ first = false;
+ }
+ log(" }");
+}
+
+template<typename K, typename OPS>
+static inline void log_dump_val_worker(pool<K, OPS> &v) {
+ log("{");
+ bool first = true;
+ for (auto &it : v) {
+ log(first ? " " : ", ");
+ log_dump_val_worker(it);
+ first = false;
+ }
+ log(" }");
+}
+
template<typename T>
static inline void log_dump_val_worker(T *ptr) { log("%p", ptr); }