Walker/Listener
Walker
- 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:
Run
enter_Component()
callbackRun
enter_AddressableComponent()
orenter_VectorComponent()
callbackRun type-specific
enter_*()
callback, such asenter_Reg()
Traverse any children
Run type-specific
exit_*()
callback, such asexit_Reg()
Run
exit_AddressableComponent()
orexit_VectorComponent()
callbackRun
exit_Component()
callback
- Parameters:
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 thelisteners
provided in the order that they are listed.- Parameters:
node (
Node
) – Node to start traversing. Listener traversal includes this node.listeners (
RDLListener
) – One or moreRDLListener
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.
Listener
- 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. ReturningNone
is equivalent toWalkerAction.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.