]> git.sur5r.net Git - freertos/blob
5b091aba591a0138481b75679a6782886c46c37a
[freertos] /
1 <?xml version="1.0" standalone="no"?>
2
3 <xsl:stylesheet version="1.0"
4            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5        xmlns:xlink="http://www.w3.org/1999/xlink"
6        xmlns:exsl="http://exslt.org/common"
7        xmlns:dyn="http://exslt.org/dynamic"
8        xmlns:math="http://exslt.org/math"
9        extension-element-prefixes="math dyn exsl xlink">
10 <!--
11 xmlns:svg="http://www.w3.org/2000/svg"
12 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
13                doctype-public="-//W3C//DTD SVG 1.0//EN"
14                    doctype-system="http://www.w3.org/TR/SVG/DTD/svg10.dtd"/>
15 -->           
16  
17 <xsl:template name="F_Calc_Proc_Height">
18         <xsl:param name="iProcInst"  select="_processor_"/>
19         
20         <xsl:variable name="tot_bifs_h_">
21                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $iProcInst)]/@BIFS_H)">0</xsl:if>
22                 
23                 <xsl:if test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $iProcInst)]/@BIFS_H">
24                         <xsl:variable name="bifs_h_" select="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $iProcInst)]/@BIFS_H)"/>
25                         <xsl:value-of select="(($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_H) * $bifs_h_)"/>       
26                 </xsl:if>
27         </xsl:variable> 
28         
29         <xsl:value-of select="(($BLKD_MOD_LANE_H * 2) + $tot_bifs_h_ + ($BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_H))"/>    
30 </xsl:template>
31
32 <xsl:template name="F_Calc_Max_Proc_Height">
33
34         <!-- Store the heights in a variable -->        
35         <xsl:variable name="proc_heights_">
36         
37                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE)">
38                         <PROC HEIGHT="0"/>
39                 </xsl:if>
40                 
41                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE">
42                         <xsl:variable name="procInst_" select="@INSTANCE"/> 
43                         <xsl:variable name="proc_height_">
44                                 <xsl:call-template name="F_Calc_Proc_Height">   
45                                         <xsl:with-param name="iProcInst" select="$procInst_"/>
46                                 </xsl:call-template>    
47                         </xsl:variable>
48                         
49 <!--                    
50                         <xsl:message>Found Proc height as <xsl:value-of select="$proc_height_"/></xsl:message>
51 -->                     
52                         <PROC HEIGHT="{$proc_height_}"/>
53                 </xsl:for-each>
54         </xsl:variable>
55         
56         <!-- Return the max of them --> 
57 <!--    
58         <xsl:message>Found Proc ax as <xsl:value-of select="math:max(exsl:node-set($proc_heights_)/PROC/@HEIGHT)"/></xsl:message>
59 -->     
60
61         <xsl:value-of select="math:max(exsl:node-set($proc_heights_)/PROC/@HEIGHT)"/>
62 </xsl:template>
63
64
65 <xsl:template name="F_Calc_Proc_MemoryUnits_Height">
66         <xsl:param name="iProcInst"  select="_processor_"/>
67         
68         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and (@MODCLASS = 'MEMORY_UNIT'))])">0</xsl:if>
69         
70         <xsl:if test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and (@MODCLASS='MEMORY_UNIT'))]">
71                 
72         <xsl:variable name="peri_gap_">
73                 <xsl:choose>
74                         <xsl:when test="not(@CSTACK_INDEX)">
75                                 <xsl:value-of select="$BLKD_BIF_H"/>
76                         </xsl:when>
77                         <xsl:otherwise>0</xsl:otherwise>
78                 </xsl:choose>   
79         </xsl:variable> 
80                         
81                 
82                 <!-- Store the all memory unit heights in a variable -->
83                 <xsl:variable name="memU_heights_">
84                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and (@MODCLASS='MEMORY_UNIT'))]">
85 <!--                            
86                                 <xsl:variable name="unitId_" select="@PSTACK_MODS_Y"/>
87 -->                             
88                                 <xsl:variable name="unitHeight_">
89                                         <xsl:call-template name="F_Calc_MemoryUnit_Height">     
90                                                 <xsl:with-param name="iShapeId" select="@SHAPE_ID"/>
91                                         </xsl:call-template>    
92                                 </xsl:variable>
93                                 
94                                 <MEM_UNIT HEIGHT="{$unitHeight_ + $peri_gap_}"/>
95                         </xsl:for-each>
96                 </xsl:variable>
97                 
98                 <xsl:value-of select="sum(exsl:node-set($memU_heights_)/MEM_UNIT/@HEIGHT)"/>
99         </xsl:if>
100 </xsl:template>
101         
102
103 <xsl:template name="F_Calc_Proc_Peripherals_Height">
104         <xsl:param name="iProcInst"  select="_processor_"/>
105         
106         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and not(@MODCLASS = 'MEMORY_UNIT'))])">0</xsl:if>
107         
108         <xsl:if test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and not(@MODCLASS='MEMORY_UNIT'))]">
109         
110                 <xsl:variable name="peri_gap_">
111                         <xsl:if test="@CSTACK_INDEX">
112                                 <xsl:value-of select="$BLKD_BIF_H"/>
113                         </xsl:if>
114                         <xsl:if test="not(@IS_CSTACK)">0</xsl:if>
115                 </xsl:variable>
116         
117                 <!-- Store the all peripheral heights in a variable -->
118                 <xsl:variable name="peri_heights_">
119                         
120                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@PROCESSOR = $iProcInst) and not(@MODCLASS='MEMORY_UNIT'))]">
121                                 <xsl:for-each select="MODULE">
122 <!--                                    
123                                         <xsl:message><xsl:value-of select="@INSTANCE"/></xsl:message>           
124 -->                                     
125                                         <xsl:variable name="peri_height_">
126                                                 <xsl:call-template name="F_Calc_PeriShape_Height">      
127                                                         <xsl:with-param name="iShapeInst" select="@INSTANCE"/>
128                                                 </xsl:call-template>    
129                                         </xsl:variable>
130                                         <PERI HEIGHT="{$peri_height_ + $peri_gap_}"/>
131                                 </xsl:for-each>         
132                         </xsl:for-each>
133                 </xsl:variable>
134                 
135                 <xsl:value-of select="sum(exsl:node-set($peri_heights_)/PERI/@HEIGHT)"/>
136         </xsl:if>
137 </xsl:template>
138         
139         
140 <xsl:template name="F_Calc_Space_AbvSbs_Height">
141         <xsl:param name="iStackToEast"  select="'NONE'"/>
142         <xsl:param name="iStackToWest"  select="'NONE'"/>
143         
144         
145         <xsl:variable name = "stackAbvSbs_West_H_">
146                 <xsl:choose>
147                         <xsl:when test="(($iStackToEast = '0')   and     ($iStackToWest = 'NONE'))">0</xsl:when>
148                         <xsl:when test="(($iStackToEast = 'NONE') and not($iStackToWest = 'NONE'))">
149                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
150                                         <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
151                                 </xsl:call-template>
152                         </xsl:when>
153                         <xsl:when test="(not($iStackToEast = '0') and ($iStackToWest = 'NONE'))">
154                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
155                                         <xsl:with-param name="iStackIdx"  select="($iStackToEast - 1)"/>
156                                 </xsl:call-template>
157                         </xsl:when>
158                         <xsl:otherwise>0</xsl:otherwise>
159                 </xsl:choose>
160         </xsl:variable>
161         
162         <xsl:variable name = "stackAbvSbs_East_H_">
163                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
164                         <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
165                 </xsl:call-template>
166         </xsl:variable>
167         
168         <xsl:variable name="stackAbvSbs_heights_">
169                 <STACK HEIGHT="{$stackAbvSbs_East_H_}"/>
170                 <STACK HEIGHT="{$stackAbvSbs_West_H_}"/>
171         </xsl:variable>
172         
173         <xsl:value-of select="math:max(exsl:node-set($stackAbvSbs_heights_)/STACK/@HEIGHT)"/>
174 </xsl:template>
175
176         
177 <xsl:template name="F_Calc_Space_BlwSbs_Height">
178         <xsl:param name="iStackToEast"  select="'NONE'"/>
179         <xsl:param name="iStackToWest"  select="'NONE'"/>
180                 
181         <xsl:variable name = "stackBlwSbs_West_H_">
182                 <xsl:choose>
183                         <xsl:when test="(($iStackToEast = '0')    and    ($iStackToWest = 'NONE'))">0</xsl:when>
184                         <xsl:when test="(($iStackToEast = 'NONE') and not($iStackToWest = 'NONE'))">
185                                 <xsl:call-template name="F_Calc_Stack_BlwSbs_Height">
186                                         <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
187                                 </xsl:call-template>
188                         </xsl:when>
189                         <xsl:when test="(not($iStackToEast = '0') and    ($iStackToWest = 'NONE'))">
190                                 <xsl:call-template name="F_Calc_Stack_BlwSbs_Height">
191                                         <xsl:with-param name="iStackIdx"  select="($iStackToEast - 1)"/>
192                                 </xsl:call-template>
193                         </xsl:when>
194                 </xsl:choose>
195         </xsl:variable>
196         
197         
198         <xsl:variable name = "stackBlwSbs_East_H_">
199                 <xsl:call-template name="F_Calc_Stack_BlwSbs_Height">
200                         <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
201                 </xsl:call-template>
202         </xsl:variable>
203         
204         <xsl:variable name="stackBlwSbs_heights_">
205                 <STACK HEIGHT="{$stackBlwSbs_East_H_}"/>
206                 <STACK HEIGHT="{$stackBlwSbs_West_H_}"/>
207         </xsl:variable>
208         
209         <xsl:value-of select="math:max(exsl:node-set($stackBlwSbs_heights_)/STACK/@HEIGHT)"/>
210 </xsl:template>
211         
212
213         
214 <xsl:template name="F_Calc_Stack_AbvSbs_Height">
215         <xsl:param name="iStackIdx"  select="100"/>
216 <!--    
217         <xsl:message>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</xsl:message>
218 -->     
219         
220         <xsl:if test="(not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@IS_ABVSBS))]) and
221                                    not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@STACK_HORIZ_INDEX = $iStackIdx)]))"><xsl:value-of select="$BLKD_PROC2SBS_GAP"/></xsl:if>
222         
223         <xsl:if test="(($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@IS_ABVSBS))]) or
224                                    ($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[      (@STACK_HORIZ_INDEX = $iStackIdx)]))">
225                 
226 <!--                    
227                 <xsl:variable name="peri_gap_">
228                         <xsl:value-of select="$BLKD_BIF_H"/>
229                         <xsl:choose>
230                                 <xsl:when test="(@SHAPE_VERTI_INDEX)">
231                                 </xsl:when>
232                                 <xsl:otherwise>0</xsl:otherwise>
233                         </xsl:choose>   
234                 </xsl:variable> 
235 -->                     
236                         
237 <!--            
238                 <xsl:message>The gap is <xsl:value-of select="$peri_gap_"/></xsl:message>
239                 <xsl:message>The gap is <xsl:value-of select="$peri_gap_"/></xsl:message>
240                 <xsl:message>================================</xsl:message>
241                 <xsl:message>================================</xsl:message>
242                 <xsl:message>This is above <xsl:value-of select="@INSTANCE"/></xsl:message>
243                 <xsl:message><xsl:value-of select="@INSTANCE"/> : <xsl:value-of select="$peri_height_"/></xsl:message>
244 -->     
245         
246         
247                 <!-- Store the all peripheral heights in a variable -->
248                 <xsl:variable name="peri_heights_">
249                         
250                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and not(@MODCLASS = 'MEMORY_UNIT') and (@IS_ABVSBS))]">
251                                 <xsl:for-each select="MODULE">
252 <!--                                    
253                                         <xsl:message>This is above <xsl:value-of select="@INSTANCE"/></xsl:message>
254 -->                                     
255                                         
256                                         <xsl:variable name="peri_height_">
257 <!--                                            
258                                                 <xsl:call-template name="F_Calc_Shape_Height">  
259                                                         <xsl:with-param name="shapeId" select="@SHAPE_ID"/>
260                                                 </xsl:call-template>    
261 -->      
262         
263                                                 <xsl:call-template name="F_Calc_PeriShape_Height">      
264                                                         <xsl:with-param name="iShapeInst" select="@INSTANCE"/>
265                                                 </xsl:call-template>    
266                                         </xsl:variable>
267                                         
268                                         <PERI HEIGHT="{$peri_height_ + $BLKD_BIF_H}"/>
269                                 </xsl:for-each>
270                         </xsl:for-each>
271                         
272                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@MODCLASS = 'MEMORY_UNIT') and (@IS_ABVSBS))]">
273                         
274                                 <xsl:variable name="memu_height_">
275                                         <xsl:call-template name="F_Calc_MemoryUnit_Height">     
276                                                 <xsl:with-param name="iShapeId" select="@SHAPE_ID"/>
277                                         </xsl:call-template>    
278                                 </xsl:variable>
279                         
280 <!--                            
281                                 <xsl:message>Mem_Unit : <xsl:value-of select="@SHAPE_ID"/> : <xsl:value-of select="$memu_height_ + $peri_gap_"/></xsl:message>
282 -->                             
283                                 <PERI HEIGHT="{$memu_height_ + $BLKD_BIF_H}"/>
284                         
285                         </xsl:for-each>
286                         
287                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@IS_ABVSBS))]">
288                                         
289                                 <xsl:variable name="proc_height_">
290                                         <xsl:call-template name="F_Calc_PeriShape_Height">      
291                                                 <xsl:with-param name="iShapeInst" select="@INSTANCE"/>
292                                         </xsl:call-template>    
293                                 </xsl:variable>
294                                 
295 <!--                            
296                 <xsl:message>===================================</xsl:message>
297                 <xsl:message>Processor : <xsl:value-of select="@INSTANCE"/> : <xsl:value-of select="$peri_height_ + $peri_gap_"/></xsl:message>
298                                 <PERI HEIGHT="{$proc_height_ + $BLKD_PROC2SBS_GAP }"/>
299 -->                                     
300                                 <PERI HEIGHT="{$proc_height_ + $BLKD_BIF_H}"/>
301                                 
302                         </xsl:for-each>
303                 
304                 </xsl:variable>
305                 
306 <!--            
307         <xsl:message><xsl:value-of select="@INSTANCE"/> : <xsl:value-of select="$peri_height_ + $peri_gap_"/></xsl:message>
308         <xsl:message>================================</xsl:message>
309 -->
310                 
311 <!--            
312         <xsl:message>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</xsl:message>
313 -->             
314                 <xsl:value-of select="sum(exsl:node-set($peri_heights_)/PERI/@HEIGHT)"/>
315         </xsl:if>
316         
317 </xsl:template>
318         
319 <xsl:template name="F_Calc_Stack_BlwSbs_Height">
320         <xsl:param name="iStackIdx"  select="100"/>
321         
322                 <!-- Store the all peripheral heights in a variable -->
323                 <xsl:variable name="stack_heights_">
324                         
325                         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@IS_BLWSBS))])">
326                                 <STACKSHAPE HEIGHT="0"/>
327                         </xsl:if>
328                         
329                         <xsl:if test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@IS_BLWSBS))]">
330         
331                                 <xsl:variable name="peri_gap_">
332                                         <xsl:choose>
333                                                 <xsl:when test="(@SHAPE_VERTI_INDEX)">
334                                                         <xsl:value-of select="$BLKD_BIF_H"/>
335                                                 </xsl:when>
336                                                 <xsl:otherwise>0</xsl:otherwise>
337                                         </xsl:choose>   
338                                 </xsl:variable> 
339                                 
340                                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and not(@MODCLASS = 'MEMORY_UNIT') and (@IS_BLWSBS))]">
341                                         <xsl:for-each select="MODULE">
342 <!--                                    
343                                         <xsl:message>This is below <xsl:value-of select="@INSTANCE"/></xsl:message>
344 -->     
345                                                 <xsl:variable name="peri_height_">
346                                                         <xsl:call-template name="F_Calc_PeriShape_Height">      
347                                                                 <xsl:with-param name="iShapeInst" select="@INSTANCE"/>
348                                                         </xsl:call-template>    
349                                                 </xsl:variable>
350                                                 
351                                                 <STACKSHAPE HEIGHT="{$peri_height_ + $peri_gap_}"/>
352                                         </xsl:for-each>
353                                 </xsl:for-each>
354                 
355                                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iStackIdx) and (@MODCLASS = 'MEMORY_UNIT') and (@IS_BLWSBS))]">
356                         
357                                         <xsl:variable name="memu_height_">
358                                                 <xsl:call-template name="F_Calc_MemoryUnit_Height">     
359                                                         <xsl:with-param name="iShapeId" select="@SHAPE_ID"/>
360                                                 </xsl:call-template>    
361                                         </xsl:variable>
362                         
363                                         <STACKSHAPE HEIGHT="{$memu_height_ + $peri_gap_}"/>
364                                 
365 <!--                            
366                                 <xsl:message>Mem_Unit : <xsl:value-of select="@SHAPE_ID"/> : <xsl:value-of select="$memu_height_ + $peri_gap_"/></xsl:message>
367 -->     
368                         
369                         </xsl:for-each>
370                 </xsl:if>
371                         
372                 <xsl:variable name="sbsBuckets_H_">
373                         <xsl:call-template name="F_Calc_Stack_SbsBuckets_Height">
374                                 <xsl:with-param name="iStackIdx" select="$iStackIdx"/>
375                         </xsl:call-template>    
376                 </xsl:variable>
377                         
378                         <STACKSHAPE HEIGHT="{$sbsBuckets_H_}"/>
379 <!--                    
380                         <xsl:message>Sbs Bucket H : <xsl:value-of select="$sbsBuckets_H_"/></xsl:message>
381 -->
382                 </xsl:variable>
383                 
384 <!--            
385                 <xsl:message>vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv</xsl:message>
386 -->             
387                 <xsl:value-of select="sum(exsl:node-set($stack_heights_)/STACKSHAPE/@HEIGHT)"/>
388         
389 </xsl:template>
390         
391
392 <xsl:template name="F_Calc_Stack_SbsBuckets_Height">
393         <xsl:param name="iStackIdx"  select="1000"/>
394         
395         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX = $iStackIdx)])">0</xsl:if>
396         
397         <xsl:if test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX = $iStackIdx)]">
398         
399                 <!-- Store the all buckets heights in a variable -->
400                 <xsl:variable name="bkt_heights_">
401                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX = $iStackIdx)]">
402                 
403                                 <xsl:variable name="bkt_height_">
404                                         <xsl:call-template name="F_Calc_SbsBucket_Height">      
405                                                 <xsl:with-param name="iBucketId" select="@BUS_INDEX"/>
406                                         </xsl:call-template>    
407                                 </xsl:variable>
408 <!--                            
409                                 <xsl:message>Found shared buckets height as <xsl:value-of select="$bkt_height_"/></xsl:message>
410 -->                             
411                                 <BKT HEIGHT="{$bkt_height_ + $BLKD_BIF_H}"/>
412                         </xsl:for-each>
413                 </xsl:variable>
414                 
415                 <xsl:value-of select="sum(exsl:node-set($bkt_heights_)/BKT/@HEIGHT)"/>
416         </xsl:if>
417 </xsl:template>
418
419         
420 <xsl:template name="F_Calc_Max_Stack_BlwSbs_Height">
421
422         <!-- Store the heights in a variable -->        
423         <xsl:variable name="blwSbs_heights_">
424                 
425                 <!-- Default, in case there are no modules or ports -->         
426                 <BLW HEIGHT="0"/>
427                 
428                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(@EAST &lt; $G_ROOT/EDKSYSTEM/BLKDIAGRAM/@STACK_HORIZ_WIDTH)]">
429         
430 <!--                    
431                         <xsl:message>Found a space of index <xsl:value-of select="@EAST"/></xsl:message>
432 -->     
433                         
434                         <xsl:variable name="stack_height_">
435                                 <xsl:call-template name="F_Calc_Stack_BlwSbs_Height">
436                                         <xsl:with-param name="iStackIdx"  select="@EAST"/>
437                                 </xsl:call-template>
438                         </xsl:variable>
439                         
440                         
441                         <BLW HEIGHT="{$stack_height_}"/>
442                         
443                 </xsl:for-each>
444                 
445                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(@WEST = ($G_ROOT/EDKSYSTEM/BLKDIAGRAM/@STACK_HORIZ_WIDTH -1))]">
446                         
447 <!--                    
448                         <xsl:message>Last stack of index <xsl:value-of select="@WEST"/></xsl:message>
449 -->                     
450                         
451                         <xsl:variable name="stack_height_">
452                                 <xsl:call-template name="F_Calc_Stack_BlwSbs_Height">
453                                         <xsl:with-param name="iStackIdx"  select="@WEST"/>
454                                 </xsl:call-template>
455                         </xsl:variable>
456                         
457                         
458                         <BLW HEIGHT="{$stack_height_}"/>
459                         
460                 </xsl:for-each>
461                 
462                 
463         </xsl:variable>
464         
465 <!--    
466         <xsl:message>Found Blw Sbs max as <xsl:value-of select="math:max(exsl:node-set($blwSbs_heights_)/BLW/@HEIGHT)"/></xsl:message>
467 -->     
468         <!-- Return the max of them --> 
469         <xsl:value-of select="math:max(exsl:node-set($blwSbs_heights_)/BLW/@HEIGHT)"/>
470 </xsl:template>
471         
472         
473 <xsl:template name="F_Calc_Max_Stack_AbvSbs_Height">
474
475         <!-- Store the heights in a variable -->        
476         <xsl:variable name="abvSbs_heights_">
477                 
478                 <!-- Default, in case there are no modules or ports -->         
479                 <ABV HEIGHT="0"/>
480                 
481                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(@EAST &lt; $G_ROOT/EDKSYSTEM/BLKDIAGRAM/@STACK_HORIZ_WIDTH)]">
482                         
483 <!--                    
484                         <xsl:message>Found a space of index <xsl:value-of select="@EAST"/></xsl:message>
485 -->     
486                         
487                         <xsl:variable name="stack_height_">
488                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
489                                         <xsl:with-param name="iStackIdx"  select="@EAST"/>
490                                 </xsl:call-template>
491                         </xsl:variable>
492                         
493 <!--                    
494                         <xsl:message>Found stack of width <xsl:value-of select="$stack_width_"/></xsl:message>
495                         <xsl:message>==============================</xsl:message>
496 -->                     
497                         
498                         <ABV HEIGHT="{$stack_height_}"/>
499                         
500                 </xsl:for-each>
501                 
502                 
503         </xsl:variable>
504         
505 <!--    
506         <xsl:message>Found Blw Sbs max as <xsl:value-of select="math:max(exsl:node-set($blwSbs_heights_)/BLW/@HEIGHT)"/></xsl:message>
507 -->     
508         <!-- Return the max of them --> 
509         <xsl:value-of select="math:max(exsl:node-set($abvSbs_heights_)/ABV/@HEIGHT)"/>
510 </xsl:template>
511         
512         
513 <xsl:template name="F_Calc_MultiProc_Stack_Height">
514         <xsl:param name="iMPStack_Blkd_X"  select="100"/>
515         
516                 <xsl:variable name="mpStk_ShpHeights_">
517                         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@HAS_MULTIPROCCONNS) and (@PSTACK_BLKD_X = $iMPStack_Blkd_X))])">
518                                 <MPSHAPE HEIGHT="0"/>
519                         </xsl:if>
520                         
521                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@HAS_MULTIPROCCONNS) and (@PSTACK_BLKD_X = $iMPStack_Blkd_X))]">
522                                 <xsl:variable name="shpClass_" select="@MODCLASS"/> 
523                                 <xsl:variable name="shpHeight_">
524                                         <xsl:choose>
525                                                 <xsl:when test="$shpClass_ = 'PERIPHERAL'">
526 <!--                                                    
527                                                         <xsl:message>Found Multi Proc Peripheral</xsl:message> 
528 -->     
529                                                         <xsl:call-template name="F_Calc_PeriShape_Height">      
530                                                                 <xsl:with-param name="iShapeInst" select="MODULE/@INSTANCE"/>
531                                                         </xsl:call-template>    
532                                                 </xsl:when>
533                                                 <xsl:when test="$shpClass_ = 'MEMORY_UNIT'">
534 <!--                                                    
535                                                         <xsl:message>Found Multi Proc Memory Unit</xsl:message> 
536 -->     
537                                                         <xsl:call-template name="F_Calc_MemoryUnit_Height">     
538                                                                 <xsl:with-param name="iShapeIndex"  select="@CSHAPE_INDEX"/>
539                                                         </xsl:call-template>    
540                                                 </xsl:when>
541                                                 <xsl:otherwise>0</xsl:otherwise>
542                                         </xsl:choose>
543                                 </xsl:variable>
544                                 
545 <!--                            
546                                 <xsl:message>Found <xsl:value-of select="$shpHeight_"/></xsl:message>
547 -->                             
548                                 
549                                 <MPSHAPE HEIGHT="{$shpHeight_}"/>
550                         </xsl:for-each>
551         </xsl:variable>
552         
553 <!--    
554         <xsl:message>Found stack of height <xsl:value-of select="sum(exsl:node-set($mpStk_ShpHeights_)/MPSHAPE/@HEIGHT)"/></xsl:message>
555 -->     
556         
557         <xsl:value-of select="sum(exsl:node-set($mpStk_ShpHeights_)/MPSHAPE/@HEIGHT)"/>
558 </xsl:template>
559
560 <xsl:template name="F_Calc_Max_MultiProc_Stack_Height">
561         
562         <!-- Store the heights in a variable -->        
563         
564         <xsl:variable name="mpStks_Heights_">
565                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE)">
566                         <MPSTK HEIGHT="0"/>
567                 </xsl:if>
568                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@PSTACK_BLKD_X)]">
569                         <xsl:variable name="mpstack_height_">
570                                 <xsl:call-template name="F_Calc_MultiProc_Stack_Height">
571                                         <xsl:with-param name="iMPStack_Blkd_X" select="(@PSTACK_BLKD_X + 1)"/>
572                                 </xsl:call-template>
573                         </xsl:variable>
574                         
575 <!--                    
576                         <xsl:message>Found <xsl:value-of select="$mpstack_height_"/></xsl:message>
577 -->                     
578                         <MPSTK HEIGHT="{$mpstack_height_}"/>
579                 </xsl:for-each>
580                 
581         </xsl:variable>
582
583                 <!-- Return the max of them --> 
584         <xsl:value-of select="math:max(exsl:node-set($mpStks_Heights_)/MPSTK/@HEIGHT)"/>
585         
586 </xsl:template>
587
588
589
590 <xsl:template name="F_Calc_Stack_Shape_Y">
591         
592         <xsl:param name="iHorizIdx"  select="100"/>
593         <xsl:param name="iVertiIdx"  select="100"/>
594         
595         
596 <!--    
597         <xsl:param name="sbsGap"    select="0"/>
598         <xsl:variable name="numSBSs_"     select="count($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSSHAPES/MODULE)"/>       
599         <xsl:variable name="sbs_LANE_H_"    select="($numSBSs_ * $BLKD_SBS_LANE_H)"/>
600         <xsl:variable name="sbsGap_"   select="($BLKD_PROC2SBS_GAP + $sbs_LANE_H_)"/>
601 -->     
602         
603         <xsl:variable name="sbsGap_" select="((count($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSSHAPES/MODULE) * $BLKD_SBS_LANE_H) + $BLKD_PROC2SBS_GAP)"/>        
604         
605         <xsl:if test="(not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]) and  
606                            not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(  (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]) and
607                            not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(     (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]))">0</xsl:if>
608                            
609                             
610 <!-- 
611         <xsl:if test="(not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]) and  
612                            not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(  (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]) and
613                            not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(     (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]))">
614                 <xsl:message>Something is missing </xsl:message>                           
615         </xsl:if>
616 -->     
617         
618         <xsl:if test="(($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))])   or  
619                            ($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(  (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))])   or
620                            ($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(     (@STACK_HORIZ_INDEX = $iHorizIdx) and ((@SHAPE_VERTI_INDEX = $iVertiIdx) or ($iVertiIdx = 100)))]))">
621                 <!-- Store the spaces above this one in a variable -->
622                 <xsl:variable name="spaces_above_">
623                 
624                         <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx) and (@SHAPE_VERTI_INDEX &lt; $iVertiIdx))])">
625                                 <SPACE HEIGHT="0"/>
626                         </xsl:if>
627                         
628                         <!-- Store the height of all peripherals and memory units above this one-->
629                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx)  and (@SHAPE_VERTI_INDEX &lt; $iVertiIdx))]">
630                                 
631                                 <xsl:if test="not(@MODCLASS='MEMORY_UNIT')">    
632                                         <xsl:variable name="peri_height_">
633                                                 <xsl:call-template name="F_Calc_Shape_Height">  
634                                                         <xsl:with-param name="iShapeId" select="@SHAPE_ID"/>
635                                                 </xsl:call-template>    
636                                         </xsl:variable>
637 <!--                                    
638                                         <xsl:message>Found peri height <xsl:value-of select="$peri_height_"/></xsl:message>
639 -->     
640                                         <SPACE HEIGHT="{$peri_height_ + $BLKD_BIF_H}"/>
641                                 </xsl:if>
642                                 
643                                 <xsl:if test="(@MODCLASS='MEMORY_UNIT')">       
644                                         <xsl:variable name="memu_height_">
645                                                 <xsl:call-template name="F_Calc_MemoryUnit_Height">     
646                                                         <xsl:with-param name="iShapeId" select="@SHAPE_ID"/>
647                                                 </xsl:call-template>    
648                                         </xsl:variable>
649 <!--                                    
650                                         <xsl:message>Found unit height <xsl:value-of select="$memu_height_"/></xsl:message>
651 -->                                     
652                                         <SPACE HEIGHT="{$memu_height_ + $BLKD_BIF_H}"/>
653                                 </xsl:if>
654                                 
655                         </xsl:for-each>
656                         
657                         <!-- Store the height of all the processors above this one-->
658                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[((@STACK_HORIZ_INDEX = $iHorizIdx)  and (@SHAPE_VERTI_INDEX &lt; $iVertiIdx))]">
659                                 <xsl:variable name="proc_height_">
660                                                 <xsl:call-template name="F_Calc_PeriShape_Height">      
661                                                         <xsl:with-param name="iShapeInst" select="@INSTANCE"/>
662                                                 </xsl:call-template>    
663                                 </xsl:variable>
664                                 
665 <!-- 
666                                         <xsl:message>Found Proc height <xsl:value-of select="$proc_height_ + $BLKD_BIF_H"/></xsl:message>
667 -->                                     
668                                 <SPACE HEIGHT="{$proc_height_ + $BLKD_BIF_H}"/>
669                         </xsl:for-each>
670                         
671                         <!-- If its a peripheral that is below the shared busses, or its a shared bus bucket -->
672                         <!-- add the height of the shared busses and the processor.                           -->
673                         <xsl:if  test="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[((@STACK_HORIZ_INDEX = $iHorizIdx) and (@SHAPE_VERTI_INDEX = $iVertiIdx))]/@IS_BLWSBS)">
674                                 <SPACE HEIGHT="{$sbsGap_}"/>
675                         </xsl:if>
676                         <xsl:if test="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[((@STACK_HORIZ_INDEX = $iHorizIdx) and (@SHAPE_VERTI_INDEX = $iVertiIdx))])">
677                                 <SPACE HEIGHT="{$sbsGap_}"/>
678                         </xsl:if>
679                         
680                         <!-- Store the height of all shared bus buckets above this one-->
681                         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[((@STACK_HORIZ_INDEX = $iHorizIdx)  and (@SHAPE_VERTI_INDEX &lt; $iVertiIdx))]">
682                                 <xsl:variable name="bkt_height_">
683                                         <xsl:call-template name="F_Calc_SbsBucket_Height">
684                                                 <xsl:with-param name="iBucketId" select="@BUS_INDEX"/>
685                                         </xsl:call-template>
686                                 </xsl:variable>
687                                 
688 <!-- 
689                                         <xsl:message>Found bucket height <xsl:value-of select="$bkt_height_ + $BLKD_BIF_H"/></xsl:message>
690 -->                                     
691                                 
692                                 <SPACE HEIGHT="{$bkt_height_ + $BLKD_BIF_H}"/>
693                         </xsl:for-each>
694                         
695                 </xsl:variable>
696                 
697                 <xsl:value-of select="sum(exsl:node-set($spaces_above_)/SPACE/@HEIGHT)"/>
698         </xsl:if>
699         
700 </xsl:template>
701         
702         
703 <xsl:template name="F_Calc_Max_BusConnLane_BifY">
704         
705         <xsl:param name="iBusName" select="'_busname_'"/>
706         
707         <!-- Store the heights in a variable -->        
708         <xsl:variable name="busConnYs_">
709                 
710                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE/BUSCONNS/BUSCONNLANE/BUSCONN)">
711                         <BUSCONNY HEIGHT="0"/>
712                 </xsl:if>
713                 
714                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE/BUSCONNS/BUSCONNLANE[(@BUSNAME = $iBusName)]/BUSCONN">
715                         
716                         <xsl:variable name="peri_cstk_y_">
717                                 <xsl:call-template name="F_Calc_CStackShapesAbv_Height">
718                                         <xsl:with-param name="iCStackIndex"  select="../@CSTACK_INDEX"/>
719                                         <xsl:with-param name="ICStackModY"   select="@CSTACK_MODS_Y"/>
720                                 </xsl:call-template>    
721                         </xsl:variable> 
722                                 
723                                 <xsl:variable name="peri_bif_dy_">
724                                         <xsl:value-of select="(($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_H)  * @BIF_Y)"/>
725                                 </xsl:variable>
726                                 
727                                 <xsl:variable name="peri_bc_y_">
728                                         <xsl:value-of select="($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_H + $peri_bif_dy_ + ceiling($BLKD_BIF_H div 2)) - ceiling($BLKD_BIFC_H div 2)"/>
729                                 </xsl:variable>
730                         
731 <!--                    
732                         <xsl:message>Found a busconn lane</xsl:message>
733 -->                     
734                         <BUSCONNY HEIGHT="{$peri_cstk_y_ + $peri_bif_dy_ + $peri_bc_y_}"/>
735                 </xsl:for-each>
736                 
737         </xsl:variable>
738
739                 <!-- Return the max of them --> 
740         <xsl:value-of select="math:max(exsl:node-set($busConnYs_)/BUSCONNY/@HEIGHT)"/>
741         
742 </xsl:template>
743         
744         
745 <xsl:template name="F_Calc_Min_BusConnLane_BifY">
746         
747         <xsl:param name="iBusName" select="'_busname_'"/>
748         
749         <!-- Store the heights in a variable -->        
750         <xsl:variable name="busConnYs_">
751                 
752                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE/BUSCONNS/BUSCONNLANE/BUSCONN)">
753                         <BUSCONNY HEIGHT="0"/>
754                 </xsl:if>
755                 
756                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE/BUSCONNS/BUSCONNLANE[(@BUSNAME = $iBusName)]/BUSCONN">
757                         
758                         <xsl:variable name="peri_cstk_y_">
759                                 <xsl:call-template name="F_Calc_CStackShapesAbv_Height">
760                                         <xsl:with-param name="iCStackIndex"  select="../@CSTACK_INDEX"/>
761                                         <xsl:with-param name="iCStackModY"   select="@CSTACK_MODS_Y"/>
762                                 </xsl:call-template>    
763                         </xsl:variable> 
764                                 
765                                 <xsl:variable name="peri_bif_dy_">
766                                         <xsl:value-of select="(($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_H)  * @BIF_Y)"/>
767                                 </xsl:variable>
768                                 
769                                 <xsl:variable name="peri_bc_y_">
770                                         <xsl:value-of select="($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_H + $peri_bif_dy_ + ceiling($BLKD_BIF_H div 2)) - ceiling($BLKD_BIFC_H div 2)"/>
771                                 </xsl:variable>
772                         
773 <!--                    
774                         <xsl:message>Found a busconn lane</xsl:message>
775 -->                     
776                         <BUSCONNY HEIGHT="{$peri_cstk_y_ + $peri_bc_y_}"/>
777                 </xsl:for-each>
778                 
779         </xsl:variable>
780
781                 <!-- Return the min of them --> 
782         <xsl:value-of select="math:min(exsl:node-set($busConnYs_)/BUSCONNY/@HEIGHT)"/>
783         
784 </xsl:template>
785         
786 <xsl:template name="F_Calc_Stack_Height">
787         <xsl:param name="iStackIdx"  select="100"/>
788         
789 <!--  
790         <xsl:message>Calculating height for Stack Index <xsl:value-of select="$iStackIdx"/></xsl:message>
791 -->     
792         
793         
794         <xsl:variable name="stack_height_">
795                 <!-- if this is called with no vert index of a shape 
796                          it defaults to the total height of the stack -->
797                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
798                         <xsl:with-param name="iHorizIdx"  select="$iStackIdx"/>
799                 </xsl:call-template>
800         </xsl:variable>
801         
802 <!-- 
803         <xsl:message>Calculated height for Stack as <xsl:value-of select="$stack_height_"/></xsl:message>
804 -->     
805         <xsl:value-of select="$stack_height_"/>
806 </xsl:template>
807         
808 <!--    
809 -->     
810         
811         
812 <xsl:template name="F_Calc_Stack_Width">
813         <xsl:param name="iStackIdx"  select="100"/>
814         
815 <!--    
816         <xsl:message>=============Stack Idx <xsl:value-of select="$iStackIdx"/>====</xsl:message>                       
817 -->     
818         <xsl:variable name="shape_widths_">     
819                 
820                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[@STACK_HORIZ_INDEX = $iStackIdx])">
821                         <SHAPE WIDTH="0"/>
822                 </xsl:if>
823                         
824                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[@STACK_HORIZ_INDEX = $iStackIdx])">
825                         <SHAPE WIDTH="0"/>
826                 </xsl:if>
827                         
828                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@STACK_HORIZ_INDEX = $iStackIdx)]">
829 <!--                    
830                         <xsl:variable name="proc_w_">
831                                 <xsl:value-of select="$BLKD_MOD_W"/>
832                         </xsl:variable>
833                         <xsl:message>Found processor of width <xsl:value-of select="$proc_w_"/></xsl:message>
834 -->     
835                         <SHAPE WIDTH="{$BLKD_MOD_W}"/>
836                 </xsl:for-each>
837                         
838                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(@STACK_HORIZ_INDEX = $iStackIdx)]">
839                                 
840                         <xsl:variable name="shpClass_" select="@MODCLASS"/> 
841                         <xsl:variable name="shape_w_">
842                                 <xsl:choose>
843                                                 
844                                                 <xsl:when test="$shpClass_ = 'PERIPHERAL'">
845                                                         <xsl:value-of select="$BLKD_MOD_W"/>
846                                                 </xsl:when>
847                                                 
848                                                 <xsl:when test="$shpClass_ = 'MEMORY_UNIT'">
849                                                         <xsl:value-of select="($BLKD_MOD_W * @MODS_W)"/>
850                                                 </xsl:when>
851                                                 
852                                                 <xsl:otherwise>0</xsl:otherwise>
853                                                 
854                                         </xsl:choose>
855                                 </xsl:variable>
856                                 
857 <!--            
858                         <xsl:message>Found shape width <xsl:value-of select="$shape_w_"/></xsl:message>
859 -->                             
860                                 
861                         <SHAPE WIDTH="{$shape_w_}"/>
862                 </xsl:for-each>
863                         
864                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX = $iStackIdx)]">
865                         <xsl:variable name="bucket_w_">
866                                   <xsl:value-of select="(($BLKD_MOD_BKTLANE_W * 2) + (($BLKD_MOD_W * @MODS_W) + ($BLKD_MOD_BUCKET_G * (@MODS_W - 1))))"/>
867                         </xsl:variable>
868                         
869 <!--                            
870                         <xsl:message>Found bucket of width <xsl:value-of select="$bucket_w_"/></xsl:message>
871 -->                             
872                         <SHAPE WIDTH="{$bucket_w_}"/>
873                 </xsl:for-each>
874                         
875         </xsl:variable>
876         
877         <xsl:value-of select="math:max(exsl:node-set($shape_widths_)/SHAPE/@WIDTH)"/>
878 </xsl:template>
879         
880         
881 <xsl:template name="F_Calc_Stack_X">
882         <xsl:param name="iStackIdx"  select="0"/>
883 <!--    
884         <xsl:message>Looking for stack indexes less than <xsl:value-of select="$iStackIdx"/></xsl:message>
885 -->     
886         
887         <!-- Store the stack widths in a variable -->   
888         <xsl:variable name="stackspace_widths_">
889         
890                 <xsl:if test="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/@STACK_HORIZ_WIDTH = $iStackIdx)">
891                         <STACKSPACE WIDTH="{$BLKD_BUS_LANE_W}"/>
892                 </xsl:if>
893                 
894                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES[(@STACK_HORIZ_INDEX &lt; $iStackIdx)])">
895                         <STACKSPACE WIDTH="0"/>
896                 </xsl:if>
897                 
898                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES[(@STACK_HORIZ_INDEX &lt; $iStackIdx)])">
899                         <STACKSPACE WIDTH="0"/>
900                 </xsl:if>
901                 
902                 <xsl:if test="not($G_ROOT/EDKSYSTEM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX &lt; $iStackIdx)])">
903                         <STACKSPACE WIDTH="0"/>
904                 </xsl:if>
905                 
906                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(@EAST &lt;= $iStackIdx)]">
907                         
908 <!--            
909                         <xsl:message>==============================</xsl:message>
910                         <xsl:message>Found a space of index <xsl:value-of select="@EAST"/></xsl:message>
911                         <xsl:message>Bus lane space width <xsl:value-of select="@BUSLANES_W"/></xsl:message>
912                         <xsl:message>Bus lane space is <xsl:value-of select="$space_width_"/></xsl:message>
913                         <xsl:variable name="space_width_" select="($BLKD_BUS_LANE_W * @BUSLANES_W)"/>
914 -->     
915
916                         <xsl:variable name="East_">
917                                 <xsl:choose>
918                                         <xsl:when test="@EAST"><xsl:value-of select="@EAST"/></xsl:when>
919                                         <xsl:otherwise>'NONE'</xsl:otherwise>
920                                 </xsl:choose>
921                         </xsl:variable>
922                         
923                         <xsl:variable name="West_">
924                                 <xsl:choose>
925                                         <xsl:when test="@WEST"><xsl:value-of select="@WEST"/></xsl:when>
926                                         <xsl:otherwise>NONE</xsl:otherwise>
927                                 </xsl:choose>
928                         </xsl:variable>
929                         
930 <!--
931                         <xsl:message>1 - West_ <xsl:value-of select="$West_"/></xsl:message>
932                         <xsl:message>1 - East_ <xsl:value-of select="$East_"/></xsl:message>
933 -->
934                         <xsl:variable name="space_width_">
935                                 <xsl:call-template name="F_Calc_Space_Width">
936                                         <xsl:with-param name="iStackToWest" select="$West_"/>
937                                         <xsl:with-param name="iStackToEast" select="$East_"/>
938                                 </xsl:call-template>
939                         </xsl:variable>
940                         
941                         <xsl:variable name="stack_width_">
942                                 <xsl:if test="not(@EAST = $iStackIdx)">
943                                         <xsl:call-template name="F_Calc_Stack_Width">
944                                                 <xsl:with-param name="iStackIdx"  select="@EAST"/>
945                                         </xsl:call-template>
946                                 </xsl:if>
947                                 <xsl:if test="(@EAST = $iStackIdx)">0</xsl:if>
948                         </xsl:variable>
949 <!--                    
950                         <xsl:message>Found stack of width <xsl:value-of select="$stack_width_"/></xsl:message>
951                         <xsl:message>==============================</xsl:message>
952 -->                     
953                         <STACKSPACE WIDTH="{$stack_width_ + $space_width_}"/>
954                         
955                 </xsl:for-each>
956                 
957                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(not(@EAST) and (@WEST = ($iStackIdx -1)))]">
958                         <xsl:variable name="space_width_" select="($BLKD_BUS_LANE_W * @BUSLANES_W)"/>
959 <!--                    
960                         <xsl:message>Found end space of <xsl:value-of select="$space_width_"/></xsl:message>
961 -->                     
962                         <STACKSPACE WIDTH="{$space_width_}"/>
963                 </xsl:for-each>
964                 
965                 
966         </xsl:variable>
967         
968         <xsl:value-of select="sum(exsl:node-set($stackspace_widths_)/STACKSPACE/@WIDTH)"/>
969         
970 </xsl:template> 
971         
972 <xsl:template name="F_Calc_Space_Width">
973         
974         <xsl:param name="iStackToWest"  select="'NONE'"/>
975         <xsl:param name="iStackToEast"  select="'NONE'"/>
976         
977 <!--    
978         <xsl:message>Stack to West <xsl:value-of select="$stackToWest"/></xsl:message>
979         <xsl:message>Stack to East <xsl:value-of select="$stackToEast"/></xsl:message>
980 -->     
981         
982         <xsl:variable name="spaceWidth_">
983                 <xsl:choose>
984                         <xsl:when test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[((@EAST = $iStackToEast) or (not($iStackToWest = 'NONE') and (@WEST = $iStackToWest)))]">
985                                 <xsl:value-of select="((($G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[((@EAST = $iStackToEast) or (not($iStackToWest = 'NONE') and (@WEST = $iStackToWest)))]/@BUSLANES_W) + 1) * $BLKD_BUS_LANE_W)"/>
986                         </xsl:when>     
987                         <xsl:otherwise>0</xsl:otherwise>        
988                 </xsl:choose>   
989         </xsl:variable> 
990         
991 <!--    
992         <xsl:message>Space width <xsl:value-of select="$spaceWidth_"/></xsl:message>
993 -->     
994         
995         <xsl:value-of select="$spaceWidth_"/>
996 </xsl:template>
997         
998         
999 <xsl:template name="F_Calc_Space_X">
1000         
1001         <xsl:param name="iStackToWest"  select="'NONE'"/>
1002         <xsl:param name="iStackToEast"  select="'NONE'"/>
1003         
1004 <!--    
1005         <xsl:message>Stack East <xsl:value-of select="$stackToEast"/></xsl:message>
1006         <xsl:message>Stack West <xsl:value-of select="$stackToWest"/></xsl:message>
1007 -->     
1008         
1009         <!-- Store the stack widths in a variable -->   
1010         
1011 <!--    
1012         <xsl:message>Looking for stack indexes less than <xsl:value-of select="$stackIdx"/></xsl:message>
1013 -->     
1014         
1015         <xsl:variable name="stackspace_widths_">
1016                 
1017                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES[(@STACK_HORIZ_INDEX &lt; $iStackToEast)])">
1018                         <STACKSPACE WIDTH="0"/>
1019                 </xsl:if>
1020                 
1021                 <xsl:if test="not($G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES[(@STACK_HORIZ_INDEX &lt; $iStackToEast)])">
1022                         <STACKSPACE WIDTH="0"/>
1023                 </xsl:if>
1024                 
1025                 <xsl:if test="not($G_ROOT/EDKSYSTEM/SBSBUCKETS/SBSBUCKET[(@STACK_HORIZ_INDEX &lt; $iStackToEast)])">
1026                         <STACKSPACE WIDTH="0"/>
1027                 </xsl:if>
1028                 
1029                 <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[((@EAST &lt; $iStackToEast) or (not($iStackToWest = 'NONE') and (@EAST &lt;= $iStackToWest)))]">
1030                         
1031 <!--            
1032                         <xsl:message>==============================</xsl:message>
1033                         <xsl:message>Found a space of index <xsl:value-of select="@EAST"/></xsl:message>
1034 -->     
1035
1036                         <xsl:variable name="East_">
1037                                 <xsl:choose>
1038                                         <xsl:when test="@EAST"><xsl:value-of select="@EAST"/></xsl:when>
1039                                         <xsl:otherwise>'NONE'</xsl:otherwise>
1040                                 </xsl:choose>
1041                         </xsl:variable>
1042                         
1043                         <xsl:variable name="West_">
1044                                 <xsl:choose>
1045                                         <xsl:when test="@WEST"><xsl:value-of select="@WEST"/></xsl:when>
1046                                         <xsl:otherwise>NONE</xsl:otherwise>
1047                                 </xsl:choose>
1048                         </xsl:variable>
1049 <!--
1050                         <xsl:message>2 - West_ <xsl:value-of select="$West_"/></xsl:message>
1051                         <xsl:message>2 - East_ <xsl:value-of select="$East_"/></xsl:message>
1052  -->                    
1053                         <xsl:variable name="space_width_">
1054                                 <xsl:call-template name="F_Calc_Space_Width">
1055                                         <xsl:with-param name="iStackToWest" select="$West_"/>
1056                                         <xsl:with-param name="iStackToEast" select="$East_"/>
1057                                 </xsl:call-template>
1058                         </xsl:variable>
1059                         
1060 <!--                    
1061                         <xsl:variable name="space_width_" select="($BLKD_BUS_LANE_W * @BUSLANES_W)"/>
1062                         <xsl:message>Bus lane space width <xsl:value-of select="@BUSLANES_W"/></xsl:message>
1063                         <xsl:message>Bus lane space is <xsl:value-of select="$space_width_"/></xsl:message>
1064 -->     
1065                         
1066                         <xsl:variable name="stack_width_">
1067                                 <xsl:call-template name="F_Calc_Stack_Width">
1068                                         <xsl:with-param name="iStackIdx"  select="@EAST"/>
1069                                 </xsl:call-template>
1070                         </xsl:variable>
1071                         
1072 <!--                    
1073                         <xsl:message>Found stack of width <xsl:value-of select="$stack_width_"/></xsl:message>
1074                         <xsl:message>==============================</xsl:message>
1075 -->                     
1076                         
1077                         <STACKSPACE WIDTH="{$stack_width_ + $space_width_}"/>
1078                 </xsl:for-each>
1079         </xsl:variable>
1080         
1081         <xsl:variable name = "stackToWest_W_">
1082                 <xsl:choose>
1083                         <xsl:when test="(($iStackToEast = '0')   and     ($iStackToWest = 'NONE'))">0</xsl:when>
1084                         <xsl:when test="(($iStackToEast = 'NONE') and not($iStackToWest = 'NONE'))">
1085                                 <xsl:call-template name="F_Calc_Stack_Width">
1086                                         <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
1087                                 </xsl:call-template>
1088                         </xsl:when>
1089                         <xsl:when test="(not($iStackToEast = '0') and ($iStackToWest = 'NONE'))">
1090                                 <xsl:call-template name="F_Calc_Stack_Width">
1091                                         <xsl:with-param name="iStackIdx"  select="($iStackToEast - 1)"/>
1092                                 </xsl:call-template>
1093                         </xsl:when>
1094                         <xsl:otherwise>0</xsl:otherwise>
1095                 </xsl:choose>
1096         </xsl:variable>
1097         
1098 <!--    
1099         <xsl:variable name = "stackToEast_W_">
1100                 <xsl:call-template name="F_Calc_Stack_Width">
1101                         <xsl:with-param name="stackIdx"  select="$stackToEast"/>
1102                 </xsl:call-template>
1103         </xsl:variable>
1104         <xsl:variable name ="extSpaceEast_W_" select="ceiling($stackToEast_W_ div 2)"/>
1105 -->     
1106         
1107         <xsl:variable name ="extSpaceWest_W_" select="ceiling($stackToWest_W_ div 2)"/>
1108          
1109         <xsl:value-of select="sum(exsl:node-set($stackspace_widths_)/STACKSPACE/@WIDTH) - $extSpaceWest_W_"/>
1110 </xsl:template> 
1111
1112 </xsl:stylesheet>