]> git.sur5r.net Git - freertos/blob
89b61569f039c9f6a27fcdff60a7284fc2c7a6b2
[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:exsl="http://exslt.org/common"
6        xmlns:dyn="http://exslt.org/dynamic"
7        xmlns:math="http://exslt.org/math"
8        xmlns:xlink="http://www.w3.org/1999/xlink"
9        extension-element-prefixes="math dyn exsl xlink">
10            
11 <!-- 
12 <xsl:output method="xml" 
13                         version="1.0" 
14                         encoding="UTF-8" 
15                         indent="yes"
16                 doctype-public="-//W3C//DTD SVG 1.0//EN"
17                     doctype-system="http://www.w3.org/TR/SVG/DTD/svg10.dtd"/>
18 -->     
19  
20 <!-- 
21                  ===========================================================
22                         Handle Bucket connections to the shared busses./
23                         
24                  ===========================================================
25 -->             
26         
27 <xsl:template name="BCLaneSpace_BucketToSharedBus">     
28         
29         <xsl:param name="iBusStd"           select="'NONE'"/>   
30         <xsl:param name="iBifType"          select="'NONE'"/>   
31         <xsl:param name="iBusName"          select="'NONE'"/>   
32         <xsl:param name="iStackToEast"      select="'NONE'"/>   
33         <xsl:param name="iStackToWest"      select="'NONE'"/>   
34         <xsl:param name="iStackToEast_W"    select="0"/>        
35         <xsl:param name="iStackToWest_W"    select="0"/>        
36         <xsl:param name="iLaneInSpace_X"    select="0"/>        
37         <xsl:param name="iSpaceSharedBus_Y" select="0"/>        
38         
39 <!--    
40         <xsl:message>Stack To East <xsl:value-of select="$iStackToEast"/></xsl:message>
41         <xsl:message>Stack to West <xsl:value-of select="$iStackToWest"/></xsl:message>
42         <xsl:message>Stack to East Width <xsl:value-of select="$iStackToEast_W"/></xsl:message>
43         <xsl:message>Stack to West Width <xsl:value-of select="$iStackToWest_W"/></xsl:message>
44         <xsl:message>Shared Bus Y <xsl:value-of select="$iSpaceSharedBus_Y"/></xsl:message>
45         <xsl:message>Lane in space X <xsl:value-of select="$iLaneInSpace_X"/></xsl:message>
46 -->     
47         
48         <xsl:variable name="busColor_">
49                 <xsl:call-template name="F_BusStd2RGB">
50                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
51                 </xsl:call-template>    
52         </xsl:variable>
53         
54         <xsl:variable name="sbs_idx_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE= $iBusName)]/@BUS_INDEX"/>
55         <xsl:variable name="sbs_name_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@BUS_INDEX = $sbs_idx_)]/@BUSNAME"/>
56                                         
57         <xsl:variable name="sbs_bc_y_" select="($iSpaceSharedBus_Y + ($sbs_idx_ * $BLKD_SBS_LANE_H))"/>
58                                         
59         <xsl:variable name="bktshp_hori_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@BUS_INDEX = $sbs_idx_)]/@STACK_HORIZ_INDEX"/>
60         <xsl:variable name="bktshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/SBSBUCKETS/SBSBUCKET[(@BUS_INDEX = $sbs_idx_)]/@SHAPE_VERTI_INDEX"/>
61         
62         <xsl:variable name="space_W_">
63                 <xsl:call-template name="F_Calc_Space_Width"> 
64                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
65                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
66                 </xsl:call-template>            
67         </xsl:variable>
68         
69         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
70         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>
71         
72 <!--    
73         <xsl:message>Ext Shape to West <xsl:value-of select="$extSpaceWest_W_"/></xsl:message>
74         <xsl:message>Ext Shape to East <xsl:value-of select="$extSpaceEast_W_"/></xsl:message>
75 -->     
76         <xsl:variable name="bktshp_Y_">
77                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
78                         <xsl:with-param name="iHorizIdx"  select="$bktshp_hori_idx_"/>
79                         <xsl:with-param name="iVertiIdx"  select="$bktshp_vert_idx_"/>
80                 </xsl:call-template>
81         </xsl:variable>
82                                                 
83         <xsl:variable name="sbsStack_H_diff_">
84                 <xsl:choose>
85                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
86                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
87                                 
88                                 <xsl:variable name="stackToWest_AbvSbs_H_">
89                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
90                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
91                                         </xsl:call-template>
92                                 </xsl:variable>
93                                 
94                                 <xsl:variable name="stackToEast_AbvSbs_H_">
95                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
96                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
97                                         </xsl:call-template>
98                                 </xsl:variable>
99                                 
100 <!--                            
101                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
102                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
103 -->                             
104                                 <xsl:if test="($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_)">
105                                         <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
106                                 </xsl:if>       
107                                 
108                                 <xsl:if test="not($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_)">0</xsl:if>       
109                         </xsl:when>
110                 </xsl:choose>
111         </xsl:variable>
112         
113         <xsl:variable name="vert_line_x_"   select="($iLaneInSpace_X  +  ceiling($BLKD_BIFC_W div 2))"/>
114         <xsl:variable name="vert_line_y1_"  select="($iSpaceSharedBus_Y   + ($sbs_idx_ * $BLKD_SBS_LANE_H) + ceiling($BLKD_BIFC_W div 2))"/>
115         <xsl:variable name="vert_line_y2_"  select="($bktshp_Y_ + ceiling($BLKD_MOD_W div 2) + $sbsStack_H_diff_)"/>
116         <xsl:variable name="bcInSpace_X_"   select="($iLaneInSpace_X  +  ceiling($BLKD_BIFC_W div 2) - ceiling($BLKD_BUS_ARROW_W div 2))"/>
117         
118         
119 <!--    
120         <xsl:message>Shared Bus Y <xsl:value-of select="$G_SharedBus_Y"/></xsl:message>
121         <xsl:message>Vert Bus Y <xsl:value-of select="$vert_line_y1_"/></xsl:message>
122         <xsl:message>vert y1 <xsl:value-of select="$vert_line_y1_"/></xsl:message>
123         <xsl:message>vert y2 <xsl:value-of select="$vert_line_y2_"/></xsl:message>
124 -->     
125         
126         <xsl:variable name="horz_line_y_"   select="$vert_line_y2_"/>
127         <xsl:variable name="horz_line_x1_"  select="$vert_line_x_"/>
128         <xsl:variable name="horz_line_x2_"  select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_)"/>
129         
130         <xsl:variable name="v_bus_ul_x_"   select="$vert_line_x_"/>
131         <xsl:variable name="v_bus_ul_y_"   select="$vert_line_y1_"/>
132         <xsl:variable name="v_bus_width_"  select="$BLKD_P2P_BUS_W"/>
133                 
134         <xsl:variable name="v_bus_height_" select="(($vert_line_y2_ - $vert_line_y1_) - ceiling($BLKD_BIFC_H div 2))"/>
135         
136         <xsl:variable name="h_bus_ul_x_"   select="$v_bus_ul_x_"/>
137         <xsl:variable name="h_bus_ul_y_"   select="$vert_line_y2_   - $BLKD_BIFC_H + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
138         <xsl:variable name="h_bus_width_"  select="ceiling($space_W_ div 2) + $extSpaceEast_W_"/>
139         <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
140         
141 <!--    
142         <xsl:variable name="h_bus_width_"  select="($space_W_ + ceiling(($extSpaceWest_W_ + $extSpaceEast_W_) div 2) - $BLKD_BIFC_W)"/>
143         <xsl:message>v bus x <xsl:value-of select="$v_bus_ul_x_"/></xsl:message>
144         <xsl:message>v bus y <xsl:value-of select="$v_bus_ul_y_"/></xsl:message>
145         <xsl:message>v bus w <xsl:value-of select="$v_bus_width_"/></xsl:message>
146         <xsl:message>v bus y1 <xsl:value-of select="$vert_line_y1_"/></xsl:message>
147         <xsl:message>v bus y2 <xsl:value-of select="$vert_line_y2_"/></xsl:message>
148         <xsl:message>v bus h <xsl:value-of select="$v_bus_height_"/></xsl:message>
149         <xsl:message>h bus w <xsl:value-of select="$h_bus_width_"/></xsl:message>
150 -->     
151         
152         
153         <!-- Draw rectangular parts of the bus -->
154         <rect x="{$v_bus_ul_x_}" 
155                   y="{$v_bus_ul_y_ - 2}"  
156                   width= "{$v_bus_width_}" 
157                   height="{$v_bus_height_}" 
158                   style="stroke:none; fill:{$busColor_}"/>
159         
160         <rect x="{$h_bus_ul_x_}" 
161                   y="{$h_bus_ul_y_ - 5}"  
162                   width= "{$h_bus_width_}" 
163                   height="{$h_bus_height_}" 
164                   style="stroke:none; fill:{$busColor_}"/>
165 <!--    
166 -->
167                 
168 </xsl:template>                                 
169         
170 <!--
171                  ===========================================================
172                         Handle Processor's Shared bus connections.
173                  ===========================================================
174 -->
175         
176 <xsl:template name="BCLaneSpace_ProcBifToSharedBus">    
177         
178         <xsl:param name="iBusStd"           select="'NONE'"/>   
179         <xsl:param name="iBusName"          select="'NONE'"/>   
180         <xsl:param name="iBifType"          select="'NONE'"/>   
181         <xsl:param name="iStackToEast"      select="'NONE'"/>   
182         <xsl:param name="iStackToWest"      select="'NONE'"/>   
183         <xsl:param name="iStackToEast_W"    select="0"/>        
184         <xsl:param name="iStackToWest_W"    select="0"/>        
185         <xsl:param name="iLaneInSpace_X"    select="0"/>        
186         <xsl:param name="iSpaceSharedBus_Y" select="0"/>        
187         
188 <!--                                            
189         <xsl:message>Proc Bus Std  <xsl:value-of select="$iBusStd"/></xsl:message>
190         <xsl:message>Proc Bus Name <xsl:value-of select="$iBusName"/></xsl:message>
191         <xsl:message>Proc Bif Type <xsl:value-of select="$iBifType"/></xsl:message>
192 -->
193         
194         <xsl:variable name="busColor_">
195                 <xsl:call-template name="F_BusStd2RGB">
196                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
197                 </xsl:call-template>    
198         </xsl:variable>
199         
200         <xsl:variable name="sbs_idx_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE= $iBusName)]/@BUS_INDEX"/>
201         <xsl:variable name="sbs_bc_y_" select="($iSpaceSharedBus_Y + ($sbs_idx_ * $BLKD_SBS_LANE_H))"/>
202         <xsl:variable name="procInst_" select="BUSCONN/@INSTANCE"/>
203         
204         
205 <!--    
206         <xsl:message>Shared Bus Idx <xsl:value-of select="$sbs_idx_"/></xsl:message>
207         <xsl:message>Proc inst  <xsl:value-of select="$procInst_"/></xsl:message>
208 -->                                             
209         
210         <xsl:variable name="procBif_Y_"    select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * BUSCONN/@BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
211         <xsl:variable name="procBifName_"  select="BUSCONN/@BUSINTERFACE"/>
212         <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInst_)]/BUSINTERFACE[(@NAME = $procBifName_)]/@BIF_X"/>
213         <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInst_)]/BUSINTERFACE[(@NAME = $procBifName_)]/@TYPE"/>
214                                                 
215         <xsl:variable name="procshp_hori_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInst_)]/@STACK_HORIZ_INDEX"/>
216         <xsl:variable name="procshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInst_)]/@SHAPE_VERTI_INDEX"/>
217         
218         <xsl:variable name="space_W_">
219                 <xsl:call-template name="F_Calc_Space_Width"> 
220                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
221                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
222                 </xsl:call-template>            
223         </xsl:variable>
224         
225         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
226         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>
227         
228         
229 <!--                                            
230         <xsl:message>Ext Space to West <xsl:value-of select="$extSpaceWest_W_"/></xsl:message>
231         <xsl:message>Ext Space to East <xsl:value-of select="$extSpaceEast_W_"/></xsl:message>
232         
233         <xsl:message>Ext Space to East <xsl:value-of select="$extSpaceEast_W_"/></xsl:message>
234         <xsl:message>Stack horiz  <xsl:value-of select="$procshp_hori_idx_"/></xsl:message>
235         <xsl:message>Stack verti  <xsl:value-of select="$procshp_vert_idx_"/></xsl:message>
236         <xsl:message>Proc Bif Y   <xsl:value-of select="$procBif_Y_"/></xsl:message>
237 -->                                             
238                                                 
239         <xsl:variable name="procshp_Y_">
240                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
241                         <xsl:with-param name="iHorizIdx"  select="$procshp_hori_idx_"/>
242                         <xsl:with-param name="iVertiIdx"  select="$procshp_vert_idx_"/>
243                 </xsl:call-template>
244         </xsl:variable>
245                                                 
246         
247         <xsl:variable name="procStack_H_diff_">
248                 <xsl:choose>
249                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
250                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
251                 
252                                 <xsl:variable name="stackToWest_AbvSbs_H_">
253                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
254                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
255                                         </xsl:call-template>
256                                 </xsl:variable>
257                                 
258                                 <xsl:variable name="stackToEast_AbvSbs_H_">
259                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
260                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
261                                         </xsl:call-template>
262                                 </xsl:variable>
263                                 
264 <!--                            
265                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
266                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
267 -->                             
268                                 <xsl:choose>
269                                         <xsl:when test="(($procshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
270                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
271                                         </xsl:when>     
272                                         <xsl:when test="(($procshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
273                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
274                                         </xsl:when>     
275                                         <xsl:otherwise>0</xsl:otherwise>        
276                                 </xsl:choose>   
277                         </xsl:when>
278                 </xsl:choose>
279         </xsl:variable>
280         
281         <xsl:variable name="bc_Y_"  select="($procshp_Y_ + $procBif_Y_ + ceiling($BIF_H div 2) + $procStack_H_diff_) - ceiling($BLKD_BIFC_H div 2)"/>
282 <!--    
283         <xsl:variable name="bc_x_"  select="($laneInSpace_X +  ceiling($BLKD_BIFC_W div 2))"/>
284         <xsl:variable name="bc_x_"  select="0"/>
285         <xsl:message>Test</xsl:message>
286 -->     
287
288         <xsl:variable name="bc_X_">
289                 <xsl:choose>
290                         <xsl:when test="$procBifSide_ = '0'">
291                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
292 <!--                            
293                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_)"/>
294                                 <xsl:value-of select="($space_W_ -  ceiling($BLKD_MOD_W div 2))"/>
295                                 <xsl:value-of select="$space_W_ + $extSpaceEast_W_"/>
296                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
297 -->                             
298                         </xsl:when>
299                         <xsl:when test="$procBifSide_ = '1'">
300                                 <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
301                         </xsl:when>
302                         <xsl:otherwise>0</xsl:otherwise>
303                 </xsl:choose>
304         </xsl:variable>
305                                                 
306         <!-- Place the bus connectijon -->
307         <use   x="{$bc_X_}"   y="{$bc_Y_}"  xlink:href="#{$iBusStd}_busconn_{$procBifType_}"/>
308 <!--    
309 -->     
310         <xsl:variable name="vert_line_x_"   select="($iLaneInSpace_X +  ceiling($BLKD_BIFC_W div 2))"/>
311         <xsl:variable name="vert_line_y1_"  select="($procshp_Y_ + $procBif_Y_ + ceiling($BLKD_BIF_H div 2) + $procStack_H_diff_)"/>
312         <xsl:variable name="vert_line_y2_"  select="($iSpaceSharedBus_Y + ($sbs_idx_ * $BLKD_SBS_LANE_H) + ceiling($BLKD_BIFC_W div 2))"/>
313         
314 <!--    
315         <xsl:message>Vert line Y1 <xsl:value-of select="$vert_line_y1_"/></xsl:message>
316         <xsl:message>Vert line Y2 <xsl:value-of select="$vert_line_y2_"/></xsl:message>
317 -->             
318         
319         <xsl:variable name="v_bus_ul_y_">
320                 <xsl:choose>
321                         <xsl:when test="$vert_line_y1_ &gt; $vert_line_y2_">
322                                 <xsl:value-of select="$vert_line_y2_"/>
323                         </xsl:when>
324                         <xsl:when test="$vert_line_y2_ &gt; $vert_line_y1_">
325                                 <xsl:value-of select="$vert_line_y1_"/>
326                         </xsl:when>
327                 </xsl:choose>
328         </xsl:variable> 
329         
330         <xsl:variable name="v_bus_ul_x_">
331                 <xsl:choose>
332                         <xsl:when test="@ORIENTED='WEST'">
333                                 <xsl:value-of select="($vert_line_x_ + $BLKD_MOD_BIF_GAP_H)"/>
334                         </xsl:when>
335                         <xsl:when test="@ORIENTED='EAST'">
336                                 <xsl:value-of select="($vert_line_x_ - $BLKD_MOD_BIF_GAP_H)"/>
337                         </xsl:when>
338                 </xsl:choose>
339         </xsl:variable> 
340                 
341                 
342         <xsl:variable name="v_bus_width_" select="$BLKD_P2P_BUS_W"/>
343         <xsl:variable name="v_bus_height_">
344                 <xsl:choose>
345                         <xsl:when test="$vert_line_y1_ &gt; $vert_line_y2_">
346                                 <xsl:value-of select="($vert_line_y1_ - $vert_line_y2_) - $BLKD_P2P_BUS_W"/>
347                         </xsl:when>
348                         <xsl:when test="$vert_line_y2_ &gt; $vert_line_y1_">
349                                 <xsl:value-of select="($vert_line_y2_ - $vert_line_y1_) - $BLKD_P2P_BUS_W"/>
350                         </xsl:when>
351                 </xsl:choose>
352         </xsl:variable> 
353                 
354         <xsl:variable name="h_bus_ul_x_">
355                 <xsl:choose>
356                         <xsl:when test="@ORIENTED='WEST'">
357                                 <xsl:value-of select="($bc_X_ + $BLKD_BIFC_W - ceiling(($BLKD_BIFC_W - $BLKD_BIFC_Wi) div 2))"/>
358 <!--                            
359                                 <xsl:value-of select="$v_bus_ul_x_"/>
360 -->     
361                         </xsl:when>
362                         <xsl:when test="@ORIENTED='EAST'">
363                                 <xsl:value-of select="$v_bus_ul_x_"/>
364                         </xsl:when>
365                 </xsl:choose>
366         </xsl:variable> 
367                 
368                 <xsl:variable name="h_bus_ul_y_">
369                         <xsl:choose>
370                                 <xsl:when test="$vert_line_y1_ &gt; $vert_line_y2_">
371                                         <xsl:value-of select="$vert_line_y2_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
372                                 </xsl:when>
373                                 <xsl:when test="$vert_line_y2_ &gt; $vert_line_y1_">
374                                         <xsl:value-of select="$vert_line_y1_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
375                                 </xsl:when>
376                         </xsl:choose>
377                 </xsl:variable> 
378         
379         
380                 <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
381                 <xsl:variable name="h_bus_width_">
382                         <xsl:choose>
383                                 <xsl:when test="@ORIENTED='WEST'">
384                                         <xsl:value-of select="$v_bus_ul_x_ - $h_bus_ul_x_ + $BLKD_P2P_BUS_W"/>
385                                 </xsl:when>
386                                 <xsl:when test="@ORIENTED='EAST'">
387                                         <xsl:value-of select="($bc_X_ - $v_bus_ul_x_) + ceiling(($BLKD_BIFC_W - $BLKD_BIFC_Wi) div 2) + 1"/>
388                                 </xsl:when>
389                         </xsl:choose>
390                 </xsl:variable> 
391                         
392 <!--                    
393                 <xsl:if test="(@ORIENTED = 'WEST')">
394                 </xsl:if>
395                         
396                 <xsl:message>bc_X_  <xsl:value-of select="$bc_X_"/></xsl:message>
397                 <xsl:message>v_bus_ul_x  <xsl:value-of select="$v_bus_ul_x_"/></xsl:message>
398                 <xsl:message>h_bus_width <xsl:value-of select="$h_bus_width_"/></xsl:message>
399                 <xsl:message>h_bus_ul_y  <xsl:value-of select="$h_bus_ul_y_"/></xsl:message>
400 -->     
401                         
402                 <rect x="{$v_bus_ul_x_}" 
403                           y="{$v_bus_ul_y_ + 2}"  
404                           width= "{$v_bus_width_}" 
405                           height="{$v_bus_height_}" 
406                           style="stroke:none; fill:{$busColor_}"/>
407                 
408                 <rect x="{$h_bus_ul_x_}" 
409                           y="{$h_bus_ul_y_}"  
410                           width= "{$h_bus_width_}" 
411                           height="{$h_bus_height_}" 
412                           style="stroke:none; fill:{$busColor_}"/>
413 </xsl:template>                                 
414         
415 <!--
416                  ===========================================================
417                         Handle non Processor Sharedebus connections.
418                  ===========================================================
419 -->
420                                 
421 <xsl:template name="BCLaneSpace_NonProcBifToSharedBus"> 
422         
423         <xsl:param name="iBusStd"           select="'NONE'"/>   
424         <xsl:param name="iBifType"          select="'NONE'"/>   
425         <xsl:param name="iBusName"          select="'NONE'"/>   
426         <xsl:param name="iStackToEast"      select="'NONE'"/>   
427         <xsl:param name="iStackToWest"      select="'NONE'"/>   
428         <xsl:param name="iStackToEast_W"    select="0"/>        
429         <xsl:param name="iStackToWest_W"    select="0"/>        
430         <xsl:param name="iLaneInSpace_X"    select="0"/>        
431         <xsl:param name="iSpaceSharedBus_Y" select="0"/>        
432         
433                                                 
434         <xsl:variable name="sbs_idx_" select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE= $iBusName)]/@BUS_INDEX"/>
435         <xsl:variable name="sbs_bc_y_" select="($iSpaceSharedBus_Y + ($sbs_idx_ * $BLKD_SBS_LANE_H))"/>
436 <!--    
437         <xsl:variable name="sbs_bc_y_" select="($G_SharedBus_Y + ($sbs_idx_ * $BLKD_SBS_LANE_H))"/>
438 -->     
439                                                 
440         <xsl:variable name="cmplxInst_" select="BUSCONN/@INSTANCE"/>
441                                                 
442         <xsl:variable name="cmplxBif_Y_"    select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * BUSCONN/@BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
443         <xsl:variable name="cmplxBifName_"  select="BUSCONN/@BUSINTERFACE"/>
444         <xsl:variable name="cmplxBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $cmplxInst_)]/BUSINTERFACE[(@NAME = $cmplxBifName_)]/@BIF_X"/>
445         <xsl:variable name="cmplxBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $cmplxInst_)]/BUSINTERFACE[(@NAME = $cmplxBifName_)]/@TYPE"/>
446                                                 
447         <xsl:variable name="cmplxshp_hori_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $cmplxInst_)])]/@STACK_HORIZ_INDEX"/>
448         <xsl:variable name="cmplxshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $cmplxInst_)])]/@SHAPE_VERTI_INDEX"/>
449                                                 
450         <xsl:variable name="is_abvSbs_" select="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $cmplxInst_)]]/@IS_ABVSBS)"/>
451         <xsl:variable name="is_blwSbs_" select="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $cmplxInst_)]]/@IS_BLWSBS)"/>
452         
453 <!--                                            
454         <xsl:message>iStackToEast <xsl:value-of select="$iStackToEast"/></xsl:message>
455         <xsl:message>iStackToWest <xsl:value-of select="$iStackToWest"/></xsl:message>
456         <xsl:message><xsl:value-of select="$cmplxInst_"/> : <xsl:value-of select="$is_blwSbs_"/></xsl:message>
457         <xsl:message><xsl:value-of select="$cmplxInst_"/> : <xsl:value-of select="$is_abvSbs_"/></xsl:message>
458         <xsl:message><xsl:value-of select="$cmplxInst_"/> : <xsl:value-of select="$is_blwSbs_"/></xsl:message>
459         <xsl:message><xsl:value-of select="$cmplxInst_"/> : <xsl:value-of select="$is_abvSbs_"/></xsl:message>
460         <xsl:message>Stack horiz  <xsl:value-of select="$cmplxshp_hori_idx_"/></xsl:message>
461         <xsl:message>Stack verti  <xsl:value-of select="$cmplxshp_vert_idx_"/></xsl:message>
462         <xsl:message>Proc Bif Y   <xsl:value-of select="$procBif_Y_"/></xsl:message>
463 -->                                             
464         
465         
466         <xsl:variable name="busColor_">
467                 <xsl:call-template name="F_BusStd2RGB">
468                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
469                 </xsl:call-template>    
470         </xsl:variable> 
471         
472         <xsl:variable name="space_W_">
473                 <xsl:call-template name="F_Calc_Space_Width"> 
474                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
475                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
476                 </xsl:call-template>            
477         </xsl:variable>
478         
479         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
480         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                         
481         
482         <xsl:variable name="cmplxshp_Y_">
483                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
484                         <xsl:with-param name="iHorizIdx"  select="$cmplxshp_hori_idx_"/>
485                         <xsl:with-param name="iVertiIdx"  select="$cmplxshp_vert_idx_"/>
486                 </xsl:call-template>
487         </xsl:variable>
488         
489 <!--    
490         <xsl:message>Complex shape Y <xsl:value-of select="$cmplxshp_Y_"/></xsl:message>
491 -->     
492         
493         <xsl:variable name="stackToEast_">
494                 <xsl:choose>
495                         <xsl:when test="not($iStackToEast = 'NONE')"><xsl:value-of select="$iStackToEast"/></xsl:when>
496                         <xsl:otherwise>NONE</xsl:otherwise>
497                 </xsl:choose>
498         </xsl:variable> 
499         
500         <xsl:variable name="stackToWest_">
501                 <xsl:choose>
502                         <xsl:when test=" not($iStackToWest = 'NONE')"><xsl:value-of select="$iStackToWest"/></xsl:when>
503                         <xsl:when test="(not($iStackToEast = 'NONE') and not($iStackToEast = '0'))"><xsl:value-of select="($iStackToEast - 1)"/></xsl:when>
504                         <xsl:otherwise>NONE</xsl:otherwise>
505                 </xsl:choose>
506         </xsl:variable> 
507         
508                                                 
509         <xsl:variable name="cmplxStack_H_diff_">
510                 <xsl:choose>
511                         <xsl:when test="   (($stackToEast_ = 'NONE') or ($stackToWest_ = 'NONE'))">0</xsl:when>
512                         <xsl:when test="not(($stackToEast_ = 'NONE') or ($stackToWest_ = 'NONE'))">
513                                 
514                                 <xsl:variable name="stackToWest_AbvSbs_H_">
515                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
516                                                 <xsl:with-param name="iStackIdx"  select="$stackToWest_"/>
517                                         </xsl:call-template>
518                                 </xsl:variable>
519                                 
520                                 <xsl:variable name="stackToEast_AbvSbs_H_">
521                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
522                                                 <xsl:with-param name="iStackIdx"  select="$stackToEast_"/>
523                                         </xsl:call-template>
524                                 </xsl:variable>
525                                 
526 <!--                            
527                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
528                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
529 -->                             
530                                 <xsl:choose>
531                                         <xsl:when test="(($cmplxshp_hori_idx_ = $stackToEast_) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
532                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
533                                         </xsl:when>     
534                                         <xsl:when test="(($cmplxshp_hori_idx_ = $stackToWest_) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
535                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
536                                         </xsl:when>     
537                                         <xsl:otherwise>0</xsl:otherwise>        
538                                 </xsl:choose>   
539                                                                         
540                         </xsl:when>
541                 </xsl:choose>
542         </xsl:variable>
543         
544         
545         <xsl:variable name="bc_Y_"  select="($cmplxshp_Y_ + $cmplxBif_Y_ + ceiling($BIF_H div 2) + $cmplxStack_H_diff_) - ceiling($BLKD_BIFC_H div 2)"/>
546         
547         
548 <!--    
549         <xsl:message>Sstack H Diff  <xsl:value-of select="$cmplxStack_H_diff_"/></xsl:message>
550         <xsl:message>BC Y <xsl:value-of select="$bc_Y_"/></xsl:message>
551         <xsl:variable name="bc_x_"  select="($laneInSpace_X +  ceiling($BLKD_BIFC_W div 2))"/>
552         <xsl:variable name="bc_x_"  select="0"/>
553 -->     
554         <xsl:variable name="bc_X_">
555                 <xsl:choose>
556                         <xsl:when test="$cmplxBifSide_ = '0'">
557                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
558                         </xsl:when>
559                         <xsl:when test="$cmplxBifSide_ = '1'">
560                                 <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
561                         </xsl:when>
562                         <xsl:otherwise>0</xsl:otherwise>
563                 </xsl:choose>
564         </xsl:variable> 
565         
566         <use   x="{$bc_X_}"   y="{$bc_Y_}"  xlink:href="#{$iBusStd}_busconn_{$cmplxBifType_}"/>
567         
568         <xsl:variable name="vert_line_x_"  select="($iLaneInSpace_X +  ceiling($BLKD_BIFC_W div 2))"/>
569         <xsl:variable name="vert_line_y1_" select="($cmplxshp_Y_ + $cmplxBif_Y_ + ceiling($BLKD_BIF_H div 2) + $cmplxStack_H_diff_)"/>
570         <xsl:variable name="vert_line_y2_"  select="($iSpaceSharedBus_Y  + ($sbs_idx_ * $BLKD_SBS_LANE_H) + ceiling($BLKD_BIFC_W div 2))"/>
571         
572         <xsl:variable name="v_bus_ul_y_">
573                 <xsl:choose>
574                         <xsl:when test="$vert_line_y1_ &gt; $vert_line_y2_">
575                                 <xsl:value-of select="$vert_line_y2_"/>
576                         </xsl:when>
577                         <xsl:when test="$vert_line_y2_ &gt; $vert_line_y1_">
578                                 <xsl:value-of select="$vert_line_y1_"/>
579                         </xsl:when>
580                 </xsl:choose>
581         </xsl:variable> 
582         
583         <xsl:variable name="v_bus_ul_x_">
584                 <xsl:choose>
585                         <xsl:when test="@ORIENTED='WEST'">
586                                 <xsl:value-of select="($vert_line_x_ + $BLKD_MOD_BIF_GAP_H)"/>
587                         </xsl:when>
588                         <xsl:when test="@ORIENTED='EAST'">
589                                 <xsl:value-of select="($vert_line_x_ - $BLKD_MOD_BIF_GAP_H)"/>
590                         </xsl:when>
591                 </xsl:choose>
592         </xsl:variable> 
593                 
594         <xsl:variable name="v_bus_width_" select="$BLKD_P2P_BUS_W"/>
595         <xsl:variable name="v_bus_height_">
596                 <xsl:choose>
597                         <xsl:when test="$vert_line_y1_ &gt; $vert_line_y2_">
598                                 <xsl:value-of select="($vert_line_y1_ - $vert_line_y2_) - $BLKD_P2P_BUS_W + 8"/>
599                         </xsl:when>
600                         <xsl:when test="$vert_line_y2_ &gt; $vert_line_y1_">
601                                 <xsl:value-of select="($vert_line_y2_ - $vert_line_y1_) - $BLKD_P2P_BUS_W + 8"/>
602                         </xsl:when>
603                 </xsl:choose>
604         </xsl:variable> 
605                 
606         <xsl:variable name="h_bus_ul_x_">
607                 <xsl:choose>
608                         <xsl:when test="@ORIENTED='WEST'">
609                                 <xsl:value-of select="($bc_X_ + $BLKD_BIFC_W - ceiling(($BLKD_BIFC_W - $BLKD_BIFC_Wi) div 2))"/>
610                         </xsl:when>
611                         <xsl:when test="@ORIENTED='EAST'">
612                                 <xsl:value-of select="$v_bus_ul_x_"/>
613                         </xsl:when>
614                 </xsl:choose>
615         </xsl:variable> 
616                 
617         <xsl:variable name="h_bus_ul_y_">
618                 <xsl:choose>
619                         
620                         <xsl:when test="($is_blwSbs_ = 'TRUE') and ($vert_line_y1_ &gt; $vert_line_y2_)">
621                                 <xsl:value-of select="$vert_line_y1_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
622                         </xsl:when>
623                         <xsl:when test="($is_blwSbs_ = 'TRUE') and ($vert_line_y2_ &gt; $vert_line_y1_)">
624                                 <xsl:value-of select="$vert_line_y2_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
625                         </xsl:when>
626                         
627                         <xsl:when test="($is_abvSbs_ = 'TRUE') and ($vert_line_y1_ &gt; $vert_line_y2_)">
628                                 <xsl:value-of select="$vert_line_y2_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
629                         </xsl:when>
630                         <xsl:when test="($is_abvSbs_ = 'TRUE') and ($vert_line_y2_ &gt; $vert_line_y1_)">
631                                 <xsl:value-of select="$vert_line_y1_ - ceiling($BLKD_P2P_BUS_W div 2)"/>
632                         </xsl:when>
633                         
634                 </xsl:choose>
635         </xsl:variable> 
636         
637         
638         <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
639         <xsl:variable name="h_bus_width_">
640                 <xsl:choose>
641                         <xsl:when test="@ORIENTED='WEST'">
642                                 <xsl:value-of select="$v_bus_ul_x_ - $h_bus_ul_x_ + $BLKD_P2P_BUS_W"/>
643                         </xsl:when>
644                         <xsl:when test="@ORIENTED='EAST'">
645                                 <xsl:value-of select="($bc_X_ - $v_bus_ul_x_) + ceiling(($BLKD_BIFC_W - $BLKD_BIFC_Wi) div 2) + 1"/>
646                         </xsl:when>
647                 </xsl:choose>
648         </xsl:variable> 
649         
650                         
651         <rect x="{$v_bus_ul_x_}" 
652                   y="{$v_bus_ul_y_ - 2}"  
653                   width= "{$v_bus_width_}" 
654                   height="{$v_bus_height_}" 
655                   style="stroke:none; fill:{$busColor_}"/>
656                 
657         <rect x="{$h_bus_ul_x_}" 
658                   y="{$h_bus_ul_y_}"  
659                   width= "{$h_bus_width_}" 
660                   height="{$h_bus_height_}" 
661                   style="stroke:none; fill:{$busColor_}"/>
662                 
663 </xsl:template>                                 
664         
665 <!-- 
666                  ===========================================================
667                         Handle connections from processors to Memory UNITs
668                  ===========================================================
669 -->
670         
671         
672 <xsl:template name="BCLaneSpace_ProcBifToMemoryUnit">   
673         
674         <xsl:param name="iBusStd"        select="'NONE'"/>      
675         <xsl:param name="iBusName"       select="'NONE'"/>      
676         <xsl:param name="iBifType"       select="'NONE'"/>      
677         <xsl:param name="iStackToEast"   select="'NONE'"/>      
678         <xsl:param name="iStackToWest"   select="'NONE'"/>      
679         <xsl:param name="iStackToEast_W" select="0"/>   
680         <xsl:param name="iStackToWest_W" select="0"/>   
681         <xsl:param name="iLaneInSpace_X" select="0"/>   
682         
683         <xsl:variable name="bcInSpace_X_"  select="$iLaneInSpace_X"/>
684         <xsl:variable name="procInstance_" select="BUSCONN[@IS_PROCCONN]/@INSTANCE"/>
685         <xsl:variable name="mem_procshp_hori_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@STACK_HORIZ_INDEX"/>
686         <xsl:variable name="mem_procshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@SHAPE_VERTI_INDEX"/>
687                                                 
688         <xsl:variable name="mem_procshp_Y_">
689                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
690                         <xsl:with-param name="iHorizIdx"  select="$mem_procshp_hori_idx_"/>
691                         <xsl:with-param name="iVertiIdx"  select="$mem_procshp_vert_idx_"/>
692                 </xsl:call-template>
693         </xsl:variable>
694         
695         <xsl:variable name="busColor_">
696                 <xsl:call-template name="F_BusStd2RGB">
697                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
698                 </xsl:call-template>    
699         </xsl:variable> 
700         
701         <xsl:variable name="space_W_">
702                 <xsl:call-template name="F_Calc_Space_Width"> 
703                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
704                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
705                 </xsl:call-template>            
706         </xsl:variable>
707         
708         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
709         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
710         
711         <xsl:variable name="cmplxStack_H_diff_">
712                 <xsl:choose>
713                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
714                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
715                                 
716                                 <xsl:variable name="stackToWest_AbvSbs_H_">
717                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
718                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
719                                         </xsl:call-template>
720                                 </xsl:variable>
721                                 
722                                 <xsl:variable name="stackToEast_AbvSbs_H_">
723                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
724                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
725                                         </xsl:call-template>
726                                 </xsl:variable>
727                                 
728 <!--                            
729                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
730                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
731 -->                             
732                                 <xsl:choose>
733                                         <xsl:when test="(($mem_procshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
734                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
735                                         </xsl:when>     
736                                         <xsl:when test="(($mem_procshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
737                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
738                                         </xsl:when>     
739                                         <xsl:otherwise>0</xsl:otherwise>        
740                                 </xsl:choose>   
741                                                                         
742                         </xsl:when>
743                 </xsl:choose>
744         </xsl:variable>
745                                                 
746         <xsl:variable name="mem_procStack_H_diff_">
747                 <xsl:choose>
748                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
749                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
750         
751                                 <xsl:variable name="stackToWest_AbvSbs_H_">
752                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
753                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
754                                         </xsl:call-template>
755                                 </xsl:variable>
756                                 
757                                 <xsl:variable name="stackToEast_AbvSbs_H_">
758                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
759                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
760                                         </xsl:call-template>
761                                 </xsl:variable>
762                                 
763 <!--                            
764                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
765                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
766 -->                             
767                         <xsl:choose>
768                                 <xsl:when test="(($mem_procshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
769                                         <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
770                                 </xsl:when>     
771                                 <xsl:when test="(($mem_procshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
772                                         <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
773                                 </xsl:when>     
774                                 <xsl:otherwise>0</xsl:otherwise>        
775                         </xsl:choose>   
776                                                                         
777                 </xsl:when>
778         </xsl:choose>
779   </xsl:variable>
780                                                 
781         <!-- Store the conns in a variable -->  
782         <xsl:variable name="memConn_heights_">
783
784                 <xsl:for-each select="BUSCONN">
785                                                                 
786                         <xsl:variable name="bifName_"       select="@BUSINTERFACE"/>
787                         
788                                                         
789                         <xsl:choose>
790                                 <xsl:when test="@IS_PROCCONN and @BIF_Y">
791                                                         
792                                         <xsl:variable name="procBif_Y_"    select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
793                                         <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
794                                         <xsl:variable name="procBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
795                                         <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
796                                         <xsl:variable name="bcProc_Y_"     select="($mem_procshp_Y_ + $procBif_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $mem_procStack_H_diff_)"/>
797                                         <xsl:variable name="bcProc_X_">
798                                                 <xsl:choose>
799                                                         <xsl:when test="$procBifSide_ = '0'">
800                                                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
801                                                         </xsl:when>
802                                                         <xsl:when test="$procBifSide_ = '1'">
803                                                                 <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
804                                                         </xsl:when>
805                                                         <xsl:otherwise>0</xsl:otherwise>
806                                                 </xsl:choose>
807                                         </xsl:variable>
808                                                 
809                                         <MEMCONN X="{$bcProc_X_}" Y="{$bcProc_Y_}" BUSNAME="{$procBusName_}" BUSSTD="{$iBusStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}"/>
810                                                                                 
811                                 </xsl:when>
812                                                                         
813                                 <xsl:otherwise>
814                                                                         
815                                         <xsl:variable name="memcInstance_"     select="@INSTANCE"/>
816                                         <xsl:variable name="memcshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $memcInstance_)]]/@SHAPE_VERTI_INDEX"/>
817                                         <xsl:variable name="memcBifSide_"      select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $memcInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
818                                         <xsl:variable name="memcBif_Y_"        select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $memcInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_Y"/>
819                                                                                 
820                                         <xsl:variable name="memshp_Y_">
821                                                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
822                                                         <xsl:with-param name="iHorizIdx"  select="$mem_procshp_hori_idx_"/>
823                                                         <xsl:with-param name="iVertiIdx"  select="$memcshp_vert_idx_"/>
824                                                 </xsl:call-template>
825                                     </xsl:variable>
826                                         
827                                         <xsl:variable name="memcMOD_W_" select="(($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $memcInstance_)]]/@MODS_W) * $BLKD_MOD_W)"/>
828                                                                                 
829                                         <xsl:variable name="procBif_Y_"   select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
830                                         
831                                         <xsl:variable name="memcConn_Y_">
832                                                 <xsl:choose>
833                                                         <xsl:when test="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $memcInstance_)]]/@MODS_H = 1)">
834                                                                 <xsl:value-of  select="($memshp_Y_ + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V) +  ($memcBif_Y_ * ($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V)) + ceiling($BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $cmplxStack_H_diff_)"/>
835                                                         </xsl:when>
836                                                         <xsl:otherwise>
837                                                                 <xsl:value-of  select="($memshp_Y_ + $BLKD_MOD_H + $BLKD_MOD_LANE_H + ($memcBif_Y_ * ($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V)) + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $cmplxStack_H_diff_)"/>
838                                                         </xsl:otherwise>
839                                                 </xsl:choose>
840                                         </xsl:variable>
841                                         
842                                         <xsl:variable name="memcConn_X_">
843                                                 <xsl:choose>
844                                                         <xsl:when test="$memcBifSide_ = '0'">
845                                                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($memcMOD_W_ div 2) + $BLKD_BIFC_W))"/>
846                                                         </xsl:when>
847                                                         <xsl:when test="$memcBifSide_ = '1'">
848                                                                 <xsl:value-of select="ceiling($memcMOD_W_ div 2)"/>
849                                                         </xsl:when>
850                                                 </xsl:choose>
851                                         </xsl:variable>
852                                                 
853                                         <xsl:variable name="memcBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $memcInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
854                                         <xsl:variable name="memcBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $memcInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
855                                         
856                                         <MEMCONN X="{$memcConn_X_}" Y="{$memcConn_Y_}" BUSNAME="{$memcBusName_}" BUSSTD="{$iBusStd}" TYPE="{$memcBifType_}" BIFSIDE="{$memcBifSide_}"/>
857                                         
858                                 </xsl:otherwise>
859                         </xsl:choose>
860                 </xsl:for-each>
861         </xsl:variable>
862                                                 
863                                                 
864         <!-- Draw the busconnection and horizontal lines.-->                                            
865         <xsl:for-each select="exsl:node-set($memConn_heights_)/MEMCONN">
866                                                         
867                 <xsl:variable name="bus_x_" select="($bcInSpace_X_ + ceiling($BLKD_BIFC_W div 2))"/>
868                 <xsl:variable name="bus_y_" select="@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
869                 
870                 <xsl:variable name="adjusted_X_">
871                         <xsl:choose>
872                                 <xsl:when test="((@X &lt; ($bus_x_ + $BLKD_BUS_ARROW_W)) and (@BIFSIDE ='0'))">
873                                         <xsl:value-of select="(@X + $BLKD_P2P_BUS_W)"/>
874                                 </xsl:when>
875                                 <xsl:otherwise>
876                                         <xsl:value-of select="@X"/>
877                                 </xsl:otherwise>
878                         </xsl:choose>
879                 </xsl:variable>
880                 
881                 <xsl:variable name="h_bus_ul_x_dx_">
882                         <xsl:choose>
883                                 <xsl:when test="((@X &lt; ($bus_x_ + $BLKD_BUS_ARROW_W)) and (@BIFSIDE='0'))">
884                                         <xsl:value-of select="$BLKD_P2P_BUS_W"/>
885                                 </xsl:when>
886                                 <xsl:otherwise>0</xsl:otherwise>
887                         </xsl:choose>
888                 </xsl:variable>
889                 
890                 <xsl:variable name="h_bus_ul_x_">
891                         <xsl:choose>
892                                 <xsl:when test="@BIFSIDE='0'">
893                                         <xsl:value-of select="($bus_x_ - $h_bus_ul_x_dx_)"/>
894                                 </xsl:when>
895                                 <xsl:when test="@BIFSIDE='1'">
896                                         <xsl:value-of select="(@X + $BLKD_BIFC_W + $BLKD_BUS_ARROW_W)"/>
897                                 </xsl:when>
898                         </xsl:choose>
899                 </xsl:variable> 
900                 
901                 <xsl:variable name="h_bus_ul_y_" select="$bus_y_"/>
902         
903                 <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
904                 <xsl:variable name="h_bus_width_">
905                         <xsl:choose>
906                                 <xsl:when test="@BIFSIDE='0'">
907                                         <xsl:value-of select="($adjusted_X_ - $bus_x_ - $BLKD_BUS_ARROW_W)"/>
908                                 </xsl:when>
909                                 <xsl:when test="@BIFSIDE='1'">
910                                         <xsl:value-of select="$bus_x_ - $h_bus_ul_x_"/>
911                                 </xsl:when>
912                         </xsl:choose>
913                 </xsl:variable> 
914                 
915                 <!-- Place the bus connection -->
916                 <use   x="{@X}"   y="{@Y}"  xlink:href="#{@BUSSTD}_busconn_{@TYPE}"/>
917                 
918                 <!-- Draw the arrow -->
919                 <xsl:choose>
920                         <xsl:when test="@BIFSIDE='0'">
921                                 <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowEast"/>
922                         </xsl:when>
923                         <xsl:when test="@BIFSIDE='1'">
924                                 <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowWest"/>
925                         </xsl:when>
926                 </xsl:choose>
927                 
928                 
929                 <!-- Draw the horizontal part of the bus -->
930                 <rect x="{$h_bus_ul_x_}" 
931                           y="{$h_bus_ul_y_}"  
932                           width= "{$h_bus_width_}" 
933                           height="{$h_bus_height_}" 
934                           style="stroke:none; fill:{$busColor_}"/>
935         </xsl:for-each>
936         
937         <xsl:variable name="busTop_"      select="math:min(exsl:node-set($memConn_heights_)/MEMCONN/@Y)"/>
938         <xsl:variable name="busBot_"      select="math:max(exsl:node-set($memConn_heights_)/MEMCONN/@Y)"/>
939         <xsl:variable name="busName_"     select="exsl:node-set($memConn_heights_)/MEMCONN/@BUSNAME"/>
940         <xsl:variable name="busSide_"     select="exsl:node-set($memConn_heights_)/MEMCONN/@BIFSIDE"/>
941         <xsl:variable name="leftmost_x_"  select="math:min(exsl:node-set($memConn_heights_)/MEMCONN/@X)"/>
942         
943 <!--  Hack to fix CR473515 -->
944         <xsl:variable name="v_bus_x_dx_">
945                 <xsl:choose> 
946                         <xsl:when test="(($busSide_ = '0') and (($leftmost_x_ - ($bcInSpace_X_ + $BLKD_P2P_BUS_W)) &lt;= $BLKD_P2P_BUS_W))">-4</xsl:when>
947                         <xsl:otherwise><xsl:value-of select="$BLKD_P2P_BUS_W"/></xsl:otherwise>
948                 </xsl:choose>
949         </xsl:variable> 
950         
951         
952         <xsl:variable name="v_bus_y_" select="$busTop_ + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
953         <xsl:variable name="v_bus_x_">
954                 <xsl:choose>
955                         <xsl:when test="$busSide_ ='0'">
956                                 <xsl:value-of select="($bcInSpace_X_ + $v_bus_x_dx_)"/>
957                         </xsl:when>
958                         <xsl:when test="$busSide_ ='1'">
959                                 <xsl:value-of select="($bcInSpace_X_ + $BLKD_P2P_BUS_W)"/>
960                         </xsl:when>
961                 </xsl:choose>
962         </xsl:variable> 
963         
964         <!-- Draw the vertical part of the bus -->      
965         <rect x="{$v_bus_x_}" 
966                   y="{$v_bus_y_}"  
967                   width= "{$BLKD_P2P_BUS_W}" 
968                   height="{($busBot_ - $busTop_) + $BLKD_P2P_BUS_W}" 
969                   style="stroke:none; fill:{$busColor_}"/>
970
971 <!--  Hack to fix CR473515 -->
972         <xsl:if test="($busSide_ ='0')">
973                 <rect x="{$v_bus_x_}" 
974                           y="{$v_bus_y_   + ($busBot_ - $busTop_)}" 
975                       width= "{$BLKD_P2P_BUS_W * 2}" 
976                       height="{$BLKD_P2P_BUS_W}" 
977                       style="stroke:none; fill:{$busColor_}"/>
978         </xsl:if>
979                           
980 <!--    
981         <xsl:message>v_bus_x  <xsl:value-of select="$v_bus_x_"/></xsl:message>
982 -->     
983
984         <!-- Place the bus label.-->    
985 <!-- 
986         <text class="p2pbuslabel" 
987                           x="{$bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6}"
988                           y="{$busTop_ + ($BLKD_BUS_ARROW_H * 3)}">
989                         <xsl:value-of select="$busName_"/>
990         </text> 
991 -->     
992         
993         <xsl:call-template name="F_WriteText">
994                 <xsl:with-param name="iX"               select="($bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6)"/>
995                 <xsl:with-param name="iY"               select="($busTop_ + ($BLKD_BUS_ARROW_H * 3))"/>
996                 <xsl:with-param name="iText"    select="$busName_"/>
997                 <xsl:with-param name="iClass"   select="'p2pbus_label'"/>
998         </xsl:call-template>
999                           
1000 </xsl:template>                                 
1001         
1002         
1003 <!-- 
1004                  ===========================================================
1005                         Handle generic Point to Point connections
1006                  ===========================================================
1007 -->
1008         
1009 <xsl:template name="BCLaneSpace_PointToPoint">  
1010         
1011         <xsl:param name="iBusStd"        select="'NONE'"/>      
1012         <xsl:param name="iBifType"       select="'NONE'"/>      
1013         <xsl:param name="iBusName"       select="'NONE'"/>      
1014         <xsl:param name="iStackToEast"   select="'NONE'"/>      
1015         <xsl:param name="iStackToWest"   select="'NONE'"/>      
1016         <xsl:param name="iStackToEast_W" select="0"/>   
1017         <xsl:param name="iStackToWest_W" select="0"/>   
1018         <xsl:param name="iLaneInSpace_X" select="0"/>   
1019         
1020         <xsl:variable name="busColor_">
1021                 <xsl:call-template name="F_BusStd2RGB">
1022                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1023                 </xsl:call-template>    
1024         </xsl:variable> 
1025         
1026         <xsl:variable name="busColor_lt_">
1027                 <xsl:call-template name="F_BusStd2RGB_LT">
1028                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1029                 </xsl:call-template>    
1030         </xsl:variable> 
1031         
1032         
1033         <xsl:variable name="space_W_">
1034                 <xsl:call-template name="F_Calc_Space_Width"> 
1035                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
1036                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
1037                 </xsl:call-template>            
1038         </xsl:variable>
1039         
1040         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
1041         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
1042         
1043         <xsl:variable name="bcInSpace_X_"  select="($iLaneInSpace_X +  ceiling($BLKD_BIFC_W div 2) - ceiling($BLKD_BUS_ARROW_W div 2))"/>
1044         <xsl:variable name="p2pInstance_" select="BUSCONN[(@BIF_Y)]/@INSTANCE"/>
1045                                         
1046         <xsl:variable name="p2pshp_hori_idx_">
1047                 <xsl:choose>
1048                         <xsl:when test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]">
1049                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]/@STACK_HORIZ_INDEX"/>
1050                         </xsl:when>
1051                         <xsl:otherwise>
1052                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $p2pInstance_)])]/@STACK_HORIZ_INDEX"/>
1053                         </xsl:otherwise>
1054                 </xsl:choose>
1055         </xsl:variable>         
1056                                         
1057         <xsl:variable name="p2pshp_vert_idx_">
1058                 <xsl:choose>
1059                         <xsl:when test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]">
1060                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]/@SHAPE_VERTI_INDEX"/>
1061                         </xsl:when>
1062                         <xsl:otherwise>
1063                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $p2pInstance_)])]/@SHAPE_VERTI_INDEX"/>
1064                         </xsl:otherwise>
1065                 </xsl:choose>
1066         </xsl:variable>         
1067                                         
1068 <!--                                    
1069                                         <xsl:variable name="p2pshp_hori_idx_" select="/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@STACK_HORIZ_INDEX"/>
1070                                         <xsl:variable name="p2pshp_vert_idx_" select="/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@SHAPE_VERTI_INDEX"/>
1071 -->                                     
1072                                                 
1073         <xsl:variable name="p2pshp_Y_">
1074                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
1075                         <xsl:with-param name="iHorizIdx"  select="$p2pshp_hori_idx_"/>
1076                         <xsl:with-param name="iVertiIdx"  select="$p2pshp_vert_idx_"/>
1077                 </xsl:call-template>
1078         </xsl:variable>
1079                         
1080         <xsl:variable name="cmplxStack_H_diff_">
1081                 <xsl:choose>
1082                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
1083                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
1084                                 
1085                                 <xsl:variable name="stackToWest_AbvSbs_H_">
1086                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1087                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
1088                                         </xsl:call-template>
1089                                 </xsl:variable>
1090                                 
1091                                 <xsl:variable name="stackToEast_AbvSbs_H_">
1092                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1093                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
1094                                         </xsl:call-template>
1095                                 </xsl:variable>
1096                                 
1097 <!--                            
1098                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
1099                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
1100 -->                             
1101                                 <xsl:choose>
1102                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
1103                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
1104                                         </xsl:when>     
1105                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
1106                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
1107                                         </xsl:when>     
1108                                         <xsl:otherwise>0</xsl:otherwise>        
1109                                 </xsl:choose>   
1110                                                                         
1111                         </xsl:when>
1112                 </xsl:choose>
1113         </xsl:variable>
1114                                                 
1115                                                                                                                                                                 
1116         <xsl:variable name="procStack_H_diff_">
1117                 <xsl:choose>
1118                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
1119                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
1120                         
1121                                 <xsl:variable name="stackToWest_AbvSbs_H_">
1122                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1123                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
1124                                         </xsl:call-template>
1125                                 </xsl:variable>
1126                                 
1127                                 <xsl:variable name="stackToEast_AbvSbs_H_">
1128                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1129                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
1130                                         </xsl:call-template>
1131                                 </xsl:variable>
1132                                 
1133 <!--                            
1134                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
1135                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
1136 -->                             
1137                                 <xsl:choose>
1138                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
1139                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
1140                                         </xsl:when>     
1141                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
1142                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
1143                                         </xsl:when>     
1144                                         <xsl:otherwise>0</xsl:otherwise>        
1145                                 </xsl:choose>   
1146                                                                         
1147                         </xsl:when>
1148                 </xsl:choose>
1149         </xsl:variable>
1150                                                 
1151         
1152         
1153         <!-- Store the conns in a variable -->  
1154         <xsl:variable name="p2pConn_heights_">
1155         
1156                 <xsl:for-each select="BUSCONN">
1157                                                                         
1158                         <xsl:variable name="bifName_" select="@BUSINTERFACE"/>
1159                                                         
1160                                 <xsl:choose>
1161                                         <xsl:when test="@IS_PROCCONN and @BIF_Y">
1162                                                                                 
1163 <!--                                                                            
1164                                                                                 <xsl:message>Proc <xsl:value-of select="$procInstance_"/></xsl:message>
1165 -->                                                                             
1166                                                 <xsl:variable name="procBif_Y_"   select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
1167                                                 <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
1168                                                 <xsl:variable name="procBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
1169                                                 <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
1170                                                                                 
1171                                                 <xsl:variable name="bcProc_Y_"     select="($p2pshp_Y_ + $procBif_Y_ + ceiling($BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $procStack_H_diff_)"/>
1172                                                 <xsl:variable name="bcProc_X_">
1173                                                         <xsl:choose>
1174                                                                 <xsl:when test="$procBifSide_ = '0'">
1175                                                                         <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
1176                                                                 </xsl:when>
1177                                                                 <xsl:when test="$procBifSide_ = '1'">
1178                                                                         <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
1179                                                                 </xsl:when>
1180                                                                 <xsl:otherwise>0</xsl:otherwise>
1181                                                         </xsl:choose>
1182                                                 </xsl:variable>
1183                                                 
1184                                                 <P2PCONN X="{$bcProc_X_}" Y="{$bcProc_Y_}" BUSNAME= "{$procBusName_}" BUSSTD="{$iBusStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}"/>
1185                                                                                 
1186 <!--                                            
1187                                                 <xsl:message>bcProc_X_ <xsl:value-of select="$bcProc_X_"/></xsl:message>
1188                                                 <xsl:message>bcProc_Y_ <xsl:value-of select="$bcProc_Y_"/></xsl:message>
1189                                                 <P2PCONN X="{$bcInSpace_X_}" Y="{$bcProc_Y_}" BUSSTD="{$busStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}" STACK_ID=""/>
1190 -->                                             
1191                                         </xsl:when>
1192                                                                         
1193                                         <xsl:otherwise>
1194                                                                                 
1195                                                 <xsl:variable name="modInstance_"     select="@INSTANCE"/>
1196                                                 <xsl:variable name="modshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $modInstance_)]]/@SHAPE_VERTI_INDEX"/>
1197                                                 <xsl:variable name="modBifSide_"      select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
1198                                                 <xsl:variable name="modBif_Y_"        select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_Y"/>
1199                                                 <xsl:variable name="modBc_Y_"         select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * $modBif_Y_) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
1200                                                                                 
1201 <!--                                                                            
1202                                                 <xsl:message>Memory Instance <xsl:value-of select="$procInstance_"/></xsl:message>
1203 -->                                                                             
1204                                                 
1205                                                 <xsl:variable name="modshp_Y_">
1206                                                         <xsl:call-template name="F_Calc_Stack_Shape_Y">
1207                                                                 <xsl:with-param name="iHorizIdx"  select="$p2pshp_hori_idx_"/>
1208                                                                 <xsl:with-param name="iVertiIdx"  select="$modshp_vert_idx_"/>
1209                                                         </xsl:call-template>
1210                                                 </xsl:variable>
1211                                                                                 
1212                                                 <xsl:variable name="modBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
1213                                                 <xsl:variable name="modBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
1214                                                 <xsl:variable name="bcMod_Y_"     select="($modshp_Y_ + $modBc_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $cmplxStack_H_diff_)"/>
1215                                                 <xsl:variable name="bcMod_X_">
1216                                                         <xsl:choose>
1217                                                                 <xsl:when test="$modBifSide_ = '0'">
1218                                                                         <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
1219                                                                 </xsl:when>
1220                                                                 <xsl:when test="$modBifSide_ = '1'">
1221                                                                         <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
1222                                                                 </xsl:when>
1223                                                                 <xsl:otherwise>0</xsl:otherwise>
1224                                                         </xsl:choose>
1225                                                 </xsl:variable>
1226                                                 
1227 <!--                                                                            
1228                                                 <xsl:message>Bc Bif Y <xsl:value-of select="$modBif_Y_"/></xsl:message> 
1229                                                 <xsl:message>Bc Mod Y <xsl:value-of select="$modBc_Y_"/></xsl:message>  
1230                                                 <xsl:message>Bc Mod X <xsl:value-of select="$bcMod_X_"/></xsl:message>  
1231                                                 <P2PCONN X="{$bcInSpace_X_}" Y="{$bcMod_Y_}" BUSSTD="{$busStd}" TYPE="{$modBifType_}" BIFSIDE="{$modBifSide_}"/>
1232 -->                                                                             
1233                                                 <P2PCONN X="{$bcMod_X_}" Y="{$bcMod_Y_}" BUSNAME="{$modBusName_}" BUSSTD="{$iBusStd}" TYPE="{$modBifType_}" BIFSIDE="{$modBifSide_}"/>
1234                                                 
1235                                         </xsl:otherwise>
1236                                                                         
1237                                 </xsl:choose>
1238                         </xsl:for-each>
1239                 </xsl:variable>
1240         
1241         
1242         <xsl:variable name="busTop_"  select="math:min(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
1243         <xsl:variable name="busBot_"  select="math:max(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
1244         <xsl:variable name="v_bus_y_" select="$busTop_ + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
1245         <xsl:variable name="busName_" select="exsl:node-set($p2pConn_heights_)/P2PCONN/@BUSNAME"/>
1246         <xsl:variable name="busStd_"  select="exsl:node-set($p2pConn_heights_)/P2PCONN/@BUSSTD"/>
1247 <!--    
1248 -->     
1249         <!-- Draw the vertical part of the bus -->      
1250         <xsl:if test="$busStd_ = 'PLBV46_P2P'">
1251                 <rect x="{$bcInSpace_X_ + $BLKD_P2P_BUS_W}" 
1252                           y="{$v_bus_y_}"  
1253                       width= "{$BLKD_P2P_BUS_W}" 
1254                       height="{($busBot_ - $busTop_) + $BLKD_P2P_BUS_W}" 
1255                       style="stroke:{$COL_WHITE};stroke-width:1.5;fill:{$busColor_}"/>
1256         </xsl:if>
1257         
1258         <xsl:if test="not($busStd_ = 'PLBV46_P2P')">
1259                 <rect x="{$bcInSpace_X_ + $BLKD_P2P_BUS_W}" 
1260                       y="{$v_bus_y_}"  
1261                       width= "{$BLKD_P2P_BUS_W}" 
1262                       height="{($busBot_ - $busTop_) + $BLKD_P2P_BUS_W}" 
1263                       style="stroke:none;fill:{$busColor_}"/>
1264         </xsl:if>
1265         
1266 <!--     -->    
1267         
1268 <!--    
1269                   style="stroke:{$busColor_lt_};stroke-width:1;stroke-opacity:0.9;fill-opacity:2.0;fill:{$busColor_}"/>
1270 -->     
1271
1272         <!-- Place the bus label.-->    
1273 <!-- 
1274         <text class="p2pbuslabel" 
1275                           x="{$bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6}"
1276                           y="{$busTop_ + ($BLKD_BUS_ARROW_H * 3)}">
1277                         <xsl:value-of select="$busName_"/>
1278         </text> 
1279 -->     
1280                 <xsl:call-template name="F_WriteText">
1281                         <xsl:with-param name="iX"               select="($bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6)"/>
1282                         <xsl:with-param name="iY"               select="($busTop_ + ($BLKD_BUS_ARROW_H * 3))"/>
1283                         <xsl:with-param name="iText"    select="$busName_"/>
1284                         <xsl:with-param name="iClass"   select="'p2pbus_label'"/>
1285                 </xsl:call-template>
1286                           
1287                 <!-- Draw the busconnection and horizontal lines.-->                                            
1288                 <xsl:for-each select="exsl:node-set($p2pConn_heights_)/P2PCONN">
1289                                                         
1290                         <xsl:variable name="bus_x_" select="($bcInSpace_X_ + ceiling($BLKD_BIFC_W div 2))"/>
1291                         <xsl:variable name="bus_y_" select="@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
1292                 
1293                         <xsl:variable name="h_bus_ul_x_">
1294                                 <xsl:choose>
1295                                         <xsl:when test="@BIFSIDE='0'">
1296                                                 <xsl:value-of select="$bus_x_"/>
1297                                         </xsl:when>
1298                                         <xsl:when test="@BIFSIDE='1'">
1299                                                 <xsl:value-of select="(@X + $BLKD_BIFC_W + $BLKD_BUS_ARROW_W) - 1"/>
1300                                         </xsl:when>
1301                                 </xsl:choose>
1302                         </xsl:variable> 
1303                 
1304                         <xsl:variable name="h_bus_ul_y_" select="$bus_y_"/>
1305         
1306                         <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
1307                         <xsl:variable name="h_bus_width_">
1308 <!--                            
1309                                 <xsl:message>BIFSIDE <xsl:value-of select="@BIFSIDE"/></xsl:message>
1310                                 <xsl:message>BUSSTD  <xsl:value-of select="@BUSSTD"/></xsl:message>
1311                                 <xsl:message>TYPE <xsl:value-of select="@TYPE"/></xsl:message>
1312 -->                             
1313                                 <xsl:choose>
1314                                         <xsl:when test="@BIFSIDE='0'">
1315                                                 <xsl:value-of select="(@X - $bus_x_ - $BLKD_BUS_ARROW_W)"/>
1316                                         </xsl:when>
1317                                         <xsl:when test="@BIFSIDE='1'">
1318                                                 <xsl:value-of select="$bus_x_ - $h_bus_ul_x_ + 1"/>
1319                                         </xsl:when>
1320                                         
1321                                 </xsl:choose>
1322                         </xsl:variable> 
1323                         
1324                         <!-- Draw Bus connection-->
1325                         <use   x="{@X}"   y="{@Y}"  xlink:href="#{@BUSSTD}_busconn_{@TYPE}"/>
1326                         
1327                         <!-- Draw the arrow -->
1328                         <xsl:choose>
1329                                 <xsl:when test="((@BIFSIDE='0') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1330                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowEast"/>
1331                                 </xsl:when>
1332                                 <xsl:when test="((@BIFSIDE='1') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1333                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowWest"/>
1334                                 </xsl:when>
1335                                 
1336                                 <xsl:when test="((@BIFSIDE='0') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1337                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
1338                                 </xsl:when>
1339                                 
1340                                 <xsl:when test="((@BIFSIDE='1') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1341                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
1342                                 </xsl:when>
1343                                         
1344                         </xsl:choose>
1345                 
1346                         <!-- Draw the horizontal part of the bus -->
1347                         <rect x="{$h_bus_ul_x_}" 
1348                                   y="{$h_bus_ul_y_}"  
1349                                   width= "{$h_bus_width_}" 
1350                                   height="{$h_bus_height_}" 
1351                               style="stroke:none; fill:{$busColor_}"/>
1352                 
1353         </xsl:for-each>
1354                                                 
1355 <!--    
1356         <xsl:variable name="busTop_" select="math:min(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
1357         <xsl:variable name="busBot_" select="math:max(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
1358         <xsl:variable name="v_bus_y_" select="$busTop_ + ceiling($BLKD_BIFC_H div 2) - ceiling($P2P_BUS_W div 2)"/>
1359         <xsl:variable name="busName_" select="exsl:node-set($p2pConn_heights_)/P2PCONN/@BUSNAME"/>
1360 -->     
1361         <!-- Draw the vertical part of the bus -->      
1362 <!--    
1363         <rect x="{$bcInSpace_X_ + $P2P_BUS_W}" 
1364                   y="{$v_bus_y_}"  
1365                   width= "{$P2P_BUS_W}" 
1366                   height="{($busBot_ - $busTop_) + $P2P_BUS_W}" 
1367                   style="stroke:{$COL_WHITE};stroke-width:1;stroke-opacity:0.9;fill-opacity:2.0;fill:{$busColor_}"/>
1368 -->     
1369         
1370 <!--    
1371                   style="stroke:{$busColor_lt_};stroke-width:1;stroke-opacity:0.9;fill-opacity:2.0;fill:{$busColor_}"/>
1372 -->     
1373         <!-- Place the bus label.-->    
1374 <!--    
1375         <text class="p2pbuslabel" 
1376                           x="{$bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6}"
1377                           y="{$busTop_ + ($BLKD_BUS_ARROW_H * 3)}">
1378                         <xsl:value-of select="$busName_"/>
1379         </text> 
1380 -->     
1381         
1382                                                 
1383 </xsl:template> 
1384         
1385         
1386                                         
1387 <!-- 
1388                  ===========================================================
1389                         Handle MultiStack Point to Point connections
1390                  ===========================================================
1391 -->
1392                                         
1393 <xsl:template name="BCLaneSpace_MultiStack_PointToPoint">       
1394         
1395         <xsl:param name="iBusStd"          select="'NONE'"/>    
1396         <xsl:param name="iBusName"         select="'NONE'"/>    
1397         <xsl:param name="iBifType"         select="'NONE'"/>    
1398         <xsl:param name="iStackToEast"     select="'NONE'"/>    
1399         <xsl:param name="iStackToWest"     select="'NONE'"/>    
1400         <xsl:param name="iStackToEast_W"   select="0"/> 
1401         <xsl:param name="iStackToWest_W"   select="0"/> 
1402         <xsl:param name="iLaneInSpace_X"   select="0"/> 
1403         
1404 <!--    
1405         <xsl:message>Stack To East <xsl:value-of select="$iStackToEast"/></xsl:message>
1406         <xsl:message>Stack to West <xsl:value-of select="$iStackToWest"/></xsl:message>
1407         <xsl:message>Stack to East Width <xsl:value-of select="$iStackToEast_W"/></xsl:message>
1408         <xsl:message>Stack to West Width <xsl:value-of select="$iStackToWest_W"/></xsl:message>
1409         <xsl:message>Lane in space X <xsl:value-of select="$iLaneInSpace_X"/></xsl:message>
1410         <xsl:message>Shared Bus Y <xsl:value-of select="$iSpaceSharedBus_Y"/></xsl:message>
1411 -->     
1412         
1413         <xsl:variable name="busColor_">
1414                 <xsl:call-template name="F_BusStd2RGB">
1415                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1416                 </xsl:call-template>    
1417         </xsl:variable> 
1418         
1419         <xsl:variable name="space_W_">
1420                 <xsl:call-template name="F_Calc_Space_Width"> 
1421                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
1422                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
1423                 </xsl:call-template>            
1424         </xsl:variable>
1425         
1426         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
1427         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
1428         
1429         <!-- Store the connections in a variable -->
1430         <xsl:variable name="bcInSpace_X_"  select="($iLaneInSpace_X +  ceiling($BLKD_BIFC_W div 2) - ceiling($BLKD_BUS_ARROW_W div 2))"/>
1431                                         
1432         <xsl:variable name="multiConns_">
1433                                                 
1434                 <xsl:for-each select="BUSCONN">
1435                                                         
1436                         <xsl:variable name="bifName_"      select="@BUSINTERFACE"/>
1437                         <xsl:variable name="multiInstance_" select="@INSTANCE"/>
1438                         <xsl:variable name="mulshp_hori_idx_">
1439                                 <xsl:choose>
1440                                         <xsl:when test="@IS_PROCCONN">
1441                                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $multiInstance_)]/@STACK_HORIZ_INDEX"/>
1442                                         </xsl:when>
1443                                         <xsl:otherwise>
1444                                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $multiInstance_)])]/@STACK_HORIZ_INDEX"/>
1445                                         </xsl:otherwise>
1446                                 </xsl:choose>
1447                         </xsl:variable> 
1448                                                         
1449                         <xsl:variable name="mulshp_vert_idx_">
1450                                 <xsl:choose>
1451                                         <xsl:when test="@IS_PROCCONN">
1452                                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $multiInstance_)]/@SHAPE_VERTI_INDEX"/>
1453                                         </xsl:when>
1454                                         <xsl:otherwise>
1455                                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $multiInstance_)])]/@SHAPE_VERTI_INDEX"/>
1456                                         </xsl:otherwise>
1457                                 </xsl:choose>
1458                         </xsl:variable> 
1459                                 
1460 <!--                                                    
1461                         <xsl:message>Shape Horiz <xsl:value-of select="$mulshp_hori_idx_"/></xsl:message>
1462                         <xsl:message>Shape Verti <xsl:value-of select="$mulshp_vert_idx_"/></xsl:message>
1463 -->     
1464                                                         
1465                         <xsl:variable name="mulshp_Y_">
1466                                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
1467                                         <xsl:with-param name="iHorizIdx"  select="$mulshp_hori_idx_"/>
1468                                         <xsl:with-param name="iVertiIdx"  select="$mulshp_vert_idx_"/>
1469                                 </xsl:call-template>
1470                         </xsl:variable>
1471                                                 
1472                         <xsl:variable name="cmplxStack_H_diff_">
1473                                 <xsl:choose>
1474                                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
1475                                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
1476                                                 
1477                                                 <xsl:variable name="stackToWest_AbvSbs_H_">
1478                                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1479                                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
1480                                                         </xsl:call-template>
1481                                                 </xsl:variable>
1482                         
1483                                                 <xsl:variable name="stackToEast_AbvSbs_H_">
1484                                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1485                                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
1486                                                         </xsl:call-template>
1487                                                 </xsl:variable>
1488                                 
1489 <!--                            
1490                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
1491                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
1492 -->                             
1493                                                 <xsl:choose>
1494                                                         <xsl:when test="(($mulshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
1495                                                                         <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
1496                                                         </xsl:when>     
1497                                                         <xsl:when test="(($mulshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
1498                                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
1499                                                         </xsl:when>     
1500                                                         <xsl:otherwise>0</xsl:otherwise>        
1501                                                 </xsl:choose>   
1502                                                                         
1503                                         </xsl:when>
1504                                 </xsl:choose>
1505                         </xsl:variable>
1506                                                 
1507                                                                                                                                                                 
1508                         <xsl:variable name="procStack_H_diff_">
1509                                 <xsl:choose>
1510                                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
1511                                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
1512                         
1513                                                 <xsl:variable name="stackToWest_AbvSbs_H_">
1514                                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1515                                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
1516                                                         </xsl:call-template>
1517                                                 </xsl:variable>
1518                                 
1519                                                 <xsl:variable name="stackToEast_AbvSbs_H_">
1520                                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1521                                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
1522                                                         </xsl:call-template>
1523                                                 </xsl:variable>
1524                                 
1525 <!--                            
1526                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
1527                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
1528 -->                             
1529                                                 <xsl:choose>
1530                                                         <xsl:when test="(($mulshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
1531                                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
1532                                                         </xsl:when>     
1533                                                         <xsl:when test="(($mulshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
1534                                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
1535                                                         </xsl:when>     
1536                                                         <xsl:otherwise>0</xsl:otherwise>        
1537                                                 </xsl:choose>   
1538                                                                         
1539                                         </xsl:when>
1540                                 </xsl:choose>
1541                         </xsl:variable>
1542                                                         
1543                         <xsl:choose>
1544                                                         
1545                                 <xsl:when test="@IS_PROCCONN and @BIF_Y">
1546                                                                                 
1547                                         <xsl:variable name="procBif_Y_"   select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
1548                                                                                 
1549                                         <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
1550                                         <xsl:variable name="procBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
1551                                         <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
1552                                                                                 
1553                                         <xsl:variable name="bcProc_Y_"     select="($mulshp_Y_ + $procBif_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $procStack_H_diff_)"/>
1554                                         
1555                                         <xsl:variable name="bcProc_X_">
1556                                                 <xsl:choose>
1557                                                         <xsl:when test="$procBifSide_ = '0'">
1558                                                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
1559 <!--
1560                                                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - ceiling($BLKD_MOD_W div 2))"/>
1561 -->                                                     
1562                                                         </xsl:when>
1563                                                         <xsl:when test="$procBifSide_ = '1'">
1564                                                                 <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
1565                                                         </xsl:when>
1566                                                         <xsl:otherwise>0</xsl:otherwise>
1567                                                 </xsl:choose>
1568                                         </xsl:variable>
1569                                         
1570                                         <MULTICONN X="{$bcProc_X_}" Y="{$bcProc_Y_}" BUSNAME="{$procBusName_}" BUSSTD="{$iBusStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}" IS_PROC="TRUE"/>
1571                                 </xsl:when>
1572                                                                         
1573                                 <xsl:otherwise>
1574                                                                                         
1575                                         <xsl:variable name="modType_"     select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/@MODCLASS"/>
1576                                         <xsl:variable name="modBif_Y_"    select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_Y"/>
1577                                         <xsl:variable name="modBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
1578                                         <xsl:variable name="modBusStd_"   select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSSTD"/>
1579                                         <xsl:variable name="memcMOD_W_"   select="(($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $multiInstance_)]]/@MODS_W) * $BLKD_MOD_W)"/>
1580                                                                 
1581                                         <xsl:variable name="modBc_Y_">
1582                                                 <xsl:choose>
1583                                                         <xsl:when test="($modType_ = 'MEMORY_CNTLR') and (($modBusStd_ = 'LMB') or ($modBusStd_= 'OCM'))">
1584                                                         <xsl:value-of select="$BLKD_MOD_H + $BLKD_MOD_LANE_H + ((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * $modBif_Y_))"/>
1585                                                         </xsl:when>
1586                                                         <xsl:otherwise>
1587                                                         <xsl:value-of select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * $modBif_Y_) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
1588                                                         </xsl:otherwise>
1589                                                 </xsl:choose>
1590                                         </xsl:variable>   
1591 <!--                                    
1592                                         <xsl:message><xsl:value-of select="$multiInstance_"/>.<xsl:value-of select="$bifName_"/>:Y = <xsl:value-of select="$modBif_Y_"/></xsl:message>
1593                                         <xsl:message><xsl:value-of select="$multiInstance_"/>.<xsl:value-of select="$bifName_"/>:BcY = <xsl:value-of select="$modBc_Y_"/></xsl:message>
1594                                         <xsl:message><xsl:value-of select="$multiInstance_"/>.<xsl:value-of select="$bifName_"/>:TcY = <xsl:value-of select="($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V)"/></xsl:message>
1595 -->     
1596                                         
1597                                         <xsl:variable name="modBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
1598                                         <xsl:variable name="modBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $multiInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
1599                                         
1600 <!--                                    
1601                                         <xsl:variable name="bcMod_Y_"     select="($mulshp_Y_ + $modBc_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2))"/>
1602 -->                                     
1603                                         <xsl:variable name="bcMod_Y_"     select="($mulshp_Y_ + $modBc_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $cmplxStack_H_diff_)"/>
1604                                         
1605                                         <xsl:variable name="bcMod_X_">
1606                                                 <xsl:choose>
1607                                                         <xsl:when test="$modBifSide_ = '0'">
1608                                                                 <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($memcMOD_W_ div 2) + $BLKD_BIFC_W))"/>
1609 <!-- 
1610  -->                                                    
1611                                                         </xsl:when>
1612                                                         <xsl:when test="$modBifSide_ = '1'">
1613                                                                 <xsl:value-of select="ceiling($memcMOD_W_ div 2)"/>
1614                                                         </xsl:when>
1615                                                         <xsl:otherwise>0</xsl:otherwise>
1616                                                 </xsl:choose>
1617                                         </xsl:variable>
1618                                                 
1619                                         
1620                                         <MULTICONN X="{$bcMod_X_}" Y="{$bcMod_Y_}" BUSNAME="{$modBusName_}" BUSSTD="{$iBusStd}" TYPE="{$modBifType_}" BIFSIDE="{$modBifSide_}" IS_MOD="TRUE"/>
1621 <!--                                    
1622                                         <MULTICONN X="{$bcInSpace_X_}" Y="{$bcMod_Y_}" BUSSTD="{$busStd}" TYPE="{$modBifType_}" BIFSIDE="{$modBifSide_}"/>
1623 -->                                     
1624                                                 
1625                                         </xsl:otherwise>
1626                                 </xsl:choose>   
1627                         </xsl:for-each>
1628                 </xsl:variable>
1629                                         
1630                 <!-- Draw the busconnection and horizontal lines.-->                                            
1631                 <xsl:for-each select="exsl:node-set($multiConns_)/MULTICONN">
1632                                                         
1633                         <xsl:variable name="bus_x_" select="($bcInSpace_X_ + ceiling($BLKD_BIFC_W div 2))"/>
1634                         <xsl:variable name="bus_y_" select="@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
1635                 
1636 <!--
1637                                                 <xsl:value-of select="$bus_x_"/>
1638 -->                                             
1639                         <xsl:variable name="h_bus_ul_x_">
1640                                 <xsl:choose>
1641                                         <xsl:when test="@BIFSIDE='0' and (@IS_PROC)">
1642                                                 <xsl:value-of select="$bus_x_ - $BLKD_P2P_BUS_W"/>
1643                                         </xsl:when>
1644                                         <xsl:when test="@BIFSIDE='0' and (@IS_MOD)">
1645                                                 <xsl:value-of select="$bus_x_ - $BLKD_P2P_BUS_W"/>
1646                                         </xsl:when>
1647                                         <xsl:when test="@BIFSIDE='1' and (@IS_PROC)">
1648                                                 <xsl:value-of select="(@X + $BLKD_BIFC_W + $BLKD_BUS_ARROW_W)"/>
1649                                         </xsl:when>
1650                                         <xsl:when test="@BIFSIDE='1' and (@IS_MOD)">
1651                                                 <xsl:value-of select="(@X + $BLKD_BIFC_W + $BLKD_BUS_ARROW_W)"/>
1652                                         </xsl:when>
1653                                 </xsl:choose>
1654                         </xsl:variable> 
1655                 
1656                         <xsl:variable name="h_bus_ul_y_" select="$bus_y_"/>
1657                         <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
1658                         <xsl:variable name="h_bus_width_">
1659 <!--
1660                                 <xsl:message>BUSSTD  <xsl:value-of select="@BUSSTD"/></xsl:message>
1661                                 <xsl:message>BIFSIDE <xsl:value-of select="@BIFSIDE"/></xsl:message>
1662                                 <xsl:message>TYPE <xsl:value-of select="@TYPE"/></xsl:message>
1663 -->                             
1664                                 <xsl:choose>
1665                                         <xsl:when test="@BIFSIDE='0' and (@IS_PROC)">
1666                                                 <xsl:value-of select="(@X - $bus_x_ - $BLKD_P2P_BUS_W)"/>
1667                                         </xsl:when>
1668                                         <xsl:when test="@BIFSIDE='0' and (@IS_MOD)">
1669                                                 <xsl:value-of select="(@X - $bus_x_ - $BLKD_BUS_ARROW_W)"/>
1670                                         </xsl:when>
1671                                         <xsl:when test="@BIFSIDE='1' and (@IS_PROC)">
1672                                                 <xsl:value-of select="$bus_x_ - $h_bus_ul_x_ - $BLKD_BUS_ARROW_W - $BLKD_P2P_BUS_W"/>
1673                                         </xsl:when>
1674                                         <xsl:when test="@BIFSIDE='1' and (@IS_MOD)">
1675                                                 <xsl:value-of select="$BLKD_P2P_BUS_W + $BLKD_BUS_ARROW_W "/>
1676 <!--
1677                                                 <xsl:value-of select="$bus_x_ - $h_bus_ul_x_"/>
1678   -->
1679                                         </xsl:when>
1680                                 </xsl:choose>
1681                         </xsl:variable>         
1682                         
1683                         
1684 <!-- 
1685                         <xsl:message>h_bus_x_      <xsl:value-of select="$h_bus_ul_x_"/></xsl:message>
1686                         <xsl:message>BIFSIDE  <xsl:value-of select="@BIFSIDE"/></xsl:message>
1687                         <xsl:message>h_bus_width_  <xsl:value-of select="$h_bus_width_"/></xsl:message>
1688  -->                    
1689                         
1690                         <!-- Draw the horizontal part of the bus -->
1691                         <xsl:if test="($h_bus_width_ &gt; 0)">  
1692                                 <rect x="{$h_bus_ul_x_}" 
1693                                           y="{$h_bus_ul_y_}"  
1694                                           width= "{$h_bus_width_}" 
1695                                           height="{$h_bus_height_}" 
1696                                       style="stroke:none; fill:{$busColor_}"/>
1697                         </xsl:if>     
1698                 
1699                         
1700                         <!-- Draw the arrow -->
1701                         <xsl:choose>
1702                                 <xsl:when test="((@BIFSIDE='0') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1703                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowEast"/>
1704                                 </xsl:when>
1705                                 <xsl:when test="((@BIFSIDE='1') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1706                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowWest"/>
1707                                 </xsl:when>
1708                                 
1709                                 <xsl:when test="((@BIFSIDE='0') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1710                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
1711                                 </xsl:when>
1712                                 
1713                                 <xsl:when test="((@BIFSIDE='1') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
1714                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
1715                                 </xsl:when>
1716                                         
1717                         </xsl:choose>
1718                 
1719                         <use   x="{@X}"   y="{@Y}"  xlink:href="#{@BUSSTD}_busconn_{@TYPE}"/>
1720                 </xsl:for-each>
1721                                                 
1722                 <xsl:variable name="busTop_" select="math:min(exsl:node-set($multiConns_)/MULTICONN/@Y)"/>
1723                 <xsl:variable name="busBot_" select="math:max(exsl:node-set($multiConns_)/MULTICONN/@Y)"/>
1724                 <xsl:variable name="v_bus_y_" select="$busTop_ + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
1725                 <xsl:variable name="busName_" select="exsl:node-set($multiConns_)/MULTICONN/@BUSNAME"/>
1726         
1727 <!-- 
1728 -->               
1729                 <!-- Draw the vertical part of the bus -->      
1730                 <rect x="{$bcInSpace_X_ - $BLKD_P2P_BUS_W}" 
1731                           y="{$v_bus_y_}"  
1732                       width= "{$BLKD_P2P_BUS_W}" 
1733                       height="{($busBot_ - $busTop_) + $BLKD_P2P_BUS_W}" 
1734                       style="stroke:none; fill:{$busColor_}"/>
1735 <!-- 
1736                 <xsl:message>v_bus_x_  <xsl:value-of select="($bcInSpace_X_ + $BLKD_P2P_BUS_W)"/></xsl:message>
1737  -->                  
1738  
1739         <!-- Place the bus label.-->    
1740                 <xsl:call-template name="F_WriteText">
1741                         <xsl:with-param name="iX"               select="($bcInSpace_X_   + $BLKD_BUS_ARROW_W + ceiling($BLKD_BUS_ARROW_W div 2) + ceiling($BLKD_BUS_ARROW_W div 4) + 6)"/>
1742                         <xsl:with-param name="iY"               select="($busTop_ + ($BLKD_BUS_ARROW_H * 3))"/>
1743                         <xsl:with-param name="iText"    select="$busName_"/>
1744                         <xsl:with-param name="iClass"   select="'p2pbus_label'"/>
1745                 </xsl:call-template>
1746                           
1747 </xsl:template> 
1748         
1749         
1750 <!-- 
1751                  ===========================================================
1752                         Handle Processor to processor connections
1753                  ===========================================================
1754 -->
1755 <xsl:template name="BCLaneSpace_ProcToProc">    
1756         
1757         <xsl:param name="iBusStd"         select="'NONE'"/>     
1758         <xsl:param name="iBusName"        select="'NONE'"/>     
1759         <xsl:param name="iBifType"        select="'NONE'"/>     
1760         <xsl:param name="iStackToEast"    select="'NONE'"/>     
1761         <xsl:param name="iStackToWest"    select="'NONE'"/>     
1762         <xsl:param name="iStackToEast_W"  select="0"/>  
1763         <xsl:param name="iStackToWest_W"  select="0"/>  
1764         <xsl:param name="iLaneInSpace_X"  select="0"/>  
1765         
1766         <xsl:variable name="busColor_">
1767                 <xsl:call-template name="F_BusStd2RGB">
1768                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1769                 </xsl:call-template>    
1770         </xsl:variable> 
1771         
1772         <xsl:variable name="space_W_">
1773                 <xsl:call-template name="F_Calc_Space_Width"> 
1774                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
1775                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
1776                 </xsl:call-template>            
1777         </xsl:variable>
1778         
1779         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
1780         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
1781                 
1782         <xsl:variable name="pr2pr_StackToWest_"   select="math:min(BUSCONN/@STACK_HORIZ_INDEX)"/>
1783         <xsl:variable name="pr2pr_StackToEast_"   select="math:max(BUSCONN/@STACK_HORIZ_INDEX)"/>
1784         <xsl:variable name="proc2procConn_heights_">
1785         
1786         <xsl:for-each select="BUSCONN">
1787                                         
1788                 <xsl:variable name="procInstance_" select="@INSTANCE"/>
1789                 <xsl:variable name="bifName_"      select="@BUSINTERFACE"/>
1790                 <xsl:variable name="procshp_hori_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@STACK_HORIZ_INDEX"/>
1791                 <xsl:variable name="procshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $procInstance_)]/@SHAPE_VERTI_INDEX"/>
1792                 <xsl:variable name="procshp_Y_">
1793                         <xsl:call-template name="F_Calc_Stack_Shape_Y">
1794                                 <xsl:with-param name="iHorizIdx"  select="$procshp_hori_idx_"/>
1795                                 <xsl:with-param name="iVertiIdx"  select="$procshp_vert_idx_"/>
1796                         </xsl:call-template>
1797                 </xsl:variable>
1798                                                 
1799                 <xsl:variable name="procStack_H_diff_">
1800                         <xsl:choose>
1801                                 <xsl:when test="   (($pr2pr_StackToEast_ = 'NONE') or ($pr2pr_StackToWest_ = 'NONE'))">0</xsl:when>
1802                                 <xsl:when test="not(($pr2pr_StackToEast_ = 'NONE') or ($pr2pr_StackToWest_ = 'NONE'))">
1803                         
1804                                         <xsl:variable name="stackToWest_AbvSbs_H_">
1805                                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1806                                                         <xsl:with-param name="iStackIdx"  select="$pr2pr_StackToWest_"/>
1807                                                 </xsl:call-template>
1808                                         </xsl:variable>
1809                                 
1810                                         <xsl:variable name="stackToEast_AbvSbs_H_">
1811                                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
1812                                                         <xsl:with-param name="iStackIdx"  select="$pr2pr_StackToEast_"/>
1813                                                 </xsl:call-template>
1814                                         </xsl:variable>
1815 <!--                            
1816                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
1817                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
1818 -->                             
1819                                         <xsl:choose>
1820                                                 <xsl:when test="(($procshp_hori_idx_ = $pr2pr_StackToEast_) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
1821                                                         <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
1822                                                 </xsl:when>     
1823                                                 <xsl:when test="(($procshp_hori_idx_ = $pr2pr_StackToWest_) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
1824                                                         <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
1825                                                 </xsl:when>     
1826                                                 <xsl:otherwise>0</xsl:otherwise>        
1827                                         </xsl:choose>   
1828                                                                                 
1829                                 </xsl:when>
1830                         </xsl:choose>
1831                 </xsl:variable>
1832                                                 
1833                 <!-- Store the conns in a variable -->  
1834                 <xsl:variable name="procBif_Y_"   select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
1835                                                                                         
1836                 <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
1837                 <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $procInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
1838                                                                         
1839                 <xsl:variable name="bcInSpace_X_">
1840                         <xsl:choose>
1841                                 <xsl:when test="$procBifSide_ = '1'"><xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/></xsl:when>
1842                                 <xsl:when test="$procBifSide_ = '0'"><xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - ceiling($BLKD_MOD_W div 2) - $BLKD_BIFC_W)"/></xsl:when>
1843                         </xsl:choose>
1844                 </xsl:variable> 
1845                                                         
1846                 <xsl:variable name="bcProc_Y_"     select="($procshp_Y_ + $procBif_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $procStack_H_diff_)"/>
1847 <!--                                                    
1848                 <xsl:message>Conn X <xsl:value-of select="$bcInSpace_X_"/></xsl:message>
1849                 <xsl:message>Conn Y <xsl:value-of select="$bcProc_Y_"/></xsl:message>
1850 -->                                                     
1851                                                                                 
1852                                 <PR2PRCONN X="{$bcInSpace_X_}" Y="{$bcProc_Y_}" BUSSTD="{$iBusStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}" SHAPE_ID="{$procshp_hori_idx_}"/>
1853                         </xsl:for-each>
1854                 </xsl:variable>
1855                                         
1856                 <xsl:variable name="pr2prLeft_"   select="math:min(exsl:node-set($proc2procConn_heights_)/PR2PRCONN/@SHAPE_ID)"/>
1857                 <xsl:variable name="pr2prRght_"   select="math:max(exsl:node-set($proc2procConn_heights_)/PR2PRCONN/@SHAPE_ID)"/>
1858                                 
1859                 <xsl:variable name="pr2pr_stack_Left_X_">
1860                         <xsl:call-template name="F_Calc_Stack_X"> 
1861                                 <xsl:with-param name="iStackIdx"  select="$pr2prLeft_"/>
1862                         </xsl:call-template>            
1863                 </xsl:variable> 
1864                                         
1865                 <xsl:variable name="pr2pr_stack_Rght_X_">
1866                         <xsl:call-template name="F_Calc_Stack_X"> 
1867                                 <xsl:with-param name="iStackIdx"  select="$pr2prRght_"/>
1868                         </xsl:call-template>            
1869                 </xsl:variable> 
1870                                         
1871 <!--                                    
1872                                         <xsl:message>Left stack X <xsl:value-of select="$pr2pr_stack_Left_X_"/></xsl:message>
1873                                         <xsl:message>Rght stack X <xsl:value-of select="$pr2pr_stack_Rght_X_"/></xsl:message>
1874 -->                                     
1875                 <xsl:variable name="pr2pr_space_W_" select="($pr2pr_stack_Rght_X_ - $pr2pr_stack_Left_X_)"/>
1876                                                 
1877                                         
1878                 <xsl:variable name="pr2pr_extStackEast_W_">
1879                         <xsl:call-template name="F_Calc_Stack_Width">
1880                                 <xsl:with-param name="iStackIdx"  select="$pr2prRght_"/>
1881                         </xsl:call-template>
1882                 </xsl:variable>
1883                                         
1884                 <xsl:variable name="pr2pr_extStackWest_W_">
1885                         <xsl:call-template name="F_Calc_Stack_Width">
1886                                 <xsl:with-param name="iStackIdx"  select="$pr2prLeft_"/>
1887                         </xsl:call-template>
1888                 </xsl:variable>
1889                                         
1890 <!--                                    
1891                                         <xsl:message>Space W <xsl:value-of select="$pr2pr_space_W_"/></xsl:message>
1892                                         <xsl:message>Rght stack <xsl:value-of select="$pr2pr_extStackEast_W_"/></xsl:message>
1893                                         <xsl:message>Left stack <xsl:value-of select="$pr2pr_extStackWest_W_"/></xsl:message>
1894 -->                                     
1895         
1896                 <xsl:variable name="connLeft_X_" select="ceiling($BLKD_MOD_W div 2)"/>
1897                 <xsl:variable name="connRght_X_" select="($pr2pr_space_W_ - ceiling($pr2pr_extStackWest_W_ div 2) + ceiling($pr2pr_extStackEast_W_ div 2) - ceiling($BLKD_MOD_W div 2) - $BLKD_BIFC_W)"/>
1898                                         
1899                 <!-- Draw the busconnections .-->                                               
1900                 <xsl:for-each select="exsl:node-set($proc2procConn_heights_)/PR2PRCONN">
1901                         <xsl:variable name="conn_X_">
1902                                 <xsl:choose>
1903                                         <xsl:when test="@BIFSIDE = '1'"><xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/></xsl:when>
1904                                         <xsl:when test="@BIFSIDE = '0'"><xsl:value-of select="($pr2pr_space_W_ - ceiling($pr2pr_extStackWest_W_ div 2) + ceiling($pr2pr_extStackEast_W_ div 2) - ceiling($BLKD_MOD_W div 2) - $BLKD_BIFC_W)"/></xsl:when>
1905 <!--                                                                    
1906                                         <xsl:when test="@BIFSIDE = '0'"><xsl:value-of select="($pr2pr_space_W_ + $pr2pr_extStackWest_W_ + $pr2pr_extStackEast_W_ - ceiling($BLKD_MOD_W div 2) - $BLKD_BIFC_W)"/></xsl:when>
1907 -->     
1908                                 </xsl:choose>
1909                         </xsl:variable> 
1910                                                 
1911                         <use   x="{$conn_X_}"   y="{@Y}"  xlink:href="#{@BUSSTD}_busconn_{@TYPE}"/>
1912                 </xsl:for-each>
1913                                         
1914                 <xsl:variable name="bc_Y_"     select="math:min(exsl:node-set($proc2procConn_heights_)/PR2PRCONN/@Y)"/>
1915                 <xsl:variable name="bcLeft_"   select="math:min(exsl:node-set($proc2procConn_heights_)/PR2PRCONN/@X)"/>
1916                 <xsl:variable name="bcRght_"   select="math:max(exsl:node-set($proc2procConn_heights_)/PR2PRCONN/@X)"/>
1917                                         
1918                 <xsl:variable name="leftType_"  select="(exsl:node-set($proc2procConn_heights_)/PR2PRCONN[(@X = $bcLeft_)]/@TYPE)"/>
1919                 <xsl:variable name="rghtType_"  select="(exsl:node-set($proc2procConn_heights_)/PR2PRCONN[(@X = $bcRght_)]/@TYPE)"/>
1920                                                 
1921                 <xsl:call-template name="Draw_Proc2ProcBus">
1922                         <xsl:with-param name="iBc_Y"     select="$bc_Y_"/>
1923                         <xsl:with-param name="iBusStd"   select="$iBusStd"/>
1924                         <xsl:with-param name="iBusName"  select="$iBusName"/>
1925                         <xsl:with-param name="iLeftType"  select="$leftType_"/>
1926                         <xsl:with-param name="iRghtType"  select="$rghtType_"/>
1927                         <xsl:with-param name="iBcLeft_X" select="$connLeft_X_ + $BLKD_BIFC_W"/>
1928                         <xsl:with-param name="iBcRght_X" select="$connRght_X_"/>
1929                 </xsl:call-template>
1930                                 
1931 </xsl:template> 
1932         
1933 <!-- 
1934                  ===========================================================
1935                         Handle connections to the MPMC
1936                  ===========================================================
1937 -->
1938 <xsl:template name="BCLaneSpace_ToStandAloneMPMC">      
1939         
1940         <xsl:param name="iBusStd"        select="'NONE'"/>      
1941         <xsl:param name="iBusName"       select="'NONE'"/>      
1942         <xsl:param name="iBifType"       select="'NONE'"/>      
1943         <xsl:param name="iStackToEast"   select="'NONE'"/>      
1944         <xsl:param name="iStackToWest"   select="'NONE'"/>      
1945         <xsl:param name="iStackToEast_W" select="0"/>   
1946         <xsl:param name="iStackToWest_W" select="0"/>   
1947         <xsl:param name="iLaneInSpace_X" select="0"/>   
1948         
1949         <xsl:variable name="busColor_">
1950                 <xsl:call-template name="F_BusStd2RGB">
1951                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1952                 </xsl:call-template>    
1953         </xsl:variable> 
1954         
1955         <xsl:variable name="busColor_lt_">
1956                 <xsl:call-template name="F_BusStd2RGB_LT">
1957                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
1958                 </xsl:call-template>    
1959         </xsl:variable> 
1960         
1961         <xsl:variable name="space_W_">
1962                 <xsl:call-template name="F_Calc_Space_Width"> 
1963                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
1964                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
1965                 </xsl:call-template>            
1966         </xsl:variable>
1967         
1968         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
1969         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
1970         
1971         <xsl:variable name="bcInSpace_X_"  select="($iLaneInSpace_X +  ceiling($BLKD_BIFC_W div 2) - ceiling($BLKD_BUS_ARROW_W div 2))"/>
1972         <xsl:variable name="p2pInstance_" select="BUSCONN[(@BIF_Y)]/@INSTANCE"/>
1973                                         
1974         <xsl:variable name="p2pshp_hori_idx_">
1975                 <xsl:choose>
1976                         <xsl:when test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]">
1977                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]/@STACK_HORIZ_INDEX"/>
1978                         </xsl:when>
1979                         <xsl:otherwise>
1980                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $p2pInstance_)])]/@STACK_HORIZ_INDEX"/>
1981                         </xsl:otherwise>
1982                 </xsl:choose>
1983         </xsl:variable>         
1984                                         
1985         <xsl:variable name="p2pshp_vert_idx_">
1986                 <xsl:choose>
1987                         <xsl:when test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]">
1988                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $p2pInstance_)]/@SHAPE_VERTI_INDEX"/>
1989                         </xsl:when>
1990                         <xsl:otherwise>
1991                                 <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $p2pInstance_)])]/@SHAPE_VERTI_INDEX"/>
1992                         </xsl:otherwise>
1993                 </xsl:choose>
1994         </xsl:variable>         
1995                                         
1996         <xsl:variable name="p2pshp_Y_">
1997                 <xsl:call-template name="F_Calc_Stack_Shape_Y">
1998                         <xsl:with-param name="iHorizIdx"  select="$p2pshp_hori_idx_"/>
1999                         <xsl:with-param name="iVertiIdx"  select="$p2pshp_vert_idx_"/>
2000                 </xsl:call-template>
2001         </xsl:variable>
2002                         
2003         <xsl:variable name="cmplxStack_H_diff_">
2004                 <xsl:choose>
2005                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
2006                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
2007                                 
2008                                 <xsl:variable name="stackToWest_AbvSbs_H_">
2009                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2010                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
2011                                         </xsl:call-template>
2012                                 </xsl:variable>
2013                                 
2014                                 <xsl:variable name="stackToEast_AbvSbs_H_">
2015                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2016                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
2017                                         </xsl:call-template>
2018                                 </xsl:variable>
2019                                 
2020 <!--                            
2021                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
2022                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
2023 -->                             
2024                                 
2025                                 <xsl:choose>
2026                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
2027                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
2028                                         </xsl:when>     
2029                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
2030                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
2031                                         </xsl:when>     
2032                                         <xsl:otherwise>0</xsl:otherwise>        
2033                                 </xsl:choose>   
2034                                                                         
2035                         </xsl:when>
2036                 </xsl:choose>
2037         </xsl:variable>
2038                                                 
2039         <xsl:variable name="procStack_H_diff_">
2040                 <xsl:choose>
2041                         <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
2042                         <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
2043                         
2044                                 <xsl:variable name="stackToWest_AbvSbs_H_">
2045                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2046                                                 <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
2047                                         </xsl:call-template>
2048                                 </xsl:variable>
2049                                 
2050                                 <xsl:variable name="stackToEast_AbvSbs_H_">
2051                                         <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2052                                                 <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
2053                                         </xsl:call-template>
2054                                 </xsl:variable>
2055                                 
2056 <!--                            
2057                                 <xsl:message>stack to west H <xsl:value-of select="$stackToWest_AbvSbs_H_"/></xsl:message>
2058                                 <xsl:message>stack to east H <xsl:value-of select="$stackToEast_AbvSbs_H_"/></xsl:message>
2059 -->                             
2060                                 <xsl:choose>
2061                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
2062                                                 <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
2063                                         </xsl:when>     
2064                                         <xsl:when test="(($p2pshp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
2065                                                 <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
2066                                         </xsl:when>     
2067                                         <xsl:otherwise>0</xsl:otherwise>        
2068                                 </xsl:choose>   
2069                                                                         
2070                         </xsl:when>
2071                 </xsl:choose>
2072         </xsl:variable>
2073                                                 
2074         
2075         
2076         <!-- Store the conns in a variable -->  
2077         <xsl:variable name="p2pConn_heights_">
2078         
2079                 <xsl:for-each select="BUSCONN">
2080                                                                         
2081                         <xsl:variable name="bifName_" select="@BUSINTERFACE"/>
2082                                                         
2083                                 <xsl:choose>
2084                                         <xsl:when test="@IS_PROCCONN and @BIF_Y">
2085                                                                                 
2086 <!--                                                                            
2087                                                                                 <xsl:message>Proc <xsl:value-of select="$procInstance_"/></xsl:message>
2088 -->                                                                             
2089                                                 <xsl:variable name="procBif_Y_"   select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * @BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
2090                                                 <xsl:variable name="procBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
2091                                                 <xsl:variable name="procBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
2092                                                 <xsl:variable name="procBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $p2pInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
2093                                                                                 
2094                                                 <xsl:variable name="bcProc_Y_"     select="($p2pshp_Y_ + $procBif_Y_ + ceiling($BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $procStack_H_diff_)"/>
2095                                                 <xsl:variable name="bcProc_X_">
2096                                                         <xsl:choose>
2097                                                                 <xsl:when test="$procBifSide_ = '0'">
2098                                                                         <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
2099                                                                 </xsl:when>
2100                                                                 <xsl:when test="$procBifSide_ = '1'">
2101                                                                         <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
2102                                                                 </xsl:when>
2103                                                                 <xsl:otherwise>0</xsl:otherwise>
2104                                                         </xsl:choose>
2105                                                 </xsl:variable>
2106                                                 
2107                                                 <P2PCONN X="{$bcProc_X_}" Y="{$bcProc_Y_}" BUSNAME= "{$procBusName_}" BUSSTD="{$iBusStd}" TYPE="{$procBifType_}" BIFSIDE="{$procBifSide_}"/>
2108                                                                                 
2109                                         </xsl:when>
2110                                                                         
2111                                         <xsl:otherwise>
2112                                                                                 
2113                                                 <xsl:variable name="modInstance_"     select="@INSTANCE"/>
2114                                                 <xsl:variable name="modshp_vert_idx_" select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[MODULE[(@INSTANCE = $modInstance_)]]/@SHAPE_VERTI_INDEX"/>
2115                                                 <xsl:variable name="modBifSide_"      select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
2116                                                 <xsl:variable name="modBif_Y_"        select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_Y"/>
2117                                                 <xsl:variable name="modBc_Y_"         select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * $modBif_Y_) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
2118                                                                                 
2119 <!--                                                                            
2120                                                 <xsl:message>Memory Instance <xsl:value-of select="$procInstance_"/></xsl:message>
2121 -->                                                                             
2122                                                 
2123                                                 <xsl:variable name="modshp_Y_">
2124                                                         <xsl:call-template name="F_Calc_Stack_Shape_Y">
2125                                                                 <xsl:with-param name="iHorizIdx"  select="$p2pshp_hori_idx_"/>
2126                                                                 <xsl:with-param name="iVertiIdx"  select="$modshp_vert_idx_"/>
2127                                                         </xsl:call-template>
2128                                                 </xsl:variable>
2129                                                                                 
2130                                                 <xsl:variable name="modBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
2131                                                 <xsl:variable name="modBusName_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $modInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSNAME"/>
2132                                                 <xsl:variable name="bcMod_Y_"     select="($modshp_Y_ + $modBc_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $cmplxStack_H_diff_)"/>
2133                                                 <xsl:variable name="bcMod_X_">
2134                                                         <xsl:choose>
2135                                                                 <xsl:when test="$modBifSide_ = '0'">
2136                                                                         <xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - (ceiling($BLKD_MOD_W div 2) + $BLKD_BIFC_W))"/>
2137                                                                 </xsl:when>
2138                                                                 <xsl:when test="$modBifSide_ = '1'">
2139                                                                         <xsl:value-of select="ceiling($BLKD_MOD_W div 2)"/>
2140                                                                 </xsl:when>
2141                                                                 <xsl:otherwise>0</xsl:otherwise>
2142                                                         </xsl:choose>
2143                                                 </xsl:variable>
2144                                                 
2145                                                 <P2PCONN X="{$bcMod_X_}" Y="{$bcMod_Y_}" BUSNAME="{$modBusName_}" BUSSTD="{$iBusStd}" TYPE="{$modBifType_}" BIFSIDE="{$modBifSide_}"/>
2146                                                 
2147                                         </xsl:otherwise>
2148                                                                         
2149                                 </xsl:choose>
2150                         </xsl:for-each>
2151                 </xsl:variable>
2152         
2153         
2154         <xsl:variable name="busTop_"  select="math:min(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
2155         <xsl:variable name="busBot_"  select="math:max(exsl:node-set($p2pConn_heights_)/P2PCONN/@Y)"/>
2156         <xsl:variable name="v_bus_y_" select="$busTop_ + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
2157         
2158         <xsl:variable name="busName_" select="exsl:node-set($p2pConn_heights_)/P2PCONN/@BUSNAME"/>
2159         <xsl:variable name="busStd_"  select="exsl:node-set($p2pConn_heights_)/P2PCONN/@BUSSTD"/>
2160         
2161                 <!-- Draw the vertical part of the bus -->      
2162                 <!-- Place the bus label.-->    
2163                 <!-- Draw the busconnection and horizontal lines.-->                                            
2164                 <xsl:for-each select="exsl:node-set($p2pConn_heights_)/P2PCONN">
2165                                                         
2166                         <xsl:variable name="bus_x_" select="($bcInSpace_X_ + ceiling($BLKD_BIFC_W div 2))"/>
2167                         <xsl:variable name="bus_y_" select="@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_P2P_BUS_W div 2)"/>
2168                 
2169                         <xsl:variable name="h_bus_ul_x_">
2170                                 <xsl:choose>
2171                                         <xsl:when test="@BIFSIDE='0'">
2172                                                 <xsl:value-of select="$bus_x_"/>
2173                                         </xsl:when>
2174                                         <xsl:when test="@BIFSIDE='1'">
2175                                                 <xsl:value-of select="(@X + $BLKD_BIFC_W + $BLKD_BUS_ARROW_W) - 1"/>
2176                                         </xsl:when>
2177                                 </xsl:choose>
2178                         </xsl:variable> 
2179                 
2180                         <xsl:variable name="h_bus_ul_y_" select="$bus_y_"/>
2181         
2182                         <xsl:variable name="h_bus_height_" select="$BLKD_P2P_BUS_W"/>
2183                         <xsl:variable name="h_bus_width_">
2184                                 <xsl:choose>
2185                                         <xsl:when test="@BIFSIDE='0'">
2186                                                 <xsl:value-of select="(@X - $bus_x_ - $BLKD_BUS_ARROW_W)"/>
2187                                         </xsl:when>
2188                                         <xsl:when test="@BIFSIDE='1'">
2189                                                 <xsl:value-of select="$bus_x_ - $h_bus_ul_x_ + 1"/>
2190                                         </xsl:when>
2191                                         
2192                                 </xsl:choose>
2193                         </xsl:variable> 
2194                         
2195                         <!-- Draw Bus connection-->
2196                         <use   x="{@X}"   y="{@Y}"  xlink:href="#{@BUSSTD}_busconn_{@TYPE}"/>
2197                         
2198                         <!-- Draw the arrow -->
2199                         <xsl:choose>
2200                                 <xsl:when test="((@BIFSIDE='0') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
2201                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowEast"/>
2202                                 </xsl:when>
2203                                 <xsl:when test="((@BIFSIDE='1') and not((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
2204                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowWest"/>
2205                                 </xsl:when>
2206                                 
2207                                 <xsl:when test="((@BIFSIDE='0') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
2208                                         <use   x="{@X - $BLKD_BUS_ARROW_W}"   y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
2209                                 </xsl:when>
2210                                 
2211                                 <xsl:when test="((@BIFSIDE='1') and ((@BUSSTD = 'FSL') and ((@TYPE = 'INITIATOR') or (@TYPE = 'MASTER'))))">
2212                                         <use   x="{(@X + $BLKD_BIFC_W)}" y="{@Y + ceiling($BLKD_BIFC_H div 2) - ceiling($BLKD_BUS_ARROW_H div 2)}"  xlink:href="#{@BUSSTD}_BusArrowHInitiator"/>
2213                                 </xsl:when>
2214                                         
2215                         </xsl:choose>
2216                 
2217                         <!-- Draw the horizontal part of the bus -->
2218                         <rect x="{$h_bus_ul_x_}" 
2219                                   y="{$h_bus_ul_y_}"  
2220                                   width= "{$h_bus_width_}" 
2221                                   height="{$h_bus_height_}" 
2222                                 
2223                               style="stroke:none; fill:{$busColor_}"/>
2224                         
2225                         <!-- 
2226                                 Draw the vertical part of the bus. The MPMC BIF and the top arrow will
2227                                 be added later when the main drawing happens.
2228                         -->
2229                         <xsl:variable name="v_bus_ul_x_">
2230                                 <xsl:choose>
2231                                         <xsl:when test="@BIFSIDE='0'"><xsl:value-of select="($h_bus_ul_x_)"/></xsl:when>
2232                                         <xsl:when test="@BIFSIDE='1'"><xsl:value-of select="($h_bus_ul_x_ + $h_bus_width_ - $BLKD_P2P_BUS_W)"/></xsl:when>
2233                                 </xsl:choose>
2234                         </xsl:variable>
2235                         
2236                         <rect x="{$v_bus_ul_x_}" 
2237                                   y="0"  
2238                                   width= "{$BLKD_P2P_BUS_W}" 
2239                                   height="{$h_bus_ul_y_}"  
2240                               style="stroke:none; fill:{$busColor_}"/>
2241         </xsl:for-each>
2242                                                 
2243 </xsl:template> 
2244         
2245         
2246                                 
2247 <!-- 
2248          ======================================================================
2249      Handle Split connections, (connections that go between adjacent stacks)
2250          ======================================================================
2251 -->
2252         
2253 <xsl:template name="BCLaneSpace_SplitConn">     
2254         
2255         <xsl:param name="iBusStd"          select="'NONE'"/>    
2256         <xsl:param name="iBusName"         select="'NONE'"/>    
2257         <xsl:param name="iBifType"         select="'NONE'"/>    
2258         <xsl:param name="iStackToEast"     select="'NONE'"/>    
2259         <xsl:param name="iStackToWest"     select="'NONE'"/>    
2260         <xsl:param name="iStackToEast_W"   select="0"/> 
2261         <xsl:param name="iStackToWest_W"   select="0"/> 
2262         <xsl:param name="iLaneInSpace_X"   select="0"/> 
2263         
2264         <xsl:variable name="busColor_">
2265                 <xsl:call-template name="F_BusStd2RGB">
2266                         <xsl:with-param name="iBusStd" select="$iBusStd"/>
2267                 </xsl:call-template>    
2268         </xsl:variable> 
2269         
2270         <xsl:variable name="space_W_">
2271                 <xsl:call-template name="F_Calc_Space_Width"> 
2272                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
2273                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
2274                 </xsl:call-template>            
2275         </xsl:variable>
2276         
2277         <xsl:variable name ="extSpaceWest_W_" select="ceiling($iStackToWest_W div 2)"/>
2278         <xsl:variable name ="extSpaceEast_W_" select="ceiling($iStackToEast_W div 2)"/>                                                 
2279                         
2280                                         
2281         <xsl:variable name="bifName_"      select="BUSCONN/@BUSINTERFACE"/>
2282         <xsl:variable name="shpInstance_"  select="BUSCONN/@INSTANCE"/>
2283                                         
2284 <!--                                    
2285                         <xsl:message>Found a split connection on <xsl:value-of select="$shpInstance_"/></xsl:message>   
2286 -->                                     
2287                                                 
2288                                         
2289                 <xsl:variable name="shp_hori_idx_">
2290                                                 
2291                         <xsl:choose>
2292                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $shpInstance_)]">
2293                                         <xsl:value-of select="/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $shpInstance_)]/@STACK_HORIZ_INDEX"/>
2294                                 </xsl:when>
2295                                                         
2296                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]">
2297                                         <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]/@STACK_HORIZ_INDEX"/>
2298                                 </xsl:when>
2299                                 <xsl:otherwise>_unknown_</xsl:otherwise>
2300                         </xsl:choose>           
2301                                                 
2302                 </xsl:variable> 
2303                                         
2304                 <xsl:variable name="shp_vert_idx_">
2305                                                 
2306                         <xsl:choose>
2307                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $shpInstance_)]">
2308                                         <xsl:value-of select="/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $shpInstance_)]/@SHAPE_VERTI_INDEX"/>
2309                                 </xsl:when>
2310                                                         
2311                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]">
2312                                         <xsl:value-of select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]/@SHAPE_VERTI_INDEX"/>
2313                                 </xsl:when>
2314                                 <xsl:otherwise>_unknown_</xsl:otherwise>
2315                         </xsl:choose>           
2316                                                 
2317                 </xsl:variable> 
2318                                         
2319                 <xsl:variable name="splitshp_Width_">
2320                                                 
2321                         <xsl:choose>
2322                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/PROCSHAPES/MODULE[(@INSTANCE = $shpInstance_)]">
2323                                         <xsl:value-of select="$BLKD_MOD_W"/>
2324                                 </xsl:when>
2325                                                 
2326                                 <xsl:when  test="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]/@MODS_W">
2327 <!--                                                            
2328                                                                 <xsl:message>Using mods width on <xsl:value-of select="$shpInstance_"/></xsl:message>
2329 -->                                                             
2330                                         <xsl:value-of select="($G_ROOT/EDKSYSTEM/BLKDIAGRAM/CMPLXSHAPES/CMPLXSHAPE[(MODULE[(@INSTANCE = $shpInstance_)])]/@MODS_W * $BLKD_MOD_W)"/>
2331                                 </xsl:when>
2332                                 <xsl:otherwise>
2333                                         <xsl:value-of select="$BLKD_MOD_W"/>
2334                                 </xsl:otherwise>
2335                         </xsl:choose>           
2336                                                 
2337                 </xsl:variable> 
2338                                         
2339 <!--                                    
2340                                         <xsl:message>Found width of <xsl:value-of select="$splitshp_Width_"/></xsl:message>
2341 -->                                     
2342         
2343                                         
2344                 <xsl:variable name="splitshp_Y_">
2345                         <xsl:call-template name="F_Calc_Stack_Shape_Y">
2346                                 <xsl:with-param name="iHorizIdx"  select="$shp_hori_idx_"/>
2347                                 <xsl:with-param name="iVertiIdx"  select="$shp_vert_idx_"/>
2348                         </xsl:call-template>
2349                 </xsl:variable>
2350                                         
2351                                                 
2352                 <xsl:variable name="splitStack_H_diff_">
2353                         <xsl:choose>
2354                                 <xsl:when test="   (($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">0</xsl:when>
2355                                 <xsl:when test="not(($iStackToEast = 'NONE') or ($iStackToWest = 'NONE'))">
2356         
2357                                         <xsl:variable name="stackToWest_AbvSbs_H_">
2358                                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2359                                                         <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
2360                                                 </xsl:call-template>
2361                                         </xsl:variable>
2362                                 
2363                                         <xsl:variable name="stackToEast_AbvSbs_H_">
2364                                                 <xsl:call-template name="F_Calc_Stack_AbvSbs_Height">
2365                                                         <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
2366                                                 </xsl:call-template>
2367                                         </xsl:variable>
2368                                 
2369                                         <xsl:choose>
2370                                                 <xsl:when test="(($shp_hori_idx_ = $iStackToEast) and ($stackToWest_AbvSbs_H_ &gt; $stackToEast_AbvSbs_H_))">
2371                                                         <xsl:value-of select="($stackToWest_AbvSbs_H_ - $stackToEast_AbvSbs_H_)"/>
2372                                                 </xsl:when>     
2373                                                 <xsl:when test="(($shp_hori_idx_ = $iStackToWest) and ($stackToEast_AbvSbs_H_ &gt; $stackToWest_AbvSbs_H_))">
2374                                                         <xsl:value-of select="($stackToEast_AbvSbs_H_ - $stackToWest_AbvSbs_H_)"/>
2375                                                 </xsl:when>     
2376                                                 <xsl:otherwise>0</xsl:otherwise>        
2377                                         </xsl:choose>   
2378                                                                                 
2379                                 </xsl:when>
2380                         </xsl:choose>
2381                 </xsl:variable>
2382                                                 
2383                                         
2384                 <xsl:variable name="splitBif_Y_"    select="((($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V) * BUSCONN/@BIF_Y) + ($BLKD_MOD_LANE_H + $BLKD_MOD_LABEL_H + $BLKD_MOD_BIF_GAP_V))"/>
2385                 <xsl:variable name="splitBusStd_"   select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $shpInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BUSSTD"/>
2386                 <xsl:variable name="splitBifType_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $shpInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@TYPE"/>
2387                 <xsl:variable name="splitBifSide_"  select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $shpInstance_)]/BUSINTERFACE[(@NAME = $bifName_)]/@BIF_X"/>
2388                                                                         
2389                 <xsl:variable name="bcInSpace_X_">
2390                         <xsl:choose>
2391                                 <xsl:when test="$splitBifSide_ = '1'"><xsl:value-of select="ceiling($splitshp_Width_ div 2)"/></xsl:when>
2392                                 <xsl:when test="$splitBifSide_ = '0'"><xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - ceiling($splitshp_Width_ div 2) - $BLKD_BIFC_W)"/></xsl:when>
2393                         </xsl:choose>
2394                                                                 
2395                 </xsl:variable> 
2396                                         
2397                 <xsl:variable name="bcBus_X_">
2398                         <xsl:choose>
2399                                 <xsl:when test="$splitBifSide_ = '1'"><xsl:value-of select="$bcInSpace_X_"/></xsl:when>
2400                                 <xsl:when test="$splitBifSide_ = '0'"><xsl:value-of select="($space_W_ + $extSpaceWest_W_ + $extSpaceEast_W_ - ceiling($BLKD_MOD_W div 2) - $BLKD_BIFC_W)"/></xsl:when>
2401                         </xsl:choose>
2402                 </xsl:variable> 
2403                                                         
2404                 <xsl:variable name="bcSplit_Y_">
2405                         <xsl:choose>
2406                                 <xsl:when test="(BUSCONN/@IS_MEMCONN) and (($splitBusStd_ = 'LMB') or ($splitBusStd_ = 'OCM'))">
2407 <!--                                                            
2408                                         <xsl:message>Found memory conn split connection on <xsl:value-of select="$shpInstance_"/> </xsl:message>
2409 -->     
2410                                         <xsl:value-of select="($splitshp_Y_ + $BLKD_MOD_H + $BLKD_MOD_BIF_GAP_V + (BUSCONN/@BIF_Y * ($BLKD_BIF_H + $BLKD_MOD_BIF_GAP_V)) + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $splitStack_H_diff_)"/>
2411                                 </xsl:when>     
2412                                 <xsl:otherwise>
2413                                         <xsl:value-of select="($splitshp_Y_ + $splitBif_Y_ + ceiling($BLKD_BIF_H div 2) - ceiling($BLKD_BIFC_H div 2) + $splitStack_H_diff_)"/>
2414                                 </xsl:otherwise>
2415                         </xsl:choose>
2416                 </xsl:variable>    
2417                                         
2418         <use   x="{$bcInSpace_X_}"   y="{$bcSplit_Y_}"  xlink:href="#{@BUSSTD}_busconn_{$splitBifType_}"/>
2419                                         
2420                         
2421         <xsl:call-template name="Draw_SplitConnBus">
2422                 <xsl:with-param name="iBc_Y"    select="$bcSplit_Y_"/>
2423                 <xsl:with-param name="iBc_X"    select="$bcInSpace_X_"/>
2424                 <xsl:with-param name="iBusStd"  select="$iBusStd"/>
2425                 <xsl:with-param name="iBc_Type" select="$splitBifType_"/>
2426                 <xsl:with-param name="iBc_Side" select="$splitBifSide_"/>
2427                 <xsl:with-param name="iBusName" select="$iBusName"/>
2428         </xsl:call-template>
2429                                         
2430         
2431 </xsl:template> 
2432         
2433         
2434 <xsl:template name="Define_BusLaneSpace"> 
2435         
2436         <xsl:param name="iStackToEast"  select="'NONE'"/>
2437         <xsl:param name="iStackToWest"  select="'NONE'"/>
2438         
2439 <!--    
2440         <xsl:message>Input Stack to West <xsl:value-of select="$iStackToWest"/></xsl:message>
2441         <xsl:message>Input Stack to East <xsl:value-of select="$iStackToEast"/></xsl:message>
2442 -->
2443         
2444         <xsl:variable name="stackToEast_">
2445                 <xsl:choose>
2446                         <xsl:when test="not($iStackToEast = 'NONE')"><xsl:value-of select="$iStackToEast"/></xsl:when>
2447                         <xsl:otherwise>NONE</xsl:otherwise>
2448                 </xsl:choose>
2449         </xsl:variable> 
2450         
2451         <xsl:variable name="stackToWest_">
2452                 <xsl:choose>
2453                         <xsl:when test=" not($iStackToWest = 'NONE')"><xsl:value-of select="$iStackToWest"/></xsl:when>
2454                         <xsl:when test="(not($iStackToEast = 'NONE') and not($iStackToEast = '0'))"><xsl:value-of select="($iStackToEast - 1)"/></xsl:when>
2455                         <xsl:otherwise>NONE</xsl:otherwise>
2456                 </xsl:choose>
2457         </xsl:variable> 
2458         
2459         <xsl:variable name="spaceAbvSbs_H_">
2460                 <xsl:call-template name="F_Calc_Space_AbvSbs_Height">
2461                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
2462                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
2463                 </xsl:call-template>
2464         </xsl:variable> 
2465         
2466         <xsl:variable name="spaceBlwSbs_H_">
2467                 <xsl:call-template name="F_Calc_Space_BlwSbs_Height">
2468                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
2469                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
2470                 </xsl:call-template>
2471         </xsl:variable> 
2472         
2473         
2474         <xsl:variable name="space_H_" select="($spaceAbvSbs_H_ + $BLKD_PROC2SBS_GAP + $G_Total_SharedBus_H + $spaceBlwSbs_H_)"/>
2475         <xsl:variable name="space_W_">
2476                 <xsl:call-template name="F_Calc_Space_Width"> 
2477                         <xsl:with-param name="iStackToEast"  select="$iStackToEast"/>
2478                         <xsl:with-param name="iStackToWest"  select="$iStackToWest"/>
2479                 </xsl:call-template>            
2480         </xsl:variable>
2481         
2482         <xsl:variable name="spaceSharedBus_Y_" select="$spaceAbvSbs_H_ + $BLKD_PROC2SBS_GAP"/>
2483         
2484         <xsl:variable name="space_name_">
2485                 <xsl:call-template name="F_generate_Space_Name"> 
2486                         <xsl:with-param name="iStackToEast"  select="$stackToEast_"/>
2487                         <xsl:with-param name="iStackToWest"  select="$stackToWest_"/>
2488                 </xsl:call-template>            
2489         </xsl:variable>
2490         
2491         <xsl:variable name = "stackToWest_W_">
2492                 <xsl:choose>
2493                         <xsl:when test="(($iStackToEast = '0')    and    ($iStackToWest = 'NONE'))">0</xsl:when>
2494                         <xsl:when test="(($iStackToEast = 'NONE') and not($iStackToWest = 'NONE'))">
2495                                 <xsl:call-template name="F_Calc_Stack_Width">
2496                                         <xsl:with-param name="iStackIdx"  select="$iStackToWest"/>
2497                                 </xsl:call-template>
2498                         </xsl:when>
2499                         <xsl:when test="(not($iStackToEast = '0') and not($iStackToEast = 'NONE') and ($iStackToWest = 'NONE'))">
2500                                 <xsl:call-template name="F_Calc_Stack_Width">
2501                                         <xsl:with-param name="iStackIdx"  select="($iStackToEast - 1)"/>
2502                                 </xsl:call-template>
2503                         </xsl:when>
2504                         <xsl:otherwise>0</xsl:otherwise>
2505                 </xsl:choose>
2506         </xsl:variable>
2507         
2508         <xsl:variable name = "stackToEast_W_">
2509                 <xsl:call-template name="F_Calc_Stack_Width">
2510                         <xsl:with-param name="iStackIdx"  select="$iStackToEast"/>
2511                 </xsl:call-template>
2512         </xsl:variable>
2513         
2514         <xsl:variable name ="extSpaceWest_W_" select="ceiling($stackToWest_W_ div 2)"/>
2515         <xsl:variable name ="extSpaceEast_W_" select="ceiling($stackToEast_W_ div 2)"/>
2516         
2517         <g id="{$space_name_}">
2518                  <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[((@EAST = $iStackToEast) or (($iStackToEast = 'NONE') and (@WEST = $iStackToWest)))]/BUSCONNLANE[@BUSSTD and @BUSNAME]">
2519                                 
2520                                 <xsl:variable name="busStd_"  select="@BUSSTD"/>
2521                                 <xsl:variable name="busName_" select="@BUSNAME"/>
2522                                 <xsl:variable name="busLane_X_"  select="@BUSLANE_X"/>
2523
2524 <!--
2525                                 <xsl:variable name="eastBusLane_X_">
2526                                         <xsl:choose>
2527                                            <xsl:when test="(@BUSLANE_X = 0)"><xsl:value-of select="@BUSLANE_X"/></xsl:when>
2528                                            <xsl:otherwise><xsl:value-of select="(@BUSLANE_X  - 1)"/></xsl:otherwise>
2529                                         </xsl:choose>
2530                                 </xsl:variable>
2531 -->                             
2532                                 <xsl:variable name="eastBusLane_X_" select="@BUSLANE_X"/>                               
2533                                 <xsl:variable name="laneInSpace_X_">
2534                                         <xsl:choose>
2535                                            <xsl:when test="(@ORIENTED = 'EAST')">
2536                                                    <xsl:value-of select="($extSpaceWest_W_ + ($eastBusLane_X_ * $BLKD_BUS_LANE_W) - $BLKD_BUS_ARROW_W - $BLKD_P2P_BUS_W)"/>
2537                                            </xsl:when>
2538                                            <xsl:otherwise><xsl:value-of select="($extSpaceWest_W_ + (@BUSLANE_X * $BLKD_BUS_LANE_W))"/></xsl:otherwise>
2539                                         </xsl:choose>
2540                                 </xsl:variable> 
2541                                                 
2542                          
2543                                 <xsl:variable name="busColor_">
2544                                         <xsl:call-template name="F_BusStd2RGB">
2545                                                 <xsl:with-param name="iBusStd" select="@BUSSTD"/>
2546                                         </xsl:call-template>    
2547                                 </xsl:variable>
2548                                 
2549                                 <xsl:choose>
2550 <!-- 
2551                  ===========================================================
2552                         Handle Bucket connections to the shared busses.
2553                  ===========================================================
2554 -->
2555                                         <xsl:when test="@BUSLANE_X and @IS_BKTCONN and BUSCONN[@TYPE] and $G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/@BUS_INDEX">
2556                                                 <xsl:call-template name="BCLaneSpace_BucketToSharedBus">
2557                                                         <xsl:with-param name="iBusName"           select="$busName_"/>
2558                                                         <xsl:with-param name="iBusStd"            select="$busStd_"/>
2559                                                         <xsl:with-param name="iBifType"           select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/BUSINTERFACE/@TYPE"/>
2560                                                         <xsl:with-param name="iStackToEast"       select="$stackToEast_"/>
2561                                                         <xsl:with-param name="iStackToWest"       select="$stackToWest_"/>
2562                                                         <xsl:with-param name="iStackToEast_W"     select="$stackToEast_W_"/>
2563                                                         <xsl:with-param name="iStackToWest_W"     select="$stackToWest_W_"/>
2564                                                         <xsl:with-param name="iLaneInSpace_X"     select="$laneInSpace_X_"/>
2565                                                         <xsl:with-param name="iSpaceSharedBus_Y"  select="$spaceSharedBus_Y_"/>
2566                                                 </xsl:call-template>    
2567                                         </xsl:when>
2568                                         
2569 <!--
2570                  ===========================================================
2571                         Handle Processor's Shared bus connections.
2572                  ===========================================================
2573 -->
2574                                         <xsl:when test="@BUSLANE_X and @IS_SBSCONN and not(@IS_MPMCCONN) and BUSCONN[@BIF_Y and @IS_PROCCONN and @INSTANCE and @BUSINTERFACE] and $G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/@BUS_INDEX">
2575                                                 <xsl:call-template name="BCLaneSpace_ProcBifToSharedBus">
2576                                                         <xsl:with-param name="iBusStd"            select="$busStd_"/>
2577                                                         <xsl:with-param name="iBusName"           select="$busName_"/>
2578                                                         <xsl:with-param name="iBifType"           select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/BUSINTERFACE/@TYPE"/>
2579                                                         <xsl:with-param name="iStackToEast"       select="$stackToEast_"/>
2580                                                         <xsl:with-param name="iStackToWest"       select="$stackToWest_"/>
2581                                                         <xsl:with-param name="iStackToEast_W"     select="$stackToEast_W_"/>
2582                                                         <xsl:with-param name="iStackToWest_W"     select="$stackToWest_W_"/>
2583                                                         <xsl:with-param name="iLaneInSpace_X"     select="$laneInSpace_X_"/>
2584                                                         <xsl:with-param name="iSpaceSharedBus_Y"  select="$spaceSharedBus_Y_"/>
2585                                                 </xsl:call-template>    
2586 <!--                                            
2587 -->     
2588                                         </xsl:when>     
2589                                         
2590 <!--
2591                  ===========================================================
2592                         Handle non Processor Shared Bus connections.
2593                  ===========================================================
2594 -->
2595                                         <xsl:when test="@BUSLANE_X and @IS_SBSCONN and not(@IS_MPMCCONN) and BUSCONN[@BIF_Y and not(@IS_PROCCONN) and @INSTANCE and @BUSINTERFACE] and /EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/@BUS_INDEX">
2596                                                 <xsl:call-template name="BCLaneSpace_NonProcBifToSharedBus">
2597                                                         <xsl:with-param name="iBusStd"            select="$busStd_"/>
2598                                                         <xsl:with-param name="iBusName"           select="$busName_"/>
2599                                                         <xsl:with-param name="iBifType"           select="$G_ROOT/EDKSYSTEM/MODULES/MODULE[(@INSTANCE = $busName_)]/BUSINTERFACE/@TYPE"/>
2600                                                         <xsl:with-param name="iStackToEast"       select="$stackToEast_"/>
2601                                                         <xsl:with-param name="iStackToWest"       select="$stackToWest_"/>
2602                                                         <xsl:with-param name="iStackToEast_W"     select="$stackToEast_W_"/>
2603                                                         <xsl:with-param name="iStackToWest_W"     select="$stackToWest_W_"/>
2604                                                         <xsl:with-param name="iLaneInSpace_X"     select="$laneInSpace_X_"/>
2605                                                         <xsl:with-param name="iSpaceSharedBus_Y"  select="$spaceSharedBus_Y_"/>
2606                                                 </xsl:call-template>    
2607 <!--                                            
2608 -->     
2609                                         </xsl:when>                                     
2610                                         
2611 <!-- 
2612                  ===========================================================
2613                         Handle connections from processors to Memory UNITs
2614                  ===========================================================
2615 -->                     
2616                                         <xsl:when test="@BUSLANE_X and @IS_MEMCONN and not(@IS_MULTISTK) and BUSCONN[@BIF_Y and @IS_PROCCONN and not(@IS_SPLITCONN) and @INSTANCE and @BUSINTERFACE]">
2617                                                 <xsl:call-template name="BCLaneSpace_ProcBifToMemoryUnit">
2618                                                         <xsl:with-param name="iBusStd"         select="$busStd_"/>
2619                                                         <xsl:with-param name="iBusName"        select="$busName_"/>
2620                                                         <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2621                                                         <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2622                                                         <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2623                                                         <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2624                                                         <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2625                                                         <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2626                                                 </xsl:call-template>    
2627 <!--                                            
2628 -->     
2629                                         </xsl:when>                             
2630                                 
2631                                         
2632 <!-- 
2633                  ===========================================================
2634                         Handle generic Point to Point connections
2635                  ===========================================================
2636 -->
2637                                         <xsl:when test="@BUSLANE_X and not(@IS_MULTISTK) and not(@IS_MPMCCONN) and not(@IS_MEMCONN) and not(@IS_SBSCONN) and BUSCONN[@BIF_Y and @INSTANCE and @BUSINTERFACE and not(@IS_SPLITCONN)]">
2638                                                 <xsl:call-template name="BCLaneSpace_PointToPoint">
2639                                                         <xsl:with-param name="iBusStd"         select="$busStd_"/>
2640                                                         <xsl:with-param name="iBusName"        select="$busName_"/>
2641                                                         <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2642                                                         <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2643                                                         <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2644                                                         <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2645                                                         <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2646                                                         <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2647                                                 </xsl:call-template>    
2648 <!--                                            
2649 -->     
2650                                         </xsl:when>                             
2651                                         
2652 <!-- 
2653                  ===========================================================
2654                         Handle MultiStack Point to Point connections
2655                  ===========================================================
2656 -->
2657                                         <xsl:when test="@BUSLANE_X and (@IS_MULTISTK) and not(@IS_SBSCONN) and BUSCONN[@BIF_Y and @IS_PROCCONN and @INSTANCE and @BUSINTERFACE]">
2658                                                 <xsl:call-template name="BCLaneSpace_MultiStack_PointToPoint">
2659                                                         <xsl:with-param name="iBusStd"         select="$busStd_"/>
2660                                                         <xsl:with-param name="iBusName"        select="$busName_"/>
2661                                                         <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2662                                                         <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2663                                                         <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2664                                                         <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2665                                                         <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2666                                                         <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2667                                                 </xsl:call-template>    
2668                                         </xsl:when>                             
2669                                         
2670 <!-- 
2671                  ===========================================================
2672                         Handle Processor to processor connections
2673                  ===========================================================
2674 -->
2675                                 <xsl:when test="(@IS_PROC2PROC and (count(BUSCONN[@BIF_Y and @INSTANCE and @BUSINTERFACE]) = 2))">
2676                                         <xsl:call-template name="BCLaneSpace_ProcToProc">
2677                                                 <xsl:with-param name="iBusStd"         select="$busStd_"/>
2678                                                 <xsl:with-param name="iBusName"        select="$busName_"/>
2679                                                 <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2680                                                 <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2681                                                 <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2682                                                 <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2683                                                 <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2684                                                 <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2685                                         </xsl:call-template>    
2686                                 </xsl:when>
2687 <!-- 
2688                  ===========================================================
2689                         Handle connections to the StandAlone MPMC
2690                  ===========================================================
2691 -->
2692                         <xsl:when test="@BUSLANE_X and (@IS_MPMCCONN) and not(@IS_SBSCONN) and BUSCONN[(@BIF_Y and @INSTANCE and @BUSINTERFACE)]">
2693 <!--                            
2694 -->                             
2695                                         <xsl:call-template name="BCLaneSpace_ToStandAloneMPMC">
2696                                                 <xsl:with-param name="iBusStd"         select="$busStd_"/>
2697                                                 <xsl:with-param name="iBusName"        select="$busName_"/>
2698                                                 <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2699                                                 <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2700                                                 <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2701                                                 <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2702                                                 <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2703                                                 <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2704                                         </xsl:call-template>    
2705                         </xsl:when>
2706                                         
2707 <!-- 
2708                  ===========================================================
2709                         Handle Split connections, (connections that go between non adjacent stacks)
2710                  ===========================================================
2711 -->
2712                         <xsl:when test="(BUSCONN[@BIF_Y and @INSTANCE and @BUSINTERFACE and @IS_SPLITCONN])">
2713                                 <xsl:call-template name="BCLaneSpace_SplitConn">
2714                                         <xsl:with-param name="iBusStd"         select="$busStd_"/>
2715                                         <xsl:with-param name="iBusName"        select="$busName_"/>
2716                                         <xsl:with-param name="iBifType"        select="BUSCONN/@TYPE"/>
2717                                         <xsl:with-param name="iStackToEast"    select="$stackToEast_"/>
2718                                         <xsl:with-param name="iStackToWest"    select="$stackToWest_"/>
2719                                         <xsl:with-param name="iStackToEast_W"  select="$stackToEast_W_"/>
2720                                         <xsl:with-param name="iStackToWest_W"  select="$stackToWest_W_"/>
2721                                         <xsl:with-param name="iLaneInSpace_X"  select="$laneInSpace_X_"/>
2722                                 </xsl:call-template>    
2723 <!--                            
2724 -->     
2725                         </xsl:when>
2726                                         
2727                 </xsl:choose>
2728                                                                 
2729         </xsl:for-each>
2730         </g>
2731                         
2732 </xsl:template> 
2733         
2734 <xsl:template name="Define_BusLaneSpaces"> 
2735         
2736         <xsl:variable name="lastStack_" select="(/EDKSYSTEM/BLKDIAGRAM/@STACK_HORIZ_WIDTH) - 1"/>
2737         
2738         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[@EAST]">
2739                 <xsl:sort select="@EAST" data-type="number"/>
2740                         
2741                 <xsl:call-template name="Define_BusLaneSpace">
2742                         <xsl:with-param name="iStackToEast"  select="@EAST"/>
2743                 </xsl:call-template>
2744         </xsl:for-each> 
2745         
2746 <!--    
2747         <xsl:message>Last Stack <xsl:value-of select="$lastStack_"/></xsl:message>
2748 -->     
2749         
2750         <xsl:for-each select="$G_ROOT/EDKSYSTEM/BLKDIAGRAM/BCLANESPACES/BCLANESPACE[(@WEST = $lastStack_)]">
2751                 <xsl:call-template name="Define_BusLaneSpace">
2752                         <xsl:with-param name="iStackToWest"  select="$lastStack_"/>
2753                 </xsl:call-template>
2754         </xsl:for-each> 
2755                         
2756 </xsl:template>
2757                 
2758 </xsl:stylesheet>