ifgen.svd.model package — docs

Skip to main content
`Ctrl`+`K`

# ifgen.svd.model package

## Submodules

## ifgen.svd.model.address_block module

A module implementing a data model for ARM CMSIS-SVD ‘addressBlock’ data.

class ifgen.svd.model.address_block.AddressBlock

  Bases: `StringKeyValueMixin`

  A container for address-block information.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

## ifgen.svd.model.cpu module

A module implementing a data model for ARM CMSIS-SVD ‘cpu’ data.

class ifgen.svd.model.cpu.Cpu

  Bases: `StringKeyValueMixin`

  A container for cpu information.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

## ifgen.svd.model.derived module

A module implementing a class mixin for SVD element types with a derivedFrom attribute.

class ifgen.svd.model.derived.DerivedMixin

  Bases: `StringKeyValueMixin`

  A class mixin for instances with a derived attribute.

  alternate(key: str = 'alternateRegister') → str | None

    Get a possible alternate for this instance.

  property alternates: list[T]

    Get alternates of this instance.

  property derived: bool

    Whether or not this peripheral is derived from another.

  property derived_elem: T

    Get the derived element.

  is_alternate(key: str = 'alternateRegister') → bool

    Determine if this instance is an alternate of another.

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

    Log information from this instance’s raw data.

  property name: str

    Get the name of this peripheral.

ifgen.svd.model.derived.derived_from_stack(elements: Iterable[Element]) → Iterator[Element]

  Organize elements that are derived after ones that aren’t.

## ifgen.svd.model.device module

A module implementing a data model for ARM CMSIS-SVD ‘device’ data.

class ifgen.svd.model.device.Device

  Bases: `StringKeyValueMixin`

  A container for device information.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

## ifgen.svd.model.enum module

A module implementing a data model for ARM CMSIS-SVD ‘enumeratedValue’ data.

class ifgen.svd.model.enum.EnumeratedValue

  Bases: `StringKeyValueMixin`

  A container for enumerated-value information.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

class ifgen.svd.model.enum.EnumeratedValues(derived_from: EnumeratedValues | None, enum: dict[str, EnumeratedValue])

  Bases: `DerivedMixin`

  A container for enum information.

  derived_from: EnumeratedValues | None
  enum: dict[str, EnumeratedValue]
  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

ifgen.svd.model.enum.get_enum(enumerated_values: Element) → EnumeratedValues

  Get register clusters.

## ifgen.svd.model.field module

A module implementing a data model for ARM CMSIS-SVD ‘field’ data.

class ifgen.svd.model.field.Field(derived_from: Field | None, enum: EnumeratedValues | None)

  Bases: `DerivedMixin`

  A container for field information.

  property access: str

    Get this instance’s access property.

  derived_from: Field | None
  enum: EnumeratedValues | None
  property ifgen_data: dict[str, Any]

    Populate bit-field data.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

ifgen.svd.model.field.get_fields(registers: Element) → dict[str, Field]

  Get register fields.

## ifgen.svd.model.interrupt module

A module implementing a data model for ARM CMSIS-SVD ‘interrupt’ data.

class ifgen.svd.model.interrupt.Interrupt

  Bases: `StringKeyValueMixin`

  A container for interrupt information.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

## ifgen.svd.model.peripheral module

A module implementing a data model for ARM CMSIS-SVD ‘peripheral’ data.

class ifgen.svd.model.peripheral.Cluster(derived_from: Cluster | None, children: list[Register | Cluster], peripheral: Peripheral)

  Bases: `DerivedMixin`

  A container for cluster information.

  children: list[Register | Cluster]
  derived_from: Cluster | None
  peripheral: Peripheral
  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

class ifgen.svd.model.peripheral.Peripheral(derived_from: Peripheral | None, interrupts: list[Interrupt], address_blocks: list[AddressBlock], registers: list[Register | Cluster], system_width_bits: int | None)

  Bases: `DerivedMixin`

  A container for peripheral information.

  property access: str | None

    Get the possible ‘access’ field default.

  address_blocks: list[AddressBlock]
  base_name(lower: bool = True) → str

    Get the base peripheral name.

  property bits: int | None

    Get size for this peripheral in bits.

  derived_from: Peripheral | None
  handle_address_block(address_block: Element) → None

    Handle an ‘address_block’ element.

  handle_interrupt(interrupt: Element) → None

    Handle an ‘interrupt’ element.

  interrupts: list[Interrupt]
  register_groups() → dict[str, list[Register]]

    Get register groups.

  registers: list[Register | Cluster]
  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

  system_width_bits: int | None

class ifgen.svd.model.peripheral.Register(derived_from: Register | None, fields: dict[str, Field] | None, peripheral: Peripheral)

  Bases: `DerivedMixin`

  A container for register information.

  property access: str

    Get the access setting for this register.

  property alternate_group: str | None

    Get this register’s possible alternate group.

  property bits: int

    Get the size of this register in bits.

  property c_type: str

    Get the C type for this register.

  derived_from: Register | None
  fields: dict[str, Field] | None
  peripheral: Peripheral
  property size: int

    Get the size of this register in bytes.

  classmethod string_keys() → Iterable[StringKeyVal]

    Get string keys for this instance type.

ifgen.svd.model.peripheral.fields_equal(left: dict[str, Field] | None, right: dict[str, Field] | None) → bool

  Determine if two field maps are equivalent.

ifgen.svd.model.peripheral.register_groups(registers: list[Register | Cluster]) → dict[str, list[Register]]

  Get groups of registers.

## Module contents

A module implementing a data model for ARM CMSIS-SVD ‘device’ data.

class ifgen.svd.model.SvdModel(peripherals: dict[str, Peripheral], device: Device | None = None, cpu: Cpu | None = None)

  Bases: `object`

  A model for SVD data.

  assign_cpu(cpu: Cpu) → None

    Assign a cpu instance.

  assign_device(device: Device) → None

    Assign a device instance.

  cpu: Cpu | None = None
  device: Device | None = None
  property device_name: str

    Get the SVD device name.

  metadata() → dict[str, Any]

    Get device and CPU metadata.

  namespace() → list[str]

    Get a namespace for this SVD device.

  peripherals: dict[str, Peripheral]
  register_peripheral(elem: Element, peripheral: Peripheral) → None

    Register a peripheral.