Merge pull request #987 from danc86/nextpnr-nexus-no-io-ff

build/lattice: work around lack of SDR I/O primitives in nextpnr
This commit is contained in:
enjoy-digital 2021-08-11 09:50:47 +02:00 committed by GitHub
commit ab9f214a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View File

@ -241,6 +241,31 @@ class LatticeNXSDROutput:
def lower(dr):
return LatticeNXSDROutputImpl(dr.i, dr.o, dr.clk)
# NX SDR Input and Output via regular flip-flops ---------------------------------------------------
# This is a workaround for IO-specific primitives IFD1P3BX / OFD1P3BX being unsupported in nextpnr:
# https://github.com/YosysHQ/nextpnr/issues/698
class LatticeNXSDRFFImpl(Module):
def __init__(self, i, o, clk):
self.specials += Instance("FD1P3BX",
i_CK = clk,
i_PD = 0,
i_SP = 1,
i_D = i,
o_Q = o,
)
class LatticeNXSDRInputViaFlipFlop:
@staticmethod
def lower(dr):
return LatticeNXSDRFFImpl(dr.i, dr.o, dr.clk)
class LatticeNXSDROutputViaFlipFlop:
@staticmethod
def lower(dr):
return LatticeNXSDRFFImpl(dr.i, dr.o, dr.clk)
# NX DDR Input -------------------------------------------------------------------------------------
class LatticeNXDDRInputImpl(Module):
@ -283,6 +308,12 @@ lattice_NX_special_overrides = {
DDROutput: LatticeNXDDROutput,
}
lattice_NX_special_overrides_for_oxide = dict(lattice_NX_special_overrides)
lattice_NX_special_overrides_for_oxide.update({
SDRInput: LatticeNXSDRInputViaFlipFlop,
SDROutput: LatticeNXSDROutputViaFlipFlop,
})
# iCE40 AsyncResetSynchronizer ---------------------------------------------------------------------
class LatticeiCE40AsyncResetSynchronizerImpl(Module):

View File

@ -110,7 +110,7 @@ class LatticeOxideToolchain:
"keep": ("keep", "true"),
}
special_overrides = common.lattice_NX_special_overrides
special_overrides = common.lattice_NX_special_overrides_for_oxide
def __init__(self):
self.yosys_template = _yosys_template