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">
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"/>
12 <xsl:param name="IOP_H" select="16"/>
13 <xsl:param name="IOP_W" select="16"/>
14 <xsl:param name="IOP_SPC" select="12"/>
16 <xsl:param name="MOD_IO_GAP" select="8"/>
18 <!-- ======================= DEF BLOCK =============================== -->
19 <xsl:template name="Define_IOPorts">
21 <xsl:variable name="key_col_">
22 <xsl:call-template name="BusType2Color">
23 <xsl:with-param name="busType" select="'KEY'"/>
27 <xsl:variable name="key_lt_col_">
28 <xsl:call-template name="BusType2LightColor">
29 <xsl:with-param name="busType" select="'KEY'"/>
33 <symbol id="G_IOPort">
38 height="{$IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
42 L {$IOP_W},{ceiling($IOP_H div 2)}
44 Z" style="stroke:none; fill:{$COL_SYSPRT}"/>
47 <symbol id="G_BIPort">
52 height="{$IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
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}"/>
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}"/>
68 <symbol id="KEY_IOPort">
73 height="{$IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
77 L {$IOP_W},{ceiling($IOP_H div 2)}
79 Z" style="stroke:none; fill:{$key_col_}"/>
82 <symbol id="KEY_BIPort">
87 height="{$IOP_H}" style="fill:{$key_lt_col_}; stroke:none;"/>
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_}"/>
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_}"/>
102 <symbol id="KEY_INPort">
103 <use x="0" y="0" xlink:href="#KEY_IOPort"/>
107 width= "{ceiling($IOP_W div 2)}"
108 height="{$IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
111 <symbol id="KEY_OUTPort">
112 <use x="0" y="0" xlink:href="#KEY_IOPort" transform="scale(-1,1) translate({$IOP_W * -1},0)"/>
116 width= "{ceiling($IOP_W div 2)}"
117 height="{$IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
120 <symbol id="KEY_INOUTPort">
121 <use x="0" y="0" xlink:href="#KEY_BIPort"/>
125 width= "{ceiling($IOP_W div 2)}"
126 height="{$IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
132 <!-- ======================= DRAW BLOCK =============================== -->
134 <xsl:template name="Draw_IOPorts">
135 <xsl:param name="drawarea_w" select="500"/>
136 <xsl:param name="drawarea_h" select="500"/>
139 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
141 <xsl:if test="($ports_count_ > 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"/>
148 <xsl:if test="($ports_count_ <= 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"/>
157 <xsl:template name="Draw_IOPorts_2Sides">
159 <xsl:param name="drawarea_h" select="500"/>
160 <xsl:param name="drawarea_w" select="500"/>
162 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
163 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 2)"/>
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)"/>
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)"/>
174 <xsl:for-each select="EXTERNALPORTS/PORT">
175 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
177 <xsl:variable name="poffset_" select="0"/>
178 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
180 <xsl:variable name="pdir_">
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>
189 <xsl:variable name="pside_">
191 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
192 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">E</xsl:when>
193 <xsl:otherwise>D</xsl:otherwise>
197 <xsl:variable name="pdec_">
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>
205 <xsl:variable name="px_">
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>
215 <xsl:variable name="py_">
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>
226 <xsl:variable name="prot_">
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>
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>
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>
247 <xsl:variable name="txo_">
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>
257 <xsl:variable name="tyo_">
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>
267 <xsl:if test="$pdir_ = 'B'">
271 xlink:href="#G_BIPort"
272 transform="rotate({$prot_},{$px_ + ceiling($IOP_W div 2)},{$py_ + ceiling($IOP_H div 2)})"/>
275 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
280 height="{$IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
283 <xsl:if test="not($pdir_ = 'B')">
287 xlink:href="#G_IOPort"
288 transform="rotate({$prot_},{$px_ + ceiling($IOP_W div 2)},{$py_ + ceiling($IOP_H div 2)})"/>
291 <text class="iopnumb"
294 <xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
302 <xsl:template name="Draw_IOPorts_4Sides">
304 <xsl:param name="drawarea_h" select="500"/>
305 <xsl:param name="drawarea_w" select="500"/>
307 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
308 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 4)"/>
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)"/>
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)"/>
319 <xsl:for-each select="EXTERNALPORTS/PORT">
320 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
322 <xsl:variable name="poffset_" select="0"/>
323 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
325 <xsl:variable name="pdir_">
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>
334 <xsl:variable name="pside_">
336 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
337 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">S</xsl:when>
338 <xsl:when test="($pcount_ >= ($ports_per_side_ * 2) and ($pcount_ < ($ports_per_side_ * 3)))">E</xsl:when>
339 <xsl:when test="($pcount_ >= ($ports_per_side_ * 3) and ($pcount_ < ($ports_per_side_ * 4)))">N</xsl:when>
340 <xsl:otherwise>D</xsl:otherwise>
344 <xsl:variable name="pdec_">
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>
354 <xsl:variable name="px_">
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>
364 <xsl:variable name="py_">
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>
375 <xsl:variable name="prot_">
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>
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>
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>
395 <xsl:variable name="txo_">
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>
405 <xsl:variable name="tyo_">
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>
415 <xsl:if test="$pdir_ = 'B'">
419 xlink:href="#G_BIPort"
420 transform="rotate({$prot_},{$px_ + ceiling($IOP_W div 2)},{$py_ + ceiling($IOP_H div 2)})"/>
423 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
428 height="{$IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
431 <xsl:if test="not($pdir_ = 'B')">
435 xlink:href="#G_IOPort"
436 transform="rotate({$prot_},{$px_ + ceiling($IOP_W div 2)},{$py_ + ceiling($IOP_H div 2)})"/>
439 <text class="iopnumb"
441 y="{$py_ + $tyo_}"><xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
448 <xsl:template name="Define_ExtPortsTable">
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))"/>
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>
459 <xsl:variable name="ext_ports_">
460 <xsl:if test="not(/EDKSYSTEM/EXTERNALPORTS/PORT)">
461 <EXTPORT NAME="__none__" SIGNAME="__none_" NAMELEN="0" SIGLEN="0"/>
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)}"/>
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)"/>
473 <xsl:variable name="h_font_" select="12"/>
474 <xsl:variable name="w_font_" select="12"/>
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_)"/>
483 <xsl:variable name="w_table_" select="($w_num_ + $w_name_ + $w_dir_ + $w_sign_ + $w_attr_)"/>
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>
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>
495 <xsl:message>W TABLE <xsl:value-of select="$w_table_"/></xsl:message>
498 <symbol id="BlkDiagram_ExtPortsTable">
503 height="{$h_font_}" style="fill:{$COL_RED}; stroke:none; stroke-width:1"/>
510 <!-- ======================= END MAIN BLOCK =========================== -->