aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2017-08-25 11:44:48 +0200
committerClifford Wolf <clifford@clifford.at>2017-08-25 11:44:48 +0200
commitc2d737457a889cf48fcbf5444d5c450a24f7163c (patch)
tree4aff60e3c2fd108db1cd44e370a01a25d0601285 /backends
parentd3b3dd8e88383054f74a8301616770c76166a113 (diff)
downloadyosys-c2d737457a889cf48fcbf5444d5c450a24f7163c.tar.gz
yosys-c2d737457a889cf48fcbf5444d5c450a24f7163c.tar.bz2
yosys-c2d737457a889cf48fcbf5444d5c450a24f7163c.zip
Fix bug in write_smt2 (export logic driving hierarchical cells before exporting regs)
Diffstat (limited to 'backends')
-rw-r--r--backends/smt2/smt2.cc68
1 files changed, 34 insertions, 34 deletions
diff --git a/backends/smt2/smt2.cc b/backends/smt2/smt2.cc
index cccf3dbb3..dce7c25de 100644
--- a/backends/smt2/smt2.cc
+++ b/backends/smt2/smt2.cc
@@ -794,6 +794,40 @@ struct Smt2Worker
}
}
+ if (verbose) log("=> export logic driving hierarchical cells\n");
+
+ for (auto cell : module->cells())
+ if (module->design->module(cell->type) != nullptr)
+ export_cell(cell);
+
+ while (!hiercells_queue.empty())
+ {
+ std::set<RTLIL::Cell*> queue;
+ queue.swap(hiercells_queue);
+
+ for (auto cell : queue)
+ {
+ string cell_state = stringf("(|%s_h %s| state)", get_id(module), get_id(cell->name));
+ Module *m = module->design->module(cell->type);
+ log_assert(m != nullptr);
+
+ for (auto &conn : cell->connections())
+ {
+ Wire *w = m->wire(conn.first);
+ SigSpec sig = sigmap(conn.second);
+
+ if (bvmode || GetSize(w) == 1) {
+ hier.push_back(stringf(" (= %s (|%s_n %s| %s)) ; %s.%s\n", (GetSize(w) > 1 ? get_bv(sig) : get_bool(sig)).c_str(),
+ get_id(cell->type), get_id(w), cell_state.c_str(), get_id(cell->type), get_id(w)));
+ } else {
+ for (int i = 0; i < GetSize(w); i++)
+ hier.push_back(stringf(" (= %s (|%s_n %s %d| %s)) ; %s.%s[%d]\n", get_bool(sig[i]).c_str(),
+ get_id(cell->type), get_id(w), i, cell_state.c_str(), get_id(cell->type), get_id(w), i));
+ }
+ }
+ }
+ }
+
for (int iter = 1; !registers.empty(); iter++)
{
pool<Cell*> this_regs;
@@ -940,40 +974,6 @@ struct Smt2Worker
}
}
- if (verbose) log("=> export logic driving hierarchical cells\n");
-
- for (auto cell : module->cells())
- if (module->design->module(cell->type) != nullptr)
- export_cell(cell);
-
- while (!hiercells_queue.empty())
- {
- std::set<RTLIL::Cell*> queue;
- queue.swap(hiercells_queue);
-
- for (auto cell : queue)
- {
- string cell_state = stringf("(|%s_h %s| state)", get_id(module), get_id(cell->name));
- Module *m = module->design->module(cell->type);
- log_assert(m != nullptr);
-
- for (auto &conn : cell->connections())
- {
- Wire *w = m->wire(conn.first);
- SigSpec sig = sigmap(conn.second);
-
- if (bvmode || GetSize(w) == 1) {
- hier.push_back(stringf(" (= %s (|%s_n %s| %s)) ; %s.%s\n", (GetSize(w) > 1 ? get_bv(sig) : get_bool(sig)).c_str(),
- get_id(cell->type), get_id(w), cell_state.c_str(), get_id(cell->type), get_id(w)));
- } else {
- for (int i = 0; i < GetSize(w); i++)
- hier.push_back(stringf(" (= %s (|%s_n %s %d| %s)) ; %s.%s[%d]\n", get_bool(sig[i]).c_str(),
- get_id(cell->type), get_id(w), i, cell_state.c_str(), get_id(cell->type), get_id(w), i));
- }
- }
- }
- }
-
if (verbose) log("=> finalizing SMT2 representation of %s.\n", log_id(module));
for (auto c : hiercells) {