Walker/Listener#
Walkers#
- class systemrdl.walker.RDLSimpleWalker(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
nodeand its children. Calls the corresponding callback for each of thelistenersprovided in the order that they are listed.- Parameters:
node (
Node) – Node to start traversing. Listener traversal includes this node.listeners (
RDLListener) – One or moreRDLListenerthat 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
- class systemrdl.walker.RDLSteerableWalker(unroll: bool = False, skip_not_present: bool = True)#
Identical to
RDLSimpleWalker, except that this walker allows listeners to steer the traversal of the design using “Walker Actions”From each callback, the listener may optionally return a
WalkerActionto control how the walker should continue model traversal. ReturningNoneis equivalent toWalkerAction.Continue.If this feature is not necessary, it is recommended to use
RDLSimpleWalkeras it has less traversal overhead.
- systemrdl.walker.RDLWalker#
Alias to
RDLSteerableWalkerfor backwards compatibility
Listener#
- class systemrdl.walker.RDLListener#
Base class for user-defined RDL traversal listeners.
- 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.walker.WalkerAction(value)#
- 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.