From 7b02a44efbb81ce2c97dcb87f1d8ca016c14ba76 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 27 Dec 2013 14:21:24 +0100 Subject: [PATCH] Fixed/improved opt_const $eq/$ne/$eqx/$nex handling --- passes/opt/opt_const.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/passes/opt/opt_const.cc b/passes/opt/opt_const.cc index 30d85588c..d84910ee1 100644 --- a/passes/opt/opt_const.cc +++ b/passes/opt/opt_const.cc @@ -166,6 +166,8 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons if (b.chunks[i].wire == NULL && b.chunks[i].data.bits[0] > RTLIL::State::S1) continue; } + if (a.chunks[i] == b.chunks[i]) + continue; new_a.append(a.chunks[i]); new_b.append(b.chunks[i]); } @@ -177,7 +179,7 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons goto next_cell; } - if (new_a.width != a.width) { + if (new_a.width < a.width || new_b.width < b.width) { new_a.optimize(); new_b.optimize(); cell->connections["\\A"] = new_a; -- 2.30.2