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:math="http://exslt.org/math"
6 xmlns:exsl="http://exslt.org/common"
7 xmlns:xlink="http://www.w3.org/1999/xlink"
8 extension-element-prefixes="math">
10 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
11 doctype-public="-//W3C//DTD SVG 1.0//EN"
12 doctype-system="http://www.w3.org/TR/SVG/DTD/svg10.dtd"/>
15 <!-- ======================= DEF BLOCK =============================== -->
16 <xsl:template name="Define_IOPorts">
18 <xsl:variable name="key_col_">
19 <xsl:call-template name="F_BusStd2RGB">
20 <xsl:with-param name="iBusStd" select="'KEY'"/>
24 <xsl:variable name="key_lt_col_">
25 <xsl:call-template name="F_BusStd2RGB_LT">
26 <xsl:with-param name="iBusStd" select="'KEY'"/>
34 width= "{$BLKD_IOP_W}"
35 height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
39 L {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
41 Z" style="stroke:none; fill:{$COL_SYSPRT}"/>
48 width= "{$BLKD_IOP_W}"
49 height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
52 d="M 0,{ceiling($BLKD_IOP_H div 2)}
53 {ceiling($BLKD_IOP_W div 2)},0
54 {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
55 Z" style="stroke:none; fill:{$COL_SYSPRT}"/>
58 d="M 0,{ceiling($BLKD_IOP_H div 2)}
59 {ceiling($BLKD_IOP_W div 2)},{$BLKD_IOP_H}
60 {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
61 Z" style="stroke:none; fill:{$COL_SYSPRT}"/>
69 width= "{$BLKD_IOP_W}"
70 height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
74 L {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
76 Z" style="stroke:none; fill:{$key_col_}"/>
83 width= "{$BLKD_IOP_W}"
84 height="{$BLKD_IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
87 d="M 0,{ceiling($BLKD_IOP_H div 2)}
88 {ceiling($BLKD_IOP_W div 2)},0
89 {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
90 Z" style="stroke:none; fill:{$key_col_}"/>
93 d="M 0,{ceiling($BLKD_IOP_H div 2)}
94 {ceiling($BLKD_IOP_W div 2)},{$BLKD_IOP_H}
95 {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
96 Z" style="stroke:none; fill:{$key_col_}"/>
100 <use x="0" y="0" xlink:href="#KEY_IOPort"/>
104 width= "{ceiling($BLKD_IOP_W div 2)}"
105 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
109 <use x="0" y="0" xlink:href="#KEY_IOPort" transform="scale(-1,1) translate({$BLKD_IOP_W * -1},0)"/>
113 width= "{ceiling($BLKD_IOP_W div 2)}"
114 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
117 <g id="KEY_INOUTPort">
118 <use x="0" y="0" xlink:href="#KEY_BIPort"/>
122 width= "{ceiling($BLKD_IOP_W div 2)}"
123 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
127 <!-- ======================= DRAW BLOCK =============================== -->
129 <xsl:template name="Draw_IOPorts">
131 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
133 <xsl:if test="($ports_count_ > 30)">
134 <xsl:call-template name="Draw_IOPorts_4Sides"/>
137 <xsl:if test="($ports_count_ <= 30)">
138 <xsl:call-template name="Draw_IOPorts_2Sides"/>
142 <xsl:template name="Draw_IOPorts_2Sides">
144 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
145 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 2)"/>
147 <xsl:variable name="h_ofs_">
148 <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)"/>
151 <xsl:variable name="v_ofs_">
152 <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)"/>
156 <xsl:for-each select="EXTERNALPORTS/PORT">
157 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
159 <xsl:variable name="poffset_" select="0"/>
160 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
162 <xsl:variable name="pdir_">
164 <xsl:when test="(@DIR='I' or @DIR='IN' or @DIR='INPUT')">I</xsl:when>
165 <xsl:when test="(@DIR='O' or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
166 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
167 <xsl:otherwise>I</xsl:otherwise>
171 <xsl:variable name="pside_">
173 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
174 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">E</xsl:when>
175 <xsl:otherwise>D</xsl:otherwise>
179 <xsl:variable name="pdec_">
181 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
182 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
183 <xsl:otherwise>0</xsl:otherwise>
187 <xsl:variable name="px_">
189 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
190 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
191 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_Total_DrawArea_W)"/></xsl:when>
192 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
193 <xsl:otherwise>0</xsl:otherwise>
197 <xsl:variable name="py_">
199 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
200 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_Total_DrawArea_H)"/></xsl:when>
201 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
202 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
203 <xsl:otherwise>0</xsl:otherwise>
207 <xsl:variable name="prot_">
209 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
210 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
211 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
212 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
214 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
215 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
216 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
217 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
219 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
220 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
221 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
222 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
223 <xsl:otherwise>0</xsl:otherwise>
228 <xsl:variable name="txo_">
230 <xsl:when test="($pside_ = 'W')">-10</xsl:when>
231 <xsl:when test="($pside_ = 'S')">6</xsl:when>
232 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
233 <xsl:when test="($pside_ = 'N')">6</xsl:when>
234 <xsl:otherwise>0</xsl:otherwise>
238 <xsl:variable name="tyo_">
240 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
241 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
242 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
243 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
244 <xsl:otherwise>0</xsl:otherwise>
248 <xsl:if test="$pdir_ = 'B'">
252 xlink:href="#G_BIPort"
253 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
256 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
260 width= "{$BLKD_IOP_W}"
261 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
264 <xsl:if test="not($pdir_ = 'B')">
268 xlink:href="#G_IOPort"
269 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
272 <text class="iopnumb"
275 <xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
283 <xsl:template name="Draw_IOPorts_4Sides">
285 <xsl:variable name="ports_count_" select="count($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)"/>
286 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 4)"/>
288 <xsl:variable name="h_ofs_">
289 <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)"/>
292 <xsl:variable name="v_ofs_">
293 <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)"/>
297 <xsl:for-each select="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
298 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
300 <xsl:variable name="poffset_" select="0"/>
301 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
303 <xsl:variable name="pdir_">
305 <xsl:when test="(@DIR='I' or @DIR='IN' or @DIR='INPUT')">I</xsl:when>
306 <xsl:when test="(@DIR='O' or @DIR='OUT' or @DIR='OUTPUT')">O</xsl:when>
307 <xsl:when test="(@DIR='IO' or @DIR='INOUT')">B</xsl:when>
308 <xsl:otherwise>I</xsl:otherwise>
312 <xsl:variable name="pside_">
314 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
315 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">S</xsl:when>
316 <xsl:when test="($pcount_ >= ($ports_per_side_ * 2) and ($pcount_ < ($ports_per_side_ * 3)))">E</xsl:when>
317 <xsl:when test="($pcount_ >= ($ports_per_side_ * 3) and ($pcount_ < ($ports_per_side_ * 4)))">N</xsl:when>
318 <xsl:otherwise>D</xsl:otherwise>
322 <xsl:variable name="pdec_">
324 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($ports_per_side_ * 0)"/></xsl:when>
325 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($ports_per_side_ * 1)"/></xsl:when>
326 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($ports_per_side_ * 2)"/></xsl:when>
327 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($ports_per_side_ * 3)"/></xsl:when>
328 <xsl:otherwise>0</xsl:otherwise>
332 <xsl:variable name="px_">
334 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($BLKD_PRTCHAN_W - $BLKD_IOP_W)"/></xsl:when>
335 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)) - 2)"/></xsl:when>
336 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($BLKD_PRTCHAN_W + ($BLKD_IORCHAN_W * 2) + $G_Total_DrawArea_W)"/></xsl:when>
337 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($h_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_W)))"/></xsl:when>
338 <xsl:otherwise>0</xsl:otherwise>
342 <xsl:variable name="py_">
344 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
345 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_PRTCHAN_H + ($BLKD_IORCHAN_H * 2) + $G_Total_DrawArea_H)"/></xsl:when>
346 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="($v_ofs_ + (((position() - 1) - $pdec_) * ($BLKD_IOP_SPC + $BLKD_IOP_H)))"/></xsl:when>
347 <xsl:when test="($pside_ = 'N')"><xsl:value-of select="($BLKD_PRTCHAN_H - $BLKD_IOP_H)"/></xsl:when>
348 <xsl:otherwise>0</xsl:otherwise>
353 <xsl:variable name="prot_">
355 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'I'))">0</xsl:when>
356 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'I'))">-90</xsl:when>
357 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'I'))">180</xsl:when>
358 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'I'))">90</xsl:when>
360 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'O'))">180</xsl:when>
361 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'O'))">90</xsl:when>
362 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'O'))">0</xsl:when>
363 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'O'))">-90</xsl:when>
365 <xsl:when test="(($pside_ = 'W') and ($pdir_ = 'B'))">0</xsl:when>
366 <xsl:when test="(($pside_ = 'S') and ($pdir_ = 'B'))">0</xsl:when>
367 <xsl:when test="(($pside_ = 'E') and ($pdir_ = 'B'))">0</xsl:when>
368 <xsl:when test="(($pside_ = 'N') and ($pdir_ = 'B'))">0</xsl:when>
369 <xsl:otherwise>0</xsl:otherwise>
373 <xsl:variable name="txo_">
375 <xsl:when test="($pside_ = 'W')">-14</xsl:when>
376 <xsl:when test="($pside_ = 'S')">8</xsl:when>
377 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="(($BLKD_IOP_W * 2) - 4)"/></xsl:when>
378 <xsl:when test="($pside_ = 'N')">8</xsl:when>
379 <xsl:otherwise>0</xsl:otherwise>
383 <xsl:variable name="tyo_">
385 <xsl:when test="($pside_ = 'W')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
386 <xsl:when test="($pside_ = 'S')"><xsl:value-of select="($BLKD_IOP_H * 2) + 4"/></xsl:when>
387 <xsl:when test="($pside_ = 'E')"><xsl:value-of select="ceiling($BLKD_IOP_H div 2) + 6"/></xsl:when>
388 <xsl:when test="($pside_ = 'N')">-2</xsl:when>
389 <xsl:otherwise>0</xsl:otherwise>
393 <xsl:if test="$pdir_ = 'B'">
397 xlink:href="#G_BIPort"
398 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
401 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
405 width= "{$BLKD_IOP_W}"
406 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
409 <xsl:if test="not($pdir_ = 'B')">
413 xlink:href="#G_IOPort"
414 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
417 <text class="iopnumb"
419 y="{$py_ + $tyo_}"><xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
426 <xsl:template name="Define_ExtPortsTable">
429 <xsl:if test="$oriented_= 'WEST'"><xsl:value-of select="$proc2procX_ - (string-length(@BUSNAME) * 6)"/></xsl:if>
430 <xsl:variable name="max_name_" select="math:max(string-length($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT/@NAME))"/>
431 <xsl:variable name="max_sgnm_" select="math:max(string-length($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT/@SIGNAME))"/>
433 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
434 <xsl:message>MAX SIG <xsl:value-of select="$max_sgnm_"/></xsl:message>
437 <xsl:variable name="ext_ports_">
438 <xsl:if test="not($G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT)">
439 <EXTPORT NAME="__none__" SIGNAME="__none_" NAMELEN="0" SIGLEN="0"/>
441 <xsl:if test="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
442 <xsl:for-each select="$G_ROOT/EDKSYSTEM/EXTERNALPORTS/PORT">
443 <EXTPORT NAME="{@NAME}" SIGNAME="{@SIGNAME}" NAMELEN="{string-length(@NAME)}" SIGLEN="{string-length(@SIGNAME)}"/>
448 <xsl:variable name="max_name_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@NAMELEN)"/>
449 <xsl:variable name="max_sign_" select="math:max(exsl:node-set($ext_ports_)/EXTPORT/@SIGLEN)"/>
451 <xsl:variable name="h_font_" select="12"/>
452 <xsl:variable name="w_font_" select="12"/>
454 <xsl:variable name="w_num_" select="($w_font_ * 5)"/>
455 <xsl:variable name="w_dir_" select="($w_font_ * 3)"/>
456 <xsl:variable name="w_lsbmsb_" select="($w_font_ * 9)"/>
457 <xsl:variable name="w_attr_" select="($w_font_ * 4)"/>
458 <xsl:variable name="w_name_" select="($w_font_ * $max_name_)"/>
459 <xsl:variable name="w_sign_" select="($w_font_ * $max_sign_)"/>
461 <xsl:variable name="w_table_" select="($w_num_ + $w_name_ + $w_dir_ + $w_sign_ + $w_attr_)"/>
464 <xsl:message>MAX NAME <xsl:value-of select="$max_name_"/></xsl:message>
465 <xsl:message>MAX SIG <xsl:value-of select="$max_sign_"/></xsl:message>
467 <xsl:message>W NUM <xsl:value-of select="$w_num_"/></xsl:message>
468 <xsl:message>W DIR <xsl:value-of select="$w_dir_"/></xsl:message>
469 <xsl:message>W NAM <xsl:value-of select="$w_name_"/></xsl:message>
470 <xsl:message>W SIG <xsl:value-of select="$w_sign_"/></xsl:message>
471 <xsl:message>W ATT <xsl:value-of select="$w_attr_"/></xsl:message>
473 <xsl:message>W TABLE <xsl:value-of select="$w_table_"/></xsl:message>
476 <g id="BlkDiagram_ExtPortsTable">
481 height="{$h_font_}" style="fill:{$COL_RED}; stroke:none; stroke-width:1"/>
488 <!-- ======================= END MAIN BLOCK =========================== -->