Fix max_decode_depth to control decoder hierarchy and port generation (#18)
* Initial plan * Fix max_decode_depth to properly control decoder hierarchy and port generation Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Fix test that relied on old depth behavior Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Update documentation for max_decode_depth parameter Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * fix format * Add variable_depth RDL file and smoke tests for max_decode_depth parameter Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * Add variable depth tests for APB3 and AXI4-Lite CPUIFs Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com> * fix * fix * bump --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
This commit is contained in:
@@ -85,6 +85,20 @@ class DecodeLogicGenerator(BusDecoderListener):
|
||||
def enter_AddressableComponent(self, node: AddressableNode) -> WalkerAction | None:
|
||||
action = super().enter_AddressableComponent(node)
|
||||
|
||||
should_decode = action == WalkerAction.SkipDescendants
|
||||
|
||||
if not should_decode and self._ds.max_decode_depth == 0:
|
||||
# When decoding all levels, treat leaf registers as decode boundary
|
||||
for child in node.children():
|
||||
if isinstance(child, AddressableNode):
|
||||
break
|
||||
else:
|
||||
should_decode = True
|
||||
|
||||
# Only generate select logic if we're at the decode boundary
|
||||
if not should_decode:
|
||||
return action
|
||||
|
||||
conditions: list[str] = []
|
||||
conditions.extend(self.cpuif_addr_predicate(node))
|
||||
conditions.extend(self.cpuif_prot_predicate(node))
|
||||
@@ -146,6 +160,8 @@ class DecodeLogicGenerator(BusDecoderListener):
|
||||
def __str__(self) -> str:
|
||||
body = self._decode_stack[-1]
|
||||
if isinstance(body, IfBody):
|
||||
if len(body) == 0:
|
||||
return f"{self._flavor.cpuif_select}.cpuif_err = 1'b1;"
|
||||
with body.cm(...) as b:
|
||||
b += f"{self._flavor.cpuif_select}.cpuif_err = 1'b1;"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user