mirror of
https://github.com/YosysHQ/yosys
synced 2026-02-09 18:40:53 +00:00
add $priority cell
This commit is contained in:
parent
967b47d984
commit
e166dd4475
9 changed files with 136 additions and 2 deletions
|
|
@ -658,6 +658,25 @@ RTLIL::Const RTLIL::const_bmux(const RTLIL::Const &arg1, const RTLIL::Const &arg
|
|||
return t;
|
||||
}
|
||||
|
||||
RTLIL::Const RTLIL::const_priority(const RTLIL::Const &arg)
|
||||
{
|
||||
std::vector<State> t;
|
||||
std::optional<State> first_non_zero = std::nullopt;
|
||||
for (int i = 0; i < GetSize(arg); i++)
|
||||
{
|
||||
RTLIL::State s = arg.at(i);
|
||||
if (first_non_zero && s != State::Sx) {
|
||||
t.push_back(*first_non_zero == State::S1 ? State::S0 : *first_non_zero);
|
||||
} else {
|
||||
t.push_back(s);
|
||||
}
|
||||
if ((!first_non_zero && s != State::S0) || s == State::Sx) {
|
||||
first_non_zero = s;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
RTLIL::Const RTLIL::const_demux(const RTLIL::Const &arg1, const RTLIL::Const &arg2)
|
||||
{
|
||||
int width = GetSize(arg1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue