descramble: Determine relock_next from idle_counter directly
When writing this initially, I tried to remove some duplicate conditionals by working with idle_counter_next. However, yosys isn't smart enough to rewrite the calculation in terms of idle_counter, so do it ourselves. This breaks up the critical path. Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
parent
1b47635644
commit
548bf79f55
|
@ -71,29 +71,41 @@ module descramble (
|
||||||
else if (scrambled_valid[1])
|
else if (scrambled_valid[1])
|
||||||
lfsr_next = { lfsr[8:0], locked ? ldd : ~scrambled };
|
lfsr_next = { lfsr[8:0], locked ? ldd : ~scrambled };
|
||||||
|
|
||||||
idle_counter_next = idle_counter;
|
/*
|
||||||
if (scrambled_valid[1]) begin
|
* Reset the counter to 2 to ensure we can always subtract
|
||||||
if (descrambled_next[1] && descrambled_next[0])
|
* idles without underflowing. This clause is made to depend
|
||||||
idle_counter_next = idle_counter - 2;
|
* on idle_counter (and not idle_counter_next) to reduce the critical
|
||||||
else if (descrambled_next[0])
|
* path. The actual condition is idle_counter_next <= 1 (aka
|
||||||
idle_counter_next = idle_counter - 1;
|
* we are about to underflow, and have gotten at least 28
|
||||||
else
|
* consecutive 1s).
|
||||||
idle_counter_next = CONSECUTIVE_IDLES;
|
*/
|
||||||
end else if (scrambled_valid[0]) begin
|
`define RELOCK begin \
|
||||||
if (descrambled_next[1])
|
idle_counter_next = 2; \
|
||||||
idle_counter_next = idle_counter - 1;
|
relock_next = 1; \
|
||||||
else
|
end
|
||||||
idle_counter_next = CONSECUTIVE_IDLES;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
idle_counter_next = idle_counter;
|
||||||
relock_next = 0;
|
relock_next = 0;
|
||||||
if (!idle_counter_next[4:1]) begin
|
if (scrambled_valid[1]) begin
|
||||||
/*
|
if (descrambled_next[1] && descrambled_next[0]) begin
|
||||||
* Reset the counter to 2 to ensure we can always
|
idle_counter_next = idle_counter - 2;
|
||||||
* subtract idles without underflowing
|
if (!idle_counter[4:2])
|
||||||
*/
|
`RELOCK
|
||||||
idle_counter_next = 2;
|
end else if (descrambled_next[0]) begin
|
||||||
relock_next = 1;
|
idle_counter_next = idle_counter - 1;
|
||||||
|
if (!idle_counter[4:2] && idle_counter[1:0] != 2'b11)
|
||||||
|
`RELOCK
|
||||||
|
end else begin
|
||||||
|
idle_counter_next = CONSECUTIVE_IDLES;
|
||||||
|
end
|
||||||
|
end else if (scrambled_valid[0]) begin
|
||||||
|
if (descrambled_next[1]) begin
|
||||||
|
idle_counter_next = idle_counter - 1;
|
||||||
|
if (!idle_counter[4:2] && idle_counter[1:0] != 2'b11)
|
||||||
|
`RELOCK
|
||||||
|
end else begin
|
||||||
|
idle_counter_next = CONSECUTIVE_IDLES;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
locked_next = 1;
|
locked_next = 1;
|
||||||
|
|
Loading…
Reference in New Issue