xml: Better whitespace output and other cleanup. * Don't touch existing stuff which already has a parent. Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
diff --git a/attribute-fixes.xsl b/attribute-fixes.xsl index 87c976b..ed4d65b 100644 --- a/attribute-fixes.xsl +++ b/attribute-fixes.xsl
@@ -11,6 +11,7 @@ <xsl:copy> <xsl:value-of select="normalize-space( . )" /> </xsl:copy> + <xsl:apply-templates/> </xsl:template> <!-- Sort the attributes by name -->
diff --git a/convert-port-tag.xsl b/convert-port-tag.xsl index 170d156..7ee6dc3 100644 --- a/convert-port-tag.xsl +++ b/convert-port-tag.xsl
@@ -2,7 +2,6 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="identity.xsl" /> - <!-- template-function: Allow from attribute which gives you a relative to a given pb_type --> <xsl:template name="from-pb_type"> <xsl:choose> @@ -74,9 +73,8 @@ </xsl:for-each> </xsl:attribute> <xsl:for-each select="@*"><xsl:copy /></xsl:for-each> - <xsl:apply-templates/> <xsl:if test="metadata"> - <metadata> + <metadata><xsl:text>
</xsl:text> <!-- The fasm_mux metadata attribute needs special handling. --> <xsl:if test="*/metadata/meta[@name='fasm_mux']"> <meta name="fasm_mux"><xsl:text>
</xsl:text> @@ -88,8 +86,9 @@ <xsl:for-each select="metadata"> <xsl:apply-templates/> </xsl:for-each> - </metadata> + </metadata><xsl:text>
</xsl:text> </xsl:if> + <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="interconnect/mux/metadata"></xsl:template> @@ -100,12 +99,14 @@ to <loc ...>BLOCK.PORT BLOCK.PORT</loc> --> - <xsl:template match="pinlocations/loc/port"><xsl:text> - </xsl:text><xsl:call-template name="from-pb_type"/>.<xsl:call-template name="port-value"/> + <xsl:template match="pinlocations/loc/port"> + <xsl:text>
</xsl:text> + <xsl:call-template name="from-pb_type"/>.<xsl:call-template name="port-value"/> </xsl:template> - <xsl:template match="pinlocations/loc/port[last()]"><xsl:text> - </xsl:text><xsl:call-template name="from-pb_type"/>.<xsl:call-template name="port-value"/><xsl:text> - </xsl:text> + <xsl:template match="pinlocations/loc/port[last()]"> + <xsl:text>
</xsl:text> + <xsl:call-template name="from-pb_type"/>.<xsl:call-template name="port-value"/> + <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet>
diff --git a/convert-prefix-port.xsl b/convert-prefix-port.xsl index d4c4b4a..c7f8867 100644 --- a/convert-prefix-port.xsl +++ b/convert-prefix-port.xsl
@@ -16,13 +16,13 @@ </xsl:template> <!-- Prefix in_port / out_port values with the parent name. --> - <xsl:template match="@out_port"> + <xsl:template match="@out_port[not(contains(.,'.'))]"> <xsl:attribute name="out_port"><xsl:call-template name="parent-pb_type"/>.<xsl:value-of select="."/></xsl:attribute> </xsl:template> - <xsl:template match="@in_port"> + <xsl:template match="@in_port[not(contains(.,'.'))]"> <xsl:attribute name="in_port"><xsl:call-template name="parent-pb_type"/>.<xsl:value-of select="."/></xsl:attribute> </xsl:template> - <xsl:template match="@port"> + <xsl:template match="@port[not(contains(.,'.'))]"> <xsl:attribute name="port"><xsl:call-template name="parent-pb_type"/>.<xsl:value-of select="."/></xsl:attribute> </xsl:template>
diff --git a/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.golden.xml b/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.golden.xml index 325e28a..c8670ba 100644 --- a/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.golden.xml +++ b/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.golden.xml
@@ -28,6 +28,15 @@ </meta> </metadata> </mux> + <mux input="COMMON_SLICE.AO5 COMMON_SLICE.AX" name="CARRY_DI0" output="CARRY4_VPR.DI0"> + <metadata> + <meta name="fasm_mux"> + COMMON_SLICE.AO5 = CARRY4.ACY0 + COMMON_SLICE.AX = NULL + </meta> + </metadata> + <delay_constant in_port="COMMON_SLICE.AX" max=".105e-9" out_port="CARRY4_VPR.DI0"/> + </mux> </interconnect> </pb_type> </xml>
diff --git a/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.xml b/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.xml index c2a333e..6590b67 100644 --- a/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.xml +++ b/convert_and_merge_composable_tests/composable-interconnect-existing-fasm-mux.xml
@@ -35,6 +35,15 @@ </meta> </metadata> </mux> + <mux name="CARRY_DI0" input="COMMON_SLICE.AO5 COMMON_SLICE.AX" output="CARRY4_VPR.DI0" > + <delay_constant max=".105e-9" in_port="COMMON_SLICE.AX" out_port="CARRY4_VPR.DI0" /> + <metadata> + <meta name="fasm_mux"> + COMMON_SLICE.AO5 = CARRY4.ACY0 + COMMON_SLICE.AX = NULL + </meta> + </metadata> + </mux> </interconnect> </pb_type> </xml>
diff --git a/convert_and_merge_composable_tests/composable-loc-implicit-parent.golden.xml b/convert_and_merge_composable_tests/composable-loc-implicit-parent.golden.xml index f6a4899..0c90f56 100644 --- a/convert_and_merge_composable_tests/composable-loc-implicit-parent.golden.xml +++ b/convert_and_merge_composable_tests/composable-loc-implicit-parent.golden.xml
@@ -4,10 +4,10 @@ <input name="i" width="2"/> <pinlocations> <loc> - parent.o - parent.i[0] - parent.i[1] - </loc> +parent.o +parent.i[0] +parent.i[1] +</loc> </pinlocations> <random> <loc>