3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-15 21:38:45 +00:00

Improved $_MUX_ handling in opt_const

This commit is contained in:
Clifford Wolf 2013-12-28 10:30:31 +01:00
parent d81e3ed3ae
commit bd39263796

View file

@ -17,8 +17,6 @@
* *
*/ */
#undef MUX_UNDEF_SEL_TO_UNDEF_RESULTS
#include "opt_status.h" #include "opt_status.h"
#include "kernel/register.h" #include "kernel/register.h"
#include "kernel/sigtools.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)); ACTION_DO("\\Y", input.extract(2, 1));
if (input.match(" 0")) 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)); 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)); if (input.match("01 ")) ACTION_DO("\\Y", input.extract(0, 1));
// TODO: "10 " -> replace with "!S" gate if (input.match("10 ")) {
// TODO: "0 " -> replace with "B AND S" gate cell->type = "$_INV_";
// TODO: " 1 " -> replace with "A OR S" gate cell->connections["\\A"] = input.extract(0, 1);
// TODO: "1 " -> replace with "B OR !S" gate (?) cell->connections.erase("\\B");
// TODO: " 0 " -> replace with "A AND !S" gate (?) cell->connections.erase("\\S");
if (input.match(" *")) ACTION_DO_Y(x); goto next_cell;
#endif }
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") if (cell->type == "$eq" || cell->type == "$ne" || cell->type == "$eqx" || cell->type == "$nex")