]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtSvgBLKD_IOPorts.xsl
Prepare for V9.0.0 release.
[freertos] / FreeRTOS / Demo / PPC405_Xilinx_Virtex4_GCC / __xps / .dswkshop / MdtSvgBLKD_IOPorts.xsl
1 <?xml version="1.0" standalone="no"?>
2 <xsl:stylesheet version="1.0"
3            xmlns:svg="http://www.w3.org/2000/svg"
4            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5            xmlns:exsl="http://exslt.org/common"
6            xmlns:xlink="http://www.w3.org/1999/xlink">
7                 
8 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
9                doctype-public="-//W3C//DTD SVG 1.0//EN"
10                    doctype-system="http://www.w3.org/TR/SVG/DTD/svg10.dtd"/>
11                         
12 <!--    
13 <xsl:param name="BLKD_IOP_H"   select="16"/>                            
14 <xsl:param name="BLKD_IOP_W"   select="16"/>                            
15 <xsl:param name="BLKD_IOP_SPC" select="12"/>                            
16 <xsl:param name="MOD_IO_GAP"   select="8"/>                             
17 -->
18         
19
20 <!-- ======================= DEF BLOCK =============================== -->
21 <xsl:template name="Define_IOPorts">
22         
23         <xsl:variable name="key_col_">
24                 <xsl:call-template name="BusType2Color">
25                         <xsl:with-param name="iBusType" select="'KEY'"/>
26                 </xsl:call-template>    
27         </xsl:variable>
28         
29                 <xsl:variable name="key_lt_col_">
30                         <xsl:call-template name="BusType2LightColor">
31                                 <xsl:with-param name="iBusType" select="'KEY'"/>
32                         </xsl:call-template>    
33                 </xsl:variable>
34
35          <symbol id="G_IOPort">
36                 <rect  
37                         x="0"  
38                         y="0" 
39                         width= "{$BLKD_IOP_W}" 
40                         height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/> 
41                         
42                 <path class="ioport"
43                           d="M   0,0
44                                  L   {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
45                                  L   0,{$BLKD_IOP_H}
46                                  Z" style="stroke:none; fill:{$COL_SYSPRT}"/>   
47         </symbol>
48
49          <symbol id="G_BIPort">
50                 <rect  
51                         x="0"  
52                         y="0" 
53                         width= "{$BLKD_IOP_W}" 
54                         height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/> 
55                         
56                 <path class="btop"
57                           d="M 0,{ceiling($BLKD_IOP_H div 2)}
58                                  {ceiling($BLKD_IOP_W div 2)},0
59                                  {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
60                                  Z" style="stroke:none; fill:{$COL_SYSPRT}"/>   
61                                  
62                 <path class="bbot"
63                           d="M 0,{ceiling($BLKD_IOP_H div 2)}
64                                  {ceiling($BLKD_IOP_W div 2)},{$BLKD_IOP_H}
65                                  {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
66                                  Z" style="stroke:none; fill:{$COL_SYSPRT}"/>   
67                                  
68         </symbol>
69
70          <symbol id="KEY_IOPort">
71                 <rect  
72                         x="0"  
73                         y="0" 
74                         width= "{$BLKD_IOP_W}" 
75                         height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/> 
76                         
77                 <path class="ioport"
78                           d="M   0,0
79                                  L   {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
80                                  L   0,{$BLKD_IOP_H}
81                                  Z" style="stroke:none; fill:{$key_col_}"/>     
82         </symbol>
83         
84          <symbol id="KEY_BIPort">
85                 <rect  
86                         x="0"  
87                         y="0" 
88                         width= "{$BLKD_IOP_W}" 
89                         height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/> 
90                         
91                 <path class="btop"
92                           d="M 0,{ceiling($BLKD_IOP_H div 2)}
93                                  {ceiling($BLKD_IOP_W div 2)},0
94                                  {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
95                                  Z" style="stroke:none; fill:{$key_col_}"/>     
96                                  
97                 <path class="bbot"
98                           d="M 0,{ceiling($BLKD_IOP_H div 2)}
99                                  {ceiling($BLKD_IOP_W div 2)},{$BLKD_IOP_H}
100                                  {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
101                                  Z" style="stroke:none; fill:{$key_col_}"/>
102         </symbol>
103         
104          <symbol id="KEY_INPort">
105                 <use   x="0"   y="0"   xlink:href="#KEY_IOPort"/>
106                 <rect  
107                         x="{$BLKD_IOP_W}"  
108                         y="0" 
109                         width= "{ceiling($BLKD_IOP_W div 2)}" 
110                         height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/> 
111         </symbol>
112         
113          <symbol id="KEY_OUTPort">
114                 <use   x="0"   y="0"   xlink:href="#KEY_IOPort" transform="scale(-1,1) translate({$BLKD_IOP_W * -1},0)"/>
115                 <rect  
116                         x="{$BLKD_IOP_W}"  
117                         y="0" 
118                         width= "{ceiling($BLKD_IOP_W div 2)}" 
119                         height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/> 
120         </symbol>
121
122          <symbol id="KEY_INOUTPort">
123                 <use   x="0"   y="0"   xlink:href="#KEY_BIPort"/>
124                 <rect  
125                         x="{$BLKD_IOP_W}"  
126                         y="0" 
127                         width= "{ceiling($BLKD_IOP_W div 2)}" 
128                         height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/> 
129         </symbol>
130
131
132 </xsl:template>
133
134 <!-- ======================= DRAW BLOCK =============================== -->
135
136 <xsl:template name="Draw_IOPorts"> 
137         
138         <xsl:variable name="ports_count_"    select="count(EXTERNALPORTS/PORT)"/>
139         
140         <xsl:if test="($ports_count_ &gt; 30)">
141                 <xsl:call-template name="Draw_IOPorts_4Sides"/> 
142         </xsl:if>
143         
144         <xsl:if test="($ports_count_ &lt;= 30)">
145                 <xsl:call-template name="Draw_IOPorts_2Sides"/> 
146         </xsl:if>
147 </xsl:template>
148
149 <xsl:template name="Draw_IOPorts_2Sides"> 
150         
151         <xsl:variable name="ports_count_"    select="count(EXTERNALPORTS/PORT)"/>
152         <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 2)"/>
153         
154         <xsl:variable name="h_ofs_">
155                 <xsl:value-of select="$BLKD_PRTCHAN_W + ceiling(($G_total_drawarea_W  - (($ports_per_side_ * $BLKD_IOP_W) + (($ports_per_side_ - 1) * $BLKD_IOP_SPC))) div 2)"/>
156         </xsl:variable>
157         
158         <xsl:variable name="v_ofs_">
159                 <xsl:value-of select="$BLKD_PRTCHAN_H + ceiling(($G_total_drawarea_H  - (($ports_per_side_ * $BLKD_IOP_H) + (($ports_per_side_ - 1) * $BLKD_IOP_SPC))) div 2)"/>
160         </xsl:variable>
161         
162
163         <xsl:for-each select="EXTERNALPORTS/PORT">
164                 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
165                 
166                 <xsl:variable name="poffset_" select="0"/>
167                 <xsl:variable name="pcount_"  select="$poffset_ + (position() -1)"/>
168                 
169                 <xsl:variable name="pdir_">
170                         <xsl:choose>
171                                 <xsl:when test="(@DIR='I'  or @DIR='IN'  or @DIR='INPUT')">I</xsl:when>
172                                 <xsl:when test="(@DIR='O'  or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
173                                 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
174                                 <xsl:otherwise>I</xsl:otherwise>
175                         </xsl:choose>   
176                 </xsl:variable>
177                 
178                 <xsl:variable name="pside_">
179                         <xsl:choose>
180                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 0) and ($pcount_ &lt; ($ports_per_side_ * 1)))">W</xsl:when>
181                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 1) and ($pcount_ &lt; ($ports_per_side_ * 2)))">E</xsl:when>
182                                 <xsl:otherwise>D</xsl:otherwise>
183                         </xsl:choose>   
184                 </xsl:variable>
185                 
186                 <xsl:variable name="pdec_">
187                         <xsl:choose>
188                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
189                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
190                                 <xsl:otherwise>0</xsl:otherwise>
191                         </xsl:choose>   
192                 </xsl:variable>
193                 
194                 <xsl:variable name="px_">
195                         <xsl:choose>
196                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
197                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
198                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_total_drawarea_W)"/></xsl:when>
199                                 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
200                                 <xsl:otherwise>0</xsl:otherwise>
201                         </xsl:choose>   
202                 </xsl:variable>
203                 
204                 <xsl:variable name="py_">
205                         <xsl:choose>
206                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
207                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_total_drawarea_H)"/></xsl:when>
208                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
209                                 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
210                                 <xsl:otherwise>0</xsl:otherwise>
211                         </xsl:choose>   
212                 </xsl:variable>
213                 
214         
215                 <xsl:variable name="prot_">
216                         <xsl:choose>
217                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
218                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
219                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
220                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
221                                 
222                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
223                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
224                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
225                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
226                                 
227                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
228                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
229                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
230                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
231                                 <xsl:otherwise>0</xsl:otherwise>
232                         </xsl:choose>   
233                 </xsl:variable>
234                 
235                 
236                 <xsl:variable name="txo_">
237                         <xsl:choose>
238                                 <xsl:when test="($pside_  = 'W')">-10</xsl:when>
239                                 <xsl:when test="($pside_  = 'S')">6</xsl:when>
240                                  <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
241                                 <xsl:when test="($pside_  = 'N')">6</xsl:when>
242                                 <xsl:otherwise>0</xsl:otherwise>
243                         </xsl:choose>   
244                 </xsl:variable>
245                 
246                 <xsl:variable name="tyo_">
247                         <xsl:choose>
248                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
249                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
250                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
251                                 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
252                                 <xsl:otherwise>0</xsl:otherwise>
253                         </xsl:choose>   
254                 </xsl:variable>
255
256                 <xsl:if test="$pdir_ = 'B'">       
257                         <use   x="{$px_}"  
258                                y="{$py_}"  
259                                    id="{@NAME}"
260                                xlink:href="#G_BIPort" 
261                                transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
262                 </xsl:if>
263                 
264                 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">    
265                         <rect  
266                                 x="{$px_}"  
267                                 y="{$py_}" 
268                                 width= "{$BLKD_IOP_W}" 
269                                 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/> 
270                 </xsl:if>
271                 
272                 <xsl:if test="not($pdir_ = 'B')">          
273                         <use   x="{$px_}"  
274                                y="{$py_}"  
275                                    id="{@NAME}"
276                                xlink:href="#G_IOPort" 
277                                transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
278                 </xsl:if>
279                 
280                 <text class="iopnumb"
281                         x="{$px_ + $txo_}" 
282                         y="{$py_ + $tyo_}">
283                         <xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
284                 </text>
285                 
286         </xsl:for-each>
287         
288 </xsl:template>
289
290
291 <xsl:template name="Draw_IOPorts_4Sides"> 
292         
293         <xsl:variable name="ports_count_"    select="count(EXTERNALPORTS/PORT)"/>
294         <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 4)"/>
295         
296         <xsl:variable name="h_ofs_">
297                 <xsl:value-of select="$BLKD_PRTCHAN_W + ceiling(($G_total_drawarea_W  - (($ports_per_side_ * $BLKD_IOP_W) + (($ports_per_side_ - 1) * $BLKD_IOP_SPC))) div 2)"/>
298         </xsl:variable>
299         
300         <xsl:variable name="v_ofs_">
301                 <xsl:value-of select="$BLKD_PRTCHAN_H + ceiling(($G_total_drawarea_H  - (($ports_per_side_ * $BLKD_IOP_H) + (($ports_per_side_ - 1) * $BLKD_IOP_SPC))) div 2)"/>
302         </xsl:variable>
303         
304
305         <xsl:for-each select="EXTERNALPORTS/PORT">
306                 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
307                 
308                 <xsl:variable name="poffset_" select="0"/>
309                 <xsl:variable name="pcount_"  select="$poffset_ + (position() -1)"/>
310                 
311                 <xsl:variable name="pdir_">
312                         <xsl:choose>
313                                 <xsl:when test="(@DIR='I'  or @DIR='IN'  or @DIR='INPUT')">I</xsl:when>
314                                 <xsl:when test="(@DIR='O'  or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
315                                 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
316                                 <xsl:otherwise>I</xsl:otherwise>
317                         </xsl:choose>   
318                 </xsl:variable>
319                 
320                 <xsl:variable name="pside_">
321                         <xsl:choose>
322                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 0) and ($pcount_ &lt; ($ports_per_side_ * 1)))">W</xsl:when>
323                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 1) and ($pcount_ &lt; ($ports_per_side_ * 2)))">S</xsl:when>
324                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 2) and ($pcount_ &lt; ($ports_per_side_ * 3)))">E</xsl:when>
325                                 <xsl:when test="($pcount_ &gt;= ($ports_per_side_ * 3) and ($pcount_ &lt; ($ports_per_side_ * 4)))">N</xsl:when>
326                                 <xsl:otherwise>D</xsl:otherwise>
327                         </xsl:choose>   
328                 </xsl:variable>
329                 
330                 <xsl:variable name="pdec_">
331                         <xsl:choose>
332                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
333                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
334                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 2)"/></xsl:when>
335                                 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($ports_per_side_ * 3)"/></xsl:when>
336                                 <xsl:otherwise>0</xsl:otherwise>
337                         </xsl:choose>   
338                 </xsl:variable>
339                 
340                 <xsl:variable name="px_">
341                         <xsl:choose>
342                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
343                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
344                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_total_drawarea_W)"/></xsl:when>
345                                 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
346                                 <xsl:otherwise>0</xsl:otherwise>
347                         </xsl:choose>   
348                 </xsl:variable>
349                 
350                 <xsl:variable name="py_">
351                         <xsl:choose>
352                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
353                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_total_drawarea_H)"/></xsl:when>
354                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
355                                 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
356                                 <xsl:otherwise>0</xsl:otherwise>
357                         </xsl:choose>   
358                 </xsl:variable>
359                 
360         
361                 <xsl:variable name="prot_">
362                         <xsl:choose>
363                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
364                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
365                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
366                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
367                                 
368                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
369                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
370                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
371                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
372                                 
373                                 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
374                                 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
375                                 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
376                                 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
377                                 <xsl:otherwise>0</xsl:otherwise>
378                         </xsl:choose>   
379                 </xsl:variable>
380                 
381                 <xsl:variable name="txo_">
382                         <xsl:choose>
383                                 <xsl:when test="($pside_  = 'W')">-14</xsl:when>
384                                 <xsl:when test="($pside_  = 'S')">8</xsl:when>
385                                  <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
386                                 <xsl:when test="($pside_  = 'N')">8</xsl:when>
387                                 <xsl:otherwise>0</xsl:otherwise>
388                         </xsl:choose>   
389                 </xsl:variable>
390                 
391                 <xsl:variable name="tyo_">
392                         <xsl:choose>
393                                 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
394                                 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
395                                 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
396                                 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
397                                 <xsl:otherwise>0</xsl:otherwise>
398                         </xsl:choose>   
399                 </xsl:variable>
400
401                 <xsl:if test="$pdir_ = 'B'">       
402                         <use   x="{$px_}"
403                                y="{$py_}"
404                                    id="{@NAME}"
405                                xlink:href="#G_BIPort" 
406                                transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
407                 </xsl:if>
408                 
409                 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">    
410                         <rect  
411                                 x="{$px_}"
412                                 y="{$py_}"
413                                 width= "{$BLKD_IOP_W}"
414                                 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/> 
415                 </xsl:if>
416                 
417                 <xsl:if test="not($pdir_ = 'B')">          
418                         <use   x="{$px_}"
419                                y="{$py_}"
420                                    id="{@NAME}"
421                                xlink:href="#G_IOPort"
422                                transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
423                 </xsl:if>
424                 
425                 <text class="iopnumb"
426                         x="{$px_ + $txo_}" 
427                         y="{$py_ + $tyo_}"><xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
428                 </text>
429
430         </xsl:for-each>
431         
432 </xsl:template>
433         
434 <xsl:template name="Define_ExtPortsTable">
435         
436 <!--    
437                 <xsl:if test="$oriented_= 'WEST'"><xsl:value-of select="$proc2procX_ - (string-length(@BUSNAME) * 6)"/></xsl:if>        
438                 <xsl:variable name="max_name_" select="math:max(string-length(/EDKSYSTEM/EXTERNALPORTS/PORT/@NAME))"/>
439                 <xsl:variable name="max_sgnm_" select="math:max(string-length(/EDKSYSTEM/EXTERNALPORTS/PORT/@SIGNAME))"/>
440         
441                 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
442                 <xsl:message>MAX SIG  <xsl:value-of select="$max_sgnm_"/></xsl:message>
443 -->     
444         
445                 <xsl:variable name="ext_ports_">        
446                         <xsl:if test="not(/EDKSYSTEM/EXTERNALPORTS/PORT)">
447                                 <EXTPORT NAME="__none__" SIGNAME="__none_" NAMELEN="0" SIGLEN="0"/>
448                         </xsl:if>
449                         <xsl:if test="/EDKSYSTEM/EXTERNALPORTS/PORT">
450                                 <xsl:for-each select="/EDKSYSTEM/EXTERNALPORTS/PORT">
451                                         <EXTPORT  NAME="{@NAME}" SIGNAME="{@SIGNAME}" NAMELEN="{string-length(@NAME)}" SIGLEN="{string-length(@SIGNAME)}"/>
452                                 </xsl:for-each>
453                         </xsl:if>
454                 </xsl:variable>
455         
456                 <xsl:variable name="max_name_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@NAMELEN)"/>
457                 <xsl:variable name="max_sign_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@SIGLEN)"/>
458         
459                 <xsl:variable name="h_font_" select="12"/>
460                 <xsl:variable name="w_font_" select="12"/>
461         
462                 <xsl:variable name="w_num_"    select="($w_font_ * 5)"/>
463                 <xsl:variable name="w_dir_"    select="($w_font_ * 3)"/>
464                 <xsl:variable name="w_lsbmsb_" select="($w_font_ * 9)"/>
465                 <xsl:variable name="w_attr_"   select="($w_font_ * 4)"/>
466                 <xsl:variable name="w_name_"   select="($w_font_ * $max_name_)"/>
467                 <xsl:variable name="w_sign_"   select="($w_font_ * $max_sign_)"/>
468         
469                 <xsl:variable name="w_table_" select="($w_num_ + $w_name_ + $w_dir_ + $w_sign_ + $w_attr_)"/>
470         
471 <!--    
472                 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
473                 <xsl:message>MAX SIG  <xsl:value-of select="$max_sign_"/></xsl:message>
474         
475                 <xsl:message>W NUM  <xsl:value-of select="$w_num_"/></xsl:message>
476                 <xsl:message>W DIR  <xsl:value-of select="$w_dir_"/></xsl:message>
477                 <xsl:message>W NAM  <xsl:value-of select="$w_name_"/></xsl:message>
478                 <xsl:message>W SIG  <xsl:value-of select="$w_sign_"/></xsl:message>
479                 <xsl:message>W ATT  <xsl:value-of select="$w_attr_"/></xsl:message>
480         
481                 <xsl:message>W TABLE  <xsl:value-of select="$w_table_"/></xsl:message>
482 -->     
483         
484          <symbol id="BlkDiagram_ExtPortsTable">
485                 <rect  
486                         x="0"  
487                         y="0" 
488                         width= "{$w_table_}" 
489                         height="{$h_font_}"  style="fill:{$COL_RED}; stroke:none; stroke-width:1"/> 
490         </symbol>        
491         
492         
493         
494 </xsl:template>
495
496 <!-- ======================= END MAIN BLOCK =========================== -->
497
498 </xsl:stylesheet>