diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2019-02-22 10:28:28 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2019-02-22 10:30:42 -0800 |
commit | 25680f6a078bb32f157bd580705656496717bafb (patch) | |
tree | 5a7166ce7bfd4385cd1fd9bd53b02291a85f8b85 /passes | |
parent | d55790909c3b4244889d092c8eae630c7efd1aee (diff) | |
download | yosys-25680f6a078bb32f157bd580705656496717bafb.tar.gz yosys-25680f6a078bb32f157bd580705656496717bafb.tar.bz2 yosys-25680f6a078bb32f157bd580705656496717bafb.zip |
Fix WREDUCE on FF not fixing ARST_VALUE parameter.
Adds test case that fails without code change.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'passes')
-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(); |