dvisampler: support differential input
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 4 Jul 2013 17:18:24 +0000 (19:18 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 4 Jul 2013 17:18:24 +0000 (19:18 +0200)
milkymist/dvisampler/__init__.py
milkymist/dvisampler/clocking.py

index 5b74f53a9d04acb0936cc574f842456bb2be83d7..a752f1a32ff56c5abe3fab283a4d02c0505b1450 100644 (file)
@@ -19,11 +19,19 @@ class DVISampler(Module, AutoCSR):
                for datan in range(3):
                        name = "data" + str(datan)
                        invert = False
-                       try:
-                               s = getattr(pads, name)
-                       except AttributeError:
-                               s = getattr(pads, name + "_n")
-                               invert = True
+                       if hasattr(pads, name + "_p"):
+                               s = Signal()
+                               self.specials += Instance("IBUFDS",
+                                       Instance.Input("I", getattr(pads, name + "_p")),
+                                       Instance.Input("IB", getattr(pads, name + "_n")),
+                                       Instance.Output("O", s)         
+                               )
+                       else:
+                               try:
+                                       s = getattr(pads, name)
+                               except AttributeError:
+                                       s = getattr(pads, name + "_n")
+                                       invert = True
                        
                        cap = DataCapture(8, invert)
                        setattr(self.submodules, name + "_cap", cap)
index 07d4d490b891bdb8f3ce6d34867baaff60a1131e..bf6f01e85acb7a4c81de7ed72b5e4f1e499d8e37 100644 (file)
@@ -16,6 +16,16 @@ class Clocking(Module, AutoCSR):
 
                ###
 
+               if hasattr(pads, "clk_p"):
+                       clkin = Signal()
+                       self.specials += Instance("IBUFDS",
+                               Instance.Input("I", pads.clk_p),
+                               Instance.Input("IB", pads.clk_n),
+                               Instance.Output("O", clkin)             
+                       )
+               else:
+                       clkin = pads.clk
+
                clkfbout = Signal()
                pll_locked = Signal()
                pll_clk0 = Signal()
@@ -39,7 +49,7 @@ class Clocking(Module, AutoCSR):
                        Instance.Output("CLKOUT3", pll_clk3),
                        Instance.Output("LOCKED", pll_locked),
                        Instance.Input("CLKFBIN", clkfbout),
-                       Instance.Input("CLKIN", pads.clk),
+                       Instance.Input("CLKIN", clkin),
                        Instance.Input("RST", self._r_pll_reset.storage)
                )