John Doty

Checking pin counts

  • gnet-check-pincount.scm

    Usage

    gnetlist -g check-pincount other-gnetlist-arguments

    This gnetlist back end checks that the number of pins on the package matches the intended number. It logs mismatches to the standard error output. It yields an exit code of 1 if it has found any mismatches. The pins on the package include both visible and hidden pins on the symbol(s) with the package's refdes. Unconnected pins count, but pins that are not present in the symbol(s) don't. It deduces the intended number from the following attributes:

  • pins-used=n
  • If pins-used is present, it has precedence. Use it when you don't have a symbol pin for each footprint pin.

  • pins=n
  • If pins is present, it should represent the number of pins on the footprint. Some standard gEDA symbols have this attribute.

  • footprint=n
  • If neither pins-used nor pins is present, check-pincount can extract the pin count from most standard gEDA footprint names.

    Adding your own footprints

    You may create one or more files of additional footprint information. Load them using the -m flag in your gnetlist command. Use the Scheme footprint-pins-prefix function to specify your footprints. There are two forms:

  • (footprint-pins-prefix "prefix" n)
  • If you give an explicit pin count n, check-pincount uses that for every package whose name starts with the given prefix.

  • (footprint-pins-prefix "prefix")
  • Without an explicit pin count n, check-pincount assumes that a decimal numeric field follows the prefix in the footprint name, as in e.g. "DIP14" for prefix "DIP".

    Later (footprint-pins-prefix) commands override earlier ones. Your commands loaded with -m override those built in to check-pincount.

    Using this code in other back ends

    You can also use this code from within another back end. Load the code using

    (load-from-path "gnet-check-pincount.scm")

    Possibly useful functions include:

  • (get-package-pincount refdes)
  • This yields the number of pins on the package refdes, in the form of a character string. It first looks for a pins attribute. If that's not present, it attempts to use the footprint attribute (see above). If that doesn't work, it counts connected pins. This is useful for back ends that write netlist formats that include a pin count.

  • (pins-from-footprint footprint)
  • This yields the number of pins associated with the footprint, in the form of a character string. It yields #f if the footprint's prefix is not defined (see above).