]> git.sur5r.net Git - freertos/blob - Demo/PPC405_Xilinx_Virtex4_GCC/__xps/.dswkshop/MdtXdsSVG_BlkDPeripherals.xsl
847d5b88a734044406ad54b251ca4f27622c0d31
[freertos] / Demo / PPC405_Xilinx_Virtex4_GCC / __xps / .dswkshop / MdtXdsSVG_BlkDPeripherals.xsl
1 <?xml version="1.0" standalone="no"?>
2                         
3 <xsl:stylesheet version="1.0"
4            xmlns:svg="http://www.w3.org/2000/svg"
5            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6            xmlns:math="http://exslt.org/math"
7            xmlns:exsl="http://exslt.org/common"
8            xmlns:xlink="http://www.w3.org/1999/xlink"
9            extension-element-prefixes="math">
10                                 
11 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
12                doctype-public="-//W3C//DTD SVG 1.0//EN"
13                    doctype-system="http://www.w3.org/TR/SVG/DTD/svg10.dtd"/>
14                         
15 <!--    
16 <xsl:variable name="INF_H"   select="$BIF_H       + ceiling($BIF_H div 2)"/>                            
17 <xsl:variable name="INF_W"   select="($BIF_W * 2) + $BIF_GAP"/>
18 -->     
19
20
21 <!-- ======================= DEF FUNCTIONS =================================== -->
22
23 <xsl:template name="Define_FreeCmplxModules">
24         
25         <xsl:for-each select="BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@IS_PROMOTED and not(@IS_PENALIZED) and not(@STACK_INDEX))]">  
26                 
27                 <xsl:variable name="cmplxId_" select="position()"/>
28                 
29                 <xsl:if test="@MODCLASS='MEMORY_UNIT'">
30                         <xsl:call-template name="Define_PeripheralMemory">
31                                 <xsl:with-param name="periId" select="$cmplxId_"/>
32                         </xsl:call-template>
33                 </xsl:if>
34                 
35                 <xsl:if test="((@MODCLASS='MASTER_SLAVE') or (@MODCLASS = 'MONITOR'))">
36                         <xsl:variable name="modInst_" select="MODULE/@INSTANCE"/>
37                         <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$modInst_)]/@MODTYPE"/>
38                         <xsl:call-template name="Define_Peripheral">
39                                 <xsl:with-param name="modInst"  select="$modInst_"/>
40                                 <xsl:with-param name="modType"  select="$modType_"/>
41                         </xsl:call-template>            
42                 </xsl:if>
43                 
44         </xsl:for-each>         
45 </xsl:template> 
46
47
48 <xsl:template name="Define_PenalizedModules">
49         
50         <xsl:for-each select="BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@IS_PROMOTED and @IS_PENALIZED)]">     
51                 
52                 <xsl:variable name="penalId_">unkmodule_<xsl:value-of select="@BKTROW"/>_<xsl:value-of select="@MODS_X"/></xsl:variable>
53                 
54 <!--            
55                 <xsl:message>Drawing penalized module <xsl:value-of select="$penalId_"/></xsl:message>
56 -->             
57                 
58                 <xsl:if test="@MODCLASS='MEMORY_UNIT'">
59                         <xsl:call-template name="Define_PeripheralMemory">
60                                 <xsl:with-param name="periId" select="$penalId_"/>
61                         </xsl:call-template>
62                 </xsl:if>
63                 
64 <!--            
65                 <xsl:if test="((@MODCLASS='MASTER_SLAVE') or (@MODCLASS = 'MONITOR'))">
66 -->             
67                         <xsl:variable name="modInst_" select="MODULE/@INSTANCE"/>
68                         <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst_)]/@MODTYPE"/>
69                         <xsl:call-template name="Define_Peripheral">
70                                 <xsl:with-param name="modInst"  select="$modInst_"/>
71                                 <xsl:with-param name="modType"  select="$modType_"/>
72                                 <xsl:with-param name="unkInst"  select="$penalId_"/>
73                         </xsl:call-template>            
74 <!--                    
75                 </xsl:if>
76 -->             
77                 
78         </xsl:for-each>         
79 </xsl:template> 
80
81
82 <xsl:template name="Define_IPBucket">
83                         
84         <xsl:for-each select="BLKDSHAPES/IPBUCKET">
85                 
86                 <xsl:for-each select="MODULE">  
87                         
88                         <xsl:call-template name="Define_IPBucketModule">
89                                 <xsl:with-param name="ip_type"   select="@MODTYPE"/>
90                                 <xsl:with-param name="ip_name"   select="@INSTANCE"/>
91                         </xsl:call-template>    
92                         
93                 </xsl:for-each>         
94                 
95                 <symbol id="ipbucket">
96                         <xsl:variable name="bucket_w_"  select="(($MOD_BKTLANE_W * 2) + (($periMOD_W * @MODS_W) + ($MOD_BUCKET_G * (@MODS_W - 1))))"/>
97                         <xsl:variable name="bucket_h_"  select="(($MOD_BKTLANE_H * 2) + (($periMOD_H * @MODS_H) + ($MOD_BUCKET_G * (@MODS_H - 1))))"/>
98                 
99                 <rect x="0" 
100                       y="0"  
101                           rx="4"
102                           ry="4"
103                       width= "{$bucket_w_}" 
104                       height="{$bucket_h_}" 
105                       style="stroke-width:2; stroke:{$COL_BLACK}; fill:{$COL_IORING_LT}"/>
106                                  
107                         <xsl:variable name="bkt_mods_w_" select="@MODS_W"/>
108                         
109                         <xsl:for-each select="MODULE">  
110                                 
111                                 <xsl:variable name="clm_"   select="((     position() - 1)  mod $bkt_mods_w_)"/>
112                                 <xsl:variable name="row_"   select="floor((position() - 1)  div $bkt_mods_w_)"/>
113                                 
114                                 <xsl:variable name="bk_x_"  select="$MOD_BKTLANE_W + ($clm_ * ($periMOD_W + $MOD_BUCKET_G))"/>
115                                 <xsl:variable name="bk_y_"  select="$MOD_BKTLANE_H + ($row_ * ($periMOD_H + $MOD_BUCKET_G))"/>
116                                 
117                                          
118                                 <use x="{$bk_x_}"   
119                                          y="{$bk_y_}" 
120                                          xlink:href="#ipbktmodule_{@INSTANCE}"/>                                  
121                                          
122                                          
123                         </xsl:for-each>          
124                                          
125         </symbol>               
126         
127 </xsl:for-each> 
128 </xsl:template> 
129
130
131 <xsl:template name="Define_UNKBucket">
132                         
133         <xsl:for-each select="BLKDSHAPES/UNKBUCKET">
134         
135                 <symbol id="unkbucket">
136                         <xsl:variable name="bucket_w_"  select="(($MOD_BKTLANE_W * 2) + (($periMOD_W * @MODS_W) + ($MOD_BUCKET_G * (@MODS_W - 1))))"/>
137                         <xsl:variable name="bucket_h_"  select="(($MOD_BKTLANE_H * 2) + (($periMOD_H * @MODS_H) + ($MOD_BUCKET_G * (@MODS_H - 1))))"/>
138                 
139                 <rect x="0" 
140                       y="0"  
141                           rx="4"
142                           ry="4"
143                       width= "{$bucket_w_}" 
144                       height="{$bucket_h_}" 
145                       style="stroke-width:2; stroke:{$COL_BLACK}; fill:{$COL_UNK_BG}"/>
146                                  
147                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@IS_PROMOTED and @IS_PENALIZED)]">  
148                         
149                         <xsl:variable name="bkt_mods_w_" select="@MODS_W"/>
150                                 
151                                 <xsl:variable name="mod_row_"    select="@BKTROW"/>     
152                                 <xsl:variable name="row_mods_h_" select="/EDKSYSTEM/BLKDSHAPES/UNKBUCKET/BKTROW[(@INDEX = $mod_row_)]/@MODS_H"/>        
153
154 <!--                            
155                                 <xsl:message>The row module is <xsl:value-of select="@BKTROW"/></xsl:message>
156                                 <xsl:message>The height of the module is <xsl:value-of select="$row_mods_h_"/></xsl:message>
157 -->                             
158                                 
159                                 
160                                 <xsl:variable name="bk_x_"  select="$MOD_BKTLANE_W + (@MODS_X * ($periMOD_W + $MOD_BUCKET_G))"/>
161                                 <xsl:variable name="bk_y_"  select="$MOD_BKTLANE_H + ($row_mods_h_ * ($periMOD_H + $MOD_BUCKET_G))"/>
162                                 
163                                 <use x="{$bk_x_}"   
164                                          y="{$bk_y_}" 
165                                          xlink:href="#symbol_unkmodule_{@BKTROW}_{@MODS_X}"/>                             
166 <!--                             
167 -->                              
168
169                         </xsl:for-each>          
170
171                         
172                 </symbol>               
173                 
174         </xsl:for-each> 
175 </xsl:template> 
176
177                 
178 <xsl:template name="Define_SBSBuckets">
179         
180         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/SBSBUCKETS/SBSBUCKET">      
181                 
182                 <xsl:variable name="bus_name_"   select="@BUSNAME"/>
183                 <xsl:variable name="bus_std_"    select="@BUSSTD"/>
184 <!--            
185                 <xsl:variable name="bus_std_"    select="BUSCONNS/BUSCONN/@BUSSTD"/>
186 -->     
187                 <xsl:variable name="bus_conn_w_" select="BUSCONNS/@BUSLANE_W"/>
188                 
189                 <xsl:variable name="bucket_bg_col_">
190                         <xsl:call-template name="BusType2LightColor">
191                                 <xsl:with-param name="busType" select="$bus_std_"/>
192                         </xsl:call-template>
193                 </xsl:variable>
194                 
195                 <xsl:variable name="bucket_col_">
196                         <xsl:call-template name="BusType2Color">
197                                 <xsl:with-param name="busType" select="$bus_std_"/>
198                         </xsl:call-template>
199                 </xsl:variable>
200                 
201                 
202                 <xsl:for-each select="MODULE">  
203                         
204                         <xsl:sort data-type="text" select="@INSTANCE" order="ascending"/>
205                 
206                         <xsl:call-template name="Define_SBSBucketModule">
207                                 <xsl:with-param name="bif_type"  select="$bus_std_"/>
208                                 <xsl:with-param name="ip_type"   select="@MODTYPE"/>
209                                 <xsl:with-param name="ip_name"   select="@INSTANCE"/>
210                         </xsl:call-template>    
211                         
212                 </xsl:for-each>         
213                 
214                 <symbol id="sbsbucket_{$bus_name_}">
215                         <xsl:variable name="bucket_w_"  select="(($MOD_BKTLANE_W * 2) + (($periMOD_W * @MODS_W) + ($MOD_BUCKET_G * (@MODS_W - 1))))"/>
216                         <xsl:variable name="bucket_h_"  select="(($MOD_BKTLANE_H * 2) + ((($periMOD_H + $BIFC_H) * @MODS_H) + ($MOD_BUCKET_G * (@MODS_H - 1))))"/>
217                         
218                         <rect x="0"
219                               y="0"  
220                                   rx="4"
221                                   ry="4"
222                               width= "{$bucket_w_}" 
223                               height="{$bucket_h_}" 
224                               style="stroke-width:2; stroke:{$bucket_col_}; fill:{$bucket_bg_col_}"/>
225 <!--                    
226 -->                     
227                                  
228                         <xsl:variable name="bkt_mods_w_" select="@MODS_W"/>
229                         
230                         <xsl:for-each select="MODULE">  
231                                 
232                                 <xsl:sort data-type="text" select="@INSTANCE" order="ascending"/>
233                                 
234                                 <xsl:variable name="clm_"   select="((     position() - 1)  mod $bkt_mods_w_)"/>
235                                 <xsl:variable name="row_"   select="floor((position() - 1)  div $bkt_mods_w_)"/>
236                                 
237                                 <xsl:variable name="bk_x_"  select="$MOD_BKTLANE_W + ($clm_ * ($periMOD_W + $MOD_BUCKET_G))"/>
238                                 <xsl:variable name="bk_y_"  select="$MOD_BKTLANE_H + ($row_ * ($periMOD_H + $BIFC_H + $MOD_BUCKET_G))"/>
239                                          
240                                 <!-- Lay out the module in the bucket -->
241                                  <use x="{$bk_x_}" y="{$bk_y_}"  xlink:href="#sbsbktmodule_{@INSTANCE}"/>                 
242                                 
243                                 <!-- Add its connection to the piece shared bus -->
244                                 <xsl:variable name="h_bus_y_" select="$bk_y_ + ceiling($BIFC_H div 2) - ceiling($P2P_BUS_W div 2)"/>
245                                 
246 <!--                            
247                                 <xsl:variable name="h_bus_x_" select="$bk_x_ - ($MOD_BUCKET_G + ceiling($periMOD_W div 2))"/>
248 -->     
249                                 <xsl:variable name="h_bus_x_">
250                                         <xsl:choose>
251                                                 <xsl:when test="($clm_ = '0')">0</xsl:when>
252                                         
253                                                 <xsl:when test="not($clm_ = '0')">
254                                                         <xsl:value-of select="$bk_x_ - ($MOD_BUCKET_G + ceiling($periMOD_W div 2))"/>
255                                                 </xsl:when>
256                                         </xsl:choose>
257                                 </xsl:variable>
258                                 
259 <!--                            
260                                 <xsl:variable name="h_bus_y_" select="$bk_y_ + ceiling($BIFC_H div 2) - ceiling($P2P_BUS_W)"/>
261                                 <xsl:message>h bus x <xsl:value-of select="$h_bus_x_"/></xsl:message>
262                                 <xsl:message>h bus y <xsl:value-of select="$h_bus_y_"/></xsl:message>
263 -->     
264                                 <xsl:variable name="h_bus_height_" select="$P2P_BUS_W"/>
265                                 <xsl:variable name="h_bus_width_"  select="($bk_x_ - $h_bus_x_ + ceiling($periMOD_W div 2))"/>  
266                                 
267                                 <rect x="{$h_bus_x_}" 
268                                   y="{$h_bus_y_}"  
269                                   width= "{$h_bus_width_}" 
270                                   height="{$P2P_BUS_W}" 
271                                   style="fill:{$bucket_col_}"/>
272                                 
273                         </xsl:for-each>
274                         
275                         <xsl:variable name="num_sbsbktmods_" select="count(MODULE)"/>
276                         <xsl:variable name="num_sbsbktrows_" select="ceiling($num_sbsbktmods_ div $BKT_MODS_PER_ROW)"/>
277                         
278                         <!-- If there is more than one row, connect the rows with a vertical bar -->            
279                         <xsl:if test="($num_sbsbktrows_ &gt; 1)">
280                                 
281                                 <xsl:variable name="v_bus_x_"    select="$MOD_BKTLANE_W + ($periMOD_W + $MOD_BUCKET_G)"/>
282                                 
283                                 <xsl:variable name="bkt_top_"    select="$MOD_BKTLANE_H + (0                      * ($periMOD_H + $BIFC_H + $MOD_BUCKET_G))"/>
284                                 <xsl:variable name="bkt_bot_"    select="$MOD_BKTLANE_H + (($num_sbsbktrows_ - 1) * ($periMOD_H + $BIFC_H + $MOD_BUCKET_G))"/>
285                                 
286                                 <xsl:variable name="v_bus_y_top_" select="$bkt_top_ + ceiling($BIFC_H div 2) - ceiling($P2P_BUS_W div 2)"/>
287                                 <xsl:variable name="v_bus_y_bot_" select="$bkt_bot_ + ceiling($BIFC_H div 2) - ceiling($P2P_BUS_W div 2)"/>
288                                 
289                                 <xsl:variable name="v_bus_width_"   select="$P2P_BUS_W"/>
290                                 <xsl:variable name="v_bus_height_"  select="($v_bus_y_bot_ - $v_bus_y_top_)"/>
291                                 <rect x="0" 
292                                   y="{$v_bus_y_top_}"  
293                                   width= "{$v_bus_width_}" 
294                                   height="{$v_bus_height_}" 
295                                   style="fill:{$bucket_col_}"/>
296                         </xsl:if>
297                         
298                 </symbol>
299                 
300         </xsl:for-each>         
301         
302         
303 </xsl:template> 
304         
305 <!-- ======================= END DEF BLOCK ============================ -->
306 <xsl:template name="Define_SBSBucketModule">
307         
308         <xsl:param name="bif_type"  select="'OPB'"/>
309         <xsl:param name="ip_name"   select="'ip_type'"/>
310         <xsl:param name="ip_type"   select="'ip_name'"/>
311 <!--    
312         <xsl:message>The bif type is <xsl:value-of select="$bif_type"/> </xsl:message>
313 -->     
314         
315         
316         <xsl:variable name="bif_y_">
317                 <xsl:value-of select="$MOD_LANE_H + $BIFC_H"/>  
318         </xsl:variable>
319
320         <xsl:variable name="label_y_">
321                 <xsl:value-of select="$MOD_LANE_H + $BIF_H + $BIFC_H +  $MOD_BIF_GAP_V"/>       
322         </xsl:variable>
323         
324         
325     <symbol id="sbsbktmodule_{$ip_name}">
326                 
327                 <rect x="0"
328                       y="{$BIFC_H}"
329                           rx="6" 
330                           ry="6" 
331                       width = "{$periMOD_W}"
332                       height= "{$periMOD_H}"
333                           style="fill:{$COL_BG}; stroke:{$COL_WHITE}; stroke-width:2"/>         
334                           
335                 <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
336                       y="{$label_y_}"
337                           rx="3" 
338                           ry="3" 
339                       width= "{$MOD_LABEL_W}"
340                       height="{$MOD_LABEL_H}"
341                           style="fill:{$COL_WHITE}; stroke:none;"/>             
342                 
343 <!-- -->        
344                           
345                 <xsl:if test="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/@GROUP">
346                 
347                         <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
348                           y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) - 2}"
349                               rx="3" 
350                               ry="3" 
351                           width= "{$MOD_LABEL_W}"
352                           height="{$BIF_H}"
353                                   style="fill:{$COL_IORING_LT}; stroke:none;"/>         
354                           
355         
356                    <text class="ioplblgrp" 
357                                   x="{ceiling($periMOD_W div 2)}"
358                           y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) + 12}">
359                            <xsl:value-of select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/@GROUP"/>
360                         </text>
361            
362                 </xsl:if> 
363            
364                 <text class="bciptype" 
365                           x="{ceiling($periMOD_W div 2)}"
366                           y="{$label_y_ + 8}">
367                                 <xsl:value-of select="$ip_type"/>
368                 </text>
369                                 
370                 <text class="bciplabel" 
371                           x="{ceiling($periMOD_W div 2)}"
372                           y="{$label_y_ + 16}">
373                                 <xsl:value-of select="$ip_name"/>
374            </text>
375            
376                 <xsl:for-each select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $ip_name)]/BUSINTERFACE[not(@BUSNAME = '__NOC__')]">
377                         
378                         <xsl:variable name="bif_busstd_">
379                                 <xsl:choose>
380                                         <xsl:when test="@BUSSTD">
381                                                 <xsl:value-of select="@BUSSTD"/>        
382                                         </xsl:when>
383                                         <xsl:otherwise>
384                                                 <xsl:value-of select="'TRS'"/>  
385                                         </xsl:otherwise>
386                                 </xsl:choose>
387                         </xsl:variable>
388                         
389                         <xsl:variable name="bif_name_">
390                                 <xsl:choose>
391                                         <xsl:when test="string-length(@NAME) &lt;= 5">
392                                                 <xsl:value-of select="@NAME"/>  
393                                         </xsl:when>
394                                         <xsl:otherwise>
395                                                 <xsl:value-of select="substring(@NAME,0,5)"/>   
396                                         </xsl:otherwise>
397                                 </xsl:choose>
398                         </xsl:variable>
399         
400                     <xsl:variable name="bif_x_"  select="ceiling($periMOD_W div 2) - ceiling($BIF_W div 2)"/>
401                         
402                         <!-- Draw the BIF -->
403                         <use  x="{$bif_x_}"   y="{$bif_y_}"  xlink:href="#{$bif_busstd_}_Bif"/>
404                         
405 <!--                    
406                         <symbol id="{$bus_type}_busconn_SLAVE"> 
407 -->              
408          
409                         <!-- Draw the BIF connection -->
410                         <use  x="{$bif_x_ + ceiling($BIF_W div 2) - ceiling($BIFC_W div 2)}"   y="{$bif_y_ - $BIFC_H - $MOD_LANE_H}"  xlink:href="#{$bif_busstd_}_busconn_{@BIFRANK}"/>
411                                 
412                         <text class="biflabel" 
413                                   x="{$bif_x_ + ceiling($BIF_W div 2)}"
414                                   y="{$bif_y_ + ceiling($BIF_H div 2) + 3}">
415                                         <xsl:value-of select="$bif_name_"/>
416                         </text>
417                         
418                 </xsl:for-each>
419                 
420                 <xsl:if test="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/@INTCINDEX">
421                         <xsl:variable name="intr_col_">
422                                 <xsl:call-template name="intcIdx2Color">
423                                         <xsl:with-param name="intcIdx" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/@INTCINDEX"/>
424                                 </xsl:call-template>    
425                         </xsl:variable>
426                         
427                         <xsl:call-template name="_draw_InterruptCntrl">
428                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
429                                 <xsl:with-param name="intr_x"   select="($periMOD_W - ceiling($INTR_W div 2))"/>
430                                 <xsl:with-param name="intr_y"   select="3 + $BIFC_H"/>
431                                 <xsl:with-param name="intr_idx" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/@INTCINDEX"/>
432                         </xsl:call-template>    
433                 </xsl:if>
434                 
435                       
436                 <xsl:for-each select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/INTCCNTLRTRGS/INTCTRG">
437                         <xsl:variable name="intr_col_">
438                                 <xsl:call-template name="intcIdx2Color">
439                                         <xsl:with-param name="intcIdx" select="@INTCINDEX"/>
440                                 </xsl:call-template>    
441                         </xsl:variable>
442                         
443                         <xsl:call-template name="_draw_InterruptSource">
444                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
445                                 <xsl:with-param name="intr_x"   select="($periMOD_W - $INTR_W)"/>
446                                 <xsl:with-param name="intr_y"   select="((position() - 1) * (ceiling($INTR_H div 2) + 3)) + $BIFC_H"/>
447                                 <xsl:with-param name="intr_pri" select="@PRIORITY"/>
448                                 <xsl:with-param name="intr_idx" select="@INTCINDEX"/>
449                         </xsl:call-template>    
450                         
451                 </xsl:for-each>
452                 
453         </symbol>                         
454         
455 </xsl:template> 
456
457 <xsl:template name="Define_IPBucketModule">
458         
459         <xsl:param name="ip_name"   select="'ip_type'"/>
460         <xsl:param name="ip_type"   select="'ip_name'"/>
461         
462         <xsl:variable name="bif_y_">
463                 <xsl:value-of select="$MOD_LANE_H"/>    
464         </xsl:variable>
465
466         <xsl:variable name="label_y_">
467                 <xsl:value-of select="(ceiling($periMOD_H div 2) - ceiling($MOD_LABEL_H div 2))"/>      
468         </xsl:variable>
469         
470     <symbol id="ipbktmodule_{$ip_name}">
471
472                 <rect x="0"
473                       y="0"
474                           rx="6" 
475                           ry="6" 
476                       width = "{$periMOD_W}"
477                       height= "{$periMOD_H}"
478                           style="fill:{$COL_BG}; stroke:{$COL_BLACK}; stroke-width:2"/>         
479                           
480                 <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
481                       y="{$label_y_}"
482                           rx="3" 
483                           ry="3" 
484                       width= "{$MOD_LABEL_W}"
485                       height="{$MOD_LABEL_H}"
486                           style="fill:{$COL_WHITE}; stroke:none;"/>             
487                           
488 <!--
489                           y="{$label_y_ + ceiling($MOD_LABEL_H div 2) - 4}"
490                           y="{$label_y_ + ceiling($MOD_LABEL_H div 2) + 4}"
491 -->                       
492
493                 <text class="bciptype" 
494                           x="{ceiling($periMOD_W div 2)}"
495                           y="{$label_y_ + 8}">
496                                 <xsl:value-of select="$ip_type"/>
497                 </text>
498                                 
499                 <text class="bciplabel" 
500                           x="{ceiling($periMOD_W div 2)}"
501                           y="{$label_y_ + 16}">
502                                 <xsl:value-of select="$ip_name"/>
503            </text>
504            
505                 <xsl:if test="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $ip_name)]/@GROUP">
506                 
507                 <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
508                       y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) - 2}"
509                           rx="3" 
510                           ry="3" 
511                       width= "{$MOD_LABEL_W}"
512                       height="{$BIF_H}"
513                           style="fill:{$COL_IORING_LT}; stroke:none;"/>         
514                           
515         
516                    <text class="ioplblgrp" 
517                           x="{ceiling($periMOD_W div 2)}"
518                       y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) + 12}">
519                            <xsl:value-of select="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$ip_name]/@GROUP"/>
520                         </text>
521            
522                 </xsl:if> 
523                 
524                 <xsl:for-each select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$ip_name)]/INTCCNTLRTRGS/INTCTRG">
525                         
526                         <xsl:variable name="intr_col_">
527                                 <xsl:call-template name="intcIdx2Color">
528                                         <xsl:with-param name="intcIdx" select="@INTCINDEX"/>
529                                 </xsl:call-template>    
530                         </xsl:variable>
531                         
532                         <xsl:call-template name="_draw_InterruptSource">
533                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
534                                 <xsl:with-param name="intr_x"   select="($periMOD_W - $INTR_W)"/>
535                                 <xsl:with-param name="intr_y"   select="((position() - 1) * (ceiling($INTR_H div 2) + 3))"/>
536                                 <xsl:with-param name="intr_pri" select="@PRIORITY"/>
537                                 <xsl:with-param name="intr_idx" select="@INTCINDEX"/>
538                         </xsl:call-template>    
539                         
540                 </xsl:for-each>
541            
542         </symbol>                         
543         
544 </xsl:template> 
545         
546         
547 <xsl:template name="Define_Peripheral"> 
548         
549 <!-- when the module is oriented normal its label goes above the bifs -->       
550 <!-- when the module is oriented rot180, (part of a processor memory controller for example) its label goes below the bifs -->  
551
552         <xsl:param name="modVori"    select="'normal'"/>
553         <xsl:param name="modInst"    select="'_instance_'"/>
554         <xsl:param name="modType"    select="'_modtype_'"/>
555         <xsl:param name="unkInst"    select="'_unknown_'"/>
556         <xsl:param name="horizIdx"   select="'_unknown_'"/>
557         <xsl:param name="vertiIdx"   select="'_unknown_'"/>
558         
559 <!--    
560         <xsl:message>Stack Index Y <xsl:value-of select="$cstkIndex"/></xsl:message>
561         <xsl:message>Stack       Y <xsl:value-of select="$cstkMods_Y"/></xsl:message>
562 -->     
563         
564         <xsl:variable name="modName_">
565                 <xsl:choose>
566                         <xsl:when test="$unkInst = '_unknown_'">
567                                 <xsl:value-of select="$modInst"/>       
568                         </xsl:when>
569                         <xsl:otherwise>
570                                 <xsl:value-of select="$unkInst"/>       
571                         </xsl:otherwise>
572                 </xsl:choose>
573         </xsl:variable>
574         
575         <xsl:variable name="modSymbolName_">
576                 <xsl:choose>
577                         <xsl:when test="(not($horizIdx = '_unknown_') and not($vertiIdx = '_unknown_'))">
578                                 <xsl:call-template name="_gen_Stack_SymbolName"> 
579                                         <xsl:with-param name="horizIdx"  select="$horizIdx"/>
580                                         <xsl:with-param name="vertiIdx"  select="$vertiIdx"/>
581                                 </xsl:call-template>            
582                         </xsl:when>
583                         <xsl:otherwise>symbol_<xsl:value-of select="$modName_"/></xsl:otherwise>
584                 </xsl:choose>
585         </xsl:variable>
586         
587         <xsl:variable name="modTypeName_" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst)]/@MODTYPE"/>
588         
589         
590 <!--    
591         <xsl:message>The symbol type of the module is <xsl:value-of select="$modTypeName_"/></xsl:message>
592         <xsl:message>The symbol name of the module is <xsl:value-of select="$modSymbolName_"/></xsl:message>
593 -->     
594         
595         <xsl:variable name="bifs_h_">   
596                 <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $modInst)]/@BIFS_H) and not(/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $modInst)]/@BIFS_H)">0</xsl:if>
597         
598                 <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $modInst)]/@BIFS_H)">
599                         <xsl:value-of select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $modInst)]/@BIFS_H"/>
600                 </xsl:if>
601         
602                 <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $modInst)]/@BIFS_H)">
603                         <xsl:value-of select="/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $modInst)]/@BIFS_H"/>
604                 </xsl:if>
605         </xsl:variable>         
606         
607         <xsl:variable name="label_y_">
608                 <xsl:choose>
609                         <xsl:when test="$modVori = 'rot180'">
610                                 <xsl:value-of select="($MOD_LANE_H + (($BIF_H + $MOD_BIF_GAP_V) * $bifs_h_))"/> 
611                         </xsl:when>
612                         <xsl:otherwise>
613                                 <xsl:value-of select="$MOD_LANE_H"/>    
614                         </xsl:otherwise>
615                 </xsl:choose>
616         </xsl:variable>
617         
618         <xsl:variable name="bif_dy_">
619                 <xsl:choose>
620                         <xsl:when test="$modVori = 'rot180'">
621                                 <xsl:value-of select="$MOD_LANE_H"/>    
622                         </xsl:when>
623                         <xsl:otherwise>
624                                 <xsl:value-of select="($MOD_LANE_H + $MOD_LABEL_H + $MOD_BIF_GAP_V)"/>  
625                         </xsl:otherwise>
626                 </xsl:choose>
627         </xsl:variable>
628         
629         <xsl:variable name="peri_stroke_col_">
630                 <xsl:choose>
631                         <xsl:when test="((@MODCLASS = 'MASTER_SLAVE') or (@MODCLASS = 'MONITOR')) and BUSCONNS/BUSCONN">
632                                 <xsl:call-template name="BusType2Color">
633                                         <xsl:with-param name="busType" select="BUSCONNS/BUSCONN/@BUSSTD"/>
634                                 </xsl:call-template>
635                         </xsl:when>
636                         
637                         <xsl:otherwise>
638                                 <xsl:value-of select="$COL_WHITE"/>
639                         </xsl:otherwise>
640                 </xsl:choose>
641         </xsl:variable>
642         
643         <xsl:variable name="modHeight_">
644                 <xsl:call-template name="_calc_PeriShape_Height">
645                         <xsl:with-param name="shapeInst"  select="$modName_"/>
646                 </xsl:call-template>    
647         </xsl:variable>         
648         
649     <symbol id="{$modSymbolName_}">
650                 
651                 <xsl:if test="$modTypeName_ = 'mpmc'">
652                 <rect x="0"
653                       y="0"
654                           rx="6" 
655                           ry="6" 
656                       width = "{$periMOD_W}"
657                       height= "{$modHeight_}"
658                           style="fill:#669900; stroke:{$peri_stroke_col_}; stroke-width:2"/>            
659                 </xsl:if>       
660                 
661                 <xsl:if test="not($modTypeName_ = 'mpmc')">
662                 <rect x="0"
663                       y="0"
664                           rx="6" 
665                           ry="6" 
666                       width = "{$periMOD_W}"
667                       height= "{$modHeight_}"
668                           style="fill:{$COL_BG}; stroke:{$peri_stroke_col_}; stroke-width:2"/>          
669                 </xsl:if>       
670                 
671                                           
672                 <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
673                       y="{$label_y_}"
674                           rx="3" 
675                           ry="3" 
676                       width= "{$MOD_LABEL_W}"
677                       height="{$MOD_LABEL_H}"
678                           style="fill:{$COL_WHITE}; stroke:none;"/>             
679                           
680 <!--                      
681                           y="{$label_y_ + ceiling($MOD_LABEL_H div 2) - 4}">
682                           y="{$label_y_ + ceiling($MOD_LABEL_H div 2) + 4}">
683 -->
684                           
685                 <text class="bciptype" 
686                           x="{ceiling($periMOD_W div 2)}"
687                           y="{$label_y_ + 8}">
688                                 <xsl:value-of select="$modType"/>
689                 </text>
690                                 
691                 <text class="bciplabel" 
692                           x="{ceiling($periMOD_W div 2)}"
693                           y="{$label_y_ + 16}">
694                                 <xsl:value-of select="$modInst"/>
695            </text>
696            
697                 <xsl:if test="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$modInst]/@GROUP">
698                 
699                 <rect x="{ceiling($periMOD_W div 2) - ceiling($MOD_LABEL_W div 2)}"
700                       y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) - 2}"
701                           rx="3" 
702                           ry="3" 
703                       width= "{$MOD_LABEL_W}"
704                       height="{$BIF_H}"
705                           style="fill:{$COL_IORING_LT}; stroke:none;"/>         
706                           
707                    <text class="ioplblgrp" 
708                           x="{ceiling($periMOD_W div 2)}"
709                       y="{$label_y_ + $BIF_H + ceiling($BIF_H div 3) + 12}">
710                            <xsl:value-of select="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$modInst]/@GROUP"/>
711                         </text>
712            
713                 </xsl:if> 
714            
715                 <xsl:for-each select="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$modInst]/BUSINTERFACE[(@BIF_X and @BIF_Y and not(@BUSNAME = '__NOC__'))]">
716                         
717                         <xsl:variable name="bif_busstd_">
718                                 <xsl:choose>
719                                         <xsl:when test="@BUSSTD">
720                                                 <xsl:value-of select="@BUSSTD"/>        
721                                         </xsl:when>
722                                         <xsl:otherwise>
723                                                 <xsl:value-of select="'TRS'"/>  
724                                         </xsl:otherwise>
725                                 </xsl:choose>
726                         </xsl:variable>
727                         
728                         <xsl:variable name="bif_y_">
729                                 <xsl:value-of select="(($BIF_H + $MOD_BIF_GAP_V)  * @BIF_Y)"/>
730                         </xsl:variable>
731                         
732                         <xsl:variable name="bif_buscol_">
733                                 <xsl:call-template name="BusType2Color">
734                                         <xsl:with-param name="busType" select="$bif_busstd_"/>
735                                 </xsl:call-template>
736                         </xsl:variable>
737                 
738                         
739                         <xsl:variable name="bif_name_">
740                                 <xsl:choose>
741                                         <xsl:when test="not(@NAME)">'UNK'</xsl:when>
742                                         <xsl:when test="string-length(@NAME) &lt;= 5">
743                                                 <xsl:value-of select="@NAME"/>  
744                                         </xsl:when>
745                                         <xsl:otherwise>
746                                                 <xsl:value-of select="substring(@NAME,0,5)"/>   
747                                         </xsl:otherwise>
748                                 </xsl:choose>
749                         </xsl:variable>
750         
751                         <xsl:variable name="bif_x_" >
752                                 <xsl:if test="not(@ORIENTED='CENTER')">
753                                         <xsl:value-of select="(($BIF_W * @BIF_X) + ($MOD_BIF_GAP_H * @BIF_X) + ($MOD_LANE_W * 1))"/>
754                                 </xsl:if>
755                                 <xsl:if test="(@ORIENTED='CENTER')">
756                                         <xsl:value-of select="ceiling($periMOD_W div 2) - ceiling($BIF_W div 2)"/>
757                                 </xsl:if>
758                         </xsl:variable> 
759                         
760                         <xsl:if test="not(@IS_INTCONN)">
761                                 <xsl:variable name="horz_line_y_" select="($bif_y_  + $bif_dy_ + ceiling($BIFC_H div 2))"/>
762                         
763                                 <xsl:variable name="horz_line_x1_">
764                                         <xsl:choose>
765                                                 <xsl:when test="@BIF_X = '0'">0</xsl:when>
766                                                 <xsl:otherwise><xsl:value-of select="($periMOD_W - $MOD_LANE_W)"/></xsl:otherwise>
767                                         </xsl:choose>
768                                 </xsl:variable>
769                         
770                                 <xsl:variable name="horz_line_x2_">
771                                         <xsl:choose>
772                                                 <xsl:when test="@BIF_X = '0'"><xsl:value-of select="$MOD_LANE_W"/></xsl:when>
773                                                 <xsl:otherwise><xsl:value-of select="$periMOD_W + 1"/></xsl:otherwise>
774                                         </xsl:choose>
775                                 </xsl:variable>
776                         
777                         
778                                 <line x1="{$horz_line_x1_}" 
779                                           y1="{$horz_line_y_ - 2}"
780                                   x2="{$horz_line_x2_}" 
781                                   y2="{$horz_line_y_ - 2}" 
782                                  style="stroke:{$bif_buscol_};stroke-width:1"/>
783                           
784                         </xsl:if>
785                         
786                         <use  x="{$bif_x_}"   y="{$bif_y_ + $bif_dy_}"  xlink:href="#{$bif_busstd_}_Bif"/>
787                                 
788                                 
789                         <text class="biflabel" 
790                                   x="{$bif_x_  + ceiling($BIF_W div 2)}"
791                                   y="{$bif_y_ + $bif_dy_ + ceiling($BIF_H div 2) + 3}">
792                                         <xsl:value-of select="$bif_name_"/>
793                         </text>
794                         
795                 </xsl:for-each>
796                 
797 <!--            
798                 <xsl:if test="@INTCINDEX">
799                         <xsl:variable name="intr_col_">
800                                 <xsl:call-template name="intcIdx2Color">
801                                         <xsl:with-param name="intcIdx" select="@INTCINDEX"/>
802                                 </xsl:call-template>    
803                         </xsl:variable>
804                         
805                         <xsl:call-template name="_draw_InterruptCntrl">
806                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
807                                 <xsl:with-param name="intr_x"   select="($periMOD_W - ceiling($INTR_W div 2))"/>
808                                 <xsl:with-param name="intr_y"   select="3"/>
809                                 <xsl:with-param name="intr_idx" select="@INTCINDEX"/>
810                         </xsl:call-template>    
811                 </xsl:if>
812 -->             
813                 <xsl:if test="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst)]/@INTCINDEX">
814                         <xsl:variable name="intr_col_">
815                                 <xsl:call-template name="intcIdx2Color">
816                                         <xsl:with-param name="intcIdx" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst)]/@INTCINDEX"/>
817                                 </xsl:call-template>    
818                         </xsl:variable>
819                         
820                         <xsl:call-template name="_draw_InterruptCntrl">
821                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
822                                 <xsl:with-param name="intr_x"   select="($periMOD_W - ceiling($INTR_W div 2))"/>
823                                 <xsl:with-param name="intr_y"   select="3"/>
824                                 <xsl:with-param name="intr_idx" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst)]/@INTCINDEX"/>
825                         </xsl:call-template>    
826                 </xsl:if>
827                 
828                 
829                 <xsl:for-each select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInst)]/INTCCNTLRTRGS/INTCTRG">
830                         
831                         <xsl:variable name="intr_col_">
832                                 <xsl:call-template name="intcIdx2Color">
833                                         <xsl:with-param name="intcIdx" select="@INTCINDEX"/>
834                                 </xsl:call-template>    
835                         </xsl:variable>
836                         
837                         <xsl:call-template name="_draw_InterruptSource">
838                                 <xsl:with-param name="intr_col" select="$intr_col_"/>
839                                 <xsl:with-param name="intr_x"   select="($periMOD_W - $INTR_W)"/>
840                                 <xsl:with-param name="intr_y"   select="((position() - 1) * (ceiling($INTR_H div 2) + 3))"/>
841                                 <xsl:with-param name="intr_pri" select="@PRIORITY"/>
842                                 <xsl:with-param name="intr_idx" select="@INTCINDEX"/>
843                         </xsl:call-template>    
844                         
845                 </xsl:for-each>
846                 
847         </symbol>                         
848 </xsl:template> 
849         
850 <xsl:template name="Define_MemoryUnit"> 
851         <xsl:param name="shapeId"  select="1000"/>
852         
853         <xsl:variable name="horiz_idx_"   select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/@STACK_HORIZ_INDEX"/>
854         <xsl:variable name="is_multistk_" select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/@IS_MULTISTK"/>
855         
856         
857         <xsl:choose>
858                 <xsl:when test="(($is_multistk_ = 'TRUE') or (/EDKSYSTEM/BLKDSHAPES/PROCSHAPES/MODULE[(@STACK_HORIZ_INDEX = $horiz_idx_)]))">
859                         <xsl:call-template name="Define_Processor_MemoryUnit"> 
860                                 <xsl:with-param name="shapeId"  select="$shapeId"/>
861                         </xsl:call-template>
862                 </xsl:when>
863                 
864                 <xsl:otherwise>
865                         <xsl:call-template name="Define_StandAlone_MemoryUnit"> 
866                                 <xsl:with-param name="shapeId"  select="$shapeId"/>
867                         </xsl:call-template>
868                 </xsl:otherwise>
869                 
870         </xsl:choose>
871         
872 </xsl:template> 
873         
874         
875 <xsl:template name="Define_Processor_MemoryUnit"> 
876         <xsl:param name="shapeId"  select="1000"/>
877         
878 <!--    
879         <xsl:param name="cstkIndex"    select="'_processor_'"/>
880 -->     
881         <xsl:variable name="mods_h_"  select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/@MODS_H"/>
882         <xsl:variable name="mods_w_"  select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/@MODS_W"/>
883         <xsl:variable name="memW_" select="($periMOD_W * $mods_w_)"/>
884         <xsl:variable name="memH_" select="($periMOD_H * $mods_h_)"/>
885         
886         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]">
887                 
888         
889                 <!-- first define its symbols as individual modules --> 
890                 <xsl:for-each select="MODULE[@MODCLASS='MEMORY']">
891                         <xsl:variable name="modInst_" select="@INSTANCE"/>
892                         <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$modInst_)]/@MODTYPE"/>
893                 
894                         <xsl:call-template name="Define_Peripheral"> 
895                                 <xsl:with-param name="modVori"  select="'normal'"/>
896                                 <xsl:with-param name="modInst"  select="$modInst_"/>
897                                 <xsl:with-param name="modType"  select="$modType_"/>
898                         </xsl:call-template>            
899                 </xsl:for-each> 
900         
901                 <xsl:for-each select="MODULE[@MODCLASS='MEMORY_CNTLR']">
902                         <xsl:variable name="modInst_" select="@INSTANCE"/>
903                         <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[(@INSTANCE=$modInst_)]/@MODTYPE"/>
904                 
905                         <xsl:call-template name="Define_Peripheral"> 
906                                 <xsl:with-param name="modVori"  select="'rot180'"/>
907                                 <xsl:with-param name="modInst"  select="$modInst_"/>
908                                 <xsl:with-param name="modType"  select="$modType_"/>
909                         </xsl:call-template>            
910                 </xsl:for-each> 
911         </xsl:for-each>
912         
913 <!--    
914 -->     
915         
916         <xsl:variable name="symbol_name_">
917                 <xsl:call-template name="_gen_Stack_SymbolName"> 
918                         <xsl:with-param name="horizIdx" select="@STACK_HORIZ_INDEX"/>
919                         <xsl:with-param name="vertiIdx" select="@SHAPE_VERTI_INDEX"/>
920                 </xsl:call-template>            
921         </xsl:variable>
922         
923 <!--    
924         <xsl:message>The mp stack name is <xsl:value-of select="$mp_stack_name_"/></xsl:message>
925 -->     
926                 
927     <symbol id="{$symbol_name_}">
928
929                 <rect x="0"
930                       y="0"
931                           rx="6" 
932                           ry="6" 
933                       width = "{$memW_}"
934                       height= "{$memH_}"
935                           style="fill:{$COL_BG}; stroke:{$COL_WHITE}; stroke-width:2"/>         
936                           
937                 <!-- Draw the memory block-->             
938                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(@MODCLASS = 'MEMORY')]">
939                         
940                         <xsl:variable name="modInst_" select="@INSTANCE"/>
941                         
942                          <use  x="{ceiling($memW_ div 2) - ($periMOD_W div 2)}"  
943                                    y="0"  
944                                    xlink:href="#symbol_{$modInst_}"/> 
945                 </xsl:for-each>
946                 
947                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[((@MODCLASS='MEMORY_CNTLR') and (@ORIENTED = 'WEST'))]">
948                         <xsl:variable name="modInst_" select="@INSTANCE"/>
949                         
950                          <use  x="0"  
951                                    y="{$periMOD_H}"  
952                                    xlink:href="#symbol_{$modInst_}"/> 
953                 </xsl:for-each>
954                 
955                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[((@MODCLASS='MEMORY_CNTLR') and (@ORIENTED = 'EAST'))]">
956                         <xsl:variable name="modInst_" select="@INSTANCE"/>
957                         
958                          <use  x="{$periMOD_W}"  
959                                    y="{$periMOD_H}"  
960                                    xlink:href="#symbol_{$modInst_}"/> 
961                 </xsl:for-each>
962                 
963                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[((@MODCLASS='MEMORY_CNTLR') and (@ORIENTED = 'CENTER'))]">    
964                         <xsl:variable name="modInst_" select="@INSTANCE"/>
965                         
966                          <use  x="{ceiling($memW_ div 2) - ($periMOD_W div 2)}"  
967                                    y="{$periMOD_H}"  
968                                    xlink:href="#symbol_{$modInst_}"/> 
969                 </xsl:for-each>
970                 
971         </symbol>                         
972         
973 </xsl:template> 
974
975         
976 <xsl:template name="Define_StandAlone_MemoryUnit"> 
977         
978         <xsl:param name="shapeId" select="0"/>
979         
980         <xsl:variable name="mods_h_"  select="@MODS_H"/>
981         <xsl:variable name="mods_w_"  select="@MODS_W"/>
982         
983         <xsl:variable name="memc_name_" select="MODULE[not(@MODCLASS = 'MEMORY')]/@INSTANCE"/>
984         <xsl:variable name="memc_busstd_" select="/EDKSYSTEM/BLKDSHAPES/BCLANESPACES/BCLANESPACE/BUSCONNLANE[(BUSCONN[(@INSTANCE = $memc_name_)])]/@BUSSTD"/>
985         
986 <!--    
987         <xsl:variable name="memc_busstd_" select="/EDKSYSTEM/BLKDSHAPES/BCLANESPACES/BCLANESPACE/BUSCONNLANE/@BUSSTD"/>
988         <xsl:variable name="memc_busstd_" select="/EDKSYSTEM/BCLANESPACES/BCLANESPACE/BUSCONNLANE[(BUSCONN[(@INSTANCE)])]/@BUSSTD"/>
989         <xsl:message>Memory cntlr name <xsl:value-of select="$memc_name_"/></xsl:message>
990         <xsl:message>Memory cntlr name <xsl:value-of select="$memc_name_"/></xsl:message>
991         <xsl:message>Memory cntlr busstd <xsl:value-of select="$memc_busstd_"/></xsl:message>
992 -->     
993         
994         <xsl:variable name="peri_col_">
995                 
996                 <xsl:choose>
997                         <xsl:when test="$mods_w_ &gt; 1">
998                                 <xsl:value-of select="$COL_BG"/>
999                         </xsl:when>
1000                         
1001                         <xsl:when test="/EDKSYSTEM/BLKDSHAPES/BCLANESPACES/BCLANESPACE/BUSCONNLANE[(BUSCONN[(@INSTANCE = $memc_name_)])]/@BUSSTD">
1002                                 <xsl:call-template name="BusType2Color">
1003                                         <xsl:with-param name="busType" select="$memc_busstd_"/>
1004                                 </xsl:call-template>
1005                         </xsl:when>
1006                 
1007                         <xsl:otherwise>
1008                                 <xsl:value-of select="$COL_OPBBUS"/>
1009                         </xsl:otherwise>
1010                 </xsl:choose>           
1011                 
1012         </xsl:variable>  
1013         
1014         <!-- first define its symbols as individual modules --> 
1015         <xsl:for-each select="MODULE[(@MODCLASS = 'MEMORY')]">
1016                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1017                 <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$modInst_]/@MODTYPE"/>
1018                 
1019                 <xsl:call-template name="Define_Peripheral"> 
1020                         <xsl:with-param name="modVori"  select="'rot180'"/>
1021                         <xsl:with-param name="modInst"  select="$modInst_"/>
1022                         <xsl:with-param name="modType"  select="$modType_"/>
1023                 </xsl:call-template>            
1024         </xsl:for-each> 
1025         
1026         <xsl:for-each select="MODULE[not(@MODCLASS='MEMORY')]">
1027                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1028                 <xsl:variable name="modType_" select="/EDKSYSTEM/MODULES/MODULE[@INSTANCE=$modInst_]/@MODTYPE"/>
1029                 
1030 <!--            
1031                 <xsl:message>Memory cntlr inst <xsl:value-of select="$modInst_"/></xsl:message>
1032 -->             
1033                 <xsl:call-template name="Define_Peripheral"> 
1034                         <xsl:with-param name="modVori"  select="'normal'"/>
1035                         <xsl:with-param name="modInst"  select="$modInst_"/>
1036                         <xsl:with-param name="modType"  select="$modType_"/>
1037                 </xsl:call-template>            
1038         </xsl:for-each> 
1039         
1040         <xsl:variable name="memW_" select="($periMOD_W * $mods_w_)"/>
1041         <xsl:variable name="memH_" select="($periMOD_H * $mods_h_)"/>
1042         
1043         <xsl:variable name="symbol_name_">
1044                 <xsl:call-template name="_gen_Stack_SymbolName"> 
1045                         <xsl:with-param name="horizIdx" select="@STACK_HORIZ_INDEX"/>
1046                         <xsl:with-param name="vertiIdx" select="@SHAPE_VERTI_INDEX"/>
1047                 </xsl:call-template>            
1048         </xsl:variable>
1049         
1050                 
1051     <symbol id="{$symbol_name_}">
1052                 
1053                 <rect x="0"
1054                       y="0"
1055                           rx="6" 
1056                           ry="6" 
1057                       width = "{$memW_ + 4}"
1058                       height= "{$memH_ + 4}"
1059                           style="fill:{$peri_col_}; stroke:{$peri_col_}; stroke-width:2"/>              
1060                           
1061
1062                 <!-- Draw the memory block-->             
1063                 <xsl:choose>
1064                         
1065                 <xsl:when test="$mods_w_ = 1">
1066                         
1067                         <xsl:for-each select="MODULE[(@MODCLASS='MEMORY')]">    
1068                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1069                         
1070                                 <use  x="2"  
1071                                       y="{$periMOD_H + 2}"  
1072                                       xlink:href="#symbol_{$modInst_}"/> 
1073                         </xsl:for-each>
1074                 
1075                 
1076                 <!-- Draw the memory controllers-->               
1077                         <xsl:for-each select="MODULE[not(@MODCLASS='MEMORY')]"> 
1078                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1079                         
1080                                 <use  x="2"  
1081                                           y="0"  
1082                                       xlink:href="#symbol_{$modInst_}"/> 
1083                         </xsl:for-each>
1084                 </xsl:when>     
1085                 
1086                 <xsl:when test="$mods_w_ &gt; 1">
1087                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(@MODCLASS = 'MEMORY')]">
1088                         
1089                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1090                         
1091                                  <use  x="{ceiling($memW_ div 2) - ($periMOD_W div 2)}"  
1092                                            y="{$periMOD_H + 2}"  
1093                                            xlink:href="#symbol_{$modInst_}"/> 
1094                         </xsl:for-each>
1095                 
1096                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(not(@MODCLASS='MEMORY') and (@ORIENTED = 'WEST'))]">
1097                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1098                         
1099                                 <use  x="0"  
1100                                       y="0"  
1101                                       xlink:href="#symbol_{$modInst_}"/> 
1102                         </xsl:for-each>
1103                 
1104                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(not(@MODCLASS='MEMORY') and (@ORIENTED = 'EAST'))]">
1105                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1106                         
1107                                 <use  x="{$periMOD_W}"  
1108                                       y="0"  
1109                                       xlink:href="#symbol_{$modInst_}"/> 
1110                         </xsl:for-each>
1111                 
1112                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(not(@MODCLASS='MEMORY') and (@ORIENTED = 'CENTER'))]">       
1113                                 <xsl:variable name="modInst_" select="@INSTANCE"/>
1114                         
1115                                 <use  x="{ceiling($memW_ div 2) - ($periMOD_W div 2)}"  
1116                                       y="0"  
1117                                           xlink:href="#symbol_{$modInst_}"/> 
1118                     </xsl:for-each>
1119                         
1120                 </xsl:when>     
1121                 </xsl:choose>
1122                           
1123         </symbol>                         
1124         
1125 </xsl:template> 
1126
1127 <!-- ======================= END DEF FUNCTIONS ============================ -->
1128
1129 <!-- ======================= UTILITY FUNCTIONS ============================ -->
1130
1131 <xsl:template name="_draw_InterruptSource">
1132
1133         <xsl:param name="intr_col" select="$COL_INTR_0"/>
1134         <xsl:param name="intr_x"   select="0"/>
1135         <xsl:param name="intr_y"   select="0"/>
1136         <xsl:param name="intr_pri" select="0"/>
1137         <xsl:param name="intr_idx" select="0"/>
1138         
1139                 <rect  
1140                         x="{$intr_x}"
1141                         y="{$intr_y}"
1142                         rx="3"
1143                         ry="3"
1144                         width= "{$INTR_W}" 
1145                         height="{ceiling($INTR_H div 2)}" style="fill:{$intr_col}; stroke:none; stroke-width:1"/> 
1146                         
1147                 <line x1="{$intr_x + ceiling($INTR_W div 2)}" 
1148                           y1="{$intr_y}"
1149                           x2="{$intr_x + ceiling($INTR_W div 2)}" 
1150                           y2="{$intr_y + ceiling($INTR_H div 2)}" 
1151                           style="stroke:{$COL_BLACK};stroke-width:1"/>
1152                           
1153                 <xsl:variable name="txt_ofs_">
1154                         <xsl:if test="($intr_pri &gt; 9)">4.5</xsl:if>
1155                         <xsl:if test="not($intr_pri &gt; 9)">0</xsl:if>
1156                 </xsl:variable>   
1157                 
1158                 <text class="intrsymbol" 
1159                           x="{$intr_x + 2 - $txt_ofs_}"
1160                           y="{$intr_y + 8}">
1161                                 <xsl:value-of select="$intr_pri"/>
1162                 </text>
1163                         
1164                 <text class="intrsymbol" 
1165                           x="{$intr_x + 2 + ceiling($INTR_W div 2)}"
1166                           y="{$intr_y + 8}">
1167                                 <xsl:value-of select="$intr_idx"/>
1168                 </text>
1169                         
1170 </xsl:template>
1171
1172 <xsl:template name="_draw_InterruptCntrl">
1173
1174         <xsl:param name="intr_col" select="$COL_INTR_0"/>
1175         <xsl:param name="intr_x"   select="0"/>
1176         <xsl:param name="intr_y"   select="0"/>
1177         <xsl:param name="intr_idx" select="0"/>
1178         
1179                 <rect  
1180                         x="{$intr_x}"
1181                         y="{$intr_y}"
1182                         rx="3"
1183                         ry="3"
1184                         width= "{ceiling($INTR_W div 2)}" 
1185                         height="{$INTR_H}" style="fill:{$intr_col}; stroke:none; stroke-width:1"/> 
1186                         
1187                 <line x1="{$intr_x}" 
1188                           y1="{$intr_y + ceiling($INTR_H div 4)}"
1189                           x2="{$intr_x + ceiling($INTR_W div 2)}" 
1190                           y2="{$intr_y + ceiling($INTR_H div 4)}" 
1191                           style="stroke:{$COL_BLACK};stroke-width:2"/>
1192                           
1193                 <text class="intrsymbol" 
1194                           x="{$intr_x + 2}"
1195                           y="{$intr_y + 8 + ceiling($INTR_H div 2)}">
1196                                 <xsl:value-of select="$intr_idx"/>
1197                 </text>
1198                         
1199 </xsl:template>
1200
1201
1202 <xsl:template name="_draw_InterruptedProc">
1203
1204         <xsl:param name="intr_col" select="$COL_INTR_0"/>
1205         <xsl:param name="intr_x"   select="0"/>
1206         <xsl:param name="intr_y"   select="0"/>
1207         <xsl:param name="intr_idx" select="0"/>
1208         
1209                 <rect  
1210                         x="{$intr_x}"
1211                         y="{$intr_y}"
1212                         rx="3"
1213                         ry="3"
1214                         width= "{ceiling($INTR_W div 2)}" 
1215                         height="{$INTR_H}" style="fill:{$intr_col}; stroke:none; stroke-width:1"/> 
1216                         
1217                 <line x1="{$intr_x}" 
1218                           y1="{$intr_y + ceiling($INTR_H div 4) - 2}"
1219                           x2="{$intr_x + ceiling($INTR_W div 2)}" 
1220                           y2="{$intr_y + ceiling($INTR_H div 4) - 2}" 
1221                           style="stroke:{$COL_BLACK};stroke-width:1"/>
1222                           
1223                 <line x1="{$intr_x}" 
1224                           y1="{$intr_y + ceiling($INTR_H div 4) + 2}"
1225                           x2="{$intr_x + ceiling($INTR_W div 2)}" 
1226                           y2="{$intr_y + ceiling($INTR_H div 4) + 2}" 
1227                           style="stroke:{$COL_BLACK};stroke-width:1"/>
1228                           
1229                 <text class="intrsymbol" 
1230                           x="{$intr_x + 2}"
1231                           y="{$intr_y + 8 + ceiling($INTR_H div 2)}">
1232                                 <xsl:value-of select="$intr_idx"/>
1233                 </text>
1234                         
1235 </xsl:template>
1236
1237 <xsl:template name="_calc_CStackShapesAbv_Height">
1238         <xsl:param name="cstkIndex"  select="100"/>
1239         <xsl:param name="cstkMods_Y" select="1000"/>
1240         
1241 <!--    
1242         <xsl:message>Stack Index <xsl:value-of select="$cstackIndex"/></xsl:message>
1243         
1244         <xsl:message>Stack Y <xsl:value-of select="$cstackModY"/></xsl:message>
1245 -->     
1246         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@CSTACK_INDEX = $cstkIndex)])">0</xsl:if>
1247         
1248         <xsl:if test="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@CSTACK_INDEX = $cstkIndex)]">
1249         
1250                 <xsl:variable name="shapesAbv_Heights_">
1251                         <CSTACK_MOD HEIGHT="0"/>
1252                         
1253                         <!-- Store the heights of all the peripherals above this one heights in a variable -->
1254                         <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[((@CSTACK_INDEX = $cstkIndex) and (@CSTACK_MODS_Y &lt; $cstkMods_Y))]">
1255                                 
1256                                 <xsl:variable name="shapeHeight_">
1257                                         
1258                                         <xsl:choose>
1259                                                 
1260                                                 <xsl:when test="@MODCLASS = 'PERIPHERAL'">
1261                                                         <xsl:call-template name="_calc_PeriShape_Height">       
1262                                                                 <xsl:with-param name="shapeInst" select="MODULE/@INSTANCE"/>
1263                                                         </xsl:call-template>    
1264                                                 </xsl:when>
1265                                                 
1266                                                 <xsl:when test="@MODCLASS = 'MEMORY_UNIT'">
1267                                                         <xsl:call-template name="_calc_MemoryUnit_Height">      
1268                                                                 <xsl:with-param name="shapeId" select="@SHAPE_ID"/>
1269                                                         </xsl:call-template>    
1270                                                 </xsl:when>
1271                                                 
1272                                                 <xsl:otherwise>0</xsl:otherwise>
1273                                         </xsl:choose>
1274                                 </xsl:variable>
1275                                 
1276 <!--                            
1277                                 <xsl:message>Calculated height of cstack shape of type <xsl:value-of select="@MODCLASS"/> as <xsl:value-of select="$shapeHeight_"/></xsl:message>
1278 -->                     
1279                                 
1280                                 <CSTACK_MOD HEIGHT="{$shapeHeight_ + $BIF_H}"/>
1281                         </xsl:for-each>
1282                 </xsl:variable>
1283                 
1284 <!--            
1285                 <xsl:message>Calculated height of cstack as <xsl:value-of select="sum(exsl:node-set($shapesAbv_Heights_)/CSTACK_MOD/@HEIGHT)"/></xsl:message>
1286 -->             
1287                 
1288                 <xsl:value-of select="sum(exsl:node-set($shapesAbv_Heights_)/CSTACK_MOD/@HEIGHT)"/>
1289         </xsl:if>
1290         
1291 </xsl:template>
1292
1293
1294 <xsl:template name="_calc_PeriShape_Height">
1295         <xsl:param name="shapeInst"  select="_shape_"/>
1296         
1297 <!--    
1298         <xsl:message>Calculating height of <xsl:value-of select="$shapeInst"/></xsl:message>
1299 -->     
1300         
1301         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H) and not(/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H)">0</xsl:if>
1302         
1303         <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H)">
1304                 <xsl:variable name="bifs_h_" select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H"/>
1305                 
1306                 <xsl:value-of select="($MOD_LABEL_H + ($BIF_H * $bifs_h_) + ($MOD_BIF_GAP_V * $bifs_h_) + ($MOD_LANE_H * 2))"/>
1307         </xsl:if>
1308         
1309         <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H)">
1310                 <xsl:variable name="bifs_h_" select="/EDKSYSTEM/BLKDSHAPES/BRIDGESHAPES/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H"/>
1311                 
1312                 <xsl:value-of select="($MOD_LABEL_H + ($BIF_H * $bifs_h_) + ($MOD_BIF_GAP_V * $bifs_h_) + ($MOD_LANE_H * 2))"/>
1313         </xsl:if>
1314         
1315         <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/PROCSHAPES/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H)">
1316                 <xsl:variable name="bifs_h_" select="/EDKSYSTEM/BLKDSHAPES/PROCSHAPES/MODULE[(@INSTANCE = $shapeInst)]/@BIFS_H"/>
1317                 
1318                 <xsl:value-of select="($MOD_LABEL_H + ($BIF_H * $bifs_h_) + ($MOD_BIF_GAP_V * $bifs_h_) + ($MOD_LANE_H * 2))"/>
1319         </xsl:if>
1320         
1321 </xsl:template>
1322         
1323 <xsl:template name="_calc_Shape_Height">
1324         <xsl:param name="shapeId"  select="_shape_"/>
1325         
1326 <!--    
1327         <xsl:message>Calculating height of <xsl:value-of select="$shapeId"/></xsl:message>
1328 -->     
1329         
1330         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)])">0</xsl:if>
1331         
1332         <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE/@BIFS_H)">
1333                 <xsl:variable name="bifs_h_" select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE/@BIFS_H"/>
1334                 
1335                 <xsl:value-of select="($MOD_LABEL_H + ($BIF_H * $bifs_h_) + ($MOD_BIF_GAP_V * $bifs_h_) + ($MOD_LANE_H * 2))"/>
1336         </xsl:if>
1337         
1338 </xsl:template>
1339
1340
1341 <xsl:template name="_calc_MemoryUnit_Height">
1342         <xsl:param name="shapeId"  select="1000"/>
1343         
1344         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)])">0</xsl:if>
1345         
1346         <xsl:if test="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]">
1347         
1348                 <!-- Store the memory controller heights in a variable -->      
1349                 <xsl:variable name="memC_heights_">     
1350                         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(@MODCLASS = 'MEMORY_CNTLR')])">
1351                                 <MEM_CNTLR INSTANCE="{@INSTANCE}" HEIGHT="0"/>
1352                         </xsl:if>
1353                         
1354                         <xsl:if test="(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(@MODCLASS = 'MEMORY_CNTLR')])">
1355                                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[(@MODCLASS = 'MEMORY_CNTLR')]">
1356                                         <xsl:variable name="memC_height_">
1357                                                 <xsl:call-template name="_calc_PeriShape_Height">       
1358                                                         <xsl:with-param name="shapeInst" select="@INSTANCE"/>
1359                                                 </xsl:call-template>
1360                                         </xsl:variable>
1361                                         <MEM_CNTLR INSTANCE="{@INSTANCE}" HEIGHT="{$memC_height_}"/>
1362                                 </xsl:for-each>
1363                         </xsl:if>
1364                 </xsl:variable>
1365                 
1366                 <!-- Store the bram heights in a variable -->   
1367                 <xsl:variable name="bram_heights_">     
1368                         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[not(@MODCLASS = 'MEMORY_CNTLR')])">
1369                                 <BRAM INSTANCE="{@INSTANCE}" HEIGHT="0"/>
1370                         </xsl:if>
1371                         <xsl:if test="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[not(@MODCLASS = 'MEMORY_CNTLR')]">
1372                                 <xsl:for-each select="/EDKSYSTEM/BLKDSHAPES/CMPLXSHAPES/CMPLXSHAPE[(@SHAPE_ID = $shapeId)]/MODULE[not(@MODCLASS = 'MEMORY_CNTLR')]">
1373                                         <xsl:variable name="bram_height_">
1374                                                 <xsl:call-template name="_calc_PeriShape_Height">       
1375                                                         <xsl:with-param name="shapeInst" select="@INSTANCE"/>
1376                                                 </xsl:call-template>
1377                                         </xsl:variable>
1378                                         <BRAM INSTANCE="{@INSTANCE}" HEIGHT="{$bram_height_}"/>
1379                                 </xsl:for-each>
1380                         </xsl:if>
1381                 </xsl:variable>
1382                 
1383                 <!-- Select the maximum of them -->
1384                 <xsl:variable name="max_bram_height_" select="math:max(exsl:node-set($bram_heights_)/BRAM/@HEIGHT)"/>
1385                 <xsl:variable name="max_memC_height_" select="math:max(exsl:node-set($memC_heights_)/MEM_CNTLR/@HEIGHT)"/>
1386                 
1387                 <xsl:value-of select="$max_bram_height_ + $max_memC_height_"/>
1388         </xsl:if>
1389
1390 </xsl:template>
1391
1392
1393 <xsl:template name="_calc_SbsBucket_Height">
1394         <xsl:param name="bucketId"  select="100"/>
1395         
1396 <!--    
1397         <xsl:message>Looking of height of bucket <xsl:value-of select="$bucketId"/></xsl:message>
1398 -->     
1399         <xsl:variable name="bkt_gap_" select="$BIF_H"/>
1400         
1401         <xsl:if test="not(/EDKSYSTEM/BLKDSHAPES/SBSBUCKETS/SBSBUCKET[(@BUSINDEX = $bucketId)])">0</xsl:if>
1402         
1403         <xsl:if test="/EDKSYSTEM/BLKDSHAPES/SBSBUCKETS/SBSBUCKET[(@BUSINDEX = $bucketId)]">
1404                 <xsl:variable name="mods_h_" select="/EDKSYSTEM/BLKDSHAPES/SBSBUCKETS/SBSBUCKET[(@BUSINDEX = $bucketId)]/@MODS_H"/>
1405                 
1406                 <xsl:value-of select="((($MOD_BKTLANE_H * 2) + ((($periMOD_H + $BIFC_H) * $mods_h_) + ($MOD_BUCKET_G * ($mods_h_ - 1)))) + $bkt_gap_)"/>
1407         </xsl:if>
1408 </xsl:template>
1409         
1410 <!--
1411         ===============================================
1412         
1413                 Symbol Naming Functions
1414         
1415         ===============================================
1416 -->             
1417         
1418         
1419 <xsl:template name="_gen_Proc_StackName">
1420 <xsl:param name="procInst"  select="'_unknown_'"/>
1421 symbol_STACK_<xsl:value-of select="$procInst"/>
1422 </xsl:template>
1423         
1424 <xsl:template name="_gen_Proc_GroupName">
1425 <xsl:param name="procInst"  select="'_unknown_'"/>
1426 symbol_GROUP_<xsl:value-of select="$procInst"/>
1427 </xsl:template>
1428         
1429         
1430 <xsl:template name="_gen_Space_Name"><xsl:param name="stackToEast"  select="'NONE'"/><xsl:param name="stackToWest"  select="'NONE'"/>symbol_SPACE_WEST_<xsl:value-of select="$stackToWest"/>_EAST_<xsl:value-of select="$stackToEast"/></xsl:template>
1431 <xsl:template name="_gen_Stack_Name"><xsl:param name="horizIdx"  select="'_unknown_'"/>symbol_STACK_<xsl:value-of select="$horizIdx"/></xsl:template>
1432 <xsl:template name="_gen_Stack_SymbolName"><xsl:param name="horizIdx"  select="'_unknown_'"/><xsl:param name="vertiIdx" select="'_unknown_'"/>symbol_STACK_<xsl:value-of select="$horizIdx"/>_SHAPE_<xsl:value-of select="$vertiIdx"/></xsl:template>
1433         
1434         
1435         
1436
1437 <!-- ======================= END UTILITY FUNCTIONS  ======================= -->
1438 </xsl:stylesheet>
1439