compat: Fix (only triggers notice when used) and enable SoCSDRAM compat.
This commit is contained in:
parent
50ed5e262d
commit
ee36138f75
|
@ -1,6 +1,8 @@
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
# Helpers ------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def colorer(s, color="bright"): # FIXME: Move colorer to litex.common?
|
def colorer(s, color="bright"): # FIXME: Move colorer to litex.common?
|
||||||
header = {
|
header = {
|
||||||
"bright": "\x1b[1m",
|
"bright": "\x1b[1m",
|
||||||
|
@ -12,6 +14,8 @@ def colorer(s, color="bright"): # FIXME: Move colorer to litex.common?
|
||||||
trailer = "\x1b[0m"
|
trailer = "\x1b[0m"
|
||||||
return header + str(s) + trailer
|
return header + str(s) + trailer
|
||||||
|
|
||||||
|
# Compat -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def compat_notice(name, date, info=""):
|
def compat_notice(name, date, info=""):
|
||||||
print("Compat: {name} is {deprecated} since {date} and will soon no longer work, please {update}. {info}".format(
|
print("Compat: {name} is {deprecated} since {date} and will soon no longer work, please {update}. {info}".format(
|
||||||
name = colorer(name),
|
name = colorer(name),
|
||||||
|
@ -26,14 +30,28 @@ def compat_notice(name, date, info=""):
|
||||||
print(".", end="")
|
print(".", end="")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
print("thanks :)")
|
print("thanks :)")
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
def add_compat(location):
|
def add_compat(location):
|
||||||
|
# Integration.
|
||||||
if location == "litex.soc.integration":
|
if location == "litex.soc.integration":
|
||||||
#compat_notice("SoCSDRAM", date="2020-03-24", info="Switch to SoCCore/add_sdram/soc_core_args instead.")
|
class compat_soc_sdram:
|
||||||
from litex.compat import soc_sdram
|
noticed = False
|
||||||
sys.modules["litex.soc.integration.soc_sdram"] = soc_sdram
|
def __getattr__(self, name):
|
||||||
|
if not self.noticed:
|
||||||
|
compat_notice("SoCSDRAM", date="2020-03-24", info="Switch to SoCCore/add_sdram/soc_core_args instead.")
|
||||||
|
self.noticed = True
|
||||||
|
from litex.compat import soc_sdram
|
||||||
|
return getattr(soc_sdram, name)
|
||||||
|
sys.modules["litex.soc.integration.soc_sdram"] = compat_soc_sdram()
|
||||||
|
# Cores.
|
||||||
elif location == "litex.soc.cores":
|
elif location == "litex.soc.cores":
|
||||||
compat_notice("litex.soc.cores.up5kspram", date="2020-03-24", info="Switch to litex.soc.cores.ram.")
|
class compat_up5kspram:
|
||||||
|
noticed = False
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if not self.noticed:
|
||||||
|
compat_notice("litex.soc.cores.up5kspram", date="2020-03-24", info="Switch to litex.soc.cores.ram.")
|
||||||
|
self.noticed = True
|
||||||
|
from litex.soc.cores import ram
|
||||||
|
return getattr(ram, name)
|
||||||
from litex.soc.cores import ram
|
from litex.soc.cores import ram
|
||||||
sys.modules["litex.soc.cores.up5kspram"] = ram
|
sys.modules["litex.soc.cores.up5kspram"] = compat_up5kspram()
|
||||||
|
|
Loading…
Reference in New Issue