From: Florent Kermarrec Date: Mon, 23 Mar 2020 17:47:41 +0000 (+0100) Subject: soc/doc/csr: allow CSRField.reset to be a Migen Constant. X-Git-Tag: 24jan2021_ls180~530 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d62ef38c4bfbbc0658066d8a45180917197d46d9;p=litex.git soc/doc/csr: allow CSRField.reset to be a Migen Constant. --- diff --git a/litex/soc/doc/csr.py b/litex/soc/doc/csr.py index 2e7a1bc2..22e14963 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, "