mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 09:05:32 +00:00
Added support for non-const === and !== (for miter circuits)
This commit is contained in:
parent
ecc30255ba
commit
369bf81a70
10 changed files with 128 additions and 20 deletions
|
@ -499,6 +499,8 @@ struct ExtractPass : public Pass {
|
|||
solver.addSwappablePorts("$xnor", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$eq", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$ne", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$eqx", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$nex", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$add", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$mul", "\\A", "\\B");
|
||||
solver.addSwappablePorts("$logic_and", "\\A", "\\B");
|
||||
|
|
|
@ -144,7 +144,7 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
|
|||
#endif
|
||||
}
|
||||
|
||||
if (cell->type == "$eq" || cell->type == "$ne")
|
||||
if (cell->type == "$eq" || cell->type == "$ne" || cell->type == "$eqx" || cell->type == "$nex")
|
||||
{
|
||||
RTLIL::SigSpec a = cell->connections["\\A"];
|
||||
RTLIL::SigSpec b = cell->connections["\\B"];
|
||||
|
@ -160,10 +160,12 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
|
|||
|
||||
assert(a.chunks.size() == b.chunks.size());
|
||||
for (size_t i = 0; i < a.chunks.size(); i++) {
|
||||
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 (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;
|
||||
}
|
||||
new_a.append(a.chunks[i]);
|
||||
new_b.append(b.chunks[i]);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ static bool check_signal(RTLIL::Module *mod, RTLIL::SigSpec signal, RTLIL::SigSp
|
|||
polarity = !polarity;
|
||||
return check_signal(mod, cell->connections["\\A"], ref, polarity);
|
||||
}
|
||||
if (cell->type == "$eq" && cell->connections["\\Y"] == signal) {
|
||||
if ((cell->type == "$eq" || cell->type == "$eqx") && cell->connections["\\Y"] == signal) {
|
||||
if (cell->connections["\\A"].is_fully_const()) {
|
||||
if (!cell->connections["\\A"].as_bool())
|
||||
polarity = !polarity;
|
||||
|
@ -59,7 +59,7 @@ static bool check_signal(RTLIL::Module *mod, RTLIL::SigSpec signal, RTLIL::SigSp
|
|||
return check_signal(mod, cell->connections["\\A"], ref, polarity);
|
||||
}
|
||||
}
|
||||
if (cell->type == "$ne" && cell->connections["\\Y"] == signal) {
|
||||
if ((cell->type == "$ne" || cell->type == "$nex") && cell->connections["\\Y"] == signal) {
|
||||
if (cell->connections["\\A"].is_fully_const()) {
|
||||
if (cell->connections["\\A"].as_bool())
|
||||
polarity = !polarity;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue