Fixed handling of $eq and $ne in opt_const
authorClifford Wolf <clifford@clifford.at>
Sun, 7 Jul 2013 10:59:00 +0000 (12:59 +0200)
committerClifford Wolf <clifford@clifford.at>
Sun, 7 Jul 2013 10:59:00 +0000 (12:59 +0200)
passes/opt/opt_const.cc

index 149bd97d50871bfd67db885c4843dc137a063dd9..4223ebe3b6e7f0cbe0484d32a34ab74caa563167 100644 (file)
@@ -148,8 +148,8 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
                {
                        if (cell->parameters["\\A_WIDTH"].as_int() != cell->parameters["\\B_WIDTH"].as_int()) {
                                int width = std::max(cell->parameters["\\A_WIDTH"].as_int(), cell->parameters["\\B_WIDTH"].as_int());
-                               cell->connections["\\A"].extend(width, cell->parameters["\\A_SIGNED"].as_bool());
-                               cell->connections["\\B"].extend(width, cell->parameters["\\B_SIGNED"].as_bool());
+                               cell->connections["\\A"].extend(width, cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool());
+                               cell->connections["\\B"].extend(width, cell->parameters["\\A_SIGNED"].as_bool() && cell->parameters["\\B_SIGNED"].as_bool());
                                cell->parameters["\\A_WIDTH"] = width;
                                cell->parameters["\\B_WIDTH"] = width;
                        }