From: Florent Kermarrec Date: Tue, 11 Feb 2020 16:19:22 +0000 (+0100) Subject: soc/integration: move mem_decoder to soc_core X-Git-Tag: 24jan2021_ls180~678 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5ad1d56f2cd7859a65e6e4fb927cd963b8674ba;p=litex.git soc/integration: move mem_decoder to soc_core --- diff --git a/litex/soc/integration/common.py b/litex/soc/integration/common.py index b43e8dfe..6d6699d3 100644 --- a/litex/soc/integration/common.py +++ b/litex/soc/integration/common.py @@ -12,13 +12,6 @@ from migen import * # Helpers ---------------------------------------------------------------------------------------- -def mem_decoder(address, size=0x10000000): - size = 2**log2_int(size, False) - assert (address & (size - 1)) == 0 - address >>= 2 # bytes to words aligned - size >>= 2 # bytes to words aligned - return lambda a: (a[log2_int(size):] == (address >> log2_int(size))) - def get_version(with_time=True): fmt = "%Y-%m-%d %H:%M:%S" if with_time else "%Y-%m-%d" return datetime.datetime.fromtimestamp(time.time()).strftime(fmt) diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 496435c9..b3a10356 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -37,6 +37,15 @@ __all__ = [ "soc_mini_argdict", ] +# Helpers ------------------------------------------------------------------------------------------ + +def mem_decoder(address, size=0x10000000): + size = 2**log2_int(size, False) + assert (address & (size - 1)) == 0 + address >>= 2 # bytes to words aligned + size >>= 2 # bytes to words aligned + return lambda a: (a[log2_int(size):] == (address >> log2_int(size))) + # SoCController ------------------------------------------------------------------------------------ class SoCController(Module, AutoCSR):