mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-27 00:18:46 +00:00
Move GENERATE_PATTERN macro to separate utility header
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
af61d92441
commit
bb0851bfc5
3 changed files with 157 additions and 128 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue