|
|
@ -3,7 +3,12 @@ |
|
|
<!-- |
|
|
<!-- |
|
|
$Id$ |
|
|
$Id$ |
|
|
$Log$ |
|
|
$Log$ |
|
|
Revision 1.9 2007-04-26 13:04:34 r29173 |
|
|
|
|
|
|
|
|
Revision 1.10 2007-04-30 13:10:35 r29173 |
|
|
|
|
|
improved 'guesstopology' |
|
|
|
|
|
fixed implementation of macro 'noise' |
|
|
|
|
|
when building 'load' traverse block 'noise' |
|
|
|
|
|
|
|
|
|
|
|
Revision 1.9 2007/04/26 13:04:34 r29173 |
|
|
added cases initializeModel, initiliazeInstance (block name used by psp102) |
|
|
added cases initializeModel, initiliazeInstance (block name used by psp102) |
|
|
|
|
|
|
|
|
Revision 1.8 2007/04/24 12:26:36 r29173 |
|
|
Revision 1.8 2007/04/24 12:26:36 r29173 |
|
|
@ -56,33 +61,30 @@ |
|
|
--> |
|
|
--> |
|
|
|
|
|
|
|
|
<!DOCTYPE admst SYSTEM "admst.dtd"> |
|
|
<!DOCTYPE admst SYSTEM "admst.dtd"> |
|
|
<admst version="2.2.0" xmlns:admst="http://mot-adms.sourceforge.net/xml-files/admst"> |
|
|
|
|
|
|
|
|
<admst version="2.2.6" xmlns:admst="http://mot-adms.sourceforge.net/xml-files/admst"> |
|
|
|
|
|
|
|
|
<!-- expression//function: mapping verilog-name == C-name of function --> |
|
|
<!-- expression//function: mapping verilog-name == C-name of function --> |
|
|
<admst:template match="function:getname"> |
|
|
|
|
|
|
|
|
<admst:template match="fname"> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
<admst:when test="[name='abs']"><admst:value-of select="'fabs'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$shrinkl']"><admst:value-of select="'shrinkl'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$shrinka']"><admst:value-of select="'shrinka'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='log']"><admst:value-of select="'log10'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='ln']"><admst:value-of select="'log'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='limexp']"><admst:value-of select="'limexp'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$limexp']"><admst:value-of select="'limexp'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$model']"><admst:value-of select="'_modelname'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$instance']"><admst:value-of select="'_instancename'"/></admst:when> |
|
|
|
|
|
<admst:when test="[name='\$temperature']"><admst:value-of select="'_circuit_temp'"/></admst:when> |
|
|
|
|
|
<admst:otherwise><admst:value-of select="name"/></admst:otherwise> |
|
|
|
|
|
|
|
|
<admst:when test="[name='abs']">fabs</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$shrinkl']">shrinkl</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$shrinka']">shrinka</admst:when> |
|
|
|
|
|
<admst:when test="[name='log']">log10</admst:when> |
|
|
|
|
|
<admst:when test="[name='ln']">log</admst:when> |
|
|
|
|
|
<admst:when test="[name='limexp']">limexp</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$limexp']">limexp</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$model']">_modelname</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$instance']">_instancename</admst:when> |
|
|
|
|
|
<admst:when test="[name='\$temperature']">_circuit_temp</admst:when> |
|
|
|
|
|
<admst:otherwise>%(name)</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:template> |
|
|
</admst:template> |
|
|
|
|
|
|
|
|
<admst:template match="function"> |
|
|
<admst:template match="function"> |
|
|
<admst:value-of select="name"/> |
|
|
|
|
|
<admst:variable name="function" select="%s"/> |
|
|
|
|
|
<admst:variable name="args" select=""/> |
|
|
|
|
|
|
|
|
<admst:variable name="function" select="%(name)"/> |
|
|
|
|
|
<admst:variable name="args"/> |
|
|
<admst:for-each select="arguments"> |
|
|
<admst:for-each select="arguments"> |
|
|
<admst:if test="[not($args='')]"> |
|
|
|
|
|
<admst:variable name="args" select="$args,"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
|
|
|
<admst:variable test="[exists($args)]" name="args" select="$args,"/> |
|
|
<admst:apply-templates select="." match="subexpression:stringify:noprobe"/> |
|
|
<admst:apply-templates select="." match="subexpression:stringify:noprobe"/> |
|
|
<admst:variable name="args" select="$args%s"/> |
|
|
<admst:variable name="args" select="$args%s"/> |
|
|
</admst:for-each> |
|
|
</admst:for-each> |
|
|
@ -95,7 +97,7 @@ |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:when test="[name='\$given']"> |
|
|
<admst:when test="[name='\$given']"> |
|
|
<admst:for-each select="arguments[position(.)=1]"> |
|
|
<admst:for-each select="arguments[position(.)=1]"> |
|
|
<admst:if test="adms[datatypename!='variable']"> |
|
|
|
|
|
|
|
|
<admst:if test="[datatypename!='variable']"> |
|
|
<admst:error format="$given: argument is not a variable\n"/> |
|
|
<admst:error format="$given: argument is not a variable\n"/> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
<admst:if test="[input='no']"> |
|
|
<admst:if test="[input='no']"> |
|
|
@ -116,13 +118,10 @@ |
|
|
</admst:otherwise> |
|
|
</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:for-each> |
|
|
</admst:for-each> |
|
|
<admst:if test="/simulator/probe"> |
|
|
|
|
|
<admst:value-to select="/simulator/ddx" value="0.0"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:otherwise> |
|
|
<admst:otherwise> |
|
|
<admst:variable name="mycode" select=""/> |
|
|
|
|
|
<admst:if test="[not(nilled(arguments))]"> |
|
|
|
|
|
|
|
|
<admst:variable name="mycode"/> |
|
|
|
|
|
<admst:if test="[exists(arguments)]"> |
|
|
<admst:for-each select="arguments"> |
|
|
<admst:for-each select="arguments"> |
|
|
<admst:apply-templates select="." match="subexpression:stringify:noprobe"/> |
|
|
<admst:apply-templates select="." match="subexpression:stringify:noprobe"/> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
@ -136,202 +135,114 @@ |
|
|
</admst:for-each> |
|
|
</admst:for-each> |
|
|
<admst:variable name="mycode" select="($mycode)"/> |
|
|
<admst:variable name="mycode" select="($mycode)"/> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
<admst:apply-templates select="." match="function:getname"/> |
|
|
|
|
|
<admst:variable name="mycode" select="%s$mycode"/> |
|
|
|
|
|
|
|
|
<admst:variable name="mycode" select="%(fname(.))$mycode"/> |
|
|
<admst:value-to select="/simulator/tmp" value="$mycode"/> |
|
|
<admst:value-to select="/simulator/tmp" value="$mycode"/> |
|
|
</admst:otherwise> |
|
|
</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
|
|
|
|
|
|
</admst:template> |
|
|
</admst:template> |
|
|
|
|
|
|
|
|
<admst:template match="guesstopology:variable:declaration"> |
|
|
|
|
|
<admst:for-each select="module/evaluation/variable"> |
|
|
|
|
|
<admst:assert test="adms[datatypename='variable']" format="expecting datatypename=variable\n"/> |
|
|
|
|
|
<admst:if test="[scope='local' and OPdependent='no']"> |
|
|
|
|
|
<admst:value-of select="name"/> |
|
|
|
|
|
<admst:if test="[type='integer']">int %s;\n</admst:if> |
|
|
|
|
|
<admst:if test="[type='real']">double %s=0.0/0.0;\n</admst:if> |
|
|
|
|
|
<admst:if test="[type='string']">char* %s;\n</admst:if> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
<admst:reset select="module/evaluation/variable"/> |
|
|
|
|
|
</admst:template> |
|
|
|
|
|
|
|
|
|
|
|
<admst:template match="guesstopology"> |
|
|
|
|
|
|
|
|
<admst:template match="evaluatetopology"> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
|
|
|
|
|
|
<admst:when test="admst(.)/absolute[datatypefamily='basictype']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='callfunction']"/> |
|
|
|
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='whileloop']"> |
|
|
|
|
|
<admst:apply-templates select="whileblock" match="guesstopology"/> |
|
|
|
|
|
<admst:apply-templates select="while" match="guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='callfunction']"/> |
|
|
|
|
|
<admst:when test="[datatypename='whileloop']"> |
|
|
|
|
|
<admst:apply-templates select="whileblock" match="evaluatetopology"/> |
|
|
|
|
|
<admst:apply-templates select="while" match="evaluatetopology"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='conditional']"> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='conditional']"> |
|
|
<admst:if test="if[nilled(variable[OPdependent='yes'])]"> |
|
|
<admst:if test="if[nilled(variable[OPdependent='yes'])]"> |
|
|
<admst:apply-templates select="if" match="guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:apply-templates select="if" match="evaluatetopology"/> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
<admst:when test="if/math[dependency='constant']"> |
|
|
<admst:when test="if/math[dependency='constant']"> |
|
|
<admst:apply-templates select="if" match="expression:stringify:noprobe"/> |
|
|
<admst:apply-templates select="if" match="expression:stringify:noprobe"/> |
|
|
<admst:text format="if\n(%s)\n"/> |
|
|
<admst:text format="if\n(%s)\n"/> |
|
|
<admst:text format="{\n"/> |
|
|
<admst:text format="{\n"/> |
|
|
<admst:apply-templates select="then" match="guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:apply-templates select="then" match="evaluatetopology"/> |
|
|
<admst:text format="}\n"/> |
|
|
<admst:text format="}\n"/> |
|
|
<admst:if test="[not(nilled(else))]"> |
|
|
|
|
|
|
|
|
<admst:if test="[exists(else)]"> |
|
|
<admst:text format="else\n"/> |
|
|
<admst:text format="else\n"/> |
|
|
<admst:text format="{\n"/> |
|
|
<admst:text format="{\n"/> |
|
|
<admst:apply-templates select="else" match="guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:apply-templates select="else" match="evaluatetopology"/> |
|
|
<admst:text format="}\n"/> |
|
|
<admst:text format="}\n"/> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:otherwise> |
|
|
<admst:otherwise> |
|
|
<admst:apply-templates select="then" match="guesstopology"/> |
|
|
|
|
|
<admst:apply-templates select="else" match="guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:apply-templates select="then" match="evaluatetopology"/> |
|
|
|
|
|
<admst:apply-templates select="else" match="evaluatetopology"/> |
|
|
</admst:otherwise> |
|
|
</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='contribution']"> |
|
|
|
|
|
<admst:value-of select="lhs/discipline/potential"/> |
|
|
|
|
|
<admst:if test="lhs[nature='%p']"> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='contribution']"> |
|
|
|
|
|
<admst:if test="lhs[discipline/potential=nature]"> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
<admst:when test="lhs/branch[grounded='no']"> |
|
|
<admst:when test="lhs/branch[grounded='no']"> |
|
|
<admst:if test="lhs/branch/nnode[location='internal']"> |
|
|
|
|
|
<admst:value-of select="lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:value-of select="lhs/branch/nnode/name"/> |
|
|
|
|
|
<admst:text format="here->%sNode = here->%sNode; /* nnode collapsed */ \n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
<admst:if test="lhs/branch/pnode[location='internal']"> |
|
|
|
|
|
<admst:value-of select="lhs/branch/nnode/name"/> |
|
|
|
|
|
<admst:value-of select="lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="here->%sNode = here->%sNode; /* pnode collapsed */ \n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
|
|
|
<admst:text test="lhs/branch/nnode[location='internal']" |
|
|
|
|
|
format="here->%(lhs/branch/nnode/name)Node = here->%(lhs/branch/pnode/name)Node; /* nnode collapsed */ \n"/> |
|
|
|
|
|
<admst:text test="lhs/branch/pnode[location='internal']" |
|
|
|
|
|
format="here->%(lhs/branch/pnode/name)Node = here->%(lhs/branch/nnode/name)Node; /* pnode collapsed */ \n"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:otherwise> |
|
|
<admst:otherwise> |
|
|
<admst:value-of select="lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="here->%sNode = 0; /* pnode collapsed to GND */ \n"/> |
|
|
|
|
|
|
|
|
<admst:text format="here->%(lhs/branch/pnode/name)Node = 0; /* pnode collapsed to GND */ \n"/> |
|
|
</admst:otherwise> |
|
|
</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
|
|
|
<admst:variable name="contribution" select="%(.)"/> |
|
|
|
|
|
<admst:variable name="psource" select="%(lhs/branch/pnode)"/> |
|
|
|
|
|
<admst:variable name="nsource" select="%(lhs/branch/nnode)"/> |
|
|
<admst:for-each select="rhs/probe"> |
|
|
<admst:for-each select="rhs/probe"> |
|
|
|
|
|
<admst:variable name="pprobe" select="%(branch/pnode)"/> |
|
|
|
|
|
<admst:variable name="nprobe" select="%(branch/nnode)"/> |
|
|
|
|
|
<admst:choose> |
|
|
|
|
|
<admst:when test="$contribution[static='yes']"> <admst:text format=" static_"/> </admst:when> |
|
|
|
|
|
<admst:when test="$contribution[dynamic='yes']"> <admst:text format=" dynamic_"/> </admst:when> |
|
|
|
|
|
<admst:when test="$contribution[whitenoise='yes']"> <admst:text format=" whitenoise_"/> </admst:when> |
|
|
|
|
|
<admst:when test="$contribution[flickernoise='yes']"> <admst:text format=" flickernoise_"/> </admst:when> |
|
|
|
|
|
</admst:choose> |
|
|
<admst:choose> |
|
|
<admst:choose> |
|
|
<admst:when test="../..[static='yes']"> |
|
|
|
|
|
<admst:text format=" static_"/> |
|
|
|
|
|
|
|
|
<admst:when test="[($nprobe/grounded='no')and($nsource/grounded='no')]"> |
|
|
|
|
|
<admst:text format="jacobian4(%($psource/name),%($nsource/name),%($pprobe/name),%($nprobe/name))\n"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:when test="../..[dynamic='yes']"> |
|
|
|
|
|
<admst:text format=" dynamic_"/> |
|
|
|
|
|
|
|
|
<admst:when test="[($nprobe/grounded='no')and($nsource/grounded='yes')]"> |
|
|
|
|
|
<admst:text format="jacobian2p(%($psource/name),%($pprobe/name),%($nprobe/name))\n"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:when test="../..[whitenoise='yes']"> |
|
|
|
|
|
<admst:text format=" whitenoise_"/> |
|
|
|
|
|
|
|
|
<admst:when test="[$nsource/grounded='no']"> |
|
|
|
|
|
<admst:text format="jacobian2s(%($psource/name),%($nsource/name),%($pprobe/name))\n"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:when test="../..[flickernoise='yes']"> |
|
|
|
|
|
<admst:text format=" flickernoise_"/> |
|
|
|
|
|
|
|
|
<admst:when test="[$nsource/grounded='yes']"> |
|
|
|
|
|
<admst:text format="jacobian1(%($psource/name),%($pprobe/name))\n"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
<admst:otherwise/> |
|
|
|
|
|
</admst:choose> |
|
|
|
|
|
<admst:choose> |
|
|
|
|
|
<admst:when test="branch/nnode[grounded='no']"> |
|
|
|
|
|
<admst:if test="../../lhs/branch/nnode[grounded='no']"> |
|
|
|
|
|
<admst:value-of select="branch/nnode/name"/> |
|
|
|
|
|
<admst:value-of select="branch/pnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/nnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="jacobian4(%s,%s,%s,%s)\n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
<admst:if test="../../lhs/branch/nnode[grounded='yes']"> |
|
|
|
|
|
<admst:value-of select="branch/nnode/name"/> |
|
|
|
|
|
<admst:value-of select="branch/pnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="jacobian2p(%s,%s,%s)\n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:otherwise> |
|
|
|
|
|
<admst:if test="../../lhs/branch/nnode[grounded='no']"> |
|
|
|
|
|
<admst:value-of select="branch/pnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/nnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="jacobian2s(%s,%s,%s)\n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
<admst:if test="../../lhs/branch/nnode[grounded='yes']"> |
|
|
|
|
|
<admst:value-of select="branch/pnode/name"/> |
|
|
|
|
|
<admst:value-of select="../../lhs/branch/pnode/name"/> |
|
|
|
|
|
<admst:text format="jacobian1(%s,%s)\n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:otherwise> |
|
|
|
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:for-each> |
|
|
</admst:for-each> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='assignment']"> |
|
|
|
|
|
<admst:if test="math[dependency='constant']"> |
|
|
|
|
|
<admst:if test="lhs[insource='yes' and OPdependent='no']"> |
|
|
|
|
|
<admst:apply-templates select="lhs" match="variable:lhs"/> |
|
|
|
|
|
<admst:apply-templates select="rhs" match="expression:stringify:noprobe"/> |
|
|
|
|
|
<admst:text format="=%s;\n"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='assignment']"> |
|
|
|
|
|
<admst:if test="[(lhs/insource='yes') and (lhs/OPdependent='no')]"> |
|
|
|
|
|
<admst:apply-templates select="lhs" match="variable:lhs"/> |
|
|
|
|
|
<admst:text format="="/> |
|
|
|
|
|
<admst:apply-templates select="rhs" match="expression:stringify:noprobe"/> |
|
|
|
|
|
<admst:text format="%s;\n"/> |
|
|
</admst:if> |
|
|
</admst:if> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='block']"> |
|
|
|
|
|
<admst:for-each select="item"> |
|
|
|
|
|
<admst:apply-templates select="." match="guesstopology"/> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='block']"> |
|
|
|
|
|
<admst:apply-templates select="item" match="evaluatetopology"/> |
|
|
</admst:when> |
|
|
</admst:when> |
|
|
|
|
|
|
|
|
<admst:when test="adms[datatypename='expression']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='probe']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='variable']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='mapply_unary']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='mapply_binary']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='mapply_ternary']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='function']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='number']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='string']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='nilled']"/> |
|
|
|
|
|
<admst:when test="adms[datatypename='blockvariable']"/> |
|
|
|
|
|
|
|
|
<admst:when test="[datatypename='expression']"/> |
|
|
|
|
|
<admst:when test="[datatypename='probe']"/> |
|
|
|
|
|
<admst:when test="[datatypename='variable']"/> |
|
|
|
|
|
<admst:when test="[datatypename='mapply_unary']"/> |
|
|
|
|
|
<admst:when test="[datatypename='mapply_binary']"/> |
|
|
|
|
|
<admst:when test="[datatypename='mapply_ternary']"/> |
|
|
|
|
|
<admst:when test="[datatypename='function']"/> |
|
|
|
|
|
<admst:when test="[datatypename='number']"/> |
|
|
|
|
|
<admst:when test="[datatypename='string']"/> |
|
|
|
|
|
<admst:when test="[datatypename='nilled']"/> |
|
|
|
|
|
<admst:when test="[datatypename='blockvariable']"/> |
|
|
<admst:otherwise> |
|
|
<admst:otherwise> |
|
|
<admst:value-of select="adms/datatypename"/> |
|
|
|
|
|
<admst:fatal format="%s: adms element not implemented\n"/> |
|
|
|
|
|
|
|
|
<admst:fatal format="%(datatypename): adms element not implemented\n"/> |
|
|
</admst:otherwise> |
|
|
</admst:otherwise> |
|
|
</admst:choose> |
|
|
</admst:choose> |
|
|
</admst:template> |
|
|
</admst:template> |
|
|
|
|
|
|
|
|
<admst:template match="analog:guesstopology"> |
|
|
|
|
|
<admst:if test="code"> |
|
|
|
|
|
<admst:assert test="code/adms[datatypename='block']" format="expecting datatypename=block\n"/> |
|
|
|
|
|
<admst:for-each select="code/item"> |
|
|
|
|
|
<admst:if test="adms[datatypename='block']"> |
|
|
|
|
|
<admst:if test="[name!='initial_model' and name!='initial_instance' and name!='initializeModel' and name!='initializeInstance' |
|
|
|
|
|
and name!='initial_step' and name!='noise']"> |
|
|
|
|
|
<admst:apply-templates select="." match="block:local:declaration"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
<admst:if test="adms[datatypename!='block']"> |
|
|
|
|
|
<admst:apply-templates select="." match="block:local:declaration"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
<admst:apply-templates select="code" match="guesstopology:variable:declaration"/> |
|
|
|
|
|
<admst:for-each select="code/item"> |
|
|
|
|
|
<admst:choose> |
|
|
|
|
|
<admst:when test="adms[datatypename!='block']"> |
|
|
|
|
|
<admst:apply-templates select="." match="guesstopology"/> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:otherwise> |
|
|
|
|
|
<admst:if test="[name!='initial_model' and name!='initial_instance' and name!='initializeModel' and name!='initializeInstance' |
|
|
|
|
|
and name!='initial_step' and name!='noise']"> |
|
|
|
|
|
<admst:apply-templates select="." match="guesstopology"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:otherwise> |
|
|
|
|
|
</admst:choose> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:template> |
|
|
|
|
|
|
|
|
|
|
|
<admst:template match="code"> |
|
|
<admst:template match="code"> |
|
|
<admst:value-of select="attribute[name='ngspicename']/value"/> |
|
|
|
|
|
<admst:variable name="module" select="%s"/> |
|
|
|
|
|
|
|
|
|
|
|
#include "ngspice.h" |
|
|
#include "ngspice.h" |
|
|
#include "cktdefs.h" |
|
|
#include "cktdefs.h" |
|
|
@ -342,7 +253,7 @@ |
|
|
#include "ifsim.h" |
|
|
#include "ifsim.h" |
|
|
#include "suffix.h" |
|
|
#include "suffix.h" |
|
|
|
|
|
|
|
|
#define jacobian(a,b) here->PTR_J_##a##_##b##_required=1; |
|
|
|
|
|
|
|
|
#define jacobian(a,b) here->PTR_J_##a##_##b##_required=1; |
|
|
#define static_jacobian4(p,q,r,s) jacobian(p,r) jacobian(p,s) jacobian(q,r) jacobian(q,s) |
|
|
#define static_jacobian4(p,q,r,s) jacobian(p,r) jacobian(p,s) jacobian(q,r) jacobian(q,s) |
|
|
#define static_jacobian2s(p,q,r) jacobian(p,r) jacobian(q,r) |
|
|
#define static_jacobian2s(p,q,r) jacobian(p,r) jacobian(q,r) |
|
|
#define static_jacobian2p(p,r,s) jacobian(p,r) jacobian(p,s) |
|
|
#define static_jacobian2p(p,r,s) jacobian(p,r) jacobian(p,s) |
|
|
@ -364,24 +275,69 @@ |
|
|
int $(module)guesstopology (SMPmatrix *matrix, CKTcircuit *ckt, $(module)model *model, $(module)instance *here) |
|
|
int $(module)guesstopology (SMPmatrix *matrix, CKTcircuit *ckt, $(module)model *model, $(module)instance *here) |
|
|
/* guess topology */ |
|
|
/* guess topology */ |
|
|
{ |
|
|
{ |
|
|
<admst:apply-templates select="analog" match="analog:guesstopology"/> |
|
|
|
|
|
|
|
|
<admst:template match="evaluate.localvariables"> |
|
|
|
|
|
<admst:choose> |
|
|
|
|
|
<admst:when test="[datatypename='assignment']"> |
|
|
|
|
|
<admst:if test="[(lhs/insource='yes') and (lhs/OPdependent='no')]"> |
|
|
|
|
|
<admst:push select="lhs[scope='local']" into="$localvariables" onduplicate="ignore"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:when test="[datatypename='block']"> |
|
|
|
|
|
<admst:apply-templates select="item" match="evaluate.localvariables"/> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:when test="[datatypename='conditional']"> |
|
|
|
|
|
<admst:push select="if/variable[scope='local' and OPdependent='no']" into="$localvariables" onduplicate="ignore"/> |
|
|
|
|
|
<admst:apply-templates select="then" match="evaluate.localvariables"/> |
|
|
|
|
|
<admst:apply-templates select="else" match="evaluate.localvariables"/> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:when test="[datatypename='whileloop']"> |
|
|
|
|
|
<admst:apply-templates select="whileblock" match="evaluate.localvariables"/> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:when test="[datatypename='case']"> |
|
|
|
|
|
<admst:apply-templates select="caseitem/code" match="evaluate.localvariables"/> |
|
|
|
|
|
</admst:when> |
|
|
|
|
|
<admst:when test="[datatypename='contribution']"/> |
|
|
|
|
|
<admst:when test="[datatypename='nilled']"/> |
|
|
|
|
|
<admst:when test="[datatypename='callfunction']"/> |
|
|
|
|
|
<admst:when test="[datatypename='blockvariable']"/> |
|
|
|
|
|
<admst:otherwise> |
|
|
|
|
|
<admst:error format="'%(datatypename): should not be reached\n"/> |
|
|
|
|
|
</admst:otherwise> |
|
|
|
|
|
</admst:choose> |
|
|
|
|
|
</admst:template> |
|
|
|
|
|
<admst:for-each select="analog/code[datatypename='block']/item"> |
|
|
|
|
|
<admst:if test="[(datatypename!='block') or (datatypename='block' |
|
|
|
|
|
and name!='initial_model' and name!='initializeModel' and name!='initial_instance' and name!='initializeInstance' |
|
|
|
|
|
and name!='initial_step' and name!='noise')]"> |
|
|
|
|
|
<admst:apply-templates select="." match="evaluate.localvariables"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
<admst:for-each select="$localvariables"> |
|
|
|
|
|
<admst:if test="[type='integer']">int %(name);\n</admst:if> |
|
|
|
|
|
<admst:if test="[type='real']">double %(name)=0.0/0.0;\n</admst:if> |
|
|
|
|
|
<admst:if test="[type='string']">char* %(name);\n</admst:if> |
|
|
|
|
|
</admst:for-each> |
|
|
|
|
|
<admst:for-each select="analog/code[datatypename='block']/item"> |
|
|
|
|
|
<admst:if test="[(datatypename!='block') or (datatypename='block' |
|
|
|
|
|
and name!='initial_model' and name!='initializeModel' and name!='initial_instance' and name!='initializeInstance' |
|
|
|
|
|
and name!='initial_step' and name!='noise')]"> |
|
|
|
|
|
<admst:apply-templates select="." match="evaluatetopology"/> |
|
|
|
|
|
</admst:if> |
|
|
|
|
|
</admst:for-each> |
|
|
return(OK); |
|
|
return(OK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
</admst:template> |
|
|
</admst:template> |
|
|
|
|
|
|
|
|
|
|
|
<admst:variable name="localvariables"/> |
|
|
<admst:for-each select="/module"> |
|
|
<admst:for-each select="/module"> |
|
|
<admst:value-of select="attribute[name='ngspicename']/value"/> |
|
|
|
|
|
<admst:open file="%sguesstopology.c"> |
|
|
|
|
|
<admst:value-of select="/simulator/package_string"/> |
|
|
|
|
|
<admst:text format="/***\n*** Interface: %s\n"/> |
|
|
|
|
|
<admst:value-of select="/simulator/currentdate"/> |
|
|
|
|
|
<admst:value-of select="/simulator/fullname"/> |
|
|
|
|
|
<admst:text format=" *** created by: %s - %s ***/\n"/> |
|
|
|
|
|
|
|
|
<admst:variable name="module" select="%(attribute[name='ngspicename']/value)"/> |
|
|
|
|
|
<admst:open file="$(module)guesstopology.c"> |
|
|
|
|
|
<admst:text format="/***\n*** Interface: %(/simulator/package_string)\n"/> |
|
|
|
|
|
<admst:text format=" *** created by: %(/simulator/fullname) - %(/simulator/currentdate) ***/\n"/> |
|
|
<admst:apply-templates select="." match="code"/> |
|
|
<admst:apply-templates select="." match="code"/> |
|
|
</admst:open> |
|
|
</admst:open> |
|
|
<admst:value-of select="attribute[name='ngspicename']/value"/> |
|
|
|
|
|
<admst:message format="%sguesstopology.c: file created\n"/> |
|
|
|
|
|
|
|
|
<admst:message format="$(module)guesstopology.c: file created\n"/> |
|
|
</admst:for-each> |
|
|
</admst:for-each> |
|
|
|
|
|
|
|
|
</admst> |
|
|
</admst> |