boards: Add Vendor prefix to platforms/targets name when useful and when multiple boards from the same vendor. (With Retro-Compat on the imports).

This commit is contained in:
Florent Kermarrec 2021-03-25 14:09:23 +01:00
parent 219067ed3a
commit 8a3cacae32
82 changed files with 78 additions and 2 deletions

View File

@ -0,0 +1,38 @@
import os
import sys
import glob
import importlib
# Boards Vendors.
vendors = [
"colorlight",
"digilent",
"enclustra",
"kosagi",
"lattice",
"linsn",
"numato",
"qmtech",
"terasic",
"sqrl",
"xilinx",
]
# Get all platforms.
platforms_dir = os.path.dirname(os.path.realpath(__file__))
platforms = glob.glob(f"{platforms_dir}/*.py")
# For each platform:
for platform in platforms:
platform = os.path.basename(platform)
platform = platform.replace(".py", "")
# Verify if a Vendor prefix is present in platform name, if so create the short import to
# allow the platform to be imported with the full name or short name ex:
# from litex_boards.platforms import digilent_arty or
# from litex_boards.platforms import arty
if platform.split("_")[0] in vendors:
short_platform = platform[len(platform.split("_")[0])+1:]
p = importlib.import_module(f"litex_boards.platforms.{platform}")
vars()[short_platform] = p
sys.modules[f"litex_boards.platforms.{short_platform}"] = p

View File

@ -0,0 +1,38 @@
import os
import sys
import glob
import importlib
# Boards Vendors.
vendors = [
"colorlight",
"digilent",
"enclustra",
"kosagi",
"lattice",
"linsn",
"numato",
"qmtech",
"terasic",
"sqrl",
"xilinx",
]
# Get all targets.
targets_dir = os.path.dirname(os.path.realpath(__file__))
targets = glob.glob(f"{targets_dir}/*.py")
# For each target:
for target in targets:
target = os.path.basename(target)
target = target.replace(".py", "")
# Verify if a Vendor prefix is present in target name, if so create the short import to
# allow the target to be imported with the full name or short name ex:
# from litex_boards.targets import digilent_arty or
# from litex_boards.targets import arty
if target.split("_")[0] in vendors:
short_target = target[len(target.split("_")[0])+1:]
t = importlib.import_module(f"litex_boards.targets.{target}")
vars()[short_target] = t
sys.modules[f"litex_boards.targets.{short_target}"] = t

View File

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

View File

@ -28,7 +28,7 @@ from litex.soc.cores.video import VideoVGAPHY
from litex.build.io import DDROutput from litex.build.io import DDROutput
from litex_boards.platforms import arrow_sockit from litex_boards.platforms import terasic_sockit
from litedram.modules import _TechnologyTimings, _SpeedgradeTimings, SDRModule, AS4C32M16 from litedram.modules import _TechnologyTimings, _SpeedgradeTimings, SDRModule, AS4C32M16
from litedram.phy import HalfRateGENSDRPHY, GENSDRPHY from litedram.phy import HalfRateGENSDRPHY, GENSDRPHY