Cube-view: 90° router mesh links, 45° component connectors
Router-router mesh links remain straight (horizontal/vertical). All component→router connectors use 45° L-bend polylines: - PE blocks: vertical then 45° diagonal to router - M_CPU/SRAM: horizontal then 45° diagonal to router - PE→HBM port group: vertical then 45° diagonal - UCIe port→router: direction-aware 45° bend Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+34
-34
@@ -135,12 +135,12 @@
|
||||
<text x="135" y="138" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r0c0</text>
|
||||
<rect x="119" y="107" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="135" y="118" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE0</text>
|
||||
<line x1="135" y1="123" x2="135" y2="127" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="135,123 135,127 135,127" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="285" cy="135" r="8" fill="#475569" stroke="#64748b" stroke-width="1"/>
|
||||
<text x="285" y="138" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r0c1</text>
|
||||
<rect x="269" y="107" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="285" y="118" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE1</text>
|
||||
<line x1="285" y1="123" x2="285" y2="127" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="285,123 285,127 285,127" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="435" cy="135" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
<text x="435" y="138" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r0c2</text>
|
||||
<circle cx="585" cy="135" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
@@ -161,17 +161,17 @@
|
||||
<text x="685" y="263" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r1c4</text>
|
||||
<rect x="669" y="232" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="685" y="243" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE2</text>
|
||||
<line x1="685" y1="248" x2="685" y2="252" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="685,248 685,252 685,252" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="835" cy="260" r="8" fill="#475569" stroke="#64748b" stroke-width="1"/>
|
||||
<text x="835" y="263" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r1c5</text>
|
||||
<rect x="819" y="232" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="835" y="243" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE3</text>
|
||||
<line x1="835" y1="248" x2="835" y2="252" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="835,248 835,252 835,252" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="135" cy="335" r="8" fill="#475569" stroke="#64748b" stroke-width="1"/>
|
||||
<text x="135" y="338" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r2c0</text>
|
||||
<rect x="89" y="327" width="32" height="16" rx="3" fill="#451a03" stroke="#f59e0b" stroke-width="1"/>
|
||||
<text x="105" y="338" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#f59e0b">M_CPU</text>
|
||||
<line x1="121" y1="335" x2="127" y2="335" stroke="#f59e0b" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="121,335 127,335 127,335" fill="none" stroke="#f59e0b" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="285" cy="335" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
<text x="285" y="338" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r2c1</text>
|
||||
<circle cx="685" cy="335" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
@@ -182,7 +182,7 @@
|
||||
<text x="135" y="488" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r3c0</text>
|
||||
<rect x="89" y="477" width="32" height="16" rx="3" fill="#1c1917" stroke="#d97706" stroke-width="1"/>
|
||||
<text x="105" y="488" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#d97706">SRAM</text>
|
||||
<line x1="121" y1="485" x2="127" y2="485" stroke="#d97706" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="121,485 127,485 127,485" fill="none" stroke="#d97706" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="285" cy="485" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
<text x="285" y="488" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r3c1</text>
|
||||
<circle cx="685" cy="485" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
@@ -193,12 +193,12 @@
|
||||
<text x="135" y="563" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r4c0</text>
|
||||
<rect x="119" y="572" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="135" y="583" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE4</text>
|
||||
<line x1="135" y1="572" x2="135" y2="568" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="135,572 135,568 135,568" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="285" cy="560" r="8" fill="#475569" stroke="#64748b" stroke-width="1"/>
|
||||
<text x="285" y="563" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r4c1</text>
|
||||
<rect x="269" y="572" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="285" y="583" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE5</text>
|
||||
<line x1="285" y1="572" x2="285" y2="568" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="285,572 285,568 285,568" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="435" cy="560" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
<text x="435" y="563" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r4c2</text>
|
||||
<circle cx="585" cy="560" r="8" fill="#334155" stroke="#475569" stroke-width="1"/>
|
||||
@@ -219,84 +219,84 @@
|
||||
<text x="685" y="688" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r5c4</text>
|
||||
<rect x="669" y="697" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="685" y="708" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE6</text>
|
||||
<line x1="685" y1="697" x2="685" y2="693" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="685,697 685,693 685,693" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<circle cx="835" cy="685" r="8" fill="#475569" stroke="#64748b" stroke-width="1"/>
|
||||
<text x="835" y="688" text-anchor="middle" font-family="monospace" font-size="6" fill="white">r5c5</text>
|
||||
<rect x="819" y="697" width="32" height="16" rx="3" fill="#2d1f3d" stroke="#a855f7" stroke-width="1"/>
|
||||
<text x="835" y="708" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#a855f7">PE7</text>
|
||||
<line x1="835" y1="697" x2="835" y2="693" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<line x1="135" y1="143" x2="324" y2="289" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="835,697 835,693 835,693" fill="none" stroke="#a855f7" stroke-width="1" opacity="0.6"/>
|
||||
<polyline points="135,143 135,216 324,289" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="239" y="216" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="285" y1="143" x2="431" y2="289" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="285,143 285,216 431,289" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="368" y="216" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="685" y1="268" x2="539" y2="289" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="685,268 685,278 539,289" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="622" y="278" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="835" y1="268" x2="646" y2="289" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="835,268 835,278 646,289" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="751" y="278" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="135" y1="552" x2="324" y2="531" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="135,552 135,542 324,531" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="239" y="542" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="285" y1="552" x2="431" y2="531" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="285,552 285,542 431,531" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="368" y="542" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="685" y1="677" x2="539" y2="531" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="685,677 685,604 539,531" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="622" y="604" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<line x1="835" y1="677" x2="646" y2="531" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<polyline points="835,677 835,604 646,531" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" stroke-dasharray="4,3"/>
|
||||
<text x="751" y="604" font-family="monospace" font-size="6" fill="#10b98188">256GB/s</text>
|
||||
<rect x="85" y="360" width="50" height="100" rx="3" fill="#1e1b4b" stroke="#8b5cf6" stroke-width="1.5" opacity="0.9"/>
|
||||
<text x="110" y="357" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#8b5cf6">UCIe-W</text>
|
||||
<rect x="87" y="362" width="46" height="23" rx="2" fill="#818cf8" opacity="0.7"/>
|
||||
<text x="110" y="376" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c0</text>
|
||||
<line x1="133" y1="374" x2="127" y2="135" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="133,374 130,374 127,135" fill="none" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="87" y="386" width="46" height="23" rx="2" fill="#a78bfa" opacity="0.7"/>
|
||||
<text x="110" y="400" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c1</text>
|
||||
<line x1="133" y1="398" x2="127" y2="260" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="133,398 130,398 127,260" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="87" y="410" width="46" height="23" rx="2" fill="#c084fc" opacity="0.7"/>
|
||||
<text x="110" y="424" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c2</text>
|
||||
<line x1="133" y1="422" x2="127" y2="560" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="133,422 130,422 127,560" fill="none" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="87" y="434" width="46" height="23" rx="2" fill="#e879f9" opacity="0.7"/>
|
||||
<text x="110" y="448" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c3</text>
|
||||
<line x1="133" y1="446" x2="127" y2="685" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="133,446 130,446 127,685" fill="none" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="435" y="85" width="100" height="50" rx="3" fill="#1e1b4b" stroke="#8b5cf6" stroke-width="1.5" opacity="0.9"/>
|
||||
<text x="485" y="82" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#8b5cf6">UCIe-N</text>
|
||||
<rect x="437" y="87" width="23" height="46" rx="2" fill="#818cf8" opacity="0.7"/>
|
||||
<text x="448" y="113" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c0</text>
|
||||
<line x1="448" y1="133" x2="135" y2="127" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="448,133 448,130 135,127" fill="none" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="461" y="87" width="23" height="46" rx="2" fill="#a78bfa" opacity="0.7"/>
|
||||
<text x="472" y="113" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c1</text>
|
||||
<line x1="472" y1="133" x2="285" y2="127" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="472,133 472,130 285,127" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="485" y="87" width="23" height="46" rx="2" fill="#c084fc" opacity="0.7"/>
|
||||
<text x="496" y="113" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c2</text>
|
||||
<line x1="496" y1="133" x2="685" y2="127" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="496,133 496,130 685,127" fill="none" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="509" y="87" width="23" height="46" rx="2" fill="#e879f9" opacity="0.7"/>
|
||||
<text x="520" y="113" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c3</text>
|
||||
<line x1="520" y1="133" x2="835" y2="127" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="520,133 520,130 835,127" fill="none" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="835" y="360" width="50" height="100" rx="3" fill="#1e1b4b" stroke="#8b5cf6" stroke-width="1.5" opacity="0.9"/>
|
||||
<text x="860" y="357" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#8b5cf6">UCIe-E</text>
|
||||
<rect x="837" y="362" width="46" height="23" rx="2" fill="#818cf8" opacity="0.7"/>
|
||||
<text x="860" y="376" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c0</text>
|
||||
<line x1="837" y1="374" x2="843" y2="135" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="837,374 840,374 843,135" fill="none" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="837" y="386" width="46" height="23" rx="2" fill="#a78bfa" opacity="0.7"/>
|
||||
<text x="860" y="400" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c1</text>
|
||||
<line x1="837" y1="398" x2="843" y2="260" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="837,398 840,398 843,260" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="837" y="410" width="46" height="23" rx="2" fill="#c084fc" opacity="0.7"/>
|
||||
<text x="860" y="424" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c2</text>
|
||||
<line x1="837" y1="422" x2="843" y2="560" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="837,422 840,422 843,560" fill="none" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="837" y="434" width="46" height="23" rx="2" fill="#e879f9" opacity="0.7"/>
|
||||
<text x="860" y="448" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c3</text>
|
||||
<line x1="837" y1="446" x2="843" y2="685" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="837,446 840,446 843,685" fill="none" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="435" y="685" width="100" height="50" rx="3" fill="#1e1b4b" stroke="#8b5cf6" stroke-width="1.5" opacity="0.9"/>
|
||||
<text x="485" y="682" text-anchor="middle" font-family="monospace" font-size="7" font-weight="bold" fill="#8b5cf6">UCIe-S</text>
|
||||
<rect x="437" y="687" width="23" height="46" rx="2" fill="#818cf8" opacity="0.7"/>
|
||||
<text x="448" y="713" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c0</text>
|
||||
<line x1="448" y1="687" x2="135" y2="693" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="448,687 448,690 135,693" fill="none" stroke="#818cf8" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="461" y="687" width="23" height="46" rx="2" fill="#a78bfa" opacity="0.7"/>
|
||||
<text x="472" y="713" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c1</text>
|
||||
<line x1="472" y1="687" x2="285" y2="693" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="472,687 472,690 285,693" fill="none" stroke="#a78bfa" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="485" y="687" width="23" height="46" rx="2" fill="#c084fc" opacity="0.7"/>
|
||||
<text x="496" y="713" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c2</text>
|
||||
<line x1="496" y1="687" x2="685" y2="693" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="496,687 496,690 685,693" fill="none" stroke="#c084fc" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="509" y="687" width="23" height="46" rx="2" fill="#e879f9" opacity="0.7"/>
|
||||
<text x="520" y="713" text-anchor="middle" font-family="monospace" font-size="5" fill="white">c3</text>
|
||||
<line x1="520" y1="687" x2="835" y2="693" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<polyline points="520,687 520,690 835,693" fill="none" stroke="#e879f9" stroke-width="1" opacity="0.5"/>
|
||||
<rect x="60" y="865" width="10" height="10" rx="2" fill="#3b82f6" stroke="#475569" stroke-width="0.5"/>
|
||||
<text x="74" y="874" font-family="monospace" font-size="8" fill="#94a3b8">PE Router</text>
|
||||
<rect x="147" y="865" width="10" height="10" rx="2" fill="#f59e0b" stroke="#475569" stroke-width="0.5"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@@ -632,22 +632,48 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
|
||||
f'text-anchor="middle" font-family="monospace" font-size="{font_sz}" '
|
||||
f'font-weight="bold" fill="{style["text"]}">{_escape(label)}</text>'
|
||||
)
|
||||
# Connector line: block → router
|
||||
# Connector line: block → router (45° L-bend)
|
||||
sc = style["stroke"]
|
||||
if kind in ("mcpu", "sram"):
|
||||
# Horizontal connector (block right edge → router left edge)
|
||||
# From block right edge, 45° bend to router
|
||||
x1 = bx + blk_w
|
||||
y1 = by + blk_h / 2
|
||||
x2 = px - r_size
|
||||
y2 = py
|
||||
# 45° bend: go horizontal first, then diagonal
|
||||
mid_x = x2 - abs(y2 - y1)
|
||||
if mid_x < x1:
|
||||
mid_x = (x1 + x2) / 2
|
||||
parts.append(
|
||||
f' <line x1="{bx + blk_w:.0f}" y1="{by + blk_h / 2:.0f}" '
|
||||
f'x2="{px - r_size:.0f}" y2="{py:.0f}" '
|
||||
f'stroke="{style["stroke"]}" stroke-width="1" opacity="0.6"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {mid_x:.0f},{y1:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
else:
|
||||
# Vertical connector (PE above/below router)
|
||||
ly1 = by + blk_h if is_top else by
|
||||
ly2 = py - r_size if is_top else py + r_size
|
||||
# PE: from block bottom/top edge, 45° bend to router
|
||||
if is_top:
|
||||
x1 = bx + blk_w / 2 + offset_x
|
||||
y1 = by + blk_h
|
||||
x2 = px
|
||||
y2 = py - r_size
|
||||
# 45° bend: go vertical first, then diagonal
|
||||
mid_y = y2 - abs(x2 - x1)
|
||||
if mid_y < y1:
|
||||
mid_y = (y1 + y2) / 2
|
||||
parts.append(
|
||||
f' <line x1="{px + offset_x:.0f}" y1="{ly1:.0f}" '
|
||||
f'x2="{px:.0f}" y2="{ly2:.0f}" '
|
||||
f'stroke="{style["stroke"]}" stroke-width="1" opacity="0.6"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {x1:.0f},{mid_y:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
else:
|
||||
x1 = bx + blk_w / 2 + offset_x
|
||||
y1 = by
|
||||
x2 = px
|
||||
y2 = py + r_size
|
||||
mid_y = y2 + abs(x2 - x1)
|
||||
if mid_y > y1:
|
||||
mid_y = (y1 + y2) / 2
|
||||
parts.append(
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {x1:.0f},{mid_y:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
|
||||
# (PE→HBM BW annotation drawn in the PE→HBM port group section above)
|
||||
@@ -668,10 +694,15 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
|
||||
rpx, rpy = mm2px(rx, ry)
|
||||
tgx, tgy = _pe_hbm_targets[pe_id]
|
||||
r_edge_y = rpy + r_size if rpy < hbm_y else rpy - r_size
|
||||
# 45° L-bend: vertical from router, then diagonal to HBM port
|
||||
mid_y = tgy - abs(tgx - rpx) if rpy < hbm_y else tgy + abs(tgx - rpx)
|
||||
if rpy < hbm_y:
|
||||
mid_y = max(mid_y, (r_edge_y + tgy) / 2)
|
||||
else:
|
||||
mid_y = min(mid_y, (r_edge_y + tgy) / 2)
|
||||
parts.append(
|
||||
f' <line x1="{rpx:.0f}" y1="{r_edge_y:.0f}" '
|
||||
f'x2="{tgx:.0f}" y2="{tgy:.0f}" '
|
||||
f'stroke="#10b981" stroke-width="1.5" opacity="0.6" '
|
||||
f' <polyline points="{rpx:.0f},{r_edge_y:.0f} {rpx:.0f},{mid_y:.0f} {tgx:.0f},{tgy:.0f}" '
|
||||
f'fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" '
|
||||
f'stroke-dasharray="4,3"/>'
|
||||
)
|
||||
# BW annotation at midpoint
|
||||
@@ -765,31 +796,43 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
|
||||
f'{conn}</text>'
|
||||
)
|
||||
|
||||
# Connector line: port → router
|
||||
# Connector line: port → router (45° L-bend)
|
||||
rpx, rpy = mm2px(crx, cry)
|
||||
if direction == "N":
|
||||
x1, y1 = lx, cy_box + ch
|
||||
x2, y2 = rpx, rpy - r_size
|
||||
mid_y = y2 - abs(x2 - x1)
|
||||
mid_y = max(mid_y, (y1 + y2) / 2)
|
||||
parts.append(
|
||||
f' <line x1="{lx:.0f}" y1="{cy_box + ch:.0f}" '
|
||||
f'x2="{rpx:.0f}" y2="{rpy - r_size:.0f}" '
|
||||
f'stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {x1:.0f},{mid_y:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "S":
|
||||
x1, y1 = lx, cy_box
|
||||
x2, y2 = rpx, rpy + r_size
|
||||
mid_y = y2 + abs(x2 - x1)
|
||||
mid_y = min(mid_y, (y1 + y2) / 2)
|
||||
parts.append(
|
||||
f' <line x1="{lx:.0f}" y1="{cy_box:.0f}" '
|
||||
f'x2="{rpx:.0f}" y2="{rpy + r_size:.0f}" '
|
||||
f'stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {x1:.0f},{mid_y:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "W":
|
||||
x1, y1 = cx + cw, cy_box + ch / 2
|
||||
x2, y2 = rpx - r_size, rpy
|
||||
mid_x = x2 - abs(y2 - y1)
|
||||
mid_x = max(mid_x, (x1 + x2) / 2)
|
||||
parts.append(
|
||||
f' <line x1="{cx + cw:.0f}" y1="{cy_box + ch / 2:.0f}" '
|
||||
f'x2="{rpx - r_size:.0f}" y2="{rpy:.0f}" '
|
||||
f'stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {mid_x:.0f},{y1:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "E":
|
||||
x1, y1 = cx, cy_box + ch / 2
|
||||
x2, y2 = rpx + r_size, rpy
|
||||
mid_x = x2 + abs(y2 - y1)
|
||||
mid_x = min(mid_x, (x1 + x2) / 2)
|
||||
parts.append(
|
||||
f' <line x1="{cx:.0f}" y1="{cy_box + ch / 2:.0f}" '
|
||||
f'x2="{rpx + r_size:.0f}" y2="{rpy:.0f}" '
|
||||
f'stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
f' <polyline points="{x1:.0f},{y1:.0f} {mid_x:.0f},{y1:.0f} {x2:.0f},{y2:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
|
||||
# ── Legend ──
|
||||
|
||||
Reference in New Issue
Block a user