m1n1.utils: Add Register32.fields property

Signed-off-by: Martin Povišer <povik@protonmail.com>
This commit is contained in:
Martin Povišer 2021-10-16 22:33:32 +02:00 committed by Hector Martin
parent d65526d326
commit 145b1101c9

View file

@ -234,6 +234,10 @@ class Register(Reloadable, metaclass=RegisterMeta):
return val
@property
def fields(self):
return {k: getattr(self, k) for k in self._fields_list}
def str_fields(self):
return f"{', '.join(f'{k}={self._field_val(k)}' for k in self._fields_list)}"