skidl.net module

Handles nets.

class skidl.net.NCNet(name=None, circuit=None, *pins_nets_buses, **attribs)[source]

Bases: Net

Lists of unconnected pins are stored using this Net subclass.

This is a netlist subclass used for storing lists of pins which are explicitly specified as not being connected. This means the ERC won’t flag these pins as floating, but no net connections for these pins will be placed in the netlist so there will actually be no connections to these pins in the physical circuit.

Parameters:
  • name – A string with the name of the net. If None or ‘’, then a unique net name will be assigned.

  • *pins_nets_buses – One or more Pin, Net, or Bus objects or lists/tuples of them to be connected to this net.

Keyword Arguments:

attribs – A dictionary of attributes and values to attach to the object.

property drive

Get the drive strength of this net.

The drive strength is always NOCONNECT_DRIVE. It can’t be changed. The drive strength cannot be deleted.

generate_netlist_net(tool=None)[source]

NO_CONNECT nets don’t generate anything for netlists.

class skidl.net.Net(name=None, circuit=None, *pins_nets_buses, **attribs)[source]

Bases: SkidlBaseObject

Lists of connected pins are stored as nets using this class.

Parameters:
  • name – A string with the name of the net. If None or ‘’, then a unique net name will be assigned.

  • circuit – The Circuit object this net belongs to.

  • *pins_nets_buses – One or more Pin, Net, or Bus objects or lists/tuples of them to be connected to this net.

Keyword Arguments:

attribs – A dictionary of attributes and values to attach to the Net object.

connect(*pins_nets_buses)[source]

Return the net after connecting other pins, nets, and buses to it.

Parameters:

*pins_nets_buses – One or more Pin, Net, or Bus objects or lists/tuples of them to be connected to this net.

Returns:

The updated net with the new connections.

Notes

Connections to nets can also be made using the += operator like so:

atmega = Part('atmel', 'ATMEGA16U2')
net = Net()
net += atmega[1]  # Connects pin 1 of chip to the net.
copy(num_copies=None, circuit=None, **attribs)[source]

Make zero or more copies of this net.

Parameters:

num_copies – Number of copies to make of this net.

Keyword Arguments:

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

Returns:

A list of Net copies or a Net if num_copies==1.

Raises:

Exception if the requested number of copies is a non-integer or negative.

Notes

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

n = Net('A')    # Create a net.
n_copy = n()    # Copy the net.

You can also use the multiplication operator to make copies:

n = 10 * Net('A')  # Create an array of nets.
create_network()[source]

Create a network from a single net.

disconnect(pin)[source]

Remove the pin from this net but not any other nets it’s attached to.

property drive

Get, set and delete the drive strength of this net.

The drive strength cannot be set to a value less than its current value. So as pins are added to a net, the drive strength reflects the maximum drive value of the pins currently on the net.

erc_list = [<function dflt_net_erc>]
classmethod fetch(name, *args, **attribs)[source]

Get the net with the given name from a circuit, or create it if not found.

generate_netlist_net(tool=None)[source]

Generate the net information for inclusion in a netlist.

Parameters:

tool – The format for the netlist file (e.g., KICAD).

generate_xml_net(tool=None)[source]

Generate the net information for inclusion in an XML file.

Parameters:

tool – The format for the XML file (e.g., KICAD).

classmethod get(name, circuit=None)[source]

Get the net with the given name from a circuit, or return None.

get_nets()[source]

Return a list of nets attached to this net, including this net.

get_pins()[source]

Return a list of pins attached to this net.

is_attached(pin_net_bus)[source]

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

is_implicit()[source]

Return true if the net name is implicit.

is_movable()[source]

Return true if the net is movable to another circuit.

A net is movable if it’s not part of a Circuit or if there are no pins attached to it.

merge_names()[source]

For multi-segment nets, select a common name for all the segments.

property name

Get, set and delete the name of this net.

When setting the net name, if another net with the same name is found, the name for this net is adjusted to make it unique.

property netclass

Get, set and delete the net class assigned to this net.

If not net class is set, then reading the net class returns None.

You can’t overwrite the net class of a net once it’s set. You’ll have to delete it and then set it to a new value.

Also, assigning a net class of None will have no affect on the existing net class of a net.

property nets
property pins
property stub
test_validity()[source]
property valid
property width

Return width of a Net, which is always 1.