aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt/opt_merge.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2017-02-09 16:06:58 +0100
committerClifford Wolf <clifford@clifford.at>2017-02-09 16:06:58 +0100
commite6cc67b46f637e5fc971c79e8f115c225b807120 (patch)
tree09d4bec9091ac3fd1976db3065ef1e26726a0fae /passes/opt/opt_merge.cc
parent848062088cfc702ba2f4616e1091f63c636bbe5b (diff)
downloadyosys-e6cc67b46f637e5fc971c79e8f115c225b807120.tar.gz
yosys-e6cc67b46f637e5fc971c79e8f115c225b807120.tar.bz2
yosys-e6cc67b46f637e5fc971c79e8f115c225b807120.zip
Fix handling of init attributes with strange width
Diffstat (limited to 'passes/opt/opt_merge.cc')
-rw-r--r--passes/opt/opt_merge.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/passes/opt/opt_merge.cc b/passes/opt/opt_merge.cc
index 97989d271..07e4dd39f 100644
--- a/passes/opt/opt_merge.cc
+++ b/passes/opt/opt_merge.cc
@@ -280,8 +280,12 @@ struct OptMergeWorker
dff_init_map.set(module);
for (auto &it : module->wires_)
- if (it.second->attributes.count("\\init") != 0)
- dff_init_map.add(it.second, it.second->attributes.at("\\init"));
+ if (it.second->attributes.count("\\init") != 0) {
+ Const initval = it.second->attributes.at("\\init");
+ for (int i = 0; i < GetSize(initval) && i < GetSize(it.second); i++)
+ if (initval[i] == State::S0 || initval[i] == State::S1)
+ dff_init_map.add(SigBit(it.second, i), initval[i]);
+ }
bool did_something = true;
while (did_something)