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:
commit
ab9f214a5e
|
@ -241,6 +241,31 @@ class LatticeNXSDROutput:
|
||||||
def lower(dr):
|
def lower(dr):
|
||||||
return LatticeNXSDROutputImpl(dr.i, dr.o, dr.clk)
|
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 -------------------------------------------------------------------------------------
|
# NX DDR Input -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class LatticeNXDDRInputImpl(Module):
|
class LatticeNXDDRInputImpl(Module):
|
||||||
|
@ -283,6 +308,12 @@ lattice_NX_special_overrides = {
|
||||||
DDROutput: LatticeNXDDROutput,
|
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 ---------------------------------------------------------------------
|
# iCE40 AsyncResetSynchronizer ---------------------------------------------------------------------
|
||||||
|
|
||||||
class LatticeiCE40AsyncResetSynchronizerImpl(Module):
|
class LatticeiCE40AsyncResetSynchronizerImpl(Module):
|
||||||
|
|
|
@ -110,7 +110,7 @@ class LatticeOxideToolchain:
|
||||||
"keep": ("keep", "true"),
|
"keep": ("keep", "true"),
|
||||||
}
|
}
|
||||||
|
|
||||||
special_overrides = common.lattice_NX_special_overrides
|
special_overrides = common.lattice_NX_special_overrides_for_oxide
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.yosys_template = _yosys_template
|
self.yosys_template = _yosys_template
|
||||||
|
|
Loading…
Reference in New Issue