mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 17:15:33 +00:00
Improved support for $sop cells
This commit is contained in:
parent
52bb1b968d
commit
95757efb25
6 changed files with 89 additions and 10 deletions
|
@ -366,21 +366,33 @@ struct CellTypes
|
|||
while (GetSize(t) < width*depth*2)
|
||||
t.push_back(RTLIL::S0);
|
||||
|
||||
RTLIL::State default_ret = State::S0;
|
||||
|
||||
for (int i = 0; i < depth; i++)
|
||||
{
|
||||
bool match = true;
|
||||
bool match_x = true;
|
||||
|
||||
for (int j = 0; j < width; j++) {
|
||||
RTLIL::State a = arg1.bits.at(j);
|
||||
if (t.at(2*width*i + 2*j + 0) == State::S1 && a == State::S1) match = false;
|
||||
if (t.at(2*width*i + 2*j + 1) == State::S1 && a == State::S0) match = false;
|
||||
if (t.at(2*width*i + 2*j + 0) == State::S1) {
|
||||
if (a == State::S1) match_x = false;
|
||||
if (a != State::S0) match = false;
|
||||
}
|
||||
if (t.at(2*width*i + 2*j + 1) == State::S1) {
|
||||
if (a == State::S0) match_x = false;
|
||||
if (a != State::S1) match = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
return State::S1;
|
||||
|
||||
if (match_x)
|
||||
default_ret = State::Sx;
|
||||
}
|
||||
|
||||
return State::S0;
|
||||
return default_ret;
|
||||
}
|
||||
|
||||
bool signed_a = cell->parameters.count("\\A_SIGNED") > 0 && cell->parameters["\\A_SIGNED"].as_bool();
|
||||
|
|
|
@ -2142,7 +2142,7 @@ void RTLIL::Cell::fixup_parameters(bool set_a_signed, bool set_b_signed)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == "$lut") {
|
||||
if (type == "$lut" || type == "$sop") {
|
||||
parameters["\\WIDTH"] = GetSize(connections_["\\A"]);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue