pid: add pipeline on error signal computation

This commit is contained in:
linuswck 2024-12-11 14:49:05 +08:00
parent bc5d24a69a
commit b631c1fa4a
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,19 @@
diff --git a/gateware/logic/pid.py b/gateware/logic/pid.py
index e737577..f1a4096 100644
--- a/gateware/logic/pid.py
+++ b/gateware/logic/pid.py
@@ -43,10 +43,12 @@ class PID(Module, AutoCSR):
self.comb += [setpoint_signed.eq(self.setpoint.storage)]
self.error = Signal((self.width + 1, True))
+ error_reg = Signal((self.width + 1, True))
+ self.sync += self.error.eq(error_reg)
self.comb += [
- If(self.running, self.error.eq(self.input - self.setpoint.storage)).Else(
- self.error.eq(0)
+ If(self.running, error_reg.eq(self.input - self.setpoint.storage)).Else(
+ error_reg.eq(0)
)
]

View File

@ -169,6 +169,7 @@
fast-servo/iir_pipeline.patch
fast-servo/linien_module_pipeline.patch
fast-servo/pid_pipeline.patch
fast-servo/pid_err_sig_pipeline.patch
];
nativeBuildInputs = [
(pkgs.python3.withPackages(ps: [