diff options
author | clairexen <claire@symbioticeda.com> | 2020-08-20 16:23:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 16:23:55 +0200 |
commit | 1d0d9d5c86f722fbfe60e530225d28ed4be93e13 (patch) | |
tree | 6d9aa7ffa6bba145db41af7908d0762d66980da6 | |
parent | 799076af24ef31e8611bd99180760e7d8cd5a771 (diff) | |
parent | 2ab350a7b01aab8f0ed39f518720d6e6792cd6d6 (diff) | |
download | yosys-1d0d9d5c86f722fbfe60e530225d28ed4be93e13.tar.gz yosys-1d0d9d5c86f722fbfe60e530225d28ed4be93e13.tar.bz2 yosys-1d0d9d5c86f722fbfe60e530225d28ed4be93e13.zip |
Merge pull request #2337 from YosysHQ/mwk/clean-keep-wire
opt_clean: Fix module keep rules.
-rw-r--r-- | passes/opt/opt_clean.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index 44de60b48..5370881d3 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -55,7 +55,12 @@ struct keep_cache_t if (!module->get_bool_attribute(ID::keep)) { bool found_keep = false; for (auto cell : module->cells()) - if (query(cell, true /* ignore_specify */)) { + if (query(cell, true /* ignore_specify_mem */)) { + found_keep = true; + break; + } + for (auto wire : module->wires()) + if (wire->get_bool_attribute(ID::keep)) { found_keep = true; break; } @@ -65,12 +70,12 @@ struct keep_cache_t return cache[module]; } - bool query(Cell *cell, bool ignore_specify = false) + bool query(Cell *cell, bool ignore_specify_mem = false) { - if (cell->type.in(ID($memwr), ID($meminit), ID($assert), ID($assume), ID($live), ID($fair), ID($cover))) + if (cell->type.in(ID($assert), ID($assume), ID($live), ID($fair), ID($cover))) return true; - if (!ignore_specify && cell->type.in(ID($specify2), ID($specify3), ID($specrule))) + if (!ignore_specify_mem && cell->type.in(ID($memwr), ID($meminit), ID($specify2), ID($specify3), ID($specrule))) return true; if (cell->has_keep_attr()) |