ifgen.svd package — docs

Skip to main content
`Ctrl`+`K`

# ifgen.svd package

## Subpackages

- ifgen.svd.group package
  - Submodules
  - ifgen.svd.group.base module
    - `PeripheralGroup`
      - `PeripheralGroup.derivatives`
      - `PeripheralGroup.peripherals`
      - `PeripheralGroup.root`
    - `get_derived()`
    - `peripheral_groups()`
  - ifgen.svd.group.enums module
    - `as_alnum()`
    - `get_enum_name()`
    - `handle_duplicate()`
    - `handle_enum_name()`
    - `is_name_part()`
    - `remove_common_prefixes()`
    - `translate_enums()`
  - ifgen.svd.group.fields module
    - `check_not_handled_fields()`
    - `handle_cluster()`
    - `handle_item()`
    - `handle_register()`
    - `handle_register_group()`
    - `parse_offset()`
    - `process_bit_fields()`
    - `sanitize_name()`
    - `struct_fields()`
  - Module contents
    - `PeripheralGroup`
      - `PeripheralGroup.derivatives`
      - `PeripheralGroup.peripherals`
      - `PeripheralGroup.root`
    - `handle_group()`
    - `peripheral_groups()`
- ifgen.svd.model package
  - Submodules
  - ifgen.svd.model.address_block module
    - `AddressBlock`
      - `AddressBlock.string_keys()`
  - ifgen.svd.model.cpu module
    - `Cpu`
      - `Cpu.string_keys()`
  - ifgen.svd.model.derived module
    - `DerivedMixin`
      - `DerivedMixin.alternate()`
      - `DerivedMixin.alternates`
      - `DerivedMixin.derived`
      - `DerivedMixin.derived_elem`
      - `DerivedMixin.is_alternate()`
      - `DerivedMixin.log()`
      - `DerivedMixin.name`
    - `derived_from_stack()`
  - ifgen.svd.model.device module
    - `Device`
      - `Device.string_keys()`
  - ifgen.svd.model.enum module
    - `EnumeratedValue`
      - `EnumeratedValue.string_keys()`
    - `EnumeratedValues`
      - `EnumeratedValues.derived_from`
      - `EnumeratedValues.enum`
      - `EnumeratedValues.string_keys()`
    - `get_enum()`
  - ifgen.svd.model.field module
    - `Field`
      - `Field.access`
      - `Field.derived_from`
      - `Field.enum`
      - `Field.ifgen_data`
      - `Field.string_keys()`
    - `get_fields()`
  - ifgen.svd.model.interrupt module
    - `Interrupt`
      - `Interrupt.string_keys()`
  - ifgen.svd.model.peripheral module
    - `Cluster`
      - `Cluster.children`
      - `Cluster.derived_from`
      - `Cluster.peripheral`
      - `Cluster.string_keys()`
    - `Peripheral`
      - `Peripheral.access`
      - `Peripheral.address_blocks`
      - `Peripheral.base_name()`
      - `Peripheral.bits`
      - `Peripheral.derived_from`
      - `Peripheral.handle_address_block()`
      - `Peripheral.handle_interrupt()`
      - `Peripheral.interrupts`
      - `Peripheral.register_groups()`
      - `Peripheral.registers`
      - `Peripheral.string_keys()`
      - `Peripheral.system_width_bits`
    - `Register`
      - `Register.access`
      - `Register.alternate_group`
      - `Register.bits`
      - `Register.c_type`
      - `Register.derived_from`
      - `Register.fields`
      - `Register.peripheral`
      - `Register.size`
      - `Register.string_keys()`
    - `fields_equal()`
    - `register_groups()`
  - Module contents
    - `SvdModel`
      - `SvdModel.assign_cpu()`
      - `SvdModel.assign_device()`
      - `SvdModel.cpu`
      - `SvdModel.device`
      - `SvdModel.device_name`
      - `SvdModel.metadata()`
      - `SvdModel.namespace()`
      - `SvdModel.peripherals`
      - `SvdModel.register_peripheral()`

## Submodules

## ifgen.svd.cpu module

A module implementing a ‘cpu’ SVD-element processor.

ifgen.svd.cpu.process_cpu(elem: Element, task: SvdProcessingTask, logger: Logger | LoggerAdapter[Any]) → None

  Process a SVD cpu element.

## ifgen.svd.device module

A module implementing a ‘device’ SVD-element processor.

ifgen.svd.device.process_device(elem: Element, task: SvdProcessingTask, logger: Logger | LoggerAdapter[Any]) → None

  Process a SVD device element.

## ifgen.svd.peripherals module

A module implementing a ‘peripherals’ SVD-element processor.

ifgen.svd.peripherals.process_peripheral(elem: Element, task: SvdProcessingTask, logger: Logger | LoggerAdapter[Any], system_width_bits: int = 32) → None

  Process a SVD peripheral element.

ifgen.svd.peripherals.process_peripherals(elem: Element, task: SvdProcessingTask, logger: Logger | LoggerAdapter[Any]) → None

  Process a SVD peripherals element.

## ifgen.svd.process module

A module implementing interfaces for processing registers and clusters.

ifgen.svd.process.cluster(element: Element, cluster_map: dict[str, Cluster], peripheral: Peripheral, register_map: dict[str, Register] = None) → Cluster

  Create a Cluster instance from an SVD element.

ifgen.svd.process.handle_registers(registers: Element, peripheral: Peripheral, cluster_map: dict[str, Cluster] = None, register_map: dict[str, Register] = None) → list[Register | Cluster]

  Handle the ‘registers’ element.

ifgen.svd.process.register(element: Element, register_map: dict[str, Register], peripheral: Peripheral) → Register

  Create a Register instance from an SVD element.

## ifgen.svd.string module

A module implementing interfaces for string-data elements.

class ifgen.svd.string.StringKeyVal(key: str, required: bool = True)

  Bases: `object`

  Name of key and whether or not it’s required.

  key: str
  required: bool = True

class ifgen.svd.string.StringKeyValueMixin

  Bases: `ABC`

  A mixin for SVD data model classes.

  classmethod create(elem: Element, *args, **kwargs) → T

    Create a device instance from an element.

  classmethod get_values(elem: Element) → dict[str, str]

    Get string values for this instance.

  handle_description(data: dict[str, Any] = None, prefix: str = None) → dict[str, Any]

    Handle a possible description entry.

  log(elem: Element, logger: Logger | LoggerAdapter[Any] | None) → None

    Log information from this instance’s raw data.

  raw(elem: Element) → dict[str, str]

    Get raw data for this instance based on string keys.

  raw_data: dict[str, str]
  abstractmethod classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

ifgen.svd.string.get_string_values(elem: Element, keys: Iterable[StringKeyVal]) → dict[str, str]

  Get string values from an element’s children.

## ifgen.svd.task module

A module implementing an SVD-processing task interface.

class ifgen.svd.task.SvdProcessingTask(model: SvdModel, min_enum_width: int)

  Bases: `object`

  A container for SVD-processing state.

  generate_configs(path: Path, config: SvdConfig) → None

    Generate output configuration files.

  min_enum_width: int
  model: SvdModel
  process(elem: Element) → None

    Process a single element.

  static svd(path: Path, min_enum_width: int) → SvdProcessingTask

    Process a single SVD file.

ifgen.svd.task.filter_includes(config: SvdConfig, model: SvdModel, paths: Iterable[Path], filtered: dict[str, str]) → Iterator[str]

  Filter includes based on configuration.

## Module contents

A module implementing interfaces for working with ARM CMSIS-SVD files.

ifgen.svd.register_processors() → None

  Register tag-processing methods.