build/lattice: add add_false_path_constraint method for API compatibility but false paths are not yet used/translated to .lpf file

This commit is contained in:
Florent Kermarrec 2020-01-17 08:53:24 +01:00
parent b4ba2a47ef
commit 1c465f89b6
3 changed files with 23 additions and 0 deletions

View File

@ -152,6 +152,9 @@ class LatticeDiamondToolchain:
special_overrides = common.lattice_ecpx_special_overrides special_overrides = common.lattice_ecpx_special_overrides
def __init__(self):
self.false_paths = set() # FIXME: use it
def build(self, platform, fragment, def build(self, platform, fragment,
build_dir = "build", build_dir = "build",
build_name = "top", build_name = "top",
@ -200,3 +203,9 @@ class LatticeDiamondToolchain:
# TODO: handle differential clk # TODO: handle differential clk
platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format( platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format(
freq=str(float(1/period)*1000), clk="{clk}"), clk=clk) freq=str(float(1/period)*1000), clk="{clk}"), clk=clk)
def add_false_path_constraint(self, platform, from_, to):
from_.attr.add("keep")
to.attr.add("keep")
if (to, from_) not in self.false_paths:
self.false_paths.add((from_, to))

View File

@ -37,3 +37,10 @@ class LatticePlatform(GenericPlatform):
if hasattr(clk, "p"): if hasattr(clk, "p"):
clk = clk.p clk = clk.p
self.toolchain.add_period_constraint(self, clk, period) self.toolchain.add_period_constraint(self, clk, period)
def add_false_path_constraint(self, from_, to):
if hasattr(from_, "p"):
from_ = from_.p
if hasattr(to, "p"):
to = to.p
self.toolchain.add_false_path_constraint(self, from_, to)

View File

@ -173,6 +173,7 @@ class LatticeTrellisToolchain:
def __init__(self): def __init__(self):
self.yosys_template = _yosys_template self.yosys_template = _yosys_template
self.build_template = _build_template self.build_template = _build_template
self.false_paths = set() # FIXME: use it
def build(self, platform, fragment, def build(self, platform, fragment,
build_dir = "build", build_dir = "build",
@ -231,6 +232,12 @@ class LatticeTrellisToolchain:
platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format( platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format(
freq=str(float(1/period)*1000), clk="{clk}"), clk=clk) freq=str(float(1/period)*1000), clk="{clk}"), clk=clk)
def add_false_path_constraint(self, platform, from_, to):
from_.attr.add("keep")
to.attr.add("keep")
if (to, from_) not in self.false_paths:
self.false_paths.add((from_, to))
def trellis_args(parser): def trellis_args(parser):
parser.add_argument("--yosys-nowidelut", action="store_true", parser.add_argument("--yosys-nowidelut", action="store_true",
help="pass '-nowidelut' to yosys synth_ecp5") help="pass '-nowidelut' to yosys synth_ecp5")