diff --git a/fast-servo/iir_pipeline.patch b/fast-servo/iir_pipeline.patch deleted file mode 100644 index b64b209..0000000 --- a/fast-servo/iir_pipeline.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/gateware/logic/iir.py b/gateware/logic/iir.py -index 2380dd7..60bfeb7 100644 ---- a/gateware/logic/iir.py -+++ b/gateware/logic/iir.py -@@ -89,7 +89,7 @@ class Iir(Filter): - zr = Signal.like(z) - self.sync += zr.eq(z) - z = Signal.like(zr) -- self.comb += z.eq(zr + signal * c[coeff]) -+ self.sync += z.eq(zr + signal * c[coeff]) - self.comb += y_next.eq(z) - self.latency.value = Constant(order + 1) - self.interval.value = Constant(1) diff --git a/fast-servo/linien-module-iir-coeff-width-set-to-18bit.patch b/fast-servo/linien-module-iir-coeff-width-set-to-18bit.patch new file mode 100644 index 0000000..f5cb71b --- /dev/null +++ b/fast-servo/linien-module-iir-coeff-width-set-to-18bit.patch @@ -0,0 +1,22 @@ +diff --git a/gateware/linien_module.py b/gateware/linien_module.py +index a64714c..1d905de 100644 +--- a/gateware/linien_module.py ++++ b/gateware/linien_module.py +@@ -47,7 +47,7 @@ from .lowlevel.scopegen import ScopeGen + + + class LinienLogic(Module, AutoCSR): +- def __init__(self, width=14, signal_width=25, chain_factor_width=8, coeff_width=25): ++ def __init__(self, width=14, signal_width=25, chain_factor_width=8, coeff_width=18): + self.init_csr(width, chain_factor_width) + self.init_submodules(width, signal_width) + self.connect_pid() +@@ -154,7 +154,7 @@ class LinienModule(Module, AutoCSR): + def __init__(self, soc): + width = 14 + signal_width = 25 +- coeff_width = 25 ++ coeff_width = 18 + chain_factor_bits = 8 + + self.init_submodules( diff --git a/flake.nix b/flake.nix index aa669d5..9709a73 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ ./fast-servo/linien-server-fast-servo.patch ./fast-servo/linien-gateware-fast-servo.patch ./fast-servo/autolock_pipeline.patch - ./fast-servo/iir_pipeline.patch + ./fast-servo/linien-module-iir-coeff-width-set-to-18bit.patch ./fast-servo/linien_module_pipeline.patch ./fast-servo/pid_pipeline.patch ./fast-servo/pid_err_sig_pipeline.patch