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"/>
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"/>
20 <!-- ======================= DEF BLOCK =============================== -->
21 <xsl:template name="Define_IOPorts">
23 <xsl:variable name="key_col_">
24 <xsl:call-template name="BusType2Color">
25 <xsl:with-param name="iBusType" select="'KEY'"/>
29 <xsl:variable name="key_lt_col_">
30 <xsl:call-template name="BusType2LightColor">
31 <xsl:with-param name="iBusType" select="'KEY'"/>
35 <symbol id="G_IOPort">
39 width= "{$BLKD_IOP_W}"
40 height="{$BLKD_IOP_H}" style="fill:{$COL_IORING_LT}; stroke:{$COL_IORING}; stroke-width:1"/>
44 L {$BLKD_IOP_W},{ceiling($BLKD_IOP_H div 2)}
46 Z" style="stroke:none; fill:{$COL_SYSPRT}"/>
49 <symbol id="G_BIPort">
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}"/>
70 <symbol id="KEY_IOPort">
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_}"/>
84 <symbol id="KEY_BIPort">
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_}"/>
104 <symbol id="KEY_INPort">
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;"/>
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)"/>
118 width= "{ceiling($BLKD_IOP_W div 2)}"
119 height="{$BLKD_IOP_H}" style="fill:{$COL_SYSPRT}; stroke:none;"/>
122 <symbol 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;"/>
134 <!-- ======================= DRAW BLOCK =============================== -->
136 <xsl:template name="Draw_IOPorts">
138 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
140 <xsl:if test="($ports_count_ > 30)">
141 <xsl:call-template name="Draw_IOPorts_4Sides"/>
144 <xsl:if test="($ports_count_ <= 30)">
145 <xsl:call-template name="Draw_IOPorts_2Sides"/>
149 <xsl:template name="Draw_IOPorts_2Sides">
151 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
152 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 2)"/>
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)"/>
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)"/>
163 <xsl:for-each select="EXTERNALPORTS/PORT">
164 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
166 <xsl:variable name="poffset_" select="0"/>
167 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
169 <xsl:variable name="pdir_">
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>
178 <xsl:variable name="pside_">
180 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
181 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">E</xsl:when>
182 <xsl:otherwise>D</xsl:otherwise>
186 <xsl:variable name="pdec_">
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>
194 <xsl:variable name="px_">
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>
204 <xsl:variable name="py_">
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>
215 <xsl:variable name="prot_">
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>
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>
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>
236 <xsl:variable name="txo_">
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>
246 <xsl:variable name="tyo_">
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>
256 <xsl:if test="$pdir_ = 'B'">
260 xlink:href="#G_BIPort"
261 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
264 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
268 width= "{$BLKD_IOP_W}"
269 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
272 <xsl:if test="not($pdir_ = 'B')">
276 xlink:href="#G_IOPort"
277 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
280 <text class="iopnumb"
283 <xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
291 <xsl:template name="Draw_IOPorts_4Sides">
293 <xsl:variable name="ports_count_" select="count(EXTERNALPORTS/PORT)"/>
294 <xsl:variable name="ports_per_side_" select="ceiling($ports_count_ div 4)"/>
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)"/>
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)"/>
305 <xsl:for-each select="EXTERNALPORTS/PORT">
306 <xsl:sort data-type="number" select="@INDEX" order="ascending"/>
308 <xsl:variable name="poffset_" select="0"/>
309 <xsl:variable name="pcount_" select="$poffset_ + (position() -1)"/>
311 <xsl:variable name="pdir_">
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>
320 <xsl:variable name="pside_">
322 <xsl:when test="($pcount_ >= ($ports_per_side_ * 0) and ($pcount_ < ($ports_per_side_ * 1)))">W</xsl:when>
323 <xsl:when test="($pcount_ >= ($ports_per_side_ * 1) and ($pcount_ < ($ports_per_side_ * 2)))">S</xsl:when>
324 <xsl:when test="($pcount_ >= ($ports_per_side_ * 2) and ($pcount_ < ($ports_per_side_ * 3)))">E</xsl:when>
325 <xsl:when test="($pcount_ >= ($ports_per_side_ * 3) and ($pcount_ < ($ports_per_side_ * 4)))">N</xsl:when>
326 <xsl:otherwise>D</xsl:otherwise>
330 <xsl:variable name="pdec_">
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>
340 <xsl:variable name="px_">
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>
350 <xsl:variable name="py_">
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>
361 <xsl:variable name="prot_">
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>
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>
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>
381 <xsl:variable name="txo_">
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>
391 <xsl:variable name="tyo_">
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>
401 <xsl:if test="$pdir_ = 'B'">
405 xlink:href="#G_BIPort"
406 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
409 <xsl:if test="(($pside_ = 'S') and not($pdir_ = 'B'))">
413 width= "{$BLKD_IOP_W}"
414 height="{$BLKD_IOP_H}" style="stroke:{$COL_IORING}; stroke-width:1"/>
417 <xsl:if test="not($pdir_ = 'B')">
421 xlink:href="#G_IOPort"
422 transform="rotate({$prot_},{$px_ + ceiling($BLKD_IOP_W div 2)},{$py_ + ceiling($BLKD_IOP_H div 2)})"/>
425 <text class="iopnumb"
427 y="{$py_ + $tyo_}"><xsl:value-of select="@INDEX"/><tspan class="iopgrp"><xsl:value-of select="@GROUP"/></tspan>
434 <xsl:template name="Define_ExtPortsTable">
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))"/>
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>
445 <xsl:variable name="ext_ports_">
446 <xsl:if test="not(/EDKSYSTEM/EXTERNALPORTS/PORT)">
447 <EXTPORT NAME="__none__" SIGNAME="__none_" NAMELEN="0" SIGLEN="0"/>
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)}"/>
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)"/>
459 <xsl:variable name="h_font_" select="12"/>
460 <xsl:variable name="w_font_" select="12"/>
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_)"/>
469 <xsl:variable name="w_table_" select="($w_num_ + $w_name_ + $w_dir_ + $w_sign_ + $w_attr_)"/>
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>
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>
481 <xsl:message>W TABLE <xsl:value-of select="$w_table_"/></xsl:message>
484 <symbol id="BlkDiagram_ExtPortsTable">
489 height="{$h_font_}" style="fill:{$COL_RED}; stroke:none; stroke-width:1"/>
496 <!-- ======================= END MAIN BLOCK =========================== -->