From d5ad1d56f2cd7859a65e6e4fb927cd963b8674ba Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 11 Feb 2020 17:19:22 +0100 Subject: [PATCH] soc/integration: move mem_decoder to soc_core --- litex/soc/integration/common.py | 7 ------- litex/soc/integration/soc_core.py | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/litex/soc/integration/common.py b/litex/soc/integration/common.py index b43e8dfe3..6d6699d3e 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 496435c9e..b3a103565 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):