Compat: Add litex.compat to handle retro-compatibility on API changes and move integration/soc_sdram to it.
Compat Notice is not yet enabled for soc_sdram since targets first need to be updated.
This commit is contained in:
parent
cc02055b42
commit
f7f277548e
|
@ -134,8 +134,3 @@ def generated_banner(line_comment="//"):
|
|||
r += "{}\n".format(datetime.datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S"))
|
||||
r += line_comment + "-"*80 + "\n"
|
||||
return r
|
||||
|
||||
|
||||
def deprecated_warning(msg):
|
||||
print("[WARNING] Deprecated, please update " + msg)
|
||||
time.sleep(2) # annoy user to force update :)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
import sys
|
||||
import time
|
||||
|
||||
def colorer(s, color="bright"): # FIXME: Move colorer to litex.common?
|
||||
header = {
|
||||
"bright": "\x1b[1m",
|
||||
"green": "\x1b[32m",
|
||||
"cyan": "\x1b[36m",
|
||||
"red": "\x1b[31m",
|
||||
"yellow": "\x1b[33m",
|
||||
"underline": "\x1b[4m"}[color]
|
||||
trailer = "\x1b[0m"
|
||||
return header + str(s) + trailer
|
||||
|
||||
def compat_notice(name, date, info=""):
|
||||
print("Compat: {name} is {deprecated} since {date} and will soon no longer work, please {update}. {info}".format(
|
||||
name = colorer(name),
|
||||
deprecated = colorer("deprecated", color="red"),
|
||||
date = colorer(date),
|
||||
update = colorer("update", color="red"),
|
||||
info = info,
|
||||
), end="")
|
||||
# Annoy user to force update :)
|
||||
for i in range(10):
|
||||
time.sleep(0.2)
|
||||
print(".", end="")
|
||||
sys.stdout.flush()
|
||||
print("thanks :)")
|
||||
time.sleep(1)
|
||||
|
||||
def add_compat(location):
|
||||
if location == "litex.soc.integration":
|
||||
#compat_notice("SoCSDRAM", date="2020-03-24", info="Switch to SoCCore/add_sdram/soc_core_args instead.")
|
||||
from litex.compat import soc_sdram
|
||||
sys.modules["litex.soc.integration.soc_sdram"] = soc_sdram
|
|
@ -1,3 +1,8 @@
|
|||
####################################################################################################
|
||||
# DISCLAIMER: Provides retro-compatibility layer for SoCSDRAM based designs.
|
||||
# Will soon no longer work, please don't use in new designs.
|
||||
####################################################################################################
|
||||
|
||||
#
|
||||
# This file is part of LiteX.
|
||||
#
|
||||
|
@ -6,11 +11,6 @@
|
|||
# This file is Copyright (c) 2019 Gabriel L. Somlo <somlo@cmu.edu>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
####################################################################################################
|
||||
# DISCLAIMER: Provides retro-compatibility layer for existing SoCSDRAM based designs.
|
||||
# Most of the SoC code has been refactored/improved and is now located in integration/soc.py
|
||||
####################################################################################################
|
||||
|
||||
import inspect
|
||||
|
||||
from migen import *
|
|
@ -0,0 +1,3 @@
|
|||
import sys
|
||||
from litex.compat import add_compat
|
||||
add_compat(__name__)
|
Loading…
Reference in New Issue