mibuild/xilinx: Xilinx's FPGAs do not necessary share the same primitives: add xilinx...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 2 Jul 2015 07:32:33 +0000 (09:32 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 2 Jul 2015 07:42:12 +0000 (09:42 +0200)
Fix DDROutput implementation on spartan6 (tested with LiteETH's GMII phy)

mibuild/xilinx/common.py
mibuild/xilinx/platform.py

index 207711efa6064e9641cb975b682d4686b321c314..ba125659d901d9c0f4573af88586d5652a1508f8 100644 (file)
@@ -103,6 +103,31 @@ class XilinxDifferentialOutput:
 
 
 class XilinxDDROutputImpl(Module):
+    def __init__(self, i1, i2, o, clk):
+        self.specials += Instance("ODDR2",
+                p_DDR_ALIGNMENT="NONE", p_INIT=0, p_SRTYPE="SYNC",
+                i_C0=clk, i_C1=~clk, i_CE=1, i_S=0, i_R=0,
+                i_D0=i1, i_D1=i2, o_Q=o,
+        )
+
+
+class XilinxDDROutput:
+    @staticmethod
+    def lower(dr):
+        return XilinxDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
+
+
+xilinx_special_overrides = {
+    NoRetiming:             XilinxNoRetiming,
+    MultiReg:               XilinxMultiReg,
+    AsyncResetSynchronizer: XilinxAsyncResetSynchronizer,
+    DifferentialInput:      XilinxDifferentialInput,
+    DifferentialOutput:     XilinxDifferentialOutput,
+    DDROutput:              XilinxDDROutput
+}
+
+
+class XilinxDDROutputImplS7(Module):
     def __init__(self, i1, i2, o, clk):
         self.specials += Instance("ODDR",
                 p_DDR_CLK_EDGE="SAME_EDGE",
@@ -111,16 +136,12 @@ class XilinxDDROutputImpl(Module):
         )
 
 
-class XilinxDDROutput:
+class XilinxDDROutputS7:
     @staticmethod
     def lower(dr):
-        return XilinxDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
+        return XilinxDDROutputImplS7(dr.i1, dr.i2, dr.o, dr.clk)
 
-xilinx_special_overrides = {
-    NoRetiming:                    XilinxNoRetiming,
-    MultiReg:                    XilinxMultiReg,
-    AsyncResetSynchronizer:        XilinxAsyncResetSynchronizer,
-    DifferentialInput:            XilinxDifferentialInput,
-    DifferentialOutput:            XilinxDifferentialOutput,
-    DDROutput:                    XilinxDDROutput
+
+xilinx_s7_special_overrides = {
+    DDROutput:              XilinxDDROutputS7
 }
index cf202b17e2a4c4956bddd49fa777496ea96fd7ee..201ad53aa5d0c6e4ccfe8097ebca02d6188d5af4 100644 (file)
@@ -16,6 +16,8 @@ class XilinxPlatform(GenericPlatform):
 
     def get_verilog(self, *args, special_overrides=dict(), **kwargs):
         so = dict(common.xilinx_special_overrides)
+        if self.device[:3] == "xc7":
+            so.update(dict(common.xilinx_s7_special_overrides))
         so.update(special_overrides)
         return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)