build/add_period_constraint: Fix trellis (thanks bjonnh and zyp) and avoid specific add_period_constraint in libero_soc.
This commit is contained in:
parent
60537fc39f
commit
f5a9efd8ba
|
@ -146,6 +146,10 @@ class LatticeTrellisToolchain(YosysNextPNRToolchain):
|
||||||
}
|
}
|
||||||
|
|
||||||
def add_period_constraint(self, platform, clk, period):
|
def add_period_constraint(self, platform, clk, period):
|
||||||
|
if clk is None:
|
||||||
|
return
|
||||||
|
if hasattr(clk, "p"):
|
||||||
|
clk = clk.p
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -236,13 +236,6 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
if subprocess.call(shell + [script]) != 0:
|
if subprocess.call(shell + [script]) != 0:
|
||||||
raise OSError("Subprocess failed")
|
raise OSError("Subprocess failed")
|
||||||
|
|
||||||
def add_period_constraint(self, platform, clk, period):
|
|
||||||
if clk in self.clocks:
|
|
||||||
if period != self.clocks[clk]:
|
|
||||||
raise ValueError("Clock already constrained to {:.2f}ns, new constraint to {:.2f}ns"
|
|
||||||
.format(self.clocks[clk], period))
|
|
||||||
self.clocks[clk] = period
|
|
||||||
|
|
||||||
def add_false_path_constraint(self, platform, from_, to):
|
def add_false_path_constraint(self, platform, from_, to):
|
||||||
if (to, from_) not in self.false_paths:
|
if (to, from_) not in self.false_paths:
|
||||||
self.false_paths.add((from_, to))
|
self.false_paths.add((from_, to))
|
||||||
|
|
|
@ -206,6 +206,10 @@ bitgen {bitgen_opt} {build_name}.ncd {build_name}.bit{fail_stmt}
|
||||||
# them through clock objects like DCM and PLL objects.
|
# them through clock objects like DCM and PLL objects.
|
||||||
|
|
||||||
def add_period_constraint(self, platform, clk, period):
|
def add_period_constraint(self, platform, clk, period):
|
||||||
|
if clk is None:
|
||||||
|
return
|
||||||
|
if hasattr(clk, "p"):
|
||||||
|
clk = clk.p
|
||||||
clk.attr.add("keep")
|
clk.attr.add("keep")
|
||||||
platform.add_platform_command(
|
platform.add_platform_command(
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue