Browse Source

xml file that does preformating of verilog files.

r29173 14 years ago
parent
commit
66b6674f6b
  1. 782
      src/spicelib/devices/adms/admst/prengspice.xml

782
src/spicelib/devices/adms/admst/prengspice.xml

@ -0,0 +1,782 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Tool 'prengspice.xml'
Copyright © 2011 Noovela - Author Laurent Lemaitre
This code IS to be used for non-commercial usage ONLY.
Note: publishing technical papers with the affiliation of a commercial company
which results are produced by the tool are typical commercial usage of the tool.
Commercial usage are subject to special fees.
Contact: r29173@noovela.com or www.noovela.com
-->
<!DOCTYPE admst PUBLIC "-//noovela//DTD_ADMST 2.3.0//FR" "admst.dtd">
<admst xmlns:admst="http://mot-adms.sourceforge.net/adms/admst.xml" version="2.3.0">
<admst:template match="adms.implicit.xml.module">
<admst:variable name="globalmodule" path="."/>
<admst:for-each select="modulenode">
<admst:value-to select="#module" path=".."/>
</admst:for-each>
<admst:apply-templates select="/items/tnode" match="godown"/>
<admst:apply-templates select="(modulefunctionp/functionpcode)|(modulecode)" match="init"/>
<admst:apply-templates select="(modulefunctionp/functionpcode)|(modulecode)" match="dependency"/>
<admst:for-each select="modulevariablep">
<admst:apply-templates select="default" match="e:init"/>
<admst:apply-templates select="default" match="e:#dependency"/>
</admst:for-each>
<admst:template match="modify">
<admst:choose>
<admst:when test="[datatypename='block']">
<admst:apply-templates select="reverse(blockcode)" match="modify"/>
<admst:value-to test="blockcode[#modifys=1]" select="#modifys" path="1"/>
<admst:value-to test="blockcode[#modifyd=1]" select="#modifyd" path="1"/>
<admst:value-to test="blockcode[#modifyfn=1]" select="#modifyfn" path="1"/>
<admst:value-to test="blockcode[#modifywn=1]" select="#modifywn" path="1"/>
<admst:value-to test="blockcode[#modifyc=1]" select="#modifyc" path="1"/>
</admst:when>
<admst:when test="[datatypename='conditional']">
<admst:apply-templates select="elsecode|thencode" match="modify"/>
<admst:value-to test="[thencode/#modifys=1 or elsecode/#modifys=1]" select="#modifys|ifcondition/@exvariable/#modifys" path="1"/>
<admst:value-to test="[thencode/#modifyd=1 or elsecode/#modifyd=1]" select="#modifyd|ifcondition/@exvariable/#modifyd" path="1"/>
<admst:value-to test="[thencode/#modifyfn=1 or elsecode/#modifyfn=1]" select="#modifyfn|ifcondition/@exvariable/#modifyfn" path="1"/>
<admst:value-to test="[thencode/#modifywn=1 or elsecode/#modifywn=1]" select="#modifywn|ifcondition/@exvariable/#modifywn" path="1"/>
<admst:value-to test="[thencode/#modifyc=1 or elsecode/#modifyc=1]" select="#modifyc|ifcondition/@exvariable/#modifyc" path="1"/>
</admst:when>
<admst:when test="[datatypename='whileloop']">
<admst:apply-templates select="whilecode" match="modify"/>
<admst:value-to test="[whilecode/#modifys=1]" select="#modifys|whilecondition/@exvariable/#modifys" path="1"/>
<admst:value-to test="[whilecode/#modifyd=1]" select="#modifyd|whilecondition/@exvariable/#modifyd" path="1"/>
<admst:value-to test="[whilecode/#modifyfn=1]" select="#modifyfn|whilecondition/@exvariable/#modifyfn" path="1"/>
<admst:value-to test="[whilecode/#modifywn=1]" select="#modifywn|whilecondition/@exvariable/#modifywn" path="1"/>
<admst:value-to test="[whilecode/#modifyc=1]" select="#modifyc|whilecondition/@exvariable/#modifyc" path="1"/>
<admst:apply-templates select="whilecode" match="modify"/>
</admst:when>
<admst:when test="[datatypename='forloop']">
<admst:apply-templates select="forcode" match="modify"/>
<admst:value-to test="[forcode/#modifys=1]" select="#modifys" path="1"/>
<admst:value-to test="[forcode/#modifyd=1]" select="#modifyd" path="1"/>
<admst:value-to test="[forcode/#modifyfn=1]" select="#modifyfn" path="1"/>
<admst:value-to test="[forcode/#modifywn=1]" select="#modifywn" path="1"/>
<admst:value-to test="[forcode/#modifyc=1]" select="#modifyc" path="1"/>
<admst:apply-templates select="forcode" match="modify"/>
</admst:when>
<admst:when test="[datatypename='case']">
<admst:apply-templates select="caseitem/casecode" match="modify"/>
<admst:for-each select="caseitem">
<admst:value-to test="[casecode/#modifys=1 and defaultcase='no']" select="#modifys|casealternative/@variable/#modifys" path="1"/>
<admst:value-to test="[casecode/#modifyd=1 and defaultcase='no']" select="#modifyd|casealternative/@variable/#modifyd" path="1"/>
<admst:value-to test="[casecode/#modifyfn=1 and defaultcase='no']" select="#modifyfn|casealternative/@variable/#modifyfn" path="1"/>
<admst:value-to test="[casecode/#modifywn=1 and defaultcase='no']" select="#modifywn|casealternative/@variable/#modifywn" path="1"/>
<admst:value-to test="[casecode/#modifyc=1 and defaultcase='no']" select="#modifyc|casealternative/@variable/#modifyc" path="1"/>
</admst:for-each>
<admst:value-to test="caseitem[#modifys=1]" select="#modifys|casecondition/@variable/#modifys" path="1"/>
<admst:value-to test="caseitem[#modifyd=1]" select="#modifyd|casecondition/@variable/#modifyd" path="1"/>
<admst:value-to test="caseitem[#modifyfn=1]" select="#modifyfn|casecondition/@variable/#modifyfn" path="1"/>
<admst:value-to test="caseitem[#modifywn=1]" select="#modifywn|casecondition/@variable/#modifywn" path="1"/>
<admst:value-to test="caseitem[#modifyc=1]" select="#modifyc|casecondition/@variable/#modifyc" path="1"/>
</admst:when>
<admst:when test="[datatypename='assignment']">
<admst:value-to test="lhs[exists(prototype/@protoinstance[#modifys=1])]" select="#modifys|rhs/@exvariable/#modifys" path="1"/>
<admst:value-to test="lhs[exists(prototype/@protoinstance[#modifyd=1])]" select="#modifyd|rhs/@exvariable/#modifyd" path="1"/>
<admst:value-to test="lhs[exists(prototype/@protoinstance[#modifyfn=1])]" select="#modifyfn|rhs/@exvariable/#modifyfn" path="1"/>
<admst:value-to test="lhs[exists(prototype/@protoinstance[#modifywn=1])]" select="#modifywn|rhs/@exvariable/#modifywn" path="1"/>
<admst:value-to test="lhs[exists(prototype/@protoinstance[#modifyc=1])]" select="#modifyc|rhs/@exvariable/#modifyc" path="1"/>
<admst:value-to test="lhs/prototype/@ddxprobe" select="#TOTOddxprobe" string="yes"/>
<admst:value-to test="lhs/prototype/@ddxprobe" select="#TOTOddxprobe" string="no"/>
<admst:push select="rhs/@exvariable/prototype/@ddxprobe" path="lhs/prototype/@ddxprobe" oncompare="nature|pnode|nnode"/>
</admst:when>
<admst:when test="[datatypename='contribution']">
<admst:choose>
<admst:when test="[#modifyd=1]">
<admst:value-to select="rhs/@exvariable/#modifyd" path="1"/>
</admst:when>
<admst:when test="[#modifyfn=1]">
<admst:value-to select="rhs/@exvariable/#modifyfn" path="1"/>
</admst:when>
<admst:when test="[#modifywn=1]">
<admst:value-to select="rhs/@exvariable/#modifywn" path="1"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="#modifys|(rhs|rhs/@exvariable)/#modifys" path="1"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='nilled']"/>
<admst:when test="[datatypename='function' and arity='callfunction']">
<admst:value-to select="#modifyc|arguments/@exvariable/#modifyc" path="1"/>
</admst:when>
<admst:otherwise>
<admst:fatal format="%(datatypename): case not handled\n"/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:apply-templates select="modulecode" match="modify"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifys=1])]/#modifys" path="1"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifyd=1])]/#modifyd" path="1"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifyfn=1])]/#modifyfn" path="1"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifywn=1])]/#modifywn" path="1"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifyc=1])]/#modifyc" path="1"/>
<admst:value-to select="modulevariablep[exists(@protoinstance[#modifys=1 or #modifyd=1 or #modifyfn=1 or #modifywn=1])]/#insource" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifys=1])]/#modifys" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifyd=1])]/#modifyd" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifyfn=1])]/#modifyfn" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifywn=1])]/#modifywn" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifyc=1])]/#modifyc" path="1"/>
<admst:value-to select="@allvariablecontainer/blockvariablep[exists(@protoinstance[#modifys=1 or #modifyd=1 or #modifyfn=1 or #modifywn=1])]/#insource" path="1"/>
</admst:template>
<admst:template match="init">
<admst:choose>
<admst:when test="[datatypename='function' and arity='callfunction']">
<admst:apply-templates select="arguments" match="e:init"/>
</admst:when>
<admst:when test="[datatypename='whileloop']">
<admst:apply-templates select="whilecondition" match="e:init"/>
<admst:apply-templates select="whilecode" match="init"/>
</admst:when>
<admst:when test="[datatypename='forloop']">
<admst:apply-templates select="forinitial|forupdate" match="init"/>
<admst:apply-templates select="forcondition" match="e:init"/>
<admst:apply-templates select="forcode" match="init"/>
</admst:when>
<admst:when test="[datatypename='case']">
<admst:apply-templates select="casecondition" match="e:init"/>
<admst:for-each select="caseitem">
<admst:for-each select="casealternative">
<admst:apply-templates select="." match="e:init"/>
</admst:for-each>
<admst:apply-templates select="casecode" match="init"/>
</admst:for-each>
</admst:when>
<admst:when test="[datatypename='conditional']">
<admst:apply-templates select="ifcondition" match="e:init"/>
<admst:apply-templates select="thencode|elsecode" match="init"/>
</admst:when>
<admst:when test="[datatypename='contribution']">
<admst:apply-templates select="rhs" match="e:init"/>
</admst:when>
<admst:when test="[datatypename='assignment']">
<admst:apply-templates select="rhs" match="e:init"/>
<admst:push select="lhs/prototype/@vpprobe" path="rhs/@exprobe" oncompare="nature|pnode|nnode"/>
<admst:push select="lhs/prototype/@protoinstance" path="lhs"/>
</admst:when>
<admst:when test="[datatypename='block']">
<admst:apply-templates select="blockcode" match="init"/>
</admst:when>
<admst:when test="[datatypename='nilled']"/>
<admst:otherwise>
<admst:fatal format="%(datatypename): case not handled\n"/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:template match="e:init">
<admst:choose>
<admst:when test="[datatypename='variable']">
<admst:push select="prototype/@protoinstance" path="."/>
</admst:when>
<admst:when test="[datatypename='function']">
<admst:apply-templates select="arguments" match="e:init"/>
<admst:value-to test="[name='ddt' and exists(#contribution)]" select="#contribution/#modifyd" path="1"/>
<admst:value-to test="[name='white_noise' and exists(#contribution)]" select="#contribution/#modifywn" path="1"/>
<admst:value-to test="[name='flicker_noise' and exists(#contribution)]" select="#contribution/#modifyfn" path="1"/>
</admst:when>
</admst:choose>
</admst:template>
<admst:template match="e:#dependency">
<admst:choose>
<admst:when test="caller()/template/textmatch[value='dependency']">
<admst:apply-templates select="." match="e:#dependency"/>
<admst:value-to select="tnode/#dependency[.='constant' and $globalopdependent='yes']" string="noprobe"/>
</admst:when>
<admst:when test="caller()/template/textmatch[value='adms.implicit.xml.module']">
<admst:apply-templates select="." match="e:#dependency"/>
<admst:value-to select="tnode/#dependency[.='constant' and $globalopdependent='yes']" string="noprobe"/>
</admst:when>
<admst:when test="[datatypename='probe']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[datatypename='variable']">
<admst:choose>
<admst:when test="[exists(prototype/@protoinstance[tnode/#dependency='linear'])]">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[exists(prototype/@protoinstance[tnode/#dependency='noprobe'])]">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[(datatypename='function' and arity='unary')]">
<admst:apply-templates select="arguments[1]" match="e:#dependency"/>
<admst:value-to select="tnode/#dependency" path="arguments[1]/tnode/#dependency"/>
</admst:when>
<admst:when test="[(datatypename='function' and arity='binary')]">
<admst:apply-templates select="arguments[1]|arguments[2]" match="e:#dependency"/>
<admst:choose>
<admst:when test="[arguments[1]/tnode/#dependency='linear' or arguments[2]/tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[arguments[1]/tnode/#dependency='noprobe' or arguments[2]/tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[(datatypename='function' and arity='ternary')]">
<admst:apply-templates select="arguments[1]|arguments[2]|arguments[3]" match="e:#dependency"/>
<admst:choose>
<admst:when test="[arguments[2]/tnode/#dependency='linear' or arguments[3]/tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[arguments[1]/tnode/#dependency!='constant' or arguments[2]/tnode/#dependency='noprobe' or arguments[3]/tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='function']">
<admst:choose>
<admst:when test="[name='ddx' or name='\$ddx']">
<admst:apply-templates select="arguments[1]" match="e:#dependency"/>
<admst:choose>
<admst:when test="arguments[1]/tnode/#dependency[.='constant' or .='noprobe']">
<admst:value-to select="tnode/#dependency" path="arguments[1]/tnode/#dependency"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:otherwise>
<admst:apply-templates select="arguments" match="e:#dependency"/>
<admst:choose>
<admst:when test="arguments[tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="arguments/tnode/#dependency[.='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='number']">
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:when>
<admst:when test="[datatypename='string']">
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:when>
<admst:otherwise>
<admst:fatal format="%(datatypename): case not handled\n"/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:template match="dependency">
<admst:choose>
<admst:when test="[datatypename='function' and arity='callfunction']">
<admst:apply-templates select="arguments" match="e:#dependency"/>
<admst:choose>
<admst:when test="arguments[tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="arguments[tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='whileloop']">
<admst:apply-templates select="whilecondition" match="e:#dependency"/>
<admst:apply-templates select="[$globalopdependent='yes' or whilecondition/tnode/#dependency='constant']/whilecode" match="dependency"/>
<admst:if test="[$globalopdependent='no']">
<admst:apply-templates select="whilecondition[tnode/#dependency='constant']" match="e:#dependency"/>
<admst:if test="[whilecondition/tnode/#dependency!='constant']">
<admst:variable name="globalopdependent" string="yes"/>
<admst:apply-templates select="whilecode" match="dependency"/>
<admst:variable name="globalopdependent" string="no"/>
</admst:if>
</admst:if>
<admst:choose>
<admst:when test="[whilecode/tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[whilecondition/tnode/#dependency!='constant' or whilecode/tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='forloop']">
<admst:apply-templates select="forinitial|forupdate" match="dependency"/>
<admst:apply-templates select="forcondition" match="e:#dependency"/>
<admst:apply-templates select="[$globalopdependent='yes' or nilled((forinitial|forcondition|forupdate)/[tnode/#dependency!='constant'])]/forcode" match="dependency"/>
<admst:if test="[$globalopdependent='no']">
<admst:apply-templates select="(forinitial|forupdate)/[tnode/#dependency='constant']" match="dependency"/>
<admst:apply-templates select="forcondition[tnode/#dependency='constant']" match="e:#dependency"/>
<admst:if test="[forcondition/tnode/#dependency!='constant' or forinitial/tnode/#dependency!='constant' or forupdate/tnode/#dependency!='constant']">
<admst:variable name="globalopdependent" string="yes"/>
<admst:apply-templates select="forcode" match="dependency"/>
<admst:variable name="globalopdependent" string="no"/>
</admst:if>
</admst:if>
<admst:choose>
<admst:when test="[forcode/tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[(forcondition!='constant' or forinitial!='constant' or forupdate!='constant') or forcode/tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='case']">
<admst:apply-templates select="casecondition" match="e:#dependency"/>
<admst:for-each select="caseitem">
<admst:for-each select="casealternative">
<admst:apply-templates select="." match="e:#dependency"/>
</admst:for-each>
<admst:apply-templates select="casecode" match="dependency"/>
</admst:for-each>
</admst:when>
<admst:when test="[datatypename='conditional']">
<admst:apply-templates select="ifcondition" match="e:#dependency"/>
<admst:choose>
<admst:when test="[$globalopdependent='no' and ifcondition/tnode/#dependency!='constant']">
<admst:variable name="globalopdependent" string="yes"/>
<admst:apply-templates select="thencode|elsecode" match="dependency"/>
<admst:variable name="globalopdependent" string="no"/>
</admst:when>
<admst:otherwise>
<admst:apply-templates select="thencode|elsecode" match="dependency"/>
</admst:otherwise>
</admst:choose>
<admst:choose>
<admst:when test="[thencode/tnode/#dependency='linear' or elsecode/tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[ifcondition/tnode/#dependency!='constant' or thencode/tnode/#dependency='noprobe' or elsecode/tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='contribution']">
<admst:apply-templates select="rhs" match="e:#dependency"/>
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[datatypename='assignment']">
<admst:apply-templates select="rhs" match="e:#dependency"/>
<admst:value-to select="tnode/#dependency" path="rhs/tnode/#dependency"/>
<admst:choose>
<admst:when test="[rhs/tnode/#dependency='linear' or exists(lhs/prototype/@protoinstance[tnode/#dependency='linear'])]">
<admst:value-to select="lhs/tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="[$globalopdependent='yes' or rhs/tnode/#dependency='noprobe' or exists(lhs/prototype/@protoinstance[tnode/#dependency='noprobe'])]">
<admst:value-to select="lhs/tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="lhs/tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='block']">
<admst:apply-templates select="blockcode" match="dependency"/>
<admst:choose>
<admst:when test="blockcode[tnode/#dependency='linear']">
<admst:value-to select="tnode/#dependency" string="linear"/>
</admst:when>
<admst:when test="blockcode[tnode/#dependency='noprobe']">
<admst:value-to select="tnode/#dependency" string="noprobe"/>
</admst:when>
<admst:otherwise>
<admst:value-to select="tnode/#dependency" string="constant"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="[datatypename='nilled']"/>
<admst:otherwise>
<admst:fatal format="%(datatypename): case not handled\n"/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:variable name="globalmodule"/>
<admst:variable name="globalcontribution"/>
<admst:variable name="globalopdependent" string="no"/>
<admst:variable name="module"/>
<admst:value-to select="/#eol" string="\n"/>
<admst:value-to select="/#idx" path="0"/>
<admst:variable name="globalexpression"/>
<admst:variable name="globalwhileloop"/>
<admst:template match="godown">
<admst:variable test="value[datatypename='whileloop']" name="globalwhileloop" path="value"/>
<admst:variable test="value[datatypename='contribution']" name="globalcontribution" path="value"/>
<admst:value-to select="value[datatypename='function' and name='ddt.000000']/name" string="`%(value/name)"/>
<admst:value-to select="value[datatypename='function' and name='white_noise']/name" string="`%(value/name)"/>
<admst:value-to select="value[datatypename='function' and name='flicker_noise']/name" string="`%(value/name)"/>
<admst:value-to select="#module" path="$globalmodule"/>
<admst:value-to select="#contribution" path="$globalcontribution"/>
<admst:value-to select="#id" path="/#idx"/>
<admst:value-to test="[exists($globalwhileloop)]" select="#whileloop" path="1"/>
<admst:value-to select="/#idx" path="/#idx+1"/>
<admst:if
test="[aname='rhs' or aname='ifcondition' or aname='whilecondition' or
aname='forcondition' or aname='default' or aname='casecondition' or
(up/value/datatypename='function' and up/value/arity='callfunction' and aname='arguments')]">
<admst:variable name="globalexpression" path="."/>
<admst:push select="#module/@expression" path="."/>
<admst:value-to select="#isexpression" path="1"/>
</admst:if>
<admst:value-to test="$globalexpression" select="#expression" path="$globalexpression"/>
<admst:apply-templates select="down" match="godown"/>
<admst:value-to test="value[datatypename='block']" select="value/name" string=" blk%(#id)"/>
<admst:variable test="value[datatypename='whileloop']" name="globalwhileloop"/>
</admst:template>
<admst:variable name="af"/>
<admst:open file="mna.va">
<admst:for-each select="/items">
<admst:choose>
<admst:when test="[datatypename='discipline']">
<admst:text/>%(.)\n<admst:text/>
</admst:when>
<admst:when test="[datatypename='nature']">
<admst:value-to select="ddt_nature" path="/items[datatypename='nature' and name='%(../../ddt_name)']"/>
<admst:value-to select="idt_nature" path="/items[datatypename='nature' and name='%(../../idt_name)']"/>
<admst:text/>%(.)\n<admst:text/>
</admst:when>
<admst:when test="[datatypename='module']">
<admst:apply-templates select="." match="adms.implicit.xml.module"/>
<admst:apply-templates select="." match="domodule"/>
</admst:when>
</admst:choose>
</admst:for-each>
<admst:message format="mna.va: temporary file created\n"/>
</admst:open>
<admst:template match="domodule">
<admst:variable name="module" path="."/>
`define ddt(v) 0.0\n
`define flicker_noise(m,p,txt) 0.0\n
`define white_noise(m,txt) 0.0\n
<admst:if test="[exists(attribute)]">(*<admst:join select="attribute" separator=",">%(.)</admst:join>*)</admst:if>
module %(name)
<admst:if test="modulenode[location='external']">(<admst:join select="modulenode[location='external']" separator=", ">%(name)</admst:join>)</admst:if>;\n
<admst:for-each select="modulenode">
<admst:if test="[exists(attribute)]">(*<admst:join select="attribute" separator=",">%(.)</admst:join>*)</admst:if>
<admst:if test="[location='external']">inout %(name);\n</admst:if>
<admst:text test="[location!='ground']" format="%(discipline/name) %(name);\n"/>
<admst:text test="[location='ground']" format="ground %(name);\n"/>
</admst:for-each>
<admst:text/>%(pass0:tnode(modulecode/tnode))<admst:text/>
<admst:for-each select="$module/@mna/value">
<admst:text format="/*mna*/ (*pseudotype=&quot;mna&quot;*) electrical _%(pnode/name)%(nnode/name);\n"/>
</admst:for-each>
<admst:text select="$module/@expression/@ddtnode/[exists(#ddtnode) and up/value/datatypename!='contribution']" format="/*ddt*/ (*pseudotype=&quot;ddt&quot;*) electrical q%(#ddtnode/#id);\n"/>
<admst:for-each select="$module/@k">
<admst:if test="value[datatypename='block' or datatypename='conditional' or datatypename='assignment']">
<admst:for-each select="value/sort(@ass)">
<admst:push oncompare="." select="$module/@kkkk" path="'%(value/lhs/prototype/type) %(value/lhs/name)_%(../../#id)'"/>
</admst:for-each>
</admst:if>
</admst:for-each>
<admst:text select="$module/@kkkk" format="/*kstant*/%(.);\n"/>\n
<admst:for-each select="modulevariablep">%(.)</admst:for-each>
<admst:value-to select="/#eol" string=" \\\n"/>
<admst:for-each select="modulefunctionp">
<admst:variable name="af" path="."/>
<admst:variable name="name" path="name"/>
<admst:text/>`define _af$name(id,$name,<admst:text/>
<admst:join select="functionpvariable[(name!=$name)and(functionpscope='input' or functionpscope='inout')]" separator=",">%(name)</admst:join>
<admst:text/>) \\\n<admst:text/>
<admst:text format="begin : id \\\n"/>
<admst:for-each select="functionpvariable[(name!=$name)and functionpscope='local']">%(type|' '|name); \\\n</admst:for-each>
<!-- fixme admst:text/>%(pass0(functionpcode))<admst:text/ -->
<admst:text select="@af" format="/*af*/real %(value/name)%(#id); \\\n"/>%(pass2:tnode(value/functionpcode/tnode))<admst:text format="end /*end of af macro*/\n"/>
<admst:variable name="af"/>
</admst:for-each>
<admst:value-to select="/#eol" string="\n"/>
<admst:text format="analog\n"/>
<admst:text format="begin\n"/>
<admst:text format="begin : initial_instance\n"/>
<admst:apply-templates select="modulecode/tnode" match="pass1:%(datatypename)"/>
<admst:text format="end /* : initial_instance*/\n"/>
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////\n
<admst:text format="begin : load\n"/>
<admst:text select="$module/@mna/value"
format="/*mna*/ integer ff%(pnode/name)%(nnode/name), pp%(pnode/name)%(nnode/name); real f%(pnode/name)%(nnode/name), p%(pnode/name)%(nnode/name);\n"/>
<admst:text select="$module/@mna/value"
format="/*mna*/ ff%(pnode/name)%(nnode/name)=1; pp%(pnode/name)%(nnode/name)=1; f%(pnode/name)%(nnode/name)=0; p%(pnode/name)%(nnode/name)=0;\n"/>
<admst:text/>%(pass2:tnode(modulecode/tnode))<admst:text/>
<admst:text format="begin : mna\n"/>
<admst:for-each select="$module/@mna/value">
<admst:text format="/*mna*/ // \$debug(&quot;%(pnode/discipline/flow/access)(%(pnode/name)%(nnode[location!='ground']/(','|name))) f=%e p=%e\\n&quot;,f%(pnode/name)%(nnode/name),p%(pnode/name)%(nnode/name));\n"/>
<admst:text format="/*mna*/ %(pnode/discipline/flow/access)(%(pnode/name)%(nnode[location!='ground']/(','|name)))&lt;+"/>
<admst:text format="%(pnode/discipline/potential/access)(_%(pnode/name)%(nnode/name));\n"/>
<admst:text format="/*mna*/ if(ff%(pnode/name)%(nnode/name) &amp;&amp; pp%(pnode/name)%(nnode/name))\n"/>
<admst:text format="/*mna*/ %(pnode/discipline/flow/access)(_%(pnode/name)%(nnode/name))&lt;+"/>
<admst:text format="%(pnode/discipline/potential/access)(_%(pnode/name)%(nnode/name));\n"/>
<admst:text format="/*mna*/ else if(ff%(pnode/name)%(nnode/name))\n"/>
<admst:text format="/*mna*/ %(pnode/discipline/flow/access)(_%(pnode/name)%(nnode/name))&lt;+"/>
<admst:text format="f%(pnode/name)%(nnode/name)-%(pnode/discipline/potential/access)(_%(pnode/name)%(nnode/name));\n"/>
<admst:text format="/*mna*/ else if(pp%(pnode/name)%(nnode/name))\n"/>
<admst:text format="/*mna*/ %(pnode/discipline/flow/access)(_%(pnode/name)%(nnode/name))&lt;+"/>
<admst:text format="p%(pnode/name)%(nnode/name)-%(pnode/discipline/potential/access)(%(pnode/name)%(nnode[location!='ground']/(','|name)));\n"/>
</admst:for-each>
<admst:text format="end /* : mna*/\n"/>
<admst:text format="end /* : load*/\n"/>
<admst:text format="end\n"/>
<admst:text format="endmodule\n"/>
</admst:template>
<admst:template match="pass0:tnode">
<admst:apply-templates select="down" match="pass0:tnode"/>
<admst:variable name="tnode" path="."/>
<admst:push select="value/@ass" path="down/value/@ass[value/lhs/prototype/tnode/up!=$tnode]"/>
<admst:push select="value/@ass0" path="down/value/@ass[value/lhs/prototype/tnode/up=$tnode]"/>
<admst:push select="value[datatypename='assignment']/@ass" path="."/>
<admst:push test="[(#dependency='constant')and(../#dependency!='constant')]" select="$module/@k" path="."/>
<admst:push select="$module/@mna"
test="value[(datatypename='probe' and nature=pnode/discipline/flow) or (datatypename='contribution' and nature=pnode/discipline/potential)]"
path="." oncompare="value/(pnode|nnode)"/>
<admst:choose>
<admst:when test="value[datatypename='contribution']">
<admst:variable name="myklass" path="/@mnacontributionklass[pnode=../../value/pnode and nnode=../../value/nnode]"/>
<admst:if test="[nilled($myklass)]">
<admst:variable name="myklass" path="value"/>
<admst:push select="/@mnacontributionklass" path="value"/>
<admst:push select="value/@sw" path="value"/>
</admst:if>
<admst:value-to select="value/#zcontrib" path="$myklass"/>
<admst:value-to test="value[datatypename='contribution' and nature=pnode/discipline/potential]" select="value/#zcontrib/#psource" path="1"/>
<admst:push select="$myklass/@sw" path="value"/>
</admst:when>
<admst:when test="value[datatypename='assignment']">
<admst:choose>
<admst:when test="[up/#dependency='constant']"><admst:value-to select="#set" path="1"/></admst:when>
<admst:when test="[#dependency='constant']"><admst:value-to select="#set" path="1"/></admst:when>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='function']">
<admst:choose>
<admst:when test="value[arity='unary']">
<admst:value-to select="#ddtnode" path="value/arguments[1]/#ddtnode"/>
<admst:value-to select="value/arguments[1]/tnode/#ddtnode"/>
</admst:when>
<admst:when test="value[arity='binary']">
<admst:choose>
<admst:when test="value[name='addp' or name='addm']">
<admst:choose>
<admst:when test="value[exists(arguments[1]/tnode/#ddtnode) and exists(arguments[2]/tnode/#ddtnode)]">
<admst:value-to select="#ddtnode" path="value/arguments[1]/tnode/#ddtnode"/>
<admst:value-to select="value/(arguments[1]|arguments[2])/tnode/#ddtnode"/>
</admst:when>
</admst:choose>
</admst:when>
<admst:when test="value[name='multtime' or name='multdiv']">
<admst:choose>
<admst:when test="value[(arguments[1]/tnode/#dependency='constant' or arguments[1]/tnode/#dependency='noprobe') and exists(arguments[2]/tnode/#ddtnode)]">
<admst:value-to select="#ddtnode" path="value/arguments[2]/tnode/#ddtnode"/>
<admst:value-to select="value/arguments[2]/tnode/#ddtnode"/>
</admst:when>
<admst:when test="value[(arguments[2]/tnode/#dependency='constant' or arguments[2]/tnode/#dependency='noprobe') and exists(arguments[1]/tnode/#ddtnode)]">
<admst:value-to select="#ddtnode" path="value/arguments[1]/tnode/#ddtnode"/>
<admst:value-to select="value/arguments[1]/tnode/#ddtnode"/>
</admst:when>
</admst:choose>
</admst:when>
</admst:choose>
</admst:when>
<admst:when test="value[arity='ternary']">
<admst:if test="value[exists(arguments[2]/tnode/#ddtnode) and exists(arguments[3]/tnode/#ddtnode)]">
<admst:value-to select="#ddtnode" path="value/arguments[2]/tnode/#ddtnode"/>
<admst:value-to select="value/(arguments[2]|arguments[3])/tnode/#ddtnode"/>
</admst:if>
</admst:when>
<admst:when test="value[arity='nary' or arity='callfunction']">
<admst:if test="value[name='ddt']">
<admst:value-to select="#ddtnode" path="."/>
<admst:push select="#expression/@ddtnode" path="[#expression!=.]"/>
</admst:if>
<admst:if test="value[exists(definition)]">
<admst:push test="$af" select="$af/@af" path="."/>
<admst:push select="#expression/@af" path="."/>
</admst:if>
</admst:when>
</admst:choose>
<admst:push select="#expression/@ddtnode" path="value/arguments[exists(tnode/#ddtnode) and name!='ddt']/tnode[exists(#ddtnode)]"/>
<admst:push test="[#expression=. and exists(#ddtnode)]" select="@ddtnode" path="."/>
</admst:when>
</admst:choose>
</admst:template>
<admst:template match="pass1:tnode">
<admst:choose>
<admst:when test="value[datatypename='nilled' or datatypename='whileloop']">%(value)</admst:when>
<admst:when test="value[datatypename='contribution']">//%(value)</admst:when>
<admst:when test="value[datatypename='conditional']">
<admst:text/>%(([#dependency!='constant']/'//')|'if('|value/ifcondition|')'|/#eol)<admst:text/>
<admst:text/>%(pass1:tnode(value/thencode/tnode))<admst:text/>
<admst:if test="[exists(value/elsecode)]">%([#dependency!='constant']/'//')else%(/#eol)%(pass1:tnode(value/elsecode/tnode))</admst:if>
<admst:push oncompare="prototype" test="[#dependency='constant' and up/#dependency!='constant']" select="@assuniq" path="sort(value/@ass/value)/lhs"/>
<admst:text select="@assuniq" format="%(name)_%(../#id)=%(name);\n"/>
</admst:when>
<admst:when test="value[datatypename='assignment']">
<admst:choose>
<admst:when test="[up/#dependency='constant']">%(value)</admst:when>
<admst:when test="[#dependency='constant']">begin %(value/(lhs/name|'_'|../#id|'='|rhs)); %(value/lhs/(name|'='|name))_%(#id); end%(/#eol)</admst:when>
<admst:otherwise>//%(value)</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='function']">
<admst:choose>
<admst:when test="value[name='\$strobe' or name='\$debug']">;//aaaaaa %(value)</admst:when>
<admst:otherwise>
<admst:text test="[#dependency!='constant']" format=";// "/>%(value)<admst:text/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='block']">
<admst:push test="[#dependency='constant' and up/#dependency!='constant']" oncompare="prototype" select="@assuniq" path="sort(value/@ass/value)/lhs"/>
<admst:push oncompare="prototype" select="@dec0" path="value/@ass0[#set=1]/value/lhs"/>
<admst:text format="begin : blk%(#id)%(/#eol)"/>
<!--admst:text format="%(value/blockvariablep/(type|' '|name|';'|/#eol))"/-->
<admst:text select="@dec0/prototype" format="%((type|' '|name|';'|/#eol))"/>
<admst:text/>%(pass1:tnode(down))<admst:text/>
<admst:text select="@assuniq" format="%(name)_%(../#id)=%(name);\n"/>
<admst:text format="end%(/#eol)"/>
</admst:when>
</admst:choose>
</admst:template>
<admst:template match="pass2:tnode">
<admst:for-each select="down[#isexpression=1]">
<admst:text test="[nilled($af)and(exists(@af))]" format="begin : _%(tnode/@af[1]/#id)\n%(@af/'real %(name)%(tnode/#id);\n')"/>
<admst:for-each select="@af">
<admst:text/>`_af%(value/name)(id%(value/name)%(#id),%(value/name)%(#id),<admst:join select="value/arguments" separator=",">%(pass2:tnode(tnode))</admst:join>
<admst:text/>)%(/#eol)<admst:text/>
</admst:for-each>
<admst:for-each select="@ddtnode[nilled(#ddtnode)]">
<admst:value-to select="value[name='ddt']/name" string=""/>
</admst:for-each>
<admst:for-each select="@ddtnode[exists(#ddtnode) and up/value/datatypename!='contribution']">
<admst:value-to select="[#expression!=. or (#expression=. and value/name='ddt')]/value/name" string=""/>
<admst:text/>I(q%(#ddtnode/#id))&lt;+ddt(%(pass2:tnode(.)));\n<admst:text/>
<admst:text/>I(q%(#ddtnode/#id))&lt;+-V(q%(#ddtnode/#id));\n<admst:text/>
</admst:for-each>
<admst:for-each select="@ddtnode[exists(#ddtnode)]">
<admst:if test="[not(#expression=. and up/value/datatypename='contribution')]">
<admst:value-to select="value/#format" string="V(q%(#ddtnode/#id))"/>
</admst:if>
</admst:for-each>
</admst:for-each>
<admst:if test="[aname='attribute']">(*%(value)*)</admst:if>
<admst:choose>
<admst:when test="value[datatypename='variablep']"></admst:when>
<admst:when test="value[datatypename='conditional']">
<admst:choose>
<admst:when test="[(nilled($af))and(#dependency='constant')]">
<admst:push oncompare="prototype" select="@assuniq" path="sort(value/@ass/value)/lhs"/>
<admst:text select="@assuniq" format="%(name)=%(name)_%(../#id);\n"/>
</admst:when>
<admst:otherwise>
<admst:text format="if("/>%(pass2:tnode(value/ifcondition/tnode)))%(/#eol)<admst:text/>
<admst:text/>%(pass2:tnode(value/thencode/tnode))<admst:text/>
<admst:if test="value[exists(elsecode)]">else%(/#eol)<admst:text/>%(pass2:tnode(value/elsecode/tnode))<admst:text/></admst:if>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='assignment']">
<admst:choose>
<admst:when test="[#dependency='constant']">%(value/lhs/name)=%(value/lhs/name)_%(#id);%(/#eol)</admst:when>
<admst:otherwise>%(value/lhs/name)=%(pass2:tnode(value/rhs/tnode));%(/#eol)</admst:otherwise>
</admst:choose>
<admst:text test="value/rhs[nilled($af)and(exists(@af))]" format="end //%(@af[1]/#id)%(/#eol)"/>
</admst:when>
<admst:when test="value[datatypename='contribution']">
<admst:text format="begin%(/#eol)"/>
<admst:choose>
<admst:when test="value[exists(#zcontrib) and nature=pnode/discipline/potential]">ff%(value/pnode/name)%(value/nnode/name)=0;f%(value/pnode/name)%(value/nnode/name)=0;p%(value/pnode/name)%(value/nnode/name)=p%(value/pnode/name)%(value/nnode/name)+</admst:when>
<admst:when test="value[exists(#zcontrib) and exists(#zcontrib/#psource) and nature=pnode/discipline/flow]">ff%(value/pnode/name)%(value/nnode/name)=1;p%(value/pnode/name)%(value/nnode/name)=0;f%(value/pnode/name)%(value/nnode/name)=f%(value/pnode/name)%(value/nnode/name)+</admst:when>
<admst:otherwise>
<admst:choose>
<admst:when test="value/nnode[location='ground']">%(value/nature/access)(%(value/pnode/name))&lt;+</admst:when>
<admst:otherwise>%(value/nature/access)(%((value/pnode/name|','|value/nnode/name)))&lt;+</admst:otherwise>
</admst:choose>
</admst:otherwise>
</admst:choose>
<admst:choose>
<admst:when test="value/rhs[datatypename='function' and name='ddt']">
<admst:text/>%(value/rhs);%(/#eol)<admst:text/>
</admst:when>
<admst:when test="[exists(value/rhs/tnode/#ddtnode)]">
<admst:text/>ddt(%(value/rhs));%(/#eol)<admst:text/>
</admst:when>
<admst:otherwise>%(value/rhs);%(/#eol)</admst:otherwise>
</admst:choose>
<admst:text format="end%(/#eol)"/>
</admst:when>
<admst:when test="value[datatypename='case']">
<admst:text/>case (%(pass2:tnode(value/casecondition/tnode)))%(/#eol)<admst:text/>
<admst:for-each select="value/caseitem">
<admst:join select="value/casealternative" separator=",">%(value)</admst:join>
<admst:if test="value/[defaultcase='yes']">default</admst:if>: %(/#eol)%(pass2:tnode(value/casecode/tnode))</admst:for-each>endcase%(/#eol)<admst:text/>
</admst:when>
<admst:when test="value[datatypename='block']">
<admst:choose>
<admst:when test="[(nilled($af))and(#dependency='constant')]">
<admst:text format="begin /*blk%(#id) replaced*/\n"/>
<admst:push oncompare="prototype" select="@assuniq" path="sort(value/@ass/value)/lhs"/>
<admst:text select="@assuniq" format="%(name)=%(name)_%(../#id);\n"/>
<admst:text format="end\n"/>
</admst:when>
<admst:otherwise>
<admst:text format="begin : blk%(#id)%(/#eol)"/>
<admst:text/>%(value/blockvariablep/(type|' '|name|';'|/#eol))%(pass2:tnode(down))<admst:text/>
<admst:text format="end%(/#eol)"/>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='variable']">%(value/name)</admst:when>
<admst:when test="value[datatypename='string']">%(value)</admst:when>
<admst:when test="value[datatypename='number']">%(value)</admst:when>
<admst:when test="value[datatypename='probe']">
<admst:choose>
<admst:when test="value[nature=pnode/discipline/flow]">
<admst:text format="%(value/pnode/discipline/potential/access)(_%(value/pnode/name)%(value/nnode/name))"/>
</admst:when>
<admst:otherwise>
<admst:choose>
<admst:when test="value/nnode[location='ground']">%(value/nature/access)(%(value/pnode/name))</admst:when>
<admst:otherwise>%(value/nature/access)(%((value/pnode/name|','|value/nnode/name)))</admst:otherwise>
</admst:choose>
</admst:otherwise>
</admst:choose>
</admst:when>
<admst:when test="value[datatypename='function' and arity='nary' and exists(definition)]">%(value/name)%(#id)</admst:when>
<admst:when test="[value/datatypename='function' and value/arity='callfunction' and #dependency='constant']">//%(value)</admst:when>
<!--modulecode blockcode thencode elsecode: value est 0-->
<admst:when test="[aname='name']"/>
<admst:when test="[aname='first']"/>
<admst:otherwise>%(value)</admst:otherwise>
</admst:choose>
</admst:template>
</admst>
Loading…
Cancel
Save