Plugin Descriptors#
- class peakrdl.plugins.exporter.ExporterSubcommandPlugin(dist_name: str | None = None, dist_version: str | None = None)#
Base class for exporter subcommand plugins.
- add_exporter_arguments(arg_group: argparse._ActionsContainer) None#
Override this function to define additional command line arguments by using the
arg_group.add_argument()method. See Python’s argparse module for more details on how to use this.Note
Not all exporter configuration options are appropriate as command-line arguments. For options that will likely remain static for a given user/organization, consider using the PeakRDL TOML configuration mechanism via the
cfg_schemaandcfgclass members.- Parameters:
arg_group (
argparse.ArgumentParser) – Add more command line arguments via this object.
- cfg_schema = {}#
Schema for additional organization-specific configuration options specified by a ‘peakrdl.toml’ file loaded at startup.
For more details, see Configuration Schema
- do_export(top_node: AddrmapNode, options: argparse.Namespace) None#
Override this function to define the implementation of your exporter.
- Parameters:
top_node (
systemrdl.node.AddrmapNode) – Node representing the top of the design to be exportedoptions (
argparse.Namespace) – Argparse namespace object containing all the command line argument values.
- generates_output_file = True#
Determines whether this subcommand should require the user to provide an output path. If
True, adds a required-ocommand-line argument. The result of this is available later in thedo_export()function viaoptions.output.Set this to
Falseif your exporter does not write any output files.
- long_desc = None#
Longer-form description. If left as None, inherits short_desc
- udp_definitions = []#
List of
systemrdl.udp.UDPDefinitionclasses that this subcommand provides. Internally, each of these definitions are registered with the compiler as soft UDPs viaRDLCompiler.register_udp()
- short_desc#
A brief one-line description of the exporter command.
- cfg#
Resolved configuration data that was extracted from the PeakRDL TOML, and validated.
- class peakrdl.plugins.importer.ImporterPlugin(dist_name: str | None = None, dist_version: str | None = None)#
Base class for importer plugins
- add_importer_arguments(arg_group: argparse._ActionsContainer) None#
Override this function to define additional command line arguments by using the
arg_group.add_argument()method. See Python’s argparse module for more details on how to use this.Note
Not all exporter configuration options are appropriate as command-line arguments. For options that will likely remain static for a given user/organization, consider using the PeakRDL TOML configuration mechanism via the
cfg_schemaandcfgclass members.- Parameters:
arg_group (
argparse.ArgumentParser) – Add more command line arguments via this object.
- cfg_schema: Dict[str, Any] = {}#
Schema for additional organization-specific configuration options specified by a ‘peakrdl.toml’ file loaded at startup
For more details, see Configuration Schema
- do_import(rdlc: RDLCompiler, options: argparse.Namespace, path: str) None#
Defines the implementation of your importer.
- Parameters:
rdlc (
systemrdl.RDLCompiler) – Reference to the SystemRDLRDLCompilerobject.options (
argparse.Namespace) – Argparse Namespace object containing all the command line argument valuespath (str) – Path to the input file
- file_extensions: List[str] = []#
A list of one or more file extensions the importer expects to support. This is used as a rough first-pass method to identify which importer is appropriate for a given file type.
- is_compatible(path: str) bool#
This function is used to further determine if this importer is capable of processing the given input file.
If the file extension was not enough to determine which importer to use, this function is called and shall determine if the file is compatible with this importer to a high degree of confidence.
Note
This should not attempt to exhaustively validate the file’s correctness.
Instead, it is recommended to open the file, and perform a low-cost scan of the contents to quickly determine if the file’s format appears to be compatible with this importer. This can be as simple as a quick keyword search.
- Parameters:
path (str) – Path to the input file
- cfg: Dict[str, Any]#
Resolved configuration data that was extracted from the PeakRDL TOML, and validated.