diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-10-16 14:44:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 14:44:38 +0200 |
commit | 0d037bf9d8d866239de15d72dc8c5acd7ab5e5cf (patch) | |
tree | 1efcd7e26b0626fc1b9b6188a3ea74db7947e8e6 /passes/pmgen/pmgen.py | |
parent | af61d924419844b90bf6d54453489b3e41b7e353 (diff) | |
parent | b8774ae849cb6aa54a852a245f8634afaac1eb76 (diff) | |
download | yosys-0d037bf9d8d866239de15d72dc8c5acd7ab5e5cf.tar.gz yosys-0d037bf9d8d866239de15d72dc8c5acd7ab5e5cf.tar.bz2 yosys-0d037bf9d8d866239de15d72dc8c5acd7ab5e5cf.zip |
Merge pull request #1450 from YosysHQ/clifford/fixdffmux
Fix handling of init attributes in peepopt dffmux pattern
Diffstat (limited to 'passes/pmgen/pmgen.py')
-rw-r--r-- | passes/pmgen/pmgen.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index 39a09991d..df0ffaff2 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -362,6 +362,7 @@ with open(outfile, "w") as f: print(" Module *module;", file=f) print(" SigMap sigmap;", file=f) print(" std::function<void()> on_accept;", file=f) + print(" bool setup_done;", file=f) print(" bool generate_mode;", file=f) print(" int accept_cnt;", file=f) print("", file=f) @@ -477,7 +478,17 @@ with open(outfile, "w") as f: print("", file=f) print(" {}_pm(Module *module, const vector<Cell*> &cells) :".format(prefix), file=f) - print(" module(module), sigmap(module), generate_mode(false), rngseed(12345678) {", file=f) + print(" module(module), sigmap(module), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f) + print(" setup(cells);", file=f) + print(" }", file=f) + print("", file=f) + + print(" {}_pm(Module *module) :".format(prefix), file=f) + print(" module(module), sigmap(module), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f) + print(" }", file=f) + print("", file=f) + + print(" void setup(const vector<Cell*> &cells) {", file=f) for current_pattern in sorted(patterns.keys()): for s, t in sorted(udata_types[current_pattern].items()): if t.endswith("*"): @@ -485,6 +496,8 @@ with open(outfile, "w") as f: else: print(" ud_{}.{} = {}();".format(current_pattern, s, t), file=f) current_pattern = None + print(" log_assert(!setup_done);", file=f) + print(" setup_done = true;", file=f) print(" for (auto port : module->ports)", file=f) print(" add_siguser(module->wire(port), nullptr);", file=f) print(" for (auto cell : module->cells())", file=f) @@ -539,6 +552,7 @@ with open(outfile, "w") as f: for current_pattern in sorted(patterns.keys()): print(" int run_{}(std::function<void()> on_accept_f) {{".format(current_pattern), file=f) + print(" log_assert(setup_done);", file=f) print(" accept_cnt = 0;", file=f) print(" on_accept = on_accept_f;", file=f) print(" rollback = 0;", file=f) |