Skip to content

Commit ab2fc51

Browse files
tpwrulesjfng
authored andcommitted
csr.reg: use __iter__ on Register instead of accessing .fields
1 parent bf8dbd3 commit ab2fc51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

amaranth_soc/csr/reg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def filter_fields(src):
532532
raise TypeError(f"Field collection must be a dict or a list, not {fields!r}")
533533

534534
width = 0
535-
for field_path, field in self._fields.flatten():
535+
for field_path, field in self:
536536
width += Shape.cast(field.port.shape).width
537537
if field.port.access.readable() and not access.readable():
538538
raise ValueError(f"Field {'__'.join(field_path)} is readable, but element access "
@@ -569,7 +569,7 @@ def elaborate(self, platform):
569569

570570
field_start = 0
571571

572-
for field_path, field in self.fields.flatten():
572+
for field_path, field in self:
573573
field_width = Shape.cast(field.port.shape).width
574574
field_slice = slice(field_start, field_start + field_width)
575575

0 commit comments

Comments
 (0)