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