diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-02-24 11:29:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-24 11:29:14 -0800 |
commit | da14bc8524c21c0d33a82fcb66d08d08f2654e6e (patch) | |
tree | 8a785b0d4de8bc7a6c16b99cc902d726fd3587ed /passes/opt | |
parent | 1816fe06af9ab2c50bd293dc10359238acc88f12 (diff) | |
parent | 25680f6a078bb32f157bd580705656496717bafb (diff) | |
download | yosys-da14bc8524c21c0d33a82fcb66d08d08f2654e6e.tar.gz yosys-da14bc8524c21c0d33a82fcb66d08d08f2654e6e.tar.bz2 yosys-da14bc8524c21c0d33a82fcb66d08d08f2654e6e.zip |
Merge pull request #824 from litghost/fix_reduce_on_ff
Fix WREDUCE on FF not fixing ARST_VALUE parameter.
Diffstat (limited to 'passes/opt')
-rw-r--r-- | passes/opt/wreduce.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/passes/opt/wreduce.cc b/passes/opt/wreduce.cc index 3aa916ec2..c550b402e 100644 --- a/passes/opt/wreduce.cc +++ b/passes/opt/wreduce.cc @@ -195,6 +195,19 @@ struct WreduceWorker for (auto bit : sig_q) work_queue_bits.insert(bit); + // Narrow ARST_VALUE parameter to new size. + // + // Note: This works because earlier loop only removes signals from + // the upper bits of the DFF. + if(cell->parameters.count("\\ARST_VALUE") > 0) { + RTLIL::Const old_arst_value = cell->parameters.at("\\ARST_VALUE"); + std::vector<RTLIL::State> new_arst_value(GetSize(sig_q)); + for(int i = 0; i < GetSize(sig_q); ++i) { + new_arst_value[i] = old_arst_value[i]; + } + cell->parameters["\\ARST_VALUE"] = RTLIL::Const(new_arst_value); + } + cell->setPort("\\D", sig_d); cell->setPort("\\Q", sig_q); cell->fixup_parameters(); |