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:dyn="http://exslt.org/dynamic"
7 xmlns:math="http://exslt.org/math"
8 xmlns:xlink="http://www.w3.org/1999/xlink"
9 extension-element-prefixes="math dyn exsl xlink">
11 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
12 doctype-public="-//W3C//DTD SVG Tiny 1.1//EN"
13 doctype-system="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"/>
16 <!-- ======================= DEF BLOCK =============================== -->
17 <xsl:template name="Define_IOPorts">
19 <xsl:variable name="key_col_">
20 <xsl:call-template name="F_BusStd2RGB">
21 <xsl:with-param name="iBusStd" select="'KEY'"/>
25 <xsl:variable name="key_lt_col_">
26 <xsl:call-template name="F_BusStd2RGB_LT">
27 <xsl:with-param name="iBusStd" select="'KEY'"/>
35 width= "{$BLKD_IOP_W}"
36 height="{$BLKD_IOP_H}"
37 fill="{$COL_IORING_LT}"
38 stroke="{$COL_IORING}"
42 L {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
46 fill="{$COL_SYSPRT}"/>
53 width= "{$BLKD_IOP_W}"
54 height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
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}"/>
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}"/>
74 width= "{$BLKD_IOP_W}"
75 height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
79 L {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
81 Z" style="stroke:none; fill:{$key_col_}"/>
88 width= "{$BLKD_IOP_W}"
89 height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
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_}"/>
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_}"/>
105 <use x="0" y="0" xlink:href="#KEY_IOPort"/>
109 width= "{ceiling($BLKD_IOP_W div 2)}"
110 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
114 <use x="0" y="0" xlink:href="#KEY_IOPort" transform="scale(-1,1) translate({$BLKD_IOP_W * -1},0)"/>
118 width= "{ceiling($BLKD_IOP_W div 2)}"
119 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
122 <g id="KEY_INOUTPort">
123 <use x="0" y="0" xlink:href="#KEY_BIPort"/>
127 width= "{ceiling($BLKD_IOP_W div 2)}"
128 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
132 <!-- ======================= DRAW BLOCK =============================== -->
134 <xsl:template name="Draw_IOPorts">
136 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
138 <xsl:if test="($ports_count_ > 30)">
139 <xsl:call-template name="Draw_IOPorts_4Sides"/>
142 <xsl:if test="($ports_count_ <= 30)">
143 <xsl:call-template name="Draw_IOPorts_2Sides"/>
147 <xsl:template name="Draw_IOPorts_2Sides">
149 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
150 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 2)"/>
152 <xsl:variable name="h_ofs_">
153 <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 name="v_ofs_">
157 <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)"/>
161 <xsl:for-each select="EXTERNALPORTS/PORT">
162 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
164 <xsl:variable name="poffset_" select="0"/>
165 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
167 <xsl:variable name="pdir_">
169 <xsl:when test="(@DIR='I' or @DIR='IN' or @DIR='INPUT')">I</xsl:when>
170 <xsl:when test="(@DIR='O' or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
171 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
172 <xsl:otherwise>I</xsl:otherwise>
176 <xsl:variable name="pside_">
178 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
179 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">E</xsl:when>
180 <xsl:otherwise>D</xsl:otherwise>
184 <xsl:variable name="pdec_">
186 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
187 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
188 <xsl:otherwise>0</xsl:otherwise>
192 <xsl:variable name="px_">
194 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
195 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
196 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_Total_DrawArea_W)"/></xsl:when>
197 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
198 <xsl:otherwise>0</xsl:otherwise>
202 <xsl:variable name="py_">
204 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
205 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_Total_DrawArea_H)"/></xsl:when>
206 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
207 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
208 <xsl:otherwise>0</xsl:otherwise>
212 <xsl:variable name="prot_">
214 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
215 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
216 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
217 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
219 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
220 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
221 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
222 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
224 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
225 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
226 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
227 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
228 <xsl:otherwise>0</xsl:otherwise>
233 <xsl:variable name="txo_">
235 <xsl:when test="($pside_ = 'W')">-10</xsl:when>
236 <xsl:when test="($pside_ = 'S')">6</xsl:when>
237 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
238 <xsl:when test="($pside_ = 'N')">6</xsl:when>
239 <xsl:otherwise>0</xsl:otherwise>
243 <xsl:variable name="tyo_">
245 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
246 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
247 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
248 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
249 <xsl:otherwise>0</xsl:otherwise>
253 <xsl:if test="$pdir_ = 'B'">
257 xlink:href="#G_BIPort"
258 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
261 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
265 width= "{$BLKD_IOP_W}"
266 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
269 <xsl:if test="not($pdir_ = 'B')">
273 xlink:href="#G_IOPort"
274 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
277 <text class="iopnumb"
280 <xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
288 <xsl:template name="Draw_IOPorts_4Sides">
290 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
291 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 4)"/>
293 <xsl:variable name="h_ofs_">
294 <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)"/>
297 <xsl:variable name="v_ofs_">
298 <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:for-each select="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
303 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
305 <xsl:variable name="poffset_" select="0"/>
306 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
308 <xsl:variable name="pdir_">
310 <xsl:when test="(@DIR='I' or @DIR='IN' or @DIR='INPUT')">I</xsl:when>
311 <xsl:when test="(@DIR='O' or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
312 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
313 <xsl:otherwise>I</xsl:otherwise>
317 <xsl:variable name="pside_">
319 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
320 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">S</xsl:when>
321 <xsl:when test="($pcount_ >= ($ports_per_side_ * 2) and ($pcount_ < ($ports_per_side_ * 3)))">E</xsl:when>
322 <xsl:when test="($pcount_ >= ($ports_per_side_ * 3) and ($pcount_ < ($ports_per_side_ * 4)))">N</xsl:when>
323 <xsl:otherwise>D</xsl:otherwise>
327 <xsl:variable name="pdec_">
329 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
330 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
331 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 2)"/></xsl:when>
332 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($ports_per_side_ * 3)"/></xsl:when>
333 <xsl:otherwise>0</xsl:otherwise>
337 <xsl:variable name="px_">
339 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
340 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
341 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_Total_DrawArea_W)"/></xsl:when>
342 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
343 <xsl:otherwise>0</xsl:otherwise>
347 <xsl:variable name="py_">
349 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
350 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_Total_DrawArea_H)"/></xsl:when>
351 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
352 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
353 <xsl:otherwise>0</xsl:otherwise>
358 <xsl:variable name="prot_">
360 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
361 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
362 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
363 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
365 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
366 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
367 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
368 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
370 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
371 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
372 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
373 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
374 <xsl:otherwise>0</xsl:otherwise>
378 <xsl:variable name="txo_">
380 <xsl:when test="($pside_ = 'W')">-14</xsl:when>
381 <xsl:when test="($pside_ = 'S')">8</xsl:when>
382 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
383 <xsl:when test="($pside_ = 'N')">8</xsl:when>
384 <xsl:otherwise>0</xsl:otherwise>
388 <xsl:variable name="tyo_">
390 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
391 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
392 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
393 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
394 <xsl:otherwise>0</xsl:otherwise>
398 <xsl:if test="$pdir_ = 'B'">
402 xlink:href="#G_BIPort"
403 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
406 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
410 width= "{$BLKD_IOP_W}"
411 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
414 <xsl:if test="not($pdir_ = 'B')">
418 xlink:href="#G_IOPort"
419 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
422 <text class="iopnumb"
424 y="{$py_ + $tyo_}"><xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
431 <xsl:template name="Define_ExtPortsTable">
434 <xsl:if test="$oriented_= 'WEST'"><xsl:value-of select="$proc2procX_ - (string-length(@BUSNAME) * 6)"/></xsl:if>
435 <xsl:variable name="max_name_" select="math:max(string-length($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT/@NAME))"/>
436 <xsl:variable name="max_sgnm_" select="math:max(string-length($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT/@SIGNAME))"/>
438 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
439 <xsl:message>MAX SIG <xsl:value-of select="$max_sgnm_"/></xsl:message>
442 <xsl:variable name="ext_ports_">
443 <xsl:if test="not($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)">
444 <EXTPORT NAME="__none__" SIGNAME="__none_" NAMELEN="0" SIGLEN="0"/>
446 <xsl:if test="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
447 <xsl:for-each select="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
448 <EXTPORT NAME="{@NAME}" SIGNAME="{@SIGNAME}" NAMELEN="{string-length(@NAME)}" SIGLEN="{string-length(@SIGNAME)}"/>
453 <xsl:variable name="max_name_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@NAMELEN)"/>
454 <xsl:variable name="max_sign_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@SIGLEN)"/>
456 <xsl:variable name="h_font_" select="12"/>
457 <xsl:variable name="w_font_" select="12"/>
459 <xsl:variable name="w_num_" select="($w_font_ * 5)"/>
460 <xsl:variable name="w_dir_" select="($w_font_ * 3)"/>
461 <xsl:variable name="w_lsbmsb_" select="($w_font_ * 9)"/>
462 <xsl:variable name="w_attr_" select="($w_font_ * 4)"/>
463 <xsl:variable name="w_name_" select="($w_font_ * $max_name_)"/>
464 <xsl:variable name="w_sign_" select="($w_font_ * $max_sign_)"/>
466 <xsl:variable name="w_table_" select="($w_num_ + $w_name_ + $w_dir_ + $w_sign_ + $w_attr_)"/>
469 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
470 <xsl:message>MAX SIG <xsl:value-of select="$max_sign_"/></xsl:message>
472 <xsl:message>W NUM <xsl:value-of select="$w_num_"/></xsl:message>
473 <xsl:message>W DIR <xsl:value-of select="$w_dir_"/></xsl:message>
474 <xsl:message>W NAM <xsl:value-of select="$w_name_"/></xsl:message>
475 <xsl:message>W SIG <xsl:value-of select="$w_sign_"/></xsl:message>
476 <xsl:message>W ATT <xsl:value-of select="$w_attr_"/></xsl:message>
478 <xsl:message>W TABLE <xsl:value-of select="$w_table_"/></xsl:message>
481 <g id="BlkDiagram_ExtPortsTable">
486 height="{$h_font_}" style="fill:{$COL_RED}; stroke:none; stroke-width:1"/>
493 <!-- ======================= END MAIN BLOCK =========================== -->