integration/export/get_csr_json: Only set type to "ro" for read_only CSRStatus.

This commit is contained in:
Florent Kermarrec 2021-08-24 19:26:36 +02:00
parent 05a614c7a2
commit f017b06926
1 changed files with 7 additions and 4 deletions

View File

@ -288,13 +288,16 @@ def get_csr_json(csr_regions={}, constants={}, mem_regions={}):
region_origin = region.origin region_origin = region.origin
if not isinstance(region.obj, Memory): if not isinstance(region.obj, Memory):
for csr in region.obj: for csr in region.obj:
size = (csr.size + region.busword - 1)//region.busword _size = (csr.size + region.busword - 1)//region.busword
_type = "rw"
if isinstance(csr, CSRStatus) and not hasattr(csr, "r"):
_type = "ro"
d["csr_registers"][name + "_" + csr.name] = { d["csr_registers"][name + "_" + csr.name] = {
"addr": region_origin, "addr": region_origin,
"size": size, "size": _size,
"type": "ro" if isinstance(csr, CSRStatus) else "rw" "type": _type
} }
region_origin += alignment//8*size region_origin += alignment//8*_size
for name, value in constants.items(): for name, value in constants.items():
d["constants"][name.lower()] = value.lower() if isinstance(value, str) else value d["constants"][name.lower()] = value.lower() if isinstance(value, str) else value