# BOM generation

## How do I create a bill of materials (BOM)?

There are five different backends for gnetlist which enable you to export a BOM. Call them with -g and be sure to give the output file name with the -o option:

       gnetlist -g partslist3 -o output.bom schematic.sch

gnetlist descends into sub sheets and list the contents of these schematics along with the parts from the top document.

The backends bom and bom2 require read access to a local file called attribs. This file should contain the name of the attributes to be listed each in a seperate line. E.g:

    value
    footprint
    description

Each of the backends lists and sorts the parts in different ways in an ascii file. Choose the one you like best:

#### bom

The bom backend needs to read an attribs file (see above). The list produced by "-g bom” will contain as many lines as there are components. Columns are seperated by tab characters. Lines are not sorted.

#### bom2

The bom2 backend also needs to read an attribs file. With "-g bom2” the refdeses of all components with the same value will be collected into a single line. Columns are seperated by colons. Different items in the same column are seperated by a komma character.

#### partslist1

A list produced by the partlist1 backend gives a line for each and every component. Lines are sorted alphabetically by refdes. Columns are “refdes”, “device”, “value”, “footprint” and “quantity”. Since every line contains just one part, the quantity is always “1”.

#### partslist2

This backend produces output similar to partslist1. Lines are sorted by the value of the device attribute.

#### partslist3

The backend partslist3 assembles all parts with the same value in a single line, very much like bom2. Lines are sorted by the value of the device attribute. The fourth column reports the number of parts in a line. Columns are seperated by the tab character, items by space.

# Design Rule Check (DRC)

## How do I check my schematics?

You can check your schematics using the drc2 gnetlist’s backend. It will check your schematics for some common errors, like duplicate references, unconnected pins, unused slots and more.

Run the drc2 backend with the following command:

    gnetlist -g drc2 -o MyDesign.drc MyDesign.sch

With this command, the DRC output is written into the file “MyDesign.drc”. You can then view this file with a text editor and see the DRC warnings and errors.

## How do I see the DRC output in the screen, without writing to a file?

Run the drc2 backend with the following command:

    gnetlist -g drc2 -o - MyDesign.sch

This way, you will see the DRC output directly in your screen.

## I want to disable some of the schematic DRC checks. How can I do it?

The drc2 backend is highly configurable. You have to put some special commands into a file and use the “-l” option of gnetlist with it.

The most common commands are:

- (define dont-check-non-numbered-parts 1) ;; Disable the non-numbered parts check
- (define dont-check-duplicated-references 1) ;; Disable the duplicate references check
- (define dont-check-one-connection-nets 1) ;; Disable the check for nets with only one connection.
- (define dont-check-pintypes-of-nets 1) ;; Disable the pintype check
- (define dont-check-not-driven-nets 1) ;; Disable the driven net check
- (define dont-check-unconnected-pins 1) ;; Disable the unconnected pins check
- (define dont-check-duplicated-slots 1) ;; Disable the duplicated slots check
- (define dont-check-unused-slots 1) ;; Disable the unused slots check
- (define dont-check-slots 1) ;; Disable slot number check
- (define action-unused-slots #\w) ;; Output an unused slots as a warning
- (define action-unused-slots #\e) ;; Output an unused slots as an error
- (define action-unused-slots #\c) ;; An unused slot is OK.
- (define case_insensitive 1) ;; Do all checks case insensitive

There are some other advanced commands, to modify the DRC matrix and the pintype which can drive a net. See the backend file “gnet-drc2.scm” with a text editor. At the beginning there is the available documentation.

Copy the above lines you want into a file (for example “drc_rules.txt”), one per line, and run the drc checker:

    gnetlist -g drc2 -l drc_rules.txt -o MyDesign.drc MyDesign.sch

With this command, the DRC output is written into the file “MyDesign.drc”. You can then view this file with a text editor and see the DRC warnings and errors.

## Can I include the DRC checking into a Makefile and stop when errors or warnings are found?

Yes. The drc2 backend will return an error if there are errors or warnings, so you can add the following to your Makefile:

    $(objects).drc : $(objects).sch
              gnetlist -g drc2 $(objects).sch -o $(objects).drc

If you are going to simulate your design, then you can add the following to your Makefile:

    $(objects).cir : $(objects).sch $(objects).drc
              grep -v ERROR $(objects).drc >/dev/null 2>&1
              gnetlist -g spice-sdb $(objects).sch  -o $(objects).cir

If not, please use the above example and adapt it to your own workflow.

## There are some warnings in my design I'm aware of. Can I ignore the warnings in the return value?

Use the “-O ignore-warnings-in-return-value” option:

    gnetlist -g drc2 -o - MyDesign.sch -O ignore-warnings-in-return-value

Do this with caution! You will be missing all the warnings!

# Attribute management

## Help! My design has hundreds of components, and it's a pain to use gschem to attach all my attributes!

The answer here is the gEDA/gaf utility “gattrib”. Gattrib is an attribute editor for gEDA. It reads your .sch file(s) and creates a spreadsheet showing all components, nets, and pins in rows, with the associated attributes listed in the columns. Gattrib allows you to add, modify, or delete attributes outside of gschem, and then save the .sch files back out. Here’s a screenshot:

Note that gattrib is the gEDA Project’s current answer to the question of heavy symbols. That is, rather than putting all attributes (such as SPICE model files, footprint names, manufacturer part nos and the like), you are encouraged to put this information into your schematic using gattrib, where it is visible and easily manipulable with gattrib.

When using gattrib, make sure you exit gschem first. Gattrib and gschem both save your work into the same file, so you should have only one program running at a time to avoid conflicts. There is no lockfile mechanism in gEDA/gaf (yet), so it’s your responsibility to avoid conflicts.

## How do I know what footprint name to use for layout using PCB?

Answered here.