From: Marcelina Koƛcielnicka Date: Tue, 9 Mar 2021 20:32:16 +0000 (+0100) Subject: opt_clean: Remove init attribute bits together with removed DFFs. X-Git-Tag: yosys-0.10~254 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3af871f969f7f5bd5201bac17544559671312a6f;p=yosys.git opt_clean: Remove init attribute bits together with removed DFFs. Fixes #2546. --- diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index 883374cf6..c66f45308 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -21,6 +21,7 @@ #include "kernel/sigtools.h" #include "kernel/log.h" #include "kernel/celltypes.h" +#include "kernel/ffinit.h" #include #include #include @@ -101,6 +102,7 @@ void rmunused_module_cells(Module *module, bool verbose) pool used_raw_bits; dict> wire2driver; dict> driver_driver_logs; + FfInitVals ffinit(&sigmap, module); SigMap raw_sigmap; for (auto &it : module->connections_) { @@ -193,6 +195,8 @@ void rmunused_module_cells(Module *module, bool verbose) if (verbose) log_debug(" removing unused `%s' cell `%s'.\n", cell->type.c_str(), cell->name.c_str()); module->design->scratchpad_set_bool("opt.did_something", true); + if (RTLIL::builtin_ff_cell_types().count(cell->type)) + ffinit.remove_init(cell->getPort(ID::Q)); module->remove(cell); count_rm_cells++; } diff --git a/tests/opt/opt_clean_init.ys b/tests/opt/opt_clean_init.ys index 0d567608d..7933f3e17 100644 --- a/tests/opt/opt_clean_init.ys +++ b/tests/opt/opt_clean_init.ys @@ -1,13 +1,22 @@ -logger -expect warning "Initial value conflict for \\y resolving to 1'0 but with init 1'1" 1 -logger -expect-no-warnings -read_verilog <