resolve issue #862 add description to soc.svd

The issue is that with no description provided it simply would
not put out a description tag, which breaks compatibility with
other programs.

Insert a somewhat useful default description including a timestamp
and the words "LiteX SoC".
This commit is contained in:
bunnie 2021-04-12 22:03:58 +08:00
parent 5011b564c3
commit ab0aab6913
1 changed files with 6 additions and 0 deletions

View File

@ -397,6 +397,12 @@ 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:
import datetime
import time
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>')