Commit 3f16323a authored by William D. Jones's avatar William D. Jones Committed by Sébastien Bourdeauducq
Browse files

build/lattice: Split special_overrides by toolchain.

parent 2e5bf6f6
......@@ -4,7 +4,7 @@ from migen.genlib.io import *
from migen.genlib.resetsync import AsyncResetSynchronizer
class LatticeAsyncResetSynchronizerImpl(Module):
class DiamondAsyncResetSynchronizerImpl(Module):
def __init__(self, cd, async_reset):
rst1 = Signal()
self.specials += [
......@@ -15,13 +15,13 @@ class LatticeAsyncResetSynchronizerImpl(Module):
]
class LatticeAsyncResetSynchronizer:
class DiamondAsyncResetSynchronizer:
@staticmethod
def lower(dr):
return LatticeAsyncResetSynchronizerImpl(dr.cd, dr.async_reset)
return DiamondAsyncResetSynchronizerImpl(dr.cd, dr.async_reset)
class LatticeDDROutputImpl(Module):
class DiamondDDROutputImpl(Module):
def __init__(self, i1, i2, o, clk):
self.specials += Instance("ODDRXD1",
synthesis_directive="ODDRAPPS=\"SCLK_ALIGNED\"",
......@@ -30,12 +30,17 @@ class LatticeDDROutputImpl(Module):
)
class LatticeDDROutput:
class DiamondDDROutput:
@staticmethod
def lower(dr):
return LatticeDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
return DiamondDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
diamond_special_overrides = {
AsyncResetSynchronizer: DiamondAsyncResetSynchronizer,
DDROutput: DiamondDDROutput
}
icestorm_special_overrides = {
lattice_special_overrides = {
AsyncResetSynchronizer: LatticeAsyncResetSynchronizer,
DDROutput: LatticeDDROutput
}
......@@ -16,12 +16,16 @@ class LatticePlatform(GenericPlatform):
raise ValueError("Unknown toolchain")
def get_verilog(self, *args, special_overrides=dict(), **kwargs):
so = dict(common.lattice_special_overrides)
so.update(special_overrides)
if isinstance(self.toolchain, diamond.LatticeDiamondToolchain):
return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)
diamond_so = dict(common.diamond_special_overrides)
diamond_so.update(special_overrides)
return GenericPlatform.get_verilog(self, *args,
special_overrides=diamond_so, **kwargs)
elif isinstance(self.toolchain, icestorm.LatticeIceStormToolchain):
return GenericPlatform.get_verilog(self, *args, special_overrides=so,
icestorm_so = dict(common.icestorm_special_overrides)
icestorm_so.update(special_overrides)
return GenericPlatform.get_verilog(self, *args,
special_overrides=icestorm_so,
attr_translate=self.toolchain.attr_translate, **kwargs)
else:
raise ValueError("Unknown toolchain")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment