skidl.pin module

Handles part pins and their connections to nets.

This module provides the Pin class which represents electronic component pins. Pins can be connected to nets and other pins, and have various electrical properties like input, output, bidirectional, etc.

class skidl.pin.PhantomPin(**attribs)[source]

Bases: Pin

A pin type that exists solely to tie two pinless nets together.

It will not participate in generating any netlists.

class skidl.pin.Pin(**attribs)[source]

Bases: SkidlBaseObject

A class for storing data about pins for electronic parts.

Parameters:

attribs – Key/value pairs of attributes to add to the pin.

nets

The electrical nets this pin is connected to (can be >1).

Type:

list

part

Link to the Part object this pin belongs to.

Type:

Part

name

Name of the pin (e.g., “GND”, “VCC”).

Type:

str

num

Pin number (e.g., “1”, “2”, “A5”).

Type:

str

func

Pin function from pin_types enum (e.g., INPUT, OUTPUT, BIDIR).

Type:

int

do_erc

When False, the pin is not checked for ERC violations.

Type:

bool

stub

When True, the pin is only for internal schematic connections.

Type:

bool

aliases

Alternative names for this pin.

Type:

list

MAX_PIN_NUM = 1152921504606846975
chk_conflict(other_pin)[source]

Check for electrical rule conflicts between this pin and another.

Parameters:

other_pin (Pin) – The other pin to check against

property circuit

Return the circuit of the part the pin belongs to.

Returns:

The circuit containing the parent part

Return type:

Circuit

connect(*pins_nets_buses)[source]

Return the pin after connecting it to one or more nets or pins.

Parameters:

pins_nets_buses – One or more Pin, Net or Bus objects or lists/tuples of them.

Returns:

The updated pin with the new connections.

Return type:

Pin

Notes

You can connect nets or pins to a pin like so:

p = Pin()     # Create a pin.
n = Net()     # Create a net.
p += net      # Connect the net to the pin.
copy(num_copies=None, **attribs)[source]

Return copy or list of copies of a pin including any net connection.

Parameters:

num_copies (int, optional) – Number of copies to make of pin.

Keyword Arguments:

attribs – Name/value pairs for setting attributes for the pin.

Returns:

A single copy or a list of copies.

Return type:

Pin or list[Pin]

Notes

An instance of a pin can be copied just by calling it like so:

p = Pin()     # Create a pin.
p_copy = p()  # This is a copy of the pin.
create_network()[source]

Create a network from a single pin.

Returns:

A network containing just this pin

Return type:

Network

disconnect()[source]

Disconnect this pin from all nets.

property drive

Get the drive strength of this pin.

Returns:

Drive strength value from pin_drives enum

Return type:

int

drives

alias of pin_drives

erc_desc()[source]

Return a string describing this pin for ERC.

Returns:

Description string for the pin

Return type:

str

export()[source]

Return a string to recreate a Pin object.

Returns:

Python code string that recreates the pin when evaluated

Return type:

str

funcs

alias of pin_types

get_nets()[source]

Return a list containing the Net objects connected to this pin.

Returns:

List of Net objects connected to this pin

Return type:

list

get_pin_info()[source]

Get basic pin information.

Returns:

(pin number, pin names/aliases, pin function)

Return type:

tuple

get_pins()[source]

Return a list containing this pin.

Returns:

List containing just this pin

Return type:

list

is_assigned()[source]

Return true if the pin has been assigned a valid pin number.

Returns:

True if the pin is assigned (either has a non-integer number or

an integer number less than or equal to MAX_PIN_SIZE), False otherwise.

Return type:

bool

Note

A pin is considered assigned if it has either a string/non-integer identifier or an integer pin number within the valid range (1 to MAX_PIN_SIZE).

is_attached(pin_net_bus)[source]

Return true if this pin is attached to the given pin, net or bus.

Parameters:

pin_net_bus – A Pin, Net or Bus object

Returns:

True if attached, False otherwise

Return type:

bool

Raises:

ValueError – If attempting to check attachment to an invalid object type

is_connected()[source]

Return true if a pin is connected to a net (but not a no-connect net).

Returns:

True if connected to a normal net, False otherwise

Return type:

bool

Raises:

ValueError – If pin is connected to both normal and no-connect nets

move(net)[source]

Move pin to another net.

Parameters:

net (Net) – Destination net for pin.

property net

Return one of the nets the pin is connected to.

Returns:

The first net the pin is connected to, or None

Return type:

Net or None

property pins

Get a list of pins (just this pin for a Pin object).

Returns:

List containing just this pin

Return type:

list

property ref

Return the reference of the part the pin belongs to.

Returns:

Reference designator of the parent part

Return type:

str

split_name(delimiters)[source]

Use chars in divider to split a pin name and add substrings to aliases.

Parameters:

delimiters (str) – String of characters used to split pin names

types

alias of pin_types

property width

Return width of a Pin, which is always 1.

Returns:

Always 1

Return type:

int