Create a Netlist

Overview

A netlist is a file which describes electrical connections between symbols. These connections are referred to as nets. In the netlist file you can find:

  • The list of the symbols

  • The list of connections (nets) between symbols.

Many different netlist formats exist. Sometimes the symbols list and the list of nets are two separate files. This netlist is fundamental in the use of schematic capture software, because the netlist is the link with other electronic CAD software such as:

  • PCB layout software.

  • Schematic and electrical signal simulators.

  • CPLD (and other programmable IC’s) compilers.

Eeschema supports several netlist formats.

  • PCBNEW format (printed circuits).

  • ORCAD PCB2 format (printed circuits).

  • CADSTAR format (printed circuits).

  • Spice format, for various simulators (the Spice format is also used by other simulators).

Netlist formats

Select the tool Netlist icon to open the netlist creation dialog.

Pcbnew selected

eeschema_netlist_dialog_pcbnew_png

Spice selected

eeschema_netlist_dialog_spice_png

Using the different tabs you can select the desired format. In Spice format you can generate netlists with either net names which makes the SPICE file more human readable or net numbers which are used by older Spice. By clicking the Netlist button, you will be asked for a netlist file name.

The netlist generation can take up to several minutes for large schematics.

Netlist examples

You can see below a schematic design using the PSPICE library:

eeschema_netlist_schematic_png

Example of a PCBNEW netlist file:

  1. # Eeschema Netlist Version 1.0 generee le 21/1/1997-16:51:15
  2. (
  3. (32E35B76 $noname C2 1NF {Lib=C}
  4. (1 0)
  5. (2 VOUT_1)
  6. )
  7. (32CFC454 $noname V2 AC_0.1 {Lib=VSOURCE}
  8. (1 N-000003)
  9. (2 0)
  10. )
  11. (32CFC413 $noname C1 1UF {Lib=C}
  12. (1 INPUT_1)
  13. (2 N-000003)
  14. )
  15. (32CFC337 $noname V1 DC_12V {Lib=VSOURCE}
  16. (1 +12V)
  17. (2 0)
  18. )
  19. (32CFC293 $noname R2 10K {Lib=R}
  20. (1 INPUT_1)
  21. (2 0)
  22. )
  23. (32CFC288 $noname R6 22K {Lib=R}
  24. (1 +12V)
  25. (2 INPUT_1)
  26. )
  27. (32CFC27F $noname R5 22K {Lib=R}
  28. (1 +12V)
  29. (2 N-000008)
  30. )
  31. (32CFC277 $noname R1 10K {Lib=R}
  32. (1 N-000008)
  33. (2 0)
  34. )
  35. (32CFC25A $noname R7 470 {Lib=R}
  36. (1 EMET_1)
  37. (2 0)
  38. )
  39. (32CFC254 $noname R4 1K {Lib=R}
  40. (1 +12V)
  41. (2 VOUT_1)
  42. )
  43. (32CFC24C $noname R3 1K {Lib=R}
  44. (1 +12V)
  45. (2 N-000006)
  46. )
  47. (32CFC230 $noname Q2 Q2N2222 {Lib=NPN}
  48. (1 VOUT_1)
  49. (2 N-000008)
  50. (3 EMET_1)
  51. )
  52. (32CFC227 $noname Q1 Q2N2222 {Lib=NPN}
  53. (1 N-000006)
  54. (2 INPUT_1)
  55. (3 EMET_1)
  56. )
  57. )
  58. # End

In PSPICE format, the netlist is as follows:

  1. * Eeschema Netlist Version 1.1 (Spice format) creation date: 18/6/2008-08:38:03
  2. .model Q2N2222 npn (bf=200)
  3. .AC 10 1Meg \*1.2
  4. .DC V1 10 12 0.5
  5. R12 /VOUT N-000003 22K
  6. R11 +12V N-000003 100
  7. L1 N-000003 /VOUT 100mH
  8. R10 N-000005 N-000004 220
  9. C3 N-000005 0 10uF
  10. C2 N-000009 0 1nF
  11. R8 N-000004 0 2.2K
  12. Q3 /VOUT N-000009 N-000004 N-000004 Q2N2222
  13. V2 N-000008 0 AC 0.1
  14. C1 /VIN N-000008 1UF
  15. V1 +12V 0 DC 12V
  16. R2 /VIN 0 10K
  17. R6 +12V /VIN 22K
  18. R5 +12V N-000012 22K
  19. R1 N-000012 0 10K
  20. R7 N-000007 0 470
  21. R4 +12V N-000009 1K
  22. R3 +12V N-000010 1K
  23. Q2 N-000009 N-000012 N-000007 N-000007 Q2N2222
  24. Q1 N-000010 /VIN N-000007 N-000007 Q2N2222
  25. .print ac v(vout)
  26. .plot ac v(nodes) (-1,5)
  27. .end

Notes on Netlists

Netlist name precautions

Many software tools that use netlists do not accept spaces in the component names, pins, nets or other informations. Avoid using spaces in labels, or names and value fields of components or their pins to ensure maximum compatibility.

In the same way, special characters other than letters and numbers can cause problems. Note that this limitation is not related to Eeschema, but to the netlist formats that can then become untranslatable to software that uses netlist files.

PSPICE netlists

For the Pspice simulator, you have to include some command lines in the netlist itself (.PROBE, .AC, etc.).

Any text line included in the schematic diagram starting with the keyword -pspice or -gnucap will be inserted (without the keyword) at the top of the netlist.

Any text line included in the schematic diagram starting with the keyword +pspice or +gnucap will be inserted (without the keyword) at the end of the netlist.

Here is a sample using many one-line texts and one multi-line text:

eeschema_pspice_netlist_png

For example, if you type the following text (do not use a label!):

  1. -PSPICE .PROBE

a line .PROBE will be inserted in the netlist.

In the previous example three lines were inserted at the beginning of the netlist and two at the end with this technique.

If you are using multiline texts, +pspice or +gnucap keywords are needed only once:

  1. +PSPICE .model NPN NPN
  2. .model PNP PNP
  3. .lib C:\Program Files\LTC\LTspiceIV\lib\cmp\standard.bjt
  4. .backanno

creates the four lines:

  1. .model NPN NPN
  2. .model PNP PNP
  3. .lib C:\Program Files\LTC\LTspiceIV\lib\cmp\standard.bjt
  4. .backanno

Also note that the GND net must be named 0 (zero) for Pspice.

Other formats

For other netlist formats you can add netlist converters in the form of plugins. These converters are automatically launched by Eeschema. Chapter 14 gives some explanations and examples of converters.

A converter is a text file (xsl format) but one can use other languages like Python. When using the xsl format, a tool (xsltproc.exe or xsltproc) read the intermediate file created by Eeschema, and the converter file to create the output file. In this case, the converter file (a sheet style) is very small and very easy to write.

Init the dialog window

You can add a new netlist plug-in via the Add Plugin button.

eeschema_netlist_dialog_add_plugin_png

Here is the plug-in PadsPcb setup window:

eeschema_netlist_dialog_padspcb_png

The setup will require:

  • A title (for example, the name of the netlist format).

  • The plug-in to launch.

When the netlist is generated:

  1. Eeschema creates an intermediate file *.tmp, for example test.tmp.

  2. Eeschema runs the plug-in, which reads test.tmp and creates test.net.

Command line format

Here is an example, using xsltproc.exe as a tool to convert .xsl files, and a file netlist_form_pads-pcb.xsl as converter sheet style:

f:/kicad/bin/xsltproc.exe -o %O.net f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl %I

With:

f:/kicad/bin/xsltproc.exeA tool to read and convert xsl file

-o %O.net

Output file: %O will define the output file.

f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl

File name converter (a sheet style, xsl format).

%I

Will be replaced by the intermediate file created by Eeschema (*.tmp).

For a schematic named test.sch, the actual command line is:

f:/kicad/bin/xsltproc.exe -o test.net f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl test.tmp.

Converter and sheet style (plug-in)

This is a very simple piece of software, because its purpose is only to convert an input text file (the intermediate text file) to another text file. Moreover, from the intermediate text file, you can create a BOM list.

When using xsltproc as the converter tool only the sheet style will be generated.

Intermediate netlist file format

See Chapter 14 for more explanations about xslproc, descriptions of the intermediate file format, and some examples of sheet style for converters.