From a678672fc978733dbaefa044fa45e14f80d307f6 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Tue, 19 Jan 2021 01:22:52 +0300 Subject: [PATCH] ecpix5: add option to select ECP5 device --- litex_boards/platforms/ecpix5.py | 5 +++-- litex_boards/targets/ecpix5.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/litex_boards/platforms/ecpix5.py b/litex_boards/platforms/ecpix5.py index 56fd519..cf89bac 100644 --- a/litex_boards/platforms/ecpix5.py +++ b/litex_boards/platforms/ecpix5.py @@ -111,8 +111,9 @@ class Platform(LatticePlatform): default_clk_name = "clk100" default_clk_period = 1e9/100e6 - def __init__(self, toolchain="trellis", **kwargs): - LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG554I", _io, _connectors, toolchain=toolchain, **kwargs) + def __init__(self, device="85F", toolchain="trellis", **kwargs): + assert device in ["45F", "85F"] + LatticePlatform.__init__(self, f"LFE5UM5G-{device}-8BG554I", _io, _connectors, toolchain=toolchain, **kwargs) def create_programmer(self): return OpenOCDJTAGProgrammer("openocd_ecpix5.cfg") diff --git a/litex_boards/targets/ecpix5.py b/litex_boards/targets/ecpix5.py index 6a2a7e7..5305053 100755 --- a/litex_boards/targets/ecpix5.py +++ b/litex_boards/targets/ecpix5.py @@ -77,8 +77,8 @@ class _CRG(Module): # BaseSoC ------------------------------------------------------------------------------------------ class BaseSoC(SoCCore): - def __init__(self, sys_clk_freq=int(75e6), with_ethernet=False, **kwargs): - platform = ecpix5.Platform(toolchain="trellis") + def __init__(self, device="85F", sys_clk_freq=int(75e6), with_ethernet=False, **kwargs): + platform = ecpix5.Platform(device=device, toolchain="trellis") # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, sys_clk_freq, @@ -128,6 +128,7 @@ def main(): parser = argparse.ArgumentParser(description="LiteX SoC on ECPIX-5") parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--load", action="store_true", help="Load bitstream") + parser.add_argument("--device", default="85F", help="ECP5 device (default: 85F)") parser.add_argument("--sys-clk-freq", default=75e6, help="System clock frequency (default: 75MHz)") parser.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support") parser.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support") @@ -137,6 +138,7 @@ def main(): args = parser.parse_args() soc = BaseSoC( + device = args.device, sys_clk_freq = int(float(args.sys_clk_freq)), with_ethernet = args.with_ethernet, **soc_core_argdict(args)