Merge pull request #880 from betrusted-io/issue-862

resolve issue #862 add description to soc.svd
This commit is contained in:
enjoy-digital 2021-04-14 08:58:42 +02:00 committed by GitHub
commit 246142256b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,10 @@ from litex.soc.doc.module import gather_submodules, ModuleNotDocumented, Documen
from litex.soc.doc.csr import DocumentedCSRRegion from litex.soc.doc.csr import DocumentedCSRRegion
from litex.soc.interconnect.csr import _CompoundCSR from litex.soc.interconnect.csr import _CompoundCSR
# for generating a timestamp in the description field, if none is otherwise given
import datetime
import time
# CPU files ---------------------------------------------------------------------------------------- # CPU files ----------------------------------------------------------------------------------------
def get_cpu_mak(cpu, compile_software): def get_cpu_mak(cpu, compile_software):
@ -397,6 +401,10 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None):
svd.append(' <name>{}</name>'.format(name.upper())) svd.append(' <name>{}</name>'.format(name.upper()))
if description is not None: if description is not None:
svd.append(' <description><![CDATA[{}]]></description>'.format(reflow(description))) svd.append(' <description><![CDATA[{}]]></description>'.format(reflow(description)))
else:
fmt = "%Y-%m-%d %H:%M:%S"
build_time = datetime.datetime.fromtimestamp(time.time()).strftime(fmt)
svd.append(' <description><![CDATA[{}]]></description>'.format(reflow("Litex SoC " + build_time)))
svd.append('') svd.append('')
svd.append(' <addressUnitBits>8</addressUnitBits>') svd.append(' <addressUnitBits>8</addressUnitBits>')
svd.append(' <width>32</width>') svd.append(' <width>32</width>')