Browse Source
Eeschema: in intermediate netlist generation: remove redundant pins list by component, and make Dick happy.
Eeschema: in intermediate netlist generation: remove redundant pins list by component, and make Dick happy.
Known bug in intermediate netlist generation: multi parts per package have their common pins listed more than once in nets section. Will be fixed.pull/1/head
6 changed files with 321 additions and 94 deletions
-
2demos/sonde xilinx/sonde xilinx-cache.lib
-
96demos/sonde xilinx/sonde xilinx.sch
-
26eeschema/netform.cpp
-
4eeschema/netlist_control.cpp
-
156eeschema/plugins/netlist_form_OrcadPcb2.xsl
-
131eeschema/plugins/netlist_form_cadstar-RINF.xsl
@ -0,0 +1,131 @@ |
|||
<?xml version="1.0" encoding="ISO-8859-1"?> |
|||
<!--XSL style sheet to EESCHEMA Generic Netlist Format to CADSTAR netlist format |
|||
Copyright (C) 2010, SoftPLC Corporation. |
|||
GPL v2. |
|||
|
|||
How to use: |
|||
https://lists.launchpad.net/kicad-developers/msg05157.html |
|||
--> |
|||
|
|||
<!DOCTYPE xsl:stylesheet [ |
|||
<!ENTITY nl "
"> <!--new line CR, LF --> |
|||
]> |
|||
|
|||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
|||
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/> |
|||
|
|||
<!-- Netlist header --> |
|||
<xsl:template match="/export"> |
|||
<xsl:text>.HEA&nl;</xsl:text> |
|||
<xsl:apply-templates select="design/date"/> <!-- Generate line .TIM <time> --> |
|||
<xsl:apply-templates select="design/tool"/> <!-- Generate line .APP <eeschema version> --> |
|||
<xsl:text>&nl;</xsl:text> |
|||
<xsl:apply-templates select="components/comp"/> <!-- Generate list of components --> |
|||
<xsl:text>&nl;&nl;</xsl:text> |
|||
<xsl:apply-templates select="nets/net"/> <!-- Generate list of nets and connections --> |
|||
<xsl:text>&nl;.END&nl;</xsl:text> |
|||
</xsl:template> |
|||
|
|||
<!-- Generate line .APP "eeschema (2010-08-17 BZR 2450)-unstable" --> |
|||
<xsl:template match="tool"> |
|||
<xsl:text>.APP "</xsl:text> |
|||
<xsl:apply-templates/> |
|||
<xsl:text>"&nl;</xsl:text> |
|||
</xsl:template> |
|||
|
|||
<!-- Generate line .TIM 20/08/2010 10:45:33 --> |
|||
<xsl:template match="date"> |
|||
<xsl:text>.TIM </xsl:text> |
|||
<xsl:apply-templates/> |
|||
<xsl:text>&nl;</xsl:text> |
|||
</xsl:template> |
|||
|
|||
<!-- for each component --> |
|||
<!-- create lines like |
|||
.ADD_COM U3 74LS541 (when no footprint name specified) |
|||
.ADD_COM JP1 CONN_8X2 pin_array_8x2 pin_array_8x2 (with a specified footprint name) |
|||
--> |
|||
<xsl:template match="comp"> |
|||
<xsl:text>.ADD_COM </xsl:text> |
|||
<xsl:value-of select="@ref"/> |
|||
<xsl:text> </xsl:text> |
|||
<xsl:choose> |
|||
<xsl:when test = "value != '' "> |
|||
<xsl:apply-templates select="value"/> |
|||
</xsl:when> |
|||
<xsl:otherwise> |
|||
<xsl:text>?</xsl:text> |
|||
</xsl:otherwise> |
|||
</xsl:choose> |
|||
<xsl:choose> |
|||
<xsl:when test = "footprint != '' "> |
|||
<xsl:text> </xsl:text> |
|||
<xsl:apply-templates select="footprint"/> |
|||
</xsl:when> |
|||
<xsl:otherwise> |
|||
</xsl:otherwise> |
|||
</xsl:choose> |
|||
<xsl:text>&nl;</xsl:text> |
|||
</xsl:template> |
|||
|
|||
<!-- for each net --> |
|||
<!-- create lines like |
|||
.ADD_TER U3.9 /PC-RST |
|||
.TER U3.8 |
|||
BUS1.2 |
|||
.ADD_TER BUS1.14 /PC-IOR |
|||
.TER U3.7 |
|||
--> |
|||
<xsl:template match="net"> |
|||
<!-- nets are output only if there is more than one pin in net --> |
|||
<xsl:if test="count(node)>1"> |
|||
<xsl:variable name="netname"> |
|||
<xsl:text> </xsl:text> |
|||
<xsl:choose> |
|||
<xsl:when test = "@name != '' "> |
|||
<xsl:value-of select="@name"/> |
|||
</xsl:when> |
|||
<xsl:otherwise> |
|||
<xsl:text>N-</xsl:text> |
|||
<xsl:value-of select="@code"/> |
|||
</xsl:otherwise> |
|||
</xsl:choose> |
|||
<xsl:text>&nl;</xsl:text> |
|||
</xsl:variable> |
|||
<xsl:apply-templates select="node" mode="first"/> |
|||
<xsl:value-of select="$netname"/> |
|||
<xsl:apply-templates select="node" mode="others"/> |
|||
</xsl:if> |
|||
</xsl:template> |
|||
|
|||
<!-- for each node --> |
|||
<xsl:template match="node" mode="first"> |
|||
<xsl:if test="position()=1"> |
|||
<xsl:text>.ADD_TER </xsl:text> |
|||
<xsl:value-of select="@ref"/> |
|||
<xsl:text>.</xsl:text> |
|||
<xsl:value-of select="@pin"/> |
|||
<xsl:text> </xsl:text> |
|||
</xsl:if> |
|||
</xsl:template> |
|||
|
|||
<xsl:template match="node" mode="others"> |
|||
<xsl:choose> |
|||
<xsl:when test='position()=1'> |
|||
</xsl:when> |
|||
<xsl:when test='position()=2'> |
|||
<xsl:text>.TER </xsl:text> |
|||
</xsl:when> |
|||
<xsl:otherwise> |
|||
<xsl:text> </xsl:text> |
|||
</xsl:otherwise> |
|||
</xsl:choose> |
|||
<xsl:if test="position()>1"> |
|||
<xsl:value-of select="@ref"/> |
|||
<xsl:text>.</xsl:text> |
|||
<xsl:value-of select="@pin"/> |
|||
<xsl:text>&nl;</xsl:text> |
|||
</xsl:if> |
|||
</xsl:template> |
|||
|
|||
</xsl:stylesheet> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue