Plugin Descriptors#

class peakrdl.plugins.exporter.ExporterSubcommandPlugin(dist_name: str | None = None, dist_version: str | None = None)#

Base class for exporter subcommand plugins.

short_desc: str = None#

A brief one-line description of the exporter command.

long_desc: str | None = None#

Longer-form description. If left as None, inherits short_desc

generates_output_file = True#

Determines whether this subcommand should require the user to provide an output path. If True, adds a required -o command-line argument. The result of this is available later in the do_export() function via options.output.

Set this to False if your exporter does not write any output files.

udp_definitions: List[Type[UDPDefinition]] = []#

List of systemrdl.udp.UDPDefinition classes that this subcommand provides. Internally, each of these definitions are registered with the compiler as soft UDPs via RDLCompiler.register_udp()

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

cfg: Dict[str, Any]#

Resolved configuration data that was extracted from the PeakRDL TOML, and validated.

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 cft_schema and cfg class members.

Parameters:

arg_group (argparse.ArgumentParser) – Add more command line arguments via this object.

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 exported

  • options (argparse.Namespace) – Argparse namespace object containing all the command line argument values.

class peakrdl.plugins.importer.ImporterPlugin(dist_name: str | None = None, dist_version: str | None = None)#

Base class for importer plugins

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.

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

cfg: Dict[str, Any]#

Resolved configuration data that was extracted from the PeakRDL TOML, and validated.

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 exaustively 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

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 cft_schema and cfg class members.

Parameters:

arg_group (argparse.ArgumentParser) – Add more command line arguments via this object.

do_import(rdlc: RDLCompiler, options: argparse.Namespace, path: str) None#

Defines the implementation of your importer.

Parameters:
  • rdlc (systemrdl.RDLCompiler) – Reference to the SystemRDL RDLCompiler object.

  • options (argparse.Namespace) – Argparse Namespace object containing all the command line argument values

  • path (str) – Path to the input file