nix-servo/fast-servo/linien-gateware-chain-pipeline.patch
linuswck 546725dff0 gateware: Add pipeline to fast_chain calculation
- Fix timing violations at 125MHz sys frequency
2025-01-13 11:17:14 +08:00

36 lines
1.2 KiB
Diff

diff --git a/gateware/logic/chains.py b/gateware/logic/chains.py
index a890849..3461a78 100644
--- a/gateware/logic/chains.py
+++ b/gateware/logic/chains.py
@@ -93,7 +93,6 @@ class FastChain(Module, AutoCSR):
self.comb += [
x_limit.x.eq(([self.demod.i, self.demod.q][sub_channel_idx] << s) + dx),
- iir_c.x.eq(x_limit.y),
iir_c.hold.eq(0),
iir_c.clear.eq(0),
iir_d.x.eq(iir_c.y),
@@ -101,14 +100,20 @@ class FastChain(Module, AutoCSR):
iir_d.clear.eq(0),
]
+ self.sync += [
+ iir_c.x.eq(x_limit.y)
+ ]
+
ys = Array([iir_c.x, iir_c.y, iir_d.y])
output_signal_this_channel = (self.out_i, self.out_q)[sub_channel_idx]
- self.comb += [
+ self.sync += [
y_limit.x.eq(
Mux(self.invert.storage, -1, 1)
* (ys[self.y_tap.storage] + (ya << s) + (offset_signal << s))
- ),
+ )
+ ]
+ self.comb += [
output_signal_this_channel.eq(y_limit.y),
]