From e305d858075902cdfe277f36ce52f8e01de65f7e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 13 Apr 2015 19:27:49 +0200 Subject: [PATCH] Added handling of bool-output cells to "wreduce" --- passes/opt/wreduce.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/passes/opt/wreduce.cc b/passes/opt/wreduce.cc index fc91f3689..72b4051fa 100644 --- a/passes/opt/wreduce.cc +++ b/passes/opt/wreduce.cc @@ -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(); } -- 2.30.2