39 from gettext
import gettext
as _
49 the_backend_arguments =
None
71 if not isinstance(arg, t):
72 raise TypeError,
'"%s" argument %d must be %s, not %s' % (
73 fun, i, t.__name__, arg.__class__.__name__)
86 if the_spice_mode
and net.unnamed_counter
is not None:
87 return str(net.unnamed_counter)
100 return [package.refdes
for package
in reversed(the_netlist.packages)]
117 return [component.refdes
118 for component
in reversed(the_netlist.components)
120 if component.refdes
is not None]
133 package = the_netlist.packages_by_refdes[refdes]
137 return [pin.number
for pin
in reversed(package.pins)]
164 for component
in reversed(the_netlist.components)
165 for cpin
in reversed(component.cpins)
167 if component.refdes
is not None
169 and not cpin.local_net.net.is_unconnected_pin]
194 wanted_net_name, basestring)
196 net = the_netlist.nets_by_name[wanted_net_name]
200 return [(pin.package.refdes, pin.number)
201 for pin
in reversed(net.connections)]
229 package = the_netlist.packages_by_refdes[wanted_refdes]
230 pin = package.pins_by_number[wanted_pin]
232 sys.stderr.write(_(
"Invalid refdes ('%s') and pin ('%s') passed "
233 "to get_nets\n") % (wanted_refdes, wanted_pin))
234 return 'ERROR_INVALID_PIN',
None
236 if pin.net.is_unconnected_pin:
248 (cpin_.component.refdes, cpin_.blueprint.number)
249 for cpin
in pin.cpins
250 for cpin_
in cpin.local_net.cpins
252 if cpin_.component.refdes
is not None]
268 package = the_netlist.packages_by_refdes[wanted_refdes]
299 wanted_attrib, basestring)
301 package = the_netlist.packages_by_refdes[refdes]
307 for component
in package.components:
309 value = component.blueprint.get_attribute(wanted_attrib)
320 wanted_attrib, basestring)
321 return the_netlist.get_toplevel_attribute(wanted_attrib,
'not found')
332 wanted_attrib, basestring)
340 package = the_netlist.packages_by_refdes[refdes]
341 pin = package.get_pin_by_pinseq(pinseq)
342 return pin.get_attribute(wanted_attrib)
356 wanted_attrib, basestring)
359 package = the_netlist.packages_by_refdes[refdes]
360 pin = package.pins_by_number[pin]
361 return pin.get_attribute(wanted_attrib)
373 package = the_netlist.packages_by_refdes[refdes]
378 return list(reversed(package.get_attribute_names(
False)))
389 wanted_net_name, has_attrib, wanted_attrib):
391 'gnetlist:graphical-objs-in-net-with-attrib-get-attrib', 1,
392 wanted_net_name, basestring)
394 'gnetlist:graphical-objs-in-net-with-attrib-get-attrib', 2,
395 has_attrib, basestring)
397 'gnetlist:graphical-objs-in-net-with-attrib-get-attrib', 3,
398 wanted_attrib, basestring)
401 has_attrib_name, has_attrib_value = \
407 net = the_netlist.nets_by_name[wanted_net_name]
411 return list(reversed(net.graphical_objs_with_attrib_get_attrib(
412 has_attrib_name, has_attrib_value, wanted_attrib)))
422 return the_backend_arguments
431 return [sheet.blueprint.filename
432 for sheet
in the_netlist.toplevel_sheets]
450 'get-packages': get_packages,
451 'get-non-unique-packages': get_non_unique_packages,
452 'get-pins': get_pins,
453 'get-all-nets': get_all_nets,
454 'get-all-unique-nets': get_all_unique_nets,
455 'get-all-connections': get_all_connections,
456 'get-nets-internal': get_nets,
457 'get-pins-nets-internal': get_pins_nets,
459 'get-all-package-attributes': get_all_package_attributes,
460 'get-toplevel-attribute': get_toplevel_attribute,
461 'get-attribute-by-pinseq': get_attribute_by_pinseq,
462 'get-attribute-by-pinnumber': get_attribute_by_pinnumber,
463 'vams-get-package-attributes': vams_get_package_attributes,
465 'graphical-objs-in-net-with-attrib-get-attrib':
466 graphical_objs_in_net_with_attrib_get_attrib,
469 'get-backend-arguments': get_backend_arguments,
470 'get-input-files': get_input_files,
471 'get-verbosity': get_verbosity
476 (define (gnetlist:get-pins-nets refdes)
477 (map (lambda (x) (cons (car x) (cadr x)))
478 (gnetlist:get-pins-nets-internal refdes)))
480 (define (gnetlist:get-nets refdes pin)
481 (let ((x (gnetlist:get-nets-internal refdes pin)))
482 (cons (car x) (cadr x))))
def get_attribute_by_pinseq
Take a refdes and pinseq number and return wanted_attribute associated with that pinseq pin and compo...
def get_attribute_by_pinnumber
Take a pin number and return the appropriate attribute on that pin.
Embedding a Guile interpreter.
Attribute parsing and lookup.
def get_pins
Return a list of pin numbers for a given package.
def get_verbosity
Indicate the verbosity level for messages.
def get_input_files
Get input files from command line.
def get_all_unique_nets
Return a list of all net names in the design.
def get_all_connections
Return a list of pins connected to the a given net.
def get_pins_nets
Return a list of pairs (pinnumber, netname) for a given package.
def get_backend_arguments
Obtain a list of `-O' backend arguments.
def get_nets
Return the net to which a given pin is connected and a list of pins graphically connected to it...
def get_all_nets
Return a list of all net names in the design; might return duplicates.
def spicified_net_name
Return the net name visible through the API.
def get_packages
Return a list of all package refdes's in the design.
def eval_string
Parse a string as Scheme and evaluate the expressions it contains, in order, returning the last expre...
def check_argument_type
Helper function for checking the type of an API function argument.
def get_toplevel_attribute
Return value of attribute, otherwise string "not found".
def graphical_objs_in_net_with_attrib_get_attrib
Given a net name, an attribute, and a wanted attribute, return all the given attribute of all the gra...
def get_non_unique_packages
Return a list of all package refdes's in the design; might return duplicates.
def vams_get_package_attributes
def define
Create a top level variable.
def get_all_package_attributes
Get attribute value(s) from a package with given refdes.
def parse_string
Parse an attribute string of the form name=value into its name and value parts.