pid: add pipeline on error signal computation
This commit is contained in:
parent
bc5d24a69a
commit
b631c1fa4a
19
fast-servo/pid_err_sig_pipeline.patch
Normal file
19
fast-servo/pid_err_sig_pipeline.patch
Normal 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)
|
||||
)
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user