summaryrefslogtreecommitdiff
path: root/passes/opt
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-12-28 10:30:31 +0100
committerClifford Wolf <clifford@clifford.at>2013-12-28 10:30:31 +0100
commitbd39263796fdf4f1c747a4a8449a0a484fdb3026 (patch)
tree90663dcdb12ac012a4b73ef472d40858a32d1c46 /passes/opt
parentd81e3ed3aeca4b517736b8c95b20b2e8b1e0c860 (diff)
Improved $_MUX_ handling in opt_const
Diffstat (limited to 'passes/opt')
-rw-r--r--passes/opt/opt_const.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/passes/opt/opt_const.cc b/passes/opt/opt_const.cc
index 84285567..0ead97b4 100644
--- a/passes/opt/opt_const.cc
+++ b/passes/opt/opt_const.cc
@@ -17,8 +17,6 @@
*
*/
-#undef MUX_UNDEF_SEL_TO_UNDEF_RESULTS
-
#include "opt_status.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
@@ -133,15 +131,16 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
ACTION_DO("\\Y", input.extract(2, 1));
if (input.match(" 0")) ACTION_DO("\\Y", input.extract(2, 1));
if (input.match(" 1")) ACTION_DO("\\Y", input.extract(1, 1));
-#ifdef MUX_UNDEF_SEL_TO_UNDEF_RESULTS
if (input.match("01 ")) ACTION_DO("\\Y", input.extract(0, 1));
- // TODO: "10 " -> replace with "!S" gate
- // TODO: "0 " -> replace with "B AND S" gate
- // TODO: " 1 " -> replace with "A OR S" gate
- // TODO: "1 " -> replace with "B OR !S" gate (?)
- // TODO: " 0 " -> replace with "A AND !S" gate (?)
- if (input.match(" *")) ACTION_DO_Y(x);
-#endif
+ if (input.match("10 ")) {
+ cell->type = "$_INV_";
+ cell->connections["\\A"] = input.extract(0, 1);
+ cell->connections.erase("\\B");
+ cell->connections.erase("\\S");
+ goto next_cell;
+ }
+ if (input.match("01*")) ACTION_DO_Y(x);
+ if (input.match("10*")) ACTION_DO_Y(x);
}
if (cell->type == "$eq" || cell->type == "$ne" || cell->type == "$eqx" || cell->type == "$nex")