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

build/lattice: Refactor special_overrides as toolchain attributes.

parent ca8d681b
...@@ -80,6 +80,8 @@ def _run_diamond(build_name, source, ver=None): ...@@ -80,6 +80,8 @@ def _run_diamond(build_name, source, ver=None):
class LatticeDiamondToolchain: class LatticeDiamondToolchain:
attr_translate = DummyAttrTranslate() attr_translate = DummyAttrTranslate()
special_overrides = common.diamond_special_overrides
def build(self, platform, fragment, build_dir="build", build_name="top", def build(self, platform, fragment, build_dir="build", build_name="top",
toolchain_path="/opt/Diamond", run=True): toolchain_path="/opt/Diamond", run=True):
os.makedirs(build_dir, exist_ok=True) os.makedirs(build_dir, exist_ok=True)
......
...@@ -9,6 +9,7 @@ from migen.fhdl.structure import _Fragment ...@@ -9,6 +9,7 @@ from migen.fhdl.structure import _Fragment
from migen.build.generic_platform import * from migen.build.generic_platform import *
from migen.build import tools from migen.build import tools
from migen.build.lattice import common
def _format_constraint(c): def _format_constraint(c):
...@@ -124,6 +125,8 @@ class LatticeIceStormToolchain: ...@@ -124,6 +125,8 @@ class LatticeIceStormToolchain:
"no_shreg_extract": None "no_shreg_extract": None
} }
special_overrides = common.icestorm_special_overrides
def __init__(self): def __init__(self):
self.yosys_opt = "-q" self.yosys_opt = "-q"
self.pre_synthesis_commands = list() self.pre_synthesis_commands = list()
......
...@@ -17,12 +17,8 @@ class LatticePlatform(GenericPlatform): ...@@ -17,12 +17,8 @@ class LatticePlatform(GenericPlatform):
def get_verilog(self, *args, special_overrides=dict(), **kwargs): def get_verilog(self, *args, special_overrides=dict(), **kwargs):
so = dict() # No common overrides between ECP and ice40. so = dict() # No common overrides between ECP and ice40.
if isinstance(self.toolchain, diamond.LatticeDiamondToolchain): so.update(self.toolchain.special_overrides)
so.update(common.diamond_special_overrides) so.update(special_overrides)
elif isinstance(self.toolchain, icestorm.LatticeIceStormToolchain):
so.update(common.icestorm_special_overrides)
else:
raise ValueError("Unknown toolchain")
return GenericPlatform.get_verilog(self, *args, special_overrides=so, return GenericPlatform.get_verilog(self, *args, special_overrides=so,
attr_translate=self.toolchain.attr_translate, attr_translate=self.toolchain.attr_translate,
**kwargs) **kwargs)
......
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