build/lattice: add add_false_path_constraint method for API compatibility but false...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 17 Jan 2020 07:53:24 +0000 (08:53 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 17 Jan 2020 09:17:19 +0000 (10:17 +0100)
litex/build/lattice/diamond.py
litex/build/lattice/platform.py
litex/build/lattice/trellis.py

index 3e192d93044b56b9727a3aab99e5db890832982d..c2c05218f39eb41d906e49bbf8abe5626de04152 100644 (file)
@@ -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
index 389f49172de0114ec096b3face181783d66d21ef..b4f8593e27a9195d06e408fb58b0de928b84581b 100644 (file)
@@ -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)
index 47803517611be07d9247acf98c65db72ee92be51..7244f283512cc2d63dec36556c3d7ce050720ff4 100644 (file)
@@ -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")