Skip to content

Commit

Permalink
Add width cast to address decode loop iterators. #92
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Dec 20, 2024
1 parent e788e7c commit 8d82eb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/peakrdl_regblock/addr_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ def enter_AddressableComponent(self, node: 'AddressableNode') -> Optional[Walker


def _get_address_str(self, node: 'AddressableNode', subword_offset: int=0) -> str:
expr_width = self.addr_decode.exp.ds.addr_width
a = str(SVInt(
node.raw_absolute_address - self.addr_decode.top_node.raw_absolute_address + subword_offset,
self.addr_decode.exp.ds.addr_width
expr_width
))
for i, stride in enumerate(self._array_stride_stack):
a += f" + i{i}*{SVInt(stride, self.addr_decode.exp.ds.addr_width)}"
a += f" + ({expr_width})'(i{i}) * {SVInt(stride, expr_width)}"
return a


Expand Down
2 changes: 1 addition & 1 deletion src/peakrdl_regblock/readback/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def current_offset_str(self) -> str:
"""
offset_parts = []
for i in range(self._loop_level):
offset_parts.append(f"i{i}*$i{i}sz")
offset_parts.append(f"i{i} * $i{i}sz")
offset_parts.append(str(self.current_offset))
return " + ".join(offset_parts)

Expand Down

0 comments on commit 8d82eb2

Please sign in to comment.