Messages
Warnings
The SystemRDL compiler provides several optional warnings. These lint-like checks report constructs that are not inherently wrong, but may be considered risky.
All warning messages are disabled by default.
Individual warning messages can be enabled by passing one or more of the
following flags into the warning_flags
option of the
RDLCompiler
constructor. Multiple flags can be combined
using bitwise OR (the |
operator).
- systemrdl.warnings.ALL
Enable all warnings.
- systemrdl.warnings.MISSING_RESET
Check if a field that implements storage, or is a runtime constant, is missing its reset value.
- systemrdl.warnings.IMPLICIT_FIELD_POS
Check if a field’s bit offset is not explicitly specified.
Some organizations may want to enforce explicit assignment of bit offsets to avoid unexpected field packing.
- systemrdl.warnings.IMPLICIT_ADDR
Check if a component’s address offset is not explicitly assigned.
Some organizations may want to enforce explicit assignment of addresses to avoid unintended address map changes.
- systemrdl.warnings.STRIDE_NOT_POW2
Check if an instance array’s address stride is not a power of two.
- systemrdl.warnings.STRICT_SELF_ALIGN
Enforce that all addressable components are aligned based on their size. Alignment is determined by the component’s size rounded up to the next power of two.
Strict self-alignment may be desireable since it can simplify address decode logic for hierarchical designs.
This rule is a superset of
STRIDE_NOT_POW2
.
Exceptions
- class systemrdl.RDLCompileError
Base class for all SystemRDL compiler exceptions
Message Handling
Warning
The MessagePrinter
and MessageHandler
classes will be deprecated in
a future release. See the following page for details: https://github.com/SystemRDL/systemrdl-compiler/issues/168
- class systemrdl.messages.MessagePrinter
Printer class that handles formatting and emitting compiler messages
This class can be extended in order to provide custom compiler message formatting or logging
- emit_message(lines: List[str]) None
Emit message. Default printer emits messages to stderr
- Parameters:
lines (List[str]) – List of strings containing each line of the message
- format_message(severity: Severity, text: str, src_ref: SourceRefBase | None) List[str]
Formats the message prior to emitting it.
- Parameters:
severity (
Severity
) – Message severity.text (str) – Body of message
src_ref (
SourceRefBase
) – Reference to source context object
- Returns:
List of strings for each line of the message
- Return type:
list
- get_selection_context(src_ref: DetailedFileSourceRef, color_code: str) List[str]
Generates the message context lines
- class systemrdl.messages.MessageHandler
- error(text: str, src_ref: SourceRefBase | None = None) None
Print an error message. Sets
had_error
to True.- Parameters:
text (str) – Message text
src_ref (SourceRefBase) – Optional source reference object to provide message context
- fatal(text: str, src_ref: SourceRefBase | None = None) NoReturn
Print a fatal message.
- Parameters:
text (str) – Message text
src_ref (SourceRefBase) – Optional source reference object to provide message context
- Raises:
RDLCompileError – Always raises this exception
- had_error
Set to True if an error message was ever emitted
- warning(text: str, src_ref: SourceRefBase | None = None) None
Print a warning message.
- Parameters:
text (str) – Message text
src_ref (SourceRefBase) – Optional source reference object to provide message context