soc/doc/csr: allow CSRField.reset to be a Migen Constant.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 23 Mar 2020 17:47:41 +0000 (18:47 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 23 Mar 2020 17:47:41 +0000 (18:47 +0100)
litex/soc/doc/csr.py

index 2e7a1bc2b078782cf87fbabc584287528374f2ac..22e14963a4d99fb546f92ab0e86d612ad818fac5 100644 (file)
@@ -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, "