class systemrdl.RDLWalker(unroll: bool = False, skip_not_present: bool = True)

Implements a walker instance that traverses the elaborated RDL instance tree Each node is visited exactly once.

Each node is visited as follows:

  1. Run enter_Component() callback

  2. Run enter_AddressableComponent() or enter_VectorComponent() callback

  3. Run type-specific enter_*() callback, such as enter_Reg()

  4. Traverse any children

  5. Run type-specific exit_*() callback, such as exit_Reg()

  6. Run exit_AddressableComponent() or exit_VectorComponent() callback

  7. Run exit_Component() callback

  • unroll (bool) – If True, any nodes that are arrays are unrolled. When the walker arrives at an array node, it will be visited multiple times according to the array dimensions.

  • skip_not_present (bool) – If True, walker skips nodes whose ‘ispresent’ property is set to False

walk(node: Node, *listeners: RDLListener, skip_top: bool = False) None

Initiates the walker to traverse the current node and its children. Calls the corresponding callback for each of the listeners provided in the order that they are listed.

  • node (Node) – Node to start traversing. Listener traversal includes this node.

  • listeners (RDLListener) – One or more RDLListener that are invoked during node traversal. Listener callbacks are executed in the same order as provided.

  • skip_top (bool) – Skip callbacks for the top node specified by node

Changed in version 1.21: Added skip_top option.


class systemrdl.RDLListener

Base class for user-defined RDL traversal listeners.

From each callback, optionally return a WalkerAction to control how the walker should continue model traversal. Returning None is equivalent to WalkerAction.Continue.

Changed in version 1.23: Added optional WalkerAction return value

enter_AddressableComponent(node: AddressableNode) WalkerAction | None
enter_Addrmap(node: AddrmapNode) WalkerAction | None
enter_Component(node: Node) WalkerAction | None
enter_Field(node: FieldNode) WalkerAction | None
enter_Mem(node: MemNode) WalkerAction | None
enter_Reg(node: RegNode) WalkerAction | None
enter_Regfile(node: RegfileNode) WalkerAction | None
enter_Signal(node: SignalNode) WalkerAction | None
enter_VectorComponent(node: VectorNode) WalkerAction | None
exit_AddressableComponent(node: AddressableNode) WalkerAction | None
exit_Addrmap(node: AddrmapNode) WalkerAction | None
exit_Component(node: Node) WalkerAction | None
exit_Field(node: FieldNode) WalkerAction | None
exit_Mem(node: MemNode) WalkerAction | None
exit_Reg(node: RegNode) WalkerAction | None
exit_Regfile(node: RegfileNode) WalkerAction | None
exit_Signal(node: SignalNode) WalkerAction | None
exit_VectorComponent(node: VectorNode) WalkerAction | None
class systemrdl.WalkerAction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Continue = 0

Continue walking the register model

SkipDescendants = 1

Walker will continue calling listener methods for this component, but will not recurse into this node’s children.

StopNow = 2

Stop the walker immediately. No more listener methods will be called.