Added handling of bool-output cells to "wreduce"
authorClifford Wolf <clifford@clifford.at>
Mon, 13 Apr 2015 17:27:49 +0000 (19:27 +0200)
committerClifford Wolf <clifford@clifford.at>
Mon, 13 Apr 2015 17:27:49 +0000 (19:27 +0200)
passes/opt/wreduce.cc

index fc91f36899d0a1e9c44e8094652f4c6f5ed0f108..72b4051fa325445517b12730d9f364dc2694bc3c 100644 (file)
@@ -347,6 +347,17 @@ struct WreducePass : public Pass {
                        if (module->has_processes_warn())
                                continue;
 
+                       for (auto c : module->selected_cells())
+                               if (c->type.in({"$reduce_and", "$reduce_or", "$reduce_xor", "$reduce_xnor", "$reduce_bool",
+                                               "$lt", "$le", "$eq", "$ne", "$eqx", "$nex", "$ge", "$gt",
+                                               "$logic_not", "$logic_and", "$logic_or"}) && GetSize(c->getPort("\\Y")) > 1) {
+                                       SigSpec sig = c->getPort("\\Y");
+                                       c->setPort("\\Y", sig[0]);
+                                       c->setParam("\\Y_WIDTH", 1);
+                                       sig.remove(0);
+                                       module->connect(sig, Const(0, GetSize(sig)));
+                               }
+
                        WreduceWorker worker(&config, module);
                        worker.run();
                }