Source Reference#

Source references are objects that capture contextual information about where in the original source code an RDL concept originated. This is useful for providing additional information for error messages and other back-annotation to source files.

Every Node in a SystemRDL register model is capable of providing contextual information about where it originated:

Similarly, information about where in the source a property assignment occurred is available via: systemrdl.node.Node.property_src_ref

class systemrdl.source_ref.SourceRefBase#

Base class for all source references

class systemrdl.source_ref.FileSourceRef(path: str)#

Simple file source reference that is only capable of providing the path to the originating file.

Some register model importers may only be able to provide limited source context.

property path: str#

Path of the originating file

class systemrdl.source_ref.DetailedFileSourceRef(path: str)#

Detailed source reference that is capable of providing a context snippet from the originating source.

property line: int#

Line number within the originating file

property line_selection: Tuple[int, int]#

Start/end coordinates of the selection within line_text. If the actual selection spans multiple lines, it is clamped to the end of this line.

property line_text: str#

Source text of the originating line

property path: str#

Path of the originating file