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) Optional[WalkerAction]
enter_Addrmap(node: AddrmapNode) Optional[WalkerAction]
enter_Component(node: Node) Optional[WalkerAction]
enter_Field(node: FieldNode) Optional[WalkerAction]
enter_Mem(node: MemNode) Optional[WalkerAction]
enter_Reg(node: RegNode) Optional[WalkerAction]
enter_Regfile(node: RegfileNode) Optional[WalkerAction]
enter_Signal(node: SignalNode) Optional[WalkerAction]
enter_VectorComponent(node: VectorNode) Optional[WalkerAction]
exit_AddressableComponent(node: AddressableNode) Optional[WalkerAction]
exit_Addrmap(node: AddrmapNode) Optional[WalkerAction]
exit_Component(node: Node) Optional[WalkerAction]
exit_Field(node: FieldNode) Optional[WalkerAction]
exit_Mem(node: MemNode) Optional[WalkerAction]
exit_Reg(node: RegNode) Optional[WalkerAction]
exit_Regfile(node: RegfileNode) Optional[WalkerAction]
exit_Signal(node: SignalNode) Optional[WalkerAction]
exit_VectorComponent(node: VectorNode) Optional[WalkerAction]
class systemrdl.WalkerAction(value)

An enumeration.

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.