### Define TOML configuration options Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/cfg_schema.md Example TOML structure for defining plugin-specific configuration options. ```toml [my-exporter] # Expects an integer max_depth = 1234 # Expects a list of strings prefixes = ["my_prefix", "other_prefix"] # Expects a file path extra_file_path = "../path/to/thing.txt" ``` -------------------------------- ### Common field configuration examples Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Various field configurations demonstrating read/write access, hardware interaction, and event handling. ```systemrdl field rw_field { // A field that is read and writable by software sw = rw; // and whose value is visible to hardware hw = r; }; // A read-only field driven by a hardware signal // No storage element field ro_field { sw = r; hw = w; }; // a field that read/writable by software, but is also writable by hardware field hw_rw_field { sw = rw; hw = rw; we; // hardware has write-enable control. }; // An up-counting counter field counter_field { sw = r; counter; // is a counter that infers an increment control hardware input signal }; // Field that is set by hardware, and cleard by software read field event_flag_field { sw = r; hw = w; hwset; // Hardware control to set the field onread = rclr; // cleared when read by software precedence = hw; // if read and set at the same time, hardware wins. }; ``` -------------------------------- ### Install PeakRDL via pip Source: https://github.com/systemrdl/peakrdl/blob/main/docs/index.md Use this command to install the PeakRDL package from PyPi. ```bash python3 -m pip install peakrdl ``` -------------------------------- ### TOML Entry Point for PeakRDL Exporter Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/exporter-plugin.md Example of how to define an entry point in pyproject.toml to make a custom exporter discoverable by PeakRDL. This is the recommended method for shareable plugins. ```toml [project.entry-points."peakrdl.exporters"] my-exporter = "my_package.__peakrdl__:MyExporterDescriptor" ``` -------------------------------- ### Get General Help Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md Use this command to display general help information for PeakRDL. For subcommand-specific help, append the subcommand name before --help. ```bash peakrdl --help ``` ```bash peakrdl --help ``` -------------------------------- ### SystemRDL example for elaboration Source: https://github.com/systemrdl/peakrdl/blob/main/docs/processing-input.md This SystemRDL code defines addrmap components. PeakRDL elaborates the last declared addrmap by default. ```systemrdl addrmap common { reg { field {} spam_y; } spam_x; }; addrmap foo { common block_a; common block_b; }; addrmap bar { common block_x; common block_y; }; ``` -------------------------------- ### Generate C Headers for Software Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md Generates C header files from a SystemRDL input file. The first example creates a standard header, while the second includes bit-field definitions using the --bitfields ltoh option. ```bash peakrdl c-header atxmega_spi.rdl -o atxmega_spi.h ``` ```bash peakrdl c-header atxmega_spi.rdl -o atxmega_spi_bf.h --bitfields ltoh ``` -------------------------------- ### TOML Entry Point for PeakRDL Importer Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/importer-plugin.md Configuration in `pyproject.toml` to register a custom importer via entry points. This allows PeakRDL to discover the importer when installed as a package. ```toml [project.entry-points."peakrdl.importers"] my-importer = "my_package.__peakrdl__:MyImporterDescriptor" ``` -------------------------------- ### Produce Dynamic HTML Documentation Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md Generates dynamic HTML documentation from a SystemRDL input file. Specify the input RDL file and the output directory for the HTML files. ```bash peakrdl html turboencabulator.rdl -o html_dir/ ``` -------------------------------- ### Parameter List Formatting Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Apply consistent brace and parenthesis conventions when defining or instantiating components with parameters. ```systemrdl field my_field #( longint unsigned MY_PARAM = 1, longint unsigned OTHER_PARAM = 2 ){ desc = "My field"; sw = rw; hw = r; }; my_field #( .MY_PARAM(2), .OTHER_PARAM(3), ) inst; ``` -------------------------------- ### Process multiple input files Source: https://github.com/systemrdl/peakrdl/blob/main/docs/processing-input.md Provide input files in the correct sequence, with dependencies first and top-level files last. ```bash peakrdl subblock1.rdl subblock2.rdl top.rdl ``` -------------------------------- ### Naming Conventions Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Use lowercase for component types and instances, and uppercase for parameters and macros. ```systemrdl field my_field { ... }; my_field inst; ``` ```systemrdl field MY_FIELD { ... }; MY_FIELD INST; ``` ```systemrdl field my_field #( longint unsigned MY_PARAM = 1, longint unsigned OTHER_PARAM = 2 ){ // ... }; ``` ```systemrdl field my_field #( longint unsigned my_param = 1, longint unsigned other_param = 2 ){ // ... }; ``` -------------------------------- ### List available top-level targets Source: https://github.com/systemrdl/peakrdl/blob/main/docs/processing-input.md Use the 'globals' command to list all available top-level targets. ```bash $ peakrdl globals example.rdl ``` -------------------------------- ### Dump elaboration with explicit top-level Source: https://github.com/systemrdl/peakrdl/blob/main/docs/processing-input.md Use the --top flag to explicitly choose an alternative addrmap to elaborate. ```bash $ peakrdl dump example.rdl --top foo ``` -------------------------------- ### TOML PeakRDL Configuration for Plugin Discovery Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/exporter-plugin.md An alternative method for PeakRDL to discover plugins by specifying paths and entry points in the PeakRDL configuration file. Useful for ad-hoc or experimental plugins. ```toml [peakrdl] # Paths for Python to search for importable modules python_search_paths = [ "/opt/my_peakrdl_plugins" ] # Define entry-point spec for the exporter plugins.exporters.my-exporter = "my_exporter:MyExporterDescriptor" ``` -------------------------------- ### Instantiate multi-dimensional register arrays Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Illustrates the syntax for creating multi-dimensional arrays of addressable components. ```systemrdl reg coefficient { field {} k[7:0] = 0; }; // a 3x3 matrix of registers coefficient transformation_matrix[3][3] @ 0x0 += 0x4; ``` -------------------------------- ### Configure HTML Plugin Options Source: https://github.com/systemrdl/peakrdl/blob/main/docs/configuring.md Customize the HTML plugin's behavior by specifying template directories and additional properties to document. This allows for tailored HTML output. ```toml [html] user_template_dir = "../path/to/html_templates" extra_doc_properties = ["hw", "my_udp"] ``` -------------------------------- ### Define schema shorthand notations Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/cfg_schema.md Shorthand syntax for defining lists, fixed mappings, and dynamic mappings in the configuration schema. ```python # Defines a schema for a list of integers [schema.Integer()] ``` ```python { "an_integer": schema.Integer(), "a_string": schema.String(), } ``` ```python {"*": schema.Integer()} ``` -------------------------------- ### Brace Placement in SystemRDL Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Opening braces must be on the same line as the statement, while closing braces occupy their own line. ```systemrdl field { desc = "My field"; sw = rw; hw = r; } my_field; ``` ```systemrdl field { desc = "My field"; sw = rw; hw = r; } my_field; ``` -------------------------------- ### Parameterizing components Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Define generic components using parameters that can be overridden during instantiation. ```systemrdl reg my_reg_type #(longint SIZE = 4, bit RESET = 4'hF) { field {} f1[SIZE - 1: 0] = RESET; }; my_reg_type r1; // Default parameterization my_reg_type #(.SIZE(8)) r2; my_reg_type #(.SIZE(16), .RESET(16'hABCD)) r3; ``` -------------------------------- ### Create a UVM Register Model Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md This command generates a UVM register model package file from a SystemRDL input file. Specify the input RDL file and the desired output filename for the UVM package. ```bash peakrdl uvm atxmega_spi.rdl -o atxmega_spi_uvm_pkg.sv ``` -------------------------------- ### Run Custom PeakRDL Commands Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md PeakRDL allows for custom commands to be defined and executed. Replace YOUR-COMMAND-HERE with the name of your custom command and provide the necessary arguments. ```bash peakrdl YOUR-COMMAND-HERE atxmega_spi.rdl ... ``` -------------------------------- ### Instantiate Arrays of Registers Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md The 'reg', 'regfile', 'addrmap', and 'mem' components can be instantiated as arrays, including multi-dimensional arrays. ```systemrdl reg my_reg_type { // (component body not shown) }; my_reg_type reg_array[16]; // 16-element array. 0 to 15 my_reg_type reg_array_3d[4][4][4]; // 3-dimensional array. 64 total elements ``` -------------------------------- ### PeakRDL Configuration for Custom Importer Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/importer-plugin.md Configuration in PeakRDL's configuration file to specify Python search paths and register an importer. This method is useful for ad-hoc or experimental plugins. ```toml [peakrdl] # Paths for Python to search for importable modules python_search_paths = [ "/opt/my_peakrdl_plugins" ] # Define entry-point spec for the exporter plugins.importers.my-importer = "my_importer:MyImporterDescriptor" ``` -------------------------------- ### Define sparse register arrays Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Demonstrates how to define an array with a stride larger than the element size, resulting in a sparse memory layout. ```systemrdl reg my_reg { regwidth = 32; // (contents not shown) }; // a sparse array my_reg my_array[256] @ 0x0 += 0x10; ``` -------------------------------- ### Define and Instantiate a Field Type Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Use named definitions for reusable component types. Define the component once and instantiate it multiple times. ```systemrdl field my_field_type { // (component body) }; my_field_type field_instance_1; my_field_type field_instance_2; my_field_type field_instance_3; ``` -------------------------------- ### Configure PeakRDL Exporter Plugin Source: https://github.com/systemrdl/peakrdl/blob/main/docs/configuring.md Map custom exporter plugins to their respective Python modules and classes. This allows for custom output generation. ```toml [peakrdl] plugins.exporters.my-exporter-name = "my_exporter_module:MyExporterDescriptorClass" ``` -------------------------------- ### Define nested register file hierarchy Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Demonstrates the use of nested regfile components within an addrmap to create complex design hierarchies. ```systemrdl addrmap my_device { default sw = rw; default hw = r; reg { field {} mode[15:8] = 0; field {} enable[0:0] = 0; } control; regfile generic_buffer { reg { field {} addr[31:0]; } start_address; reg { field {} n_bytes[31:0]; } length; }; generic_buffer rx_buffer_cfg; generic_buffer tx_buffer_cfg; }; ``` -------------------------------- ### Generate Synthesizable SystemVerilog RTL Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md This command generates SystemVerilog RTL from a SystemRDL input file. Specify the input RDL file and the output directory. The --cpuif option configures the interface type. ```bash peakrdl regblock atxmega_spi.rdl -o regblock/ --cpuif apb3-flat ``` -------------------------------- ### Define registers with varying widths Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Shows how to explicitly set the regwidth property for different registers, which may vary within the same design. ```systemrdl reg { regwidth = 32; // (contents not shown) } r32; reg { regwidth = 8; // (contents not shown) } r8; reg { regwidth = 256; // (contents not shown) } r256; ``` -------------------------------- ### Configure PeakRDL Importer Plugin Source: https://github.com/systemrdl/peakrdl/blob/main/docs/configuring.md Map custom importer plugins to their respective Python modules and classes. This is useful for integrating custom parsing logic. ```toml [peakrdl] plugins.importers.my-importer-name = "my_importer_module:MyImporterDescriptorClass" ``` -------------------------------- ### Spacing in Expressions and Braces Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Include spaces around operators and before/after braces for improved clarity. ```systemrdl reset = 4 + MY_PARAM / 2; ``` ```systemrdl reset=4+MY_PARAM/2; ``` ```systemrdl field { desc = "My field"; } my_field; ``` ```systemrdl field{ desc = "My field"; }my_field; ``` -------------------------------- ### Consistent Indentation in SystemRDL Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Use 4 spaces for indentation to maintain readability within component definitions. ```systemrdl field { desc = "My field"; sw = rw; hw = r; } my_field; ``` ```systemrdl field { desc = "My field"; sw = rw; hw = r; } my_field; ``` -------------------------------- ### Avoid Global Scope for Register Declarations Source: https://github.com/systemrdl/peakrdl/blob/main/docs/best-practices.md Demonstrates how to scope register declarations within an addrmap to prevent polluting the global namespace and avoid name collisions. This is preferred over global declarations. ```systemrdl reg my_ctrl_reg { ... }; reg my_status_reg { ... }; addrmap my_device { my_ctrl_reg ctrl; my_status_reg status; }; ``` ```systemrdl addrmap my_device { reg my_ctrl_reg { ... }; reg my_status_reg { ... }; my_ctrl_reg ctrl; my_status_reg status; }; ``` -------------------------------- ### Convert to IP-XACT XML Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md Converts a SystemRDL input file to IP-XACT XML format. Specify the input RDL file and the desired output XML filename. ```bash peakrdl ip-xact atxmega_spi.rdl -o atxmega_spi.xml ``` -------------------------------- ### Property Assignment per Line Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Keep property assignments on separate lines, though 'sw' and 'hw' may be stacked. ```systemrdl field { desc = "My field"; sw = r; hw = na; counter; onread = rclr; } my_field; ``` ```systemrdl field { desc = "My field"; sw = r; hw = na; counter; onread = rclr; } my_field; ``` ```systemrdl field { desc = "My field"; sw = r; hw = na; counter; onread = rclr; } my_field; ``` -------------------------------- ### Access configuration values Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/cfg_schema.md Retrieve validated configuration values within the do_export method. ```python def do_export(self, top_node: 'AddrmapNode', options: 'argparse.Namespace') -> None: self.cfg['max_depth'] self.cfg['prefixes'] self.cfg['extra_file_path'] ``` -------------------------------- ### Avoiding Redundant Prefixes Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Leverage SystemRDL's hierarchical scoping to avoid unnecessary naming prefixes. ```systemrdl addrmap spi_controller { reg { default sw = rw; default hw = r; field {} spi_ctrl_en; field {} spi_ctrl_rst; field {} spi_ctrl_mode; } spi_ctrl; }; ``` ```systemrdl addrmap spi_controller { reg { default sw = rw; default hw = r; field {} en; field {} rst; field {} mode; } ctrl; }; ``` -------------------------------- ### Convert IP-XACT to SystemRDL Source: https://github.com/systemrdl/peakrdl/blob/main/docs/gallery.md Converts an IP-XACT XML file to SystemRDL format. Specify the input XML file and the desired output RDL filename. ```bash peakrdl systemrdl atxmega_spi.xml -o atxmega_spi.rdl ``` -------------------------------- ### Dump elaboration of the last addrmap Source: https://github.com/systemrdl/peakrdl/blob/main/docs/processing-input.md By default, PeakRDL dumps the elaboration of the last addrmap declared in the root namespace. ```bash $ peakrdl dump example.rdl ``` -------------------------------- ### Python Exporter Plugin Descriptor Template Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/exporter-plugin.md A template for creating a plugin descriptor class that extends ExporterSubcommandPlugin. It includes placeholders for descriptions, argument definitions, and the export operation. ```python from typing import TYPE_CHECKING from peakrdl.plugins.exporter import ExporterSubcommandPlugin if TYPE_CHECKING: import argparse from systemrdl.node import AddrmapNode class MyExporterDescriptor(ExporterSubcommandPlugin): short_desc = "..." long_desc = "..." def add_exporter_arguments(self, arg_group: 'argparse.ArgumentParser') -> None: pass def do_export(self, top_node: 'AddrmapNode', options: 'argparse.Namespace') -> None: raise NotImplementedError ``` -------------------------------- ### Setting default property values Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Apply default property values to all components within the current lexical scope. ```systemrdl default sw = rw; field my_awesome_field { // implied: sw = rw; }; ``` -------------------------------- ### Explicit Address Allocation for Components Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Explicitly allocate byte addresses for 'reg', 'regfile', 'addrmap', and 'mem' components. Addresses are relative to the parent component. ```systemrdl my_reg_type reg_1 @ 0x1000; // is at address offset 0x1000 ``` -------------------------------- ### Formatting Long Descriptions Source: https://github.com/systemrdl/peakrdl/blob/main/docs/style-guide.md Break long descriptions into multiple indented lines. ```systemrdl field { desc = "My short description"; } my_field_a; field { desc = " This is a long description. It requires multiple lines that are all indented at the same level. "; } my_field_b; ``` -------------------------------- ### Use Default Assignments for Common Field Properties Source: https://github.com/systemrdl/peakrdl/blob/main/docs/best-practices.md Illustrates the use of default assignments to set common properties like 'sw' and 'hw' for multiple fields within a register. This reduces redundancy compared to defining properties for each field individually. ```systemrdl reg my_control_reg { field { sw = rw; hw = r; } a; field { sw = rw; hw = r; } b; field { sw = rw; hw = r; } c; }; ``` ```systemrdl reg my_control_reg { default sw = rw; default hw = r; field {} a; field {} b; field {} c; }; ``` -------------------------------- ### Define configuration schema in Python Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/cfg_schema.md Use the cfg_schema dictionary within an ExporterSubcommandPlugin to enforce datatypes. ```python from peakrdl.plugins.exporter import ExporterSubcommandPlugin from peakrdl.config import schema class MyExporter(ExporterSubcommandPlugin): cfg_schema = { "max_depth": schema.Integer(), "prefixes": [schema.String()], "extra_file_path": schema.FilePath(), } ``` -------------------------------- ### Define a field with a signal reference Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Demonstrates assigning a signal reference to a field's reset property instead of a standard integer. ```systemrdl signal my_alt_reset_value[8]; field { sw = rw; } my_field[8] = my_alt_reset_value; ``` -------------------------------- ### Define scoped enumeration types Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Shows how identical enumeration names can exist in different scopes, requiring careful handling to avoid name collisions in exporters. ```systemrdl field { sw = r; hw = w; enum state_e { IDLE = 0; RECEIVING = 1; DISCONNECTED = 2; }; encode = state_e; } rx_state[7:0]; field { sw = r; hw = w; enum state_e { IDLE = 0; SENDING = 1; }; encode = state_e; } tx_state[7:0]; ``` -------------------------------- ### Referencing other components Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Assign a reference to another component as a property value. ```systemrdl my_awesome_field field_1; my_awesome_field field_2; field_1->reset = field_2; // field_1 will get field_2's value when reset. ``` -------------------------------- ### Define unaligned registers Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Illustrates scenarios where registers or register files can become unaligned through direct offsets, strides, or parent block offsets. ```systemrdl addrmap top { reg my_reg { regwidth = 32; field {} f; }; // Can be unaligned directly my_reg r1 @ 0x1; // <-- offset not a multiple of 4 // Stride can cause misalignment my_reg r2[4] @ 0x10 += 0x6; // <-- stride not a multiple of 4 // parent blocks could be misaligned regfile { my_reg r1 @ 0x0; my_reg r2 @ 0x4; } rf @ 0x102; // <-- offset not aligned }; ``` -------------------------------- ### Omit Explicit Reserved Fields in Registers Source: https://github.com/systemrdl/peakrdl/blob/main/docs/best-practices.md Shows the correct way to define registers by omitting explicit 'RESERVED' fields. SystemRDL implicitly handles gaps between fields as reserved space, so explicit definitions are unnecessary and clutter the design. ```systemrdl reg my_ctrl_reg { field {} RESERVED3[31:16]; field {} mode[15:8]; field {} RESERVED2[7:5]; field {} rst[4:4]; field {} RESERVED1[3:1]; field {} en[0:0]; }; ``` ```systemrdl reg my_ctrl_reg { field {} mode[15:8]; field {} rst[4:4]; field {} en[0:0]; }; ``` -------------------------------- ### Dump register addresses Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Displays the output of the PeakRDL dump command showing absolute addresses for unaligned registers. ```default $ peakrdl dump example.rdl --unroll 0x001-0x004: top.r1 0x010-0x013: top.r2[0] 0x016-0x019: top.r2[1] 0x01c-0x01f: top.r2[2] 0x022-0x025: top.r2[3] 0x102-0x105: top.rf.r1 0x106-0x109: top.rf.r2 ``` -------------------------------- ### Define overlapping registers and fields Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Shows how registers or fields can occupy the same address space if their access policies do not conflict. ```systemrdl field ro_field {sw = r; hw = w;}; field wo_field {sw = w; hw = r;}; // Registers are allowed to overlap since one is read-only and the other is write-only reg { ro_field f; } a @ 0x0; reg { wo_field f; } b @ 0x0; // Fields are allowed to overlap for the same reason reg { ro_field f1[7:0]; wo_field f2[7:0]; } c @ 0x300; ``` -------------------------------- ### Array Stride Allocation Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Define the spacing between elements in an array of addressable components using the array stride allocation operator '+='. ```systemrdl // reg_array[0] @ 0x1000 // reg_array[1] @ 0x1010 // reg_array[2] @ 0x1020 // etc ... my_reg_type reg_array[16] @ 0x1000 += 0x10; ``` -------------------------------- ### Referencing other properties Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Link a property value to the state or attribute of another component. ```systemrdl field { counter; } my_counter[7:0]; my_awesome_field field_1; // my_counter will increment every time field_1 is accessed by software my_counter->incr = field_1->swacc; ``` -------------------------------- ### Python Importer Plugin Descriptor Template Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/importer-plugin.md A template for creating a plugin descriptor class that extends `ImporterPlugin`. This class defines file extensions, compatibility checks, argument parsing, and the import logic. ```python from typing import TYPE_CHECKING from peakrdl.plugins.importer import ImporterPlugin if TYPE_CHECKING: import argparse from systemrdl import RDLCompiler class MyImporterDescriptor(ImporterPlugin): file_extensions = ["yaml", "yml"] def is_compatible(self, path: str) -> bool: raise NotImplementedError def add_importer_arguments(self, arg_group: 'argparse.ArgumentParser') -> None: pass def do_import(self, rdlc: 'RDLCompiler', options: 'argparse.Namespace', path: str): raise NotImplementedError ``` -------------------------------- ### Overriding instance properties Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Modify properties of a specific component instance after definition. ```systemrdl field my_awesome_field { name = "My awesome field"; }; my_awesome_field field_1; field_1->name = "My overridden name"; ``` -------------------------------- ### Anonymous Field Definition and Instantiation Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Use anonymous definitions for components that will not be reused. The definition is immediately instantiated. ```systemrdl field { // (component body) } field_instance; ``` -------------------------------- ### Assigning properties to a field Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Directly assign properties to a field component definition. ```systemrdl field { name = "My awesome field"; desc = "A longer description of what this field does"; sw = rw; hw = r; }; ``` -------------------------------- ### Reference out-of-scope signals Source: https://github.com/systemrdl/peakrdl/blob/main/docs/for-devs/rdl_gotchas.md Shows a field referencing a signal defined in the root namespace from within an addrmap. ```systemrdl signal my_signal[8]; addrmap top { reg { field { sw = rw; } my_field[8] = my_signal; } r1; }; ``` -------------------------------- ### Defining enumerated fields Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Use an RDL enum to associate names with values and bind them to a field using the encode property. ```systemrdl // An enum associates names with values enum system_state_e { IDLE = 0 { desc = "The system is idle and ready for input"; }; BUSY = 1 { desc = "Busy processing an input"; }; SLEEP = 2; // No properties assigned SHUTDOWN; // Infers value of 3 }; field { encode = system_state_e; reset = system_state_e::IDLE; } system_state[1:0]; ``` -------------------------------- ### Explicit Field Bit-Positioning Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Explicitly define the bit-position and width of a field. If unspecified, bits are allocated sequentially. ```systemrdl my_field_type field_1[3:0]; // 4-bit wide field at bit position [3:0] my_field_type field_2[4]; // another 4-bit wide field, implied at position [7:4] my_field_type field_3; // single-bit field at a bit-offset of 8 my_field_type field_4[16:16]; // single-bit field at bit offset 16 ``` -------------------------------- ### Implicit boolean property assignment Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Boolean properties default to true when no value is explicitly provided. ```systemrdl counter; // implies: counter = true; ``` -------------------------------- ### Field Reset Value Assignment Source: https://github.com/systemrdl/peakrdl/blob/main/docs/systemrdl-tutorial.md Specify a field's reset value using the reset assignment operator. ```systemrdl my_field_type field_1[7:0] = 42; // field has a reset value of 42 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.