build/generic_platform: use script filename as name when no Platform file.

This commit is contained in:
Florent Kermarrec 2020-11-11 09:45:07 +01:00
parent 275932f56c
commit 9c0f687922
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@
# Copyright (c) 2015 Yann Sionneau <ys@m-labs.hk>
# 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 = []