23 from gettext
import gettext
as _
33 remove_components = set()
35 for component
in netlist.components:
36 if not component.blueprint.composite_sources:
39 for cpin
in component.cpins:
40 label = cpin.blueprint.get_attribute(
'pinlabel',
None)
42 cpin.error(_(
"pin on composite component is missing a label"))
45 dest_net = cpin.local_net.net
48 ports = [potential_port
for subsheet
in component.subsheets
49 for potential_port
in subsheet.components
50 if potential_port.blueprint.refdes == label]
53 cpin.warn(_(
"missing I/O symbol with refdes `%s' "
54 "inside schematic") % label)
56 cpin.warn(_(
"multiple I/O symbols with refdes `%s' "
57 "inside schematic") % label)
61 port.error(_(
"I/O symbol doesn't have pins"))
63 if len(port.cpins) > 1:
64 port.error(_(
"multiple pins on I/O symbol"))
66 if port.blueprint.is_graphical:
67 port.error(_(
"I/O symbol can't be graphical"))
69 src_net = port.cpins[0].local_net.net
72 if src_net != dest_net:
73 src_net.merge_into(dest_net)
74 dest_net.component_pins += src_net.component_pins
75 del src_net.component_pins[:]
78 remove_components.add(port)
79 port.sheet.components.remove(port)
80 del port.sheet.components_by_blueprint[port.blueprint]
82 port.cpins[0].local_net.cpins.remove(port.cpins[0])
83 dest_net.component_pins.remove(port.cpins[0])
86 cpin.local_net.cpins.remove(cpin)
87 dest_net.component_pins.remove(cpin)
90 remove_components.add(component)
91 component.sheet.components.remove(component)
92 del component.sheet.components_by_blueprint[component.blueprint]
94 netlist.components = [component
for component
in netlist.components
95 if component
not in remove_components]
def postproc_instances
Connect subsheet I/O ports to the instantiating component's pins.