mirror of https://github.com/YosysHQ/yosys.git
More conservastive $eq/$ne/$eqx/$nex opt_const code
This commit is contained in:
parent
122b3c067b
commit
d81e3ed3ae
|
@ -160,19 +160,13 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
|
||||||
|
|
||||||
assert(a.chunks.size() == b.chunks.size());
|
assert(a.chunks.size() == b.chunks.size());
|
||||||
for (size_t i = 0; i < a.chunks.size(); i++) {
|
for (size_t i = 0; i < a.chunks.size(); i++) {
|
||||||
if (a.chunks[i].wire == NULL && b.chunks[i].wire == NULL &&
|
if (a.chunks[i].wire == NULL && b.chunks[i].wire == NULL && a.chunks[i].data.bits[0] != b.chunks[i].data.bits[0] &&
|
||||||
a.chunks[i].data.bits[0] != b.chunks[i].data.bits[0]) {
|
a.chunks[i].data.bits[0] <= RTLIL::State::S1 && b.chunks[i].data.bits[0] <= RTLIL::State::S1) {
|
||||||
RTLIL::SigSpec new_y = RTLIL::SigSpec((cell->type == "$eq" || cell->type == "$eqx") ? RTLIL::State::S0 : RTLIL::State::S1);
|
RTLIL::SigSpec new_y = RTLIL::SigSpec((cell->type == "$eq" || cell->type == "$eqx") ? RTLIL::State::S0 : RTLIL::State::S1);
|
||||||
new_y.extend(cell->parameters["\\Y_WIDTH"].as_int(), false);
|
new_y.extend(cell->parameters["\\Y_WIDTH"].as_int(), false);
|
||||||
replace_cell(module, cell, "empty", "\\Y", new_y);
|
replace_cell(module, cell, "empty", "\\Y", new_y);
|
||||||
goto next_cell;
|
goto next_cell;
|
||||||
}
|
}
|
||||||
if (cell->type == "$eq" || cell->type == "$ne") {
|
|
||||||
if (a.chunks[i].wire == NULL && a.chunks[i].data.bits[0] > RTLIL::State::S1)
|
|
||||||
continue;
|
|
||||||
if (b.chunks[i].wire == NULL && b.chunks[i].data.bits[0] > RTLIL::State::S1)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (a.chunks[i] == b.chunks[i])
|
if (a.chunks[i] == b.chunks[i])
|
||||||
continue;
|
continue;
|
||||||
new_a.append(a.chunks[i]);
|
new_a.append(a.chunks[i]);
|
||||||
|
|
Loading…
Reference in New Issue