Add constants to SVD export

This commit is contained in:
Robert Wilbrandt 2021-02-20 21:16:45 +01:00
parent 7513460572
commit 251cea5647
No known key found for this signature in database
GPG Key ID: 73DE5FB207B8AB28
1 changed files with 9 additions and 2 deletions

View File

@ -463,8 +463,9 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None):
svd.append(' </interrupt>')
svd.append(' </peripheral>')
svd.append(' </peripherals>')
if len(soc.mem_regions) > 0:
svd.append(' <vendorExtensions>')
if len(soc.mem_regions) > 0:
svd.append(' <memoryRegions>')
for region_name, region in soc.mem_regions.items():
svd.append(' <memoryRegion>')
@ -473,6 +474,12 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None):
svd.append(' <size>0x{:08X}</size>'.format(region.size))
svd.append(' </memoryRegion>')
svd.append(' </memoryRegions>')
svd.append(' <constants>')
for name, value in soc.constants.items():
svd.append(' <constant name="{}" value="{}" />'.format(name, value))
svd.append(' </constants>')
svd.append(' </vendorExtensions>')
svd.append('</device>')
return "\n".join(svd)