platforms: make sure clocks inputs are constraints on all platforms.

Also use new loose lookup_request to simplify constraints.
This commit is contained in:
Florent Kermarrec 2020-05-05 11:45:41 +02:00
parent 86648ec7d8
commit 1f88a9d5ec
46 changed files with 182 additions and 52 deletions

View file

@ -227,15 +227,6 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
try:
self.add_period_constraint(self.lookup_request("clk200").p, 1e9/200e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("eth_clocks").rx, 1e9/125e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("eth_clocks").tx, 1e9/125e6)
except ConstraintError:
pass
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("eth_clocks:tx", loose=True), 1e9/125e6)

View file

@ -120,3 +120,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7a200t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)

View file

@ -260,3 +260,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
bscan_spi = "bscan_spi_xc7a100t.bit" if "xc7a100t" in self.device else "bscan_spi_xc7a35t.bit"
return OpenOCD("openocd_xilinx_xc7.cfg", bscan_spi)
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)

View file

@ -213,3 +213,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
bscan_spi = "bscan_spi_xc7s50.bit" if "xc7s50" in self.device else "bscan_spi_xc7a25.bit"
return OpenOCD("openocd_xilinx.cfg", bscan_spi)
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)

View file

@ -92,3 +92,8 @@ class Platform(MicrosemiPlatform):
def __init__(self):
MicrosemiPlatform.__init__(self, "MPF300TS_ES-FCG484-1", _io)
def do_finalize(self, fragment):
MicrosemiPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", 0, loose=True), 1e9/50e6)
self.add_period_constraint(self.lookup_request("clk50", 1, loose=True), 1e9/50e6)

View file

@ -122,3 +122,8 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk12", loose=True), 1e9/12e6)
self.add_period_constraint(self.lookup_request("clk25", loose=True), 1e9/25e6)

View file

@ -60,3 +60,7 @@ class Platform(LatticePlatform):
def __init__(self, **kwargs):
LatticePlatform.__init__(self, "LFE5U-25F-8BG381C", _io, **kwargs)
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk27", loose=True), 1e9/27e6)

View file

@ -220,3 +220,7 @@ class Platform(LatticePlatform):
io = {"6.1": _io_v6_1, "7.0": _io_v7_0}[revision]
connectors = {"6.1": _connectors_v6_1, "7.0": _connectors_v7_0}[revision]
LatticePlatform.__init__(self, device, io, connectors=connectors, toolchain="trellis")
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk25", loose=True), 1e9/25e6)

View file

@ -114,3 +114,7 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)

View file

@ -119,3 +119,9 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk10", loose=True), 1e9/10e6)
self.add_period_constraint(self.lookup_request("clk50", 0, loose=True), 1e9/50e6)
self.add_period_constraint(self.lookup_request("clk50", 1, loose=True), 1e9/50e6)

View file

@ -129,3 +129,9 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", 0, loose=True), 1e9/50e6)
self.add_period_constraint(self.lookup_request("clk50", 1, loose=True), 1e9/50e6)
self.add_period_constraint(self.lookup_request("clk50", 2, loose=True), 1e9/50e6)

View file

@ -45,3 +45,7 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)

View file

@ -45,3 +45,7 @@ class Platform(AlteraPlatform):
def create_programmer(self):
return USBBlaster()
def do_finalize(self, fragment):
AlteraPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)

View file

@ -138,3 +138,8 @@ class Platform(LatticePlatform):
def create_programmer(self):
trellis = os.environ.get("TRELLIS", "/usr/share/trellis")
return OpenOCDJTAGProgrammer(os.path.join(trellis, "misc", "openocd", "ecp5-evn.cfg"), "bscan_spi_lfe5um5g85f.svf")
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk12", loose=True), 1e9/12e6)
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)

View file

@ -96,3 +96,7 @@ class Platform(LatticePlatform):
def __init__(self, **kwargs):
LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG554I", _io, _connectors, **kwargs)
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)

View file

@ -80,3 +80,7 @@ class Platform(LatticePlatform):
def create_programmer(self):
return IceStormProgrammer()
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk48", loose=True), 1e9/48e6)

View file

@ -64,3 +64,7 @@ class Platform(LatticePlatform):
def create_programmer(self):
return IceStormProgrammer()
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk48", loose=True), 1e9/48e6)

View file

@ -66,3 +66,7 @@ class Platform(LatticePlatform):
def create_programmer(self):
return IceStormProgrammer()
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk48", loose=True), 1e9/48e6)

View file

@ -121,7 +121,5 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
try:
self.add_period_constraint(self.lookup_request("eth_clocks").rx, 1e9/125e6)
except ConstraintError:
pass
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", loose=True), 1e9/125e6)

View file

@ -217,3 +217,4 @@ class Platform(LatticePlatform):
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk8", loose=True), 1e9/8e6)

View file

@ -86,3 +86,7 @@ class Platform(LatticePlatform):
def create_programmer(self):
return IceStormProgrammer()
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk12", loose=True), 1e9/12e6)

View file

@ -553,16 +553,7 @@ set_property CONFIG_VOLTAGE 2.5 [current_design]
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
try:
self.add_period_constraint(self.lookup_request("clk200").p, 1e9/200e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("eth_clocks").rx, 1e9/125e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("eth_clocks").tx, 1e9/125e6)
except ConstraintError:
pass
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("eth_clocks:tx", loose=True), 1e9/125e6)
self.add_platform_command("set_property DCI_CASCADE {{32 34}} [get_iobanks 33]")

View file

@ -498,6 +498,8 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk125", loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("clk300", loose=True), 1e9/300e6)
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 44]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 45]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 46]")

View file

@ -74,3 +74,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7k160t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)

View file

@ -294,3 +294,9 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc6.cfg", "bscan_spi_xc6slx16.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk25", loose=True), 1e9/25e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", 0, loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", 1, loose=True), 1e9/125e6)

View file

@ -92,3 +92,7 @@ class Platform(LatticePlatform):
</ispXCF>
"""
return LatticeProgrammer(_xcf_template)
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk12", loose=True), 1e9/12e6)

View file

@ -92,6 +92,10 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("clk100_gtr", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("clk27_gtr", loose=True), 1e9/27e6)
self.add_period_constraint(self.lookup_request("clk33", loose=True), 1e9/33e6)
self.add_platform_command("set_property BITSTREAM.CONFIG.OVERTEMPSHUTDOWN ENABLE [current_design]")
self.add_platform_command("set_property BITSTREAM.CONFIG.UNUSEDPIN PULLNONE [current_design]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 64]")

View file

@ -184,3 +184,8 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7a50t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("eth_clocks", loose=True), 1e9/125e6)

View file

@ -137,3 +137,8 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return FpgaProg()
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk32", loose=True), 1e9/32e6)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)

View file

@ -404,3 +404,8 @@ set_property CONFIG_VOLTAGE 3.3 [current_design]
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7k160t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("clk150", loose=True), 1e9/150e6)

View file

@ -194,3 +194,8 @@ class Platform(XilinxPlatform):
def create_programmer(self):
bscan_spi = "bscan_spi_xc7a100t.bit" if "xc7a100t" in self.device else "bscan_spi_xc7a35t.bit"
return OpenOCD("openocd_netv2_rpi.cfg", bscan_spi)
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)
self.add_period_constraint(self.lookup_request("eth_clocks", loose=True), 1e9/50e6)

View file

@ -133,3 +133,8 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7a100t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("eth_clocks:ref_clk", loose=True), 1e9/50e6)

View file

@ -240,3 +240,8 @@ class Platform(XilinxPlatform):
self.add_period_constraint(self.lookup_request("eth_clocks").rx, 1e9/125e6)
except ConstraintError:
pass
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("eth_clocks", loose=True), 1e9/125e6)

View file

@ -188,3 +188,7 @@ class Platform(LatticePlatform):
io = {"0.1": _io_r0_1, "0.2": _io_r0_2 }[revision]
connectors = {"0.1": _connectors_r0_1, "0.2": _connectors_r0_2}[revision]
LatticePlatform.__init__(self, f"LFE5U-{device}-8MG285C", io, connectors, **kwargs)
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk48", loose=True), 1e9/48e6)

View file

@ -153,3 +153,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc6.cfg", "bscan_spi_xc6slx45.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk50", loose=True), 1e9/50e6)

View file

@ -168,3 +168,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc6.cfg", "bscan_spi_xc6slx45.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)

View file

@ -169,3 +169,7 @@ class Platform(XilinxPlatform):
def create_programmer(self):
return OpenOCD("openocd_xilinx_xc7.cfg", "bscan_spi_xc7a200t.bit")
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)

View file

@ -67,3 +67,7 @@ class Platform(LatticePlatform):
def create_programmer(self):
return TinyProgProgrammer()
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk16", loose=True), 1e9/16e6)

View file

@ -221,7 +221,7 @@ class Platform(LatticePlatform):
LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG756C", _io, _connectors, **kwargs)
def do_finalize(self, fragment):
try:
self.add_period_constraint(self.lookup_request("eth_clocks", 0).rx, 1e9/125e6)
except ConstraintError:
pass
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("clk12", loose=True), 1e9/12e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", loose=True), 1e9/125e6)

View file

@ -101,3 +101,7 @@ class Platform(LatticePlatform):
def __init__(self, device="LFE5U-45F", **kwargs):
LatticePlatform.__init__(self, device + "-6BG381C", _io, **kwargs)
def do_finalize(self, fragment):
LatticePlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk25", loose=True), 1e9/25e6)

View file

@ -648,11 +648,5 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
try:
self.add_period_constraint(self.lookup_request("clk200").p, 1e9/200e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("sgmii_clock").p, 1e9/125e6)
except ConstraintError:
pass
self.add_period_constraint(self.lookup_request("clk200", loose=True), 1e9/200e6)
self.add_period_constraint(self.lookup_request("sgmii_clock", loose=True), 1e9/125e6)

View file

@ -12,11 +12,11 @@ _io = [
Subsignal("p", Pins("G31"), IOStandard("DIFF_SSTL12")),
Subsignal("n", Pins("F31"), IOStandard("DIFF_SSTL12")),
),
("clk250_1", 0,
("clk250", 0,
Subsignal("p", Pins("E12"), IOStandard("DIFF_SSTL12")),
Subsignal("n", Pins("D12"), IOStandard("DIFF_SSTL12")),
),
("clk250_2", 0,
("clk250", 1,
Subsignal("p", Pins("AW26"), IOStandard("DIFF_SSTL12")),
Subsignal("n", Pins("AW27"), IOStandard("DIFF_SSTL12")),
),
@ -181,6 +181,11 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk300", loose=True), 1e9/300e6)
self.add_period_constraint(self.lookup_request("clk250", 0, loose=True), 1e9/250e6)
self.add_period_constraint(self.lookup_request("clk250", 1, loose=True), 1e9/250e6)
self.add_period_constraint(self.lookup_request("clk125", loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("clk156", loose=True), 1e9/156e6)
# DDR4 memory channel C1 Internal Vref
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 71]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 72]")

View file

@ -224,11 +224,6 @@ class Platform(LatticePlatform):
LatticePlatform.__init__(self, "LFE5UM5G-45F-8BG381C", _io, _connectors, **kwargs)
def do_finalize(self, fragment):
try:
self.add_period_constraint(self.lookup_request("eth_clocks", 0).rx, 1e9/125e6)
except ConstraintError:
pass
try:
self.add_period_constraint(self.lookup_request("eth_clocks", 1).rx, 1e9/125e6)
except ConstraintError:
pass
self.add_period_constraint(self.lookup_request("clk100", loose=True), 1e9/100e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", 0, loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("eth_clocks:rx", 1, loose=True), 1e9/125e6)

View file

@ -102,6 +102,8 @@ class Platform(XilinxPlatform):
def do_finalize(self, fragment):
XilinxPlatform.do_finalize(self, fragment)
self.add_period_constraint(self.lookup_request("clk125", loose=True), 1e9/125e6)
self.add_period_constraint(self.lookup_request("clk300", loose=True), 1e9/125e6)
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 64]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 65]")
self.add_platform_command("set_property INTERNAL_VREF 0.84 [get_iobanks 66]")

View file

@ -144,7 +144,7 @@ def main():
if args.load:
load()
soc = BaseSoC(with_ethernet=with_ethernet, **soc_core_argdict(args))
soc = BaseSoC(with_ethernet=args.with_ethernet, **soc_core_argdict(args))
builder = Builder(soc, **builder_argdict(args))
builder.build(**trellis_argdict(args))

View file

@ -7,7 +7,7 @@ import argparse
from migen import *
from litex.boards.platforms import kx2
from litex_boards.platforms import kx2
from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import *