mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
tools/litex_json2renode: Add find_memory_region helper
This commit is contained in:
parent
98168492de
commit
c149f3e4dd
1 changed files with 22 additions and 0 deletions
|
@ -667,6 +667,28 @@ def filter_memory_regions(raw_regions, alignment=None, autoalign=[]):
|
||||||
yield r
|
yield r
|
||||||
|
|
||||||
|
|
||||||
|
def find_memory_region(memory_regions, address):
|
||||||
|
""" Finds the memory region containing the specified address.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
memory_regions (list): list of memory regions filtered
|
||||||
|
with filter_memory_regions
|
||||||
|
address (int): the address to find
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict or None: the region from `memory_regions` that contains
|
||||||
|
`address` or None if none of them do
|
||||||
|
"""
|
||||||
|
for r in memory_regions:
|
||||||
|
base, size = r['base'], r['size']
|
||||||
|
end = base + size
|
||||||
|
|
||||||
|
if base <= address < end:
|
||||||
|
return r
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def generate_resc(csr, args, flash_binaries={}, tftp_binaries={}):
|
def generate_resc(csr, args, flash_binaries={}, tftp_binaries={}):
|
||||||
""" Generates platform definition.
|
""" Generates platform definition.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue