soc/doc/csr: allow CSRField.reset to be a Migen Constant.

This commit is contained in:
Florent Kermarrec 2020-03-23 18:47:41 +01:00
parent 4adac90d88
commit d62ef38c4b
1 changed files with 6 additions and 2 deletions

View 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, "