soc/cores/clock: add lock reg and assign reset
authorPawel Czarnecki <pczarnecki@internships.antmicro.com>
Wed, 20 Nov 2019 14:29:36 +0000 (15:29 +0100)
committerMateusz Holenko <mholenko@antmicro.com>
Wed, 20 Nov 2019 15:22:49 +0000 (16:22 +0100)
It was necessary to add drp_locked CSR for reading LOCK signal from
MMCM. Additionally, input signal RESET from MMCM was not driven by
any signal to do a proper reset of MMCM module thus it was impossible
to perform entirely correct dynamic clock reconfiguration.

litex/soc/cores/clock.py

index 037d367d05f5d39937474b5e3f4b8399bbf07373..4076cc25e20a6c601ed3a24ee5adfb92707d87a2 100644 (file)
@@ -92,6 +92,7 @@ class XilinxClocking(Module, AutoCSR):
 
     def expose_drp(self):
         self.drp_reset = CSR()
+        self.drp_locked = CSR()
         self.drp_read  = CSR()
         self.drp_write = CSR()
         self.drp_drdy  = CSRStatus()
@@ -261,7 +262,7 @@ class S7MMCM(XilinxClocking):
         config = self.compute_config()
         mmcm_fb = Signal()
         self.params.update(
-            p_BANDWIDTH="OPTIMIZED", o_LOCKED=self.locked,
+            p_BANDWIDTH="OPTIMIZED", o_LOCKED=self.locked, i_RST=self.reset,
 
             # VCO
             p_REF_JITTER1=0.01, p_CLKIN1_PERIOD=1e9/self.clkin_freq,