aboutsummaryrefslogtreecommitdiffstats
path: root/passes/fsm/fsm_detect.cc
diff options
context:
space:
mode:
authorPepijn de Vos <pepijndevos@gmail.com>2019-11-16 12:43:17 +0100
committerPepijn de Vos <pepijndevos@gmail.com>2019-11-16 12:43:17 +0100
commit32f0296df1b97ff5b3bcc442ac38f27a786947d6 (patch)
tree72ec224a90bb5a40e007a88fe37085dcc786a0e0 /passes/fsm/fsm_detect.cc
parentab8c521030a2c91a1e388d6f3c627a7f7dd525b2 (diff)
parent51e4e29bb1f7c030b0cac351c522dc41f7587be2 (diff)
downloadyosys-32f0296df1b97ff5b3bcc442ac38f27a786947d6.tar.gz
yosys-32f0296df1b97ff5b3bcc442ac38f27a786947d6.tar.bz2
yosys-32f0296df1b97ff5b3bcc442ac38f27a786947d6.zip
Merge branch 'master' of https://github.com/YosysHQ/yosys into gowin
Diffstat (limited to 'passes/fsm/fsm_detect.cc')
-rw-r--r--passes/fsm/fsm_detect.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/passes/fsm/fsm_detect.cc b/passes/fsm/fsm_detect.cc
index 5ae991b28..fb3896669 100644
--- a/passes/fsm/fsm_detect.cc
+++ b/passes/fsm/fsm_detect.cc
@@ -158,22 +158,25 @@ static void detect_fsm(RTLIL::Wire *wire)
std::set<sig2driver_entry_t> cellport_list;
sig2user.find(sig_q, cellport_list);
+ auto sig_q_bits = sig_q.to_sigbit_pool();
+
for (auto &cellport : cellport_list)
{
RTLIL::Cell *cell = cellport.first;
bool set_output = false, clr_output = false;
- if (cell->type == "$ne")
+ if (cell->type.in("$ne", "$reduce_or", "$reduce_bool"))
set_output = true;
- if (cell->type == "$eq")
+ if (cell->type.in("$eq", "$logic_not", "$reduce_and"))
clr_output = true;
- if (!set_output && !clr_output) {
- clr_output = true;
+ if (set_output || clr_output) {
for (auto &port_it : cell->connections())
- if (port_it.first != "\\A" || port_it.first != "\\Y")
- clr_output = false;
+ if (cell->input(port_it.first))
+ for (auto bit : assign_map(port_it.second))
+ if (bit.wire != nullptr && !sig_q_bits.count(bit))
+ goto next_cellport;
}
if (set_output || clr_output) {
@@ -184,6 +187,7 @@ static void detect_fsm(RTLIL::Wire *wire)
ce.set(sig, val);
}
}
+ next_cellport:;
}
SigSpec sig_y = sig_d, sig_undef;