Xorn
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Functions | Variables
xorn.geda.netlist.guile Namespace Reference

Scheme API for retrieving netlist information. More...

Functions

def check_argument_type
 Helper function for checking the type of an API function argument. More...
 
def spicified_net_name
 Return the net name visible through the API. More...
 
def get_packages
 Return a list of all package refdes's in the design. More...
 
def get_non_unique_packages
 Return a list of all package refdes's in the design; might return duplicates. More...
 
def get_pins
 Return a list of pin numbers for a given package. More...
 
def get_all_nets
 Return a list of all net names in the design; might return duplicates. More...
 
def get_all_unique_nets
 Return a list of all net names in the design. More...
 
def get_all_connections
 Return a list of pins connected to the a given net. More...
 
def get_nets
 Return the net to which a given pin is connected and a list of pins graphically connected to it. More...
 
def get_pins_nets
 Return a list of pairs (pinnumber, netname) for a given package. More...
 
def get_all_package_attributes
 Get attribute value(s) from a package with given refdes. More...
 
def get_toplevel_attribute
 Return value of attribute, otherwise string "not found". More...
 
def get_attribute_by_pinseq
 Take a refdes and pinseq number and return wanted_attribute associated with that pinseq pin and component. More...
 
def get_attribute_by_pinnumber
 Take a pin number and return the appropriate attribute on that pin. More...
 
def vams_get_package_attributes
 
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 graphical objects connected to that net. More...
 
def get_backend_arguments
 Obtain a list of `-O' backend arguments. More...
 
def get_input_files
 Get input files from command line. More...
 
def get_verbosity
 Indicate the verbosity level for messages. More...
 

Variables

 the_netlist = None
 Global netlist object. More...
 
 the_backend_arguments = None
 Global backend argument list. More...
 
 the_verbosity = None
 Global backend verbosity flag. More...
 
 the_spice_mode = None
 Whether to return net names appropriate for SPICE backends. More...
 

Detailed Description

Scheme API for retrieving netlist information.

This module mirrors the gnetlist Scheme API which exposes the results of a netlister run to a netlist backend written in Scheme. For each gnetlist API function, this module contains an equivalent Python function and makes it available by creating a top-level Scheme binding.

The gnetlist API included a function gnetlist:get-renamed-nets which returned a list of "renamed nets" and could be used to unit test the internals of the netlister. Due to the way nets are handled, the concept of a "renamed net" isn't applicable and this function isn't supported any more.

Some functions take a dummy argument "level" which must be a string but is otherwise ignored.

Function Documentation

def xorn.geda.netlist.guile.check_argument_type (   fun,
  i,
  arg,
  t 
)

Helper function for checking the type of an API function argument.

When constructing an error message, fun and i are used to indicate the API function and argument index, respectively.

Exceptions
TypeErrorif arg is not an instance of t or of a subclass thereof

Definition at line 70 of file guile.py.

def xorn.geda.netlist.guile.get_all_connections (   wanted_net_name)

Return a list of pins connected to the a given net.

For each pin, a pair (refdes, pinnumber) is returned.

If wanted_net_name doesn't refer to an existing net, an empty list is returned.

For historical reasons, this function returns its results in reversed order.

Definition at line 192 of file guile.py.

def xorn.geda.netlist.guile.get_all_nets (   level)

Return a list of all net names in the design; might return duplicates.

Note
Don't use this function. Use get_all_unique_nets instead.

Walks through the list of components (skipping power symbols) and through the list of individual pins on each component (skipping unconnected pins), and returns a list of the names of all found nets.

Due to the way hierarchy is handled in the new netlisting code, subsheet symbols and ports aren't part of the finished netlist. Therefore, when using hierarchical schematics, this function doesn't return some of the net name duplications the old function did.

For historical reasons, this function returns its results in reversed order.

Definition at line 156 of file guile.py.

def xorn.geda.netlist.guile.get_all_package_attributes (   refdes,
  wanted_attrib 
)

Get attribute value(s) from a package with given refdes.

This function returns the values of a specific attribute type attached to the symbol instances with the given refdes.

Every first attribute value found is added to the return list. False is added if the instance has no such attribute.

Note
The order of the values in the return list is the order of symbol instances within gnetlist (the first element is the value associated with the first symbol instance).

This function does not return its results in reversed order.

Parameters
[in]refdespackage reference
[in]wanted_attribattribute name
Returns
a list of attribute values as strings and False

Definition at line 295 of file guile.py.

def xorn.geda.netlist.guile.get_all_unique_nets (   level)

Return a list of all net names in the design.

Stub nets for unconnected pins are not included.

For historical reasons, this function returns its results in reversed order.

Definition at line 178 of file guile.py.

def xorn.geda.netlist.guile.get_attribute_by_pinnumber (   refdes,
  pin,
  wanted_attrib 
)

Take a pin number and return the appropriate attribute on that pin.

pin is the value associated with the pinnumber= attribute and refdes.

Definition at line 350 of file guile.py.

def xorn.geda.netlist.guile.get_attribute_by_pinseq (   refdes,
  pinseq,
  wanted_attrib 
)

Take a refdes and pinseq number and return wanted_attribute associated with that pinseq pin and component.

Definition at line 326 of file guile.py.

def xorn.geda.netlist.guile.get_backend_arguments ( )

Obtain a list of `-O' backend arguments.

Returns a list of arguments passed to the gnetlist backend via the `-O' gnetlist command-line option.

Definition at line 421 of file guile.py.

def xorn.geda.netlist.guile.get_input_files ( )

Get input files from command line.

This function returns a list of the files named on the command line.

Returns
a list of filenames as strings

Definition at line 430 of file guile.py.

def xorn.geda.netlist.guile.get_nets (   wanted_refdes,
  wanted_pin 
)

Return the net to which a given pin is connected and a list of pins graphically connected to it.

The result is a pair (netname, [(refdes, pin), (refdes, pin), ...]).

If wanted_refdes and wanted_pin don't refer to an existing pin, the pair ('ERROR_INVALID_PIN', None) is returned.

Note
This function is different to all other API functions in that it does not consider the actual logical net but only pins which are graphically connected to the given pin. Unless you are analyzing the graphical properties of a netlist, you should only use the netname part of its return value.

Reflecting the behavior of gnetlist:get-nets, this function doesn't return the pin itself if it isn't connected to anything.

For historical reasons, this function returns the list in reversed order.

Definition at line 224 of file guile.py.

def xorn.geda.netlist.guile.get_non_unique_packages (   level)

Return a list of all package refdes's in the design; might return duplicates.

Note
Don't use this function. Use get_packages instead.

Walks through the list of components and returns a list of each component's refdes. Power symbols don't have a refdes and are skipped.

For historical reasons, this function returns its results in reversed order.

Definition at line 114 of file guile.py.

def xorn.geda.netlist.guile.get_packages (   level)

Return a list of all package refdes's in the design.

For historical reasons, this function returns its results in reversed order.

Definition at line 98 of file guile.py.

def xorn.geda.netlist.guile.get_pins (   refdes)

Return a list of pin numbers for a given package.

If refdes doesn't refer to an existing package, an empty list is returned.

For historical reasons, this function returns its results in reversed order.

Definition at line 130 of file guile.py.

def xorn.geda.netlist.guile.get_pins_nets (   wanted_refdes)

Return a list of pairs (pinnumber, netname) for a given package.

Each pair contains the name of a pin of that package and the name of the net connected to that pin.

If refdes doesn't refer to an existing package, an empty list is returned.

This function does not return its results in reversed order.

Definition at line 265 of file guile.py.

def xorn.geda.netlist.guile.get_toplevel_attribute (   wanted_attrib)

Return value of attribute, otherwise string "not found".

Definition at line 318 of file guile.py.

def xorn.geda.netlist.guile.get_verbosity ( )

Indicate the verbosity level for messages.

If the "-q" gnetlist command-line option was specified, returns -1. If the "-v" gnetlist command-line option was specified, returns 1. Otherwise, returns 0.

Definition at line 440 of file guile.py.

def xorn.geda.netlist.guile.graphical_objs_in_net_with_attrib_get_attrib (   wanted_net_name,
  has_attrib,
  wanted_attrib 
)

Given a net name, an attribute, and a wanted attribute, return all the given attribute of all the graphical objects connected to that net.

For historical reasons, this function returns its results in reversed order.

Definition at line 389 of file guile.py.

def xorn.geda.netlist.guile.spicified_net_name (   net)

Return the net name visible through the API.

If the name of the invoked backend starts with "spice", gnetlist omits the "unnamed_net" net name prefix. Here, however, the generated netlist is independent of the backend, so the API needs to fix up the net name before passing it to the backend.

If the_spice_mode isn't true when evaluated in a boolean context, this function just returns net.name.

Definition at line 85 of file guile.py.

def xorn.geda.netlist.guile.vams_get_package_attributes (   refdes)

Definition at line 368 of file guile.py.

Variable Documentation

xorn.geda.netlist.guile.the_backend_arguments = None

Global backend argument list.

Set this to the actual list of arguments.

Definition at line 49 of file guile.py.

xorn.geda.netlist.guile.the_netlist = None

Global netlist object.

Set this to the netlist to be inspected.

Definition at line 45 of file guile.py.

xorn.geda.netlist.guile.the_spice_mode = None

Whether to return net names appropriate for SPICE backends.

Set this to True or False depending on whether the backend expects the API functions to return SPICE net names.

See also
spicified_net_name

Definition at line 60 of file guile.py.

xorn.geda.netlist.guile.the_verbosity = None

Global backend verbosity flag.

Set this to 1 if a `-v' option has been passed, to -1 if a `-q' option has been passed, to 0 otherwise.

Definition at line 54 of file guile.py.