diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-07-20 10:35:47 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-07-20 10:35:47 +0200 |
commit | a6174aaf5eec37f1d1713afa978ae16286fc0b74 (patch) | |
tree | 6dc2d41220ff1ec5200f224798c399315878b0c0 /kernel | |
parent | 15fd615da5a119b4ee9cded9f44ae36fd66820f7 (diff) | |
download | yosys-a6174aaf5eec37f1d1713afa978ae16286fc0b74.tar.gz yosys-a6174aaf5eec37f1d1713afa978ae16286fc0b74.tar.bz2 yosys-a6174aaf5eec37f1d1713afa978ae16286fc0b74.zip |
Added log_cell()
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/log.cc | 15 | ||||
-rw-r--r-- | kernel/log.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/kernel/log.cc b/kernel/log.cc index 3108bddfe..949bf4327 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -213,3 +213,18 @@ const char *log_id(std::string str) string_buf.push_back(str); return string_buf.back().c_str(); } + +void log_cell(RTLIL::Cell *cell, std::string indent) +{ + char *ptr; + size_t size; + + FILE *f = open_memstream(&ptr, &size); + ILANG_BACKEND::dump_cell(f, indent, cell); + fputc(0, f); + fclose(f); + + log("%s", ptr); + free(ptr); +} + diff --git a/kernel/log.h b/kernel/log.h index 2c3597c9a..f6dcc0ac2 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -57,6 +57,8 @@ template<typename T> static inline const char *log_id(T *obj) { return log_id(obj->name); } +void log_cell(RTLIL::Cell *cell, std::string indent = ""); + #define log_abort() log_error("Abort in %s:%d.\n", __FILE__, __LINE__) #define log_assert(_assert_expr_) do { if (_assert_expr_) break; log_error("Assert `%s' failed in %s:%d.\n", #_assert_expr_, __FILE__, __LINE__); } while (0) |