File: 0000_scale_factor.xml

package info (click to toggle)
adms 2.3.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,592 kB
  • sloc: xml: 7,167; perl: 4,866; ansic: 3,147; lex: 1,128; yacc: 691; sh: 323; makefile: 110
file content (98 lines) | stat: -rw-r--r-- 3,815 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  This file is part of adms - http://sourceforge.net/projects/mot-adms.

  adms is a code generator for the Verilog-AMS language.

  Copyright (C) 2015 Guilherme Brondani Torri <guitorri@gmail.com>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<!DOCTYPE admst SYSTEM "admst.dtd">

<admst version="2.3.5">

  <!-- handle number element -->
  <admst:template match=":number">

    <!-- check type -->
    <admst:if test="[cast='i']">
        <admst:variable name="cast" select="int"/> <!-- store -->
    </admst:if>
    <admst:if test="[cast='d']">
        <admst:variable name="cast" select="double"/> <!-- store -->
    </admst:if>

    <!-- pretty print value and scaling -->
    <admst:value-of select="value"/>
    <admst:choose>
      <admst:when test="[scalingunit='1']">%s</admst:when>

      <admst:when test="[scalingunit='T']">$(cast) %se12</admst:when>
      <admst:when test="[scalingunit='G']">$(cast) %se+9</admst:when>
      <admst:when test="[scalingunit='M']">$(cast) %se+6</admst:when>
      <admst:when test="[scalingunit='K']">$(cast) %se+3</admst:when>
      <admst:when test="[scalingunit='k']">$(cast) %se+3</admst:when>
      <admst:when test="[scalingunit='m']">$(cast) %se-3</admst:when>
      <admst:when test="[scalingunit='u']">$(cast) %se-6</admst:when>
      <admst:when test="[scalingunit='n']">$(cast) %se-9</admst:when>
      <admst:when test="[scalingunit='p']">$(cast) %se-12</admst:when>
      <admst:when test="[scalingunit='f']">$(cast) %se-15</admst:when>
      <admst:when test="[scalingunit='a']">$(cast) %se-18</admst:when>

      <admst:when test="[scalingunit='E']">$(cast) %se+18</admst:when>
      <admst:when test="[scalingunit='P']">$(cast) %se+15</admst:when>
      <admst:when test="[scalingunit='h']">$(cast) %se+2</admst:when>
      <admst:when test="[scalingunit='D']">$(cast) %se+1</admst:when>
      <admst:when test="[scalingunit='d']">$(cast) %se-1</admst:when>
      <admst:when test="[scalingunit='c']">$(cast) %se-2</admst:when>
      <admst:when test="[scalingunit='A']">$(cast) %se-10</admst:when>

      <admst:otherwise>
        <admst:value-of select="scalingunit"/>
        <admst:fatal format="%s%s: scaling unit not supported\n"/>
      </admst:otherwise>
    </admst:choose>
  </admst:template>

  <!-- handle default element  -->
  <admst:template match=":expression">
    <!-- get type of data -->
    <admst:value-of select="tree/adms/datatypename"/>
    <admst:variable name="type" select="%s"/> <!-- store -->
    <admst:text format="\t$(type) "/>
    <admst:apply-templates select="tree" match=":$(type)" required="yes"/>
  </admst:template>

  <!-- loop over modules -->
  <admst:for-each select="/module">

    <!-- print module name -->
    <admst:value-of select="./name" />
    <admst:text format="module : %s\n"/>

      <!-- print name of variables, type and its default value -->
      <admst:for-each select="variable">
        <admst:value-of select="./name" />
        <admst:text format="variable : %s  " />
        <admst:apply-templates select="default" match=":expression"/>
        <admst:text format="\n" />
      </admst:for-each>

  </admst:for-each>  <!-- module -->

</admst>