From 9c0f68792240fba088b4a02fbf1ec8056edcb237 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 11 Nov 2020 09:45:07 +0100 Subject: [PATCH] build/generic_platform: use script filename as name when no Platform file. --- litex/build/generic_platform.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litex/build/generic_platform.py b/litex/build/generic_platform.py index 00cd6a040..54b48509b 100644 --- a/litex/build/generic_platform.py +++ b/litex/build/generic_platform.py @@ -6,6 +6,7 @@ # Copyright (c) 2015 Yann Sionneau # SPDX-License-Identifier: BSD-2-Clause +import sys import os from migen.fhdl.structure import Signal, Cat @@ -291,7 +292,11 @@ class GenericPlatform: self.device = device self.constraint_manager = ConstraintManager(io, connectors) if name is None: + # Get name from Platform file. name = self.__module__.split(".")[-1] + if name == "__main__": + # If no Platform file, use script filename, + name = os.path.splitext(os.path.basename(sys.argv[0]))[0] self.name = name self.sources = [] self.verilog_include_paths = []