mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 09:05:32 +00:00
dfflegalize: Add special support for const-D latches.
Those can be created by `opt_dff` when optimizing `$adff` with const clock, or with D == Q. Make dfflegalize do the opposite transform when such dlatches would be otherwise unimplementable.
This commit is contained in:
parent
000fd08198
commit
e9c2c1b717
2 changed files with 71 additions and 0 deletions
|
@ -659,6 +659,24 @@ flip_dqisr:;
|
|||
// This init value is not supported at all...
|
||||
if (supported_dlatch & flip_initmask(initmask))
|
||||
goto flip_dqi;
|
||||
|
||||
if ((sig_d == State::S0 && (supported_adff0 & initmask)) ||
|
||||
(sig_d == State::S1 && (supported_adff1 & initmask)) ||
|
||||
(sig_d == State::S0 && (supported_adff1 & flip_initmask(initmask))) ||
|
||||
(sig_d == State::S1 && (supported_adff0 & flip_initmask(initmask)))
|
||||
) {
|
||||
// Special case: const-D dlatch can be converted into adff with const clock.
|
||||
ff_type = (sig_d == State::S0) ? FF_ADFF0 : FF_ADFF1;
|
||||
if (ff_neg & NEG_E) {
|
||||
ff_neg &= ~NEG_E;
|
||||
ff_neg |= NEG_R;
|
||||
}
|
||||
sig_r = sig_e;
|
||||
sig_d = State::Sx;
|
||||
sig_c = State::S1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!supported_dlatch)
|
||||
reason = "dlatch are not supported";
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue