build/gowin/common: Add DDRInput/DDROutput implementations.

This commit is contained in:
Florent Kermarrec 2021-07-14 10:01:54 +02:00
parent a8cea15b95
commit 6fc87f7c85
1 changed files with 34 additions and 0 deletions

View File

@ -33,8 +33,42 @@ class GowinAsyncResetSynchronizer:
def lower(dr): def lower(dr):
return GowinAsyncResetSynchronizerImpl(dr.cd, dr.async_reset) return GowinAsyncResetSynchronizerImpl(dr.cd, dr.async_reset)
# Gowin DDR Input ----------------------------------------------------------------------------------
class GowinDDRInputImpl(Module):
def __init__(self, i, o1, o2, clk):
self.specials += Instance("IDDR",
i_CLK = clk,
i_D = i,
o_Q0 = o1,
o_Q1 = o2,
)
class GowinDDRInput:
@staticmethod
def lower(dr):
return GowinInputImpl(dr.i, dr.o1, dr.o2, dr.clk)
# Gowin DDR Output ---------------------------------------------------------------------------------
class GowinDDROutputImpl(Module):
def __init__(self, i1, i2, o, clk):
self.specials += Instance("ODDR",
i_CLK = clk,
i_D0 = i1,
i_D1 = i2,
o_Q0 = o,
)
class GowinDDROutput:
@staticmethod
def lower(dr):
return GowinDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
# Gowin Special Overrides -------------------------------------------------------------------------- # Gowin Special Overrides --------------------------------------------------------------------------
gowin_special_overrides = { gowin_special_overrides = {
AsyncResetSynchronizer: GowinAsyncResetSynchronizer, AsyncResetSynchronizer: GowinAsyncResetSynchronizer,
DDRInput: GowinDDRInput,
DDROutput: GowinDDROutput,
} }