skidl.interface module

Interface management in SKiDL.

This module provides the Interface class, which bundles nets, buses, and pins into a single entity that can be used for connecting subsystems with complex I/O. Interfaces make it easier to handle groups of related signals and enable connecting subsystems with matching interfaces using simple operators.

class skidl.interface.Interface(*args, **kwargs)[source]

Bases: dict

A bundle of nets, buses, and pins that can be accessed as attributes or dict entries.

An Interface groups related nets, buses, and pins into a single entity where each item can be accessed either as an attribute (obj.item) or as a dictionary key (obj[‘item’]). This makes Interfaces useful for standardizing connections between subsystems or for creating reusable connection patterns.

Parameters:
  • *args – Positional arguments passed to dict constructor.

  • **kwargs – Keyword arguments defining nets/buses to include in the interface.

Keyword Arguments:

unbundle (bool, optional) – Whether to automatically unbundle buses into individual nets that can be accessed directly. Defaults to True.

Examples

>>> power = Interface(vcc=Net('VCC'), gnd=Net('GND'))
>>> power.vcc += part1['VCC']  # Connect using attribute access
>>> power['gnd'] += part1['GND']  # Connect using dictionary access
connect(other_intfc)[source]

Connect this interface to another interface.

This method connects nets and buses in this interface to those with matching names in another interface.

Parameters:

other_intfc (Interface) – The interface to connect to this one.

Returns:

This interface with connections to the other interface.

Return type:

Interface

Examples

>>> intf1 = Interface(a=Net('a'), b=Net('b'))
>>> intf2 = Interface(a=Net('a2'), b=Net('b2'))
>>> intf1.connect(intf2)  # Connect matching nets
>>> # Alternative: intf1 += intf2
erc_list = []