26 lines
865 B
Python
26 lines
865 B
Python
from mibuild.generic_platform import GenericPlatform
|
|
from mibuild.lattice import common, diamond
|
|
|
|
class LatticePlatform(GenericPlatform):
|
|
bitstream_ext = ".bit"
|
|
|
|
def __init__(self, *args, toolchain="diamond", **kwargs):
|
|
GenericPlatform.__init__(self, *args, **kwargs)
|
|
if toolchain == "diamond":
|
|
self.toolchain = diamond.LatticeDiamondToolchain()
|
|
else:
|
|
raise ValueError("Unknown toolchain")
|
|
|
|
def get_verilog(self, *args, special_overrides=dict(), **kwargs):
|
|
so = dict(common.lattice_special_overrides)
|
|
so.update(special_overrides)
|
|
return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)
|
|
|
|
def build(self, *args, **kwargs):
|
|
return self.toolchain.build(self, *args, **kwargs)
|
|
|
|
def add_period_constraint(self, clk, period):
|
|
if hasattr(clk, "p"):
|
|
clk = clk.p
|
|
self.toolchain.add_period_constraint(self, clk, period)
|