From ab0aab6913a8bb232dae0b372b7fbfa814a8fe41 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 12 Apr 2021 22:03:58 +0800 Subject: [PATCH 1/2] 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". --- litex/soc/integration/export.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litex/soc/integration/export.py b/litex/soc/integration/export.py index 9e515796d..4eaf6fd9b 100644 --- a/litex/soc/integration/export.py +++ b/litex/soc/integration/export.py @@ -397,6 +397,12 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None): svd.append(' {}'.format(name.upper())) if description is not None: svd.append(' '.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(' '.format(reflow("Litex SoC " + build_time))) svd.append('') svd.append(' 8') svd.append(' 32') From 1b78b120243a9d27391a4917ead080932906f022 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 12 Apr 2021 22:27:22 +0800 Subject: [PATCH 2/2] resolve feedback on import location --- litex/soc/integration/export.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litex/soc/integration/export.py b/litex/soc/integration/export.py index 4eaf6fd9b..ce75c8362 100644 --- a/litex/soc/integration/export.py +++ b/litex/soc/integration/export.py @@ -33,6 +33,10 @@ from litex.soc.doc.module import gather_submodules, ModuleNotDocumented, Documen from litex.soc.doc.csr import DocumentedCSRRegion 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 ---------------------------------------------------------------------------------------- def get_cpu_mak(cpu, compile_software): @@ -398,8 +402,6 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None): if description is not None: svd.append(' '.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(' '.format(reflow("Litex SoC " + build_time)))