apb4 if working?

This commit is contained in:
Arnav Sacheti
2025-10-20 22:09:25 -07:00
parent f956232a62
commit 395f584f52
9 changed files with 106 additions and 57 deletions

View File

@@ -22,6 +22,10 @@ class StructGenerator(BusDecoderListener):
def enter_AddressableComponent(self, node: AddressableNode) -> WalkerAction | None:
action = super().enter_AddressableComponent(node)
self._skip = False
if action == WalkerAction.SkipDescendants:
self._skip = True
if node.children():
# Push new body onto stack
body = StructBody(f"cpuif_sel_{node.inst_name}_t", True, True)
@@ -34,7 +38,7 @@ class StructGenerator(BusDecoderListener):
if node.children():
body = self._stack.pop()
if body and isinstance(body, StructBody):
if body and isinstance(body, StructBody) and not self._skip:
self._stack.appendleft(body)
type = body.name
@@ -42,11 +46,12 @@ class StructGenerator(BusDecoderListener):
if node.array_dimensions:
for dim in node.array_dimensions:
name += f"[{dim}]"
name = f"[{dim - 1}:0]{name}"
self._stack[-1] += f"{type} {name};"
super().exit_AddressableComponent(node)
def __str__(self) -> str:
self._stack[-1] += "logic cpuif_err;"
return "\n".join(map(str, self._stack))