From d62ef38c4bfbbc0658066d8a45180917197d46d9 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 23 Mar 2020 18:47:41 +0100 Subject: [PATCH] soc/doc/csr: allow CSRField.reset to be a Migen Constant. --- litex/soc/doc/csr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litex/soc/doc/csr.py b/litex/soc/doc/csr.py index 2e7a1bc2b..22e14963a 100644 --- a/litex/soc/doc/csr.py +++ b/litex/soc/doc/csr.py @@ -242,8 +242,12 @@ class DocumentedCSRRegion: for field in reg.fields: field_name = field.name attr_str = "" - if field.reset_value != 0: - attr_str = "\"attr\": '" + str(field.reset_value) + "', " + if isinstance(field.reset_value, Constant): + field_reset_value = field.reset_value.value + else: + field_reset_value = field.reset_value + if field_reset_value != 0: + attr_str = "\"attr\": '" + str(field_reset_value) + "', " type_str = "" if field.pulse: type_str = "\"type\": 4, "