From: Florent Kermarrec Date: Fri, 17 Jan 2020 07:53:24 +0000 (+0100) Subject: build/lattice: add add_false_path_constraint method for API compatibility but false... X-Git-Tag: 24jan2021_ls180~733 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c465f89b608c565c9bd06437d60eb072e6adef5;p=litex.git build/lattice: add add_false_path_constraint method for API compatibility but false paths are not yet used/translated to .lpf file --- diff --git a/litex/build/lattice/diamond.py b/litex/build/lattice/diamond.py index 3e192d93..c2c05218 100644 --- a/litex/build/lattice/diamond.py +++ b/litex/build/lattice/diamond.py @@ -152,6 +152,9 @@ class LatticeDiamondToolchain: special_overrides = common.lattice_ecpx_special_overrides + def __init__(self): + self.false_paths = set() # FIXME: use it + def build(self, platform, fragment, build_dir = "build", build_name = "top", @@ -200,3 +203,9 @@ class LatticeDiamondToolchain: # TODO: handle differential clk platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format( 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)) \ No newline at end of file diff --git a/litex/build/lattice/platform.py b/litex/build/lattice/platform.py index 389f4917..b4f8593e 100644 --- a/litex/build/lattice/platform.py +++ b/litex/build/lattice/platform.py @@ -37,3 +37,10 @@ class LatticePlatform(GenericPlatform): if hasattr(clk, "p"): clk = clk.p 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) diff --git a/litex/build/lattice/trellis.py b/litex/build/lattice/trellis.py index 47803517..7244f283 100644 --- a/litex/build/lattice/trellis.py +++ b/litex/build/lattice/trellis.py @@ -173,6 +173,7 @@ class LatticeTrellisToolchain: def __init__(self): self.yosys_template = _yosys_template self.build_template = _build_template + self.false_paths = set() # FIXME: use it def build(self, platform, fragment, build_dir = "build", @@ -231,6 +232,12 @@ class LatticeTrellisToolchain: platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format( 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): parser.add_argument("--yosys-nowidelut", action="store_true", help="pass '-nowidelut' to yosys synth_ecp5")