soc/integration: move mem_decoder to soc_core
This commit is contained in:
parent
0a737cb624
commit
d5ad1d56f2
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue