Remove xbar/noc remnants, rule-based cube-view connectors
- Delete xbar.py and noc.py (TwoDMeshNocComponent) — unused since router mesh - Remove xbar_v1/noc_2d_mesh_v1 from components.yaml - Fix pe_to_xbar → pe_to_router in routing exclusion set - Fix xbar_to_hbm_bw_gbs → hbm_to_router_bw_gbs in report.py - Update all docstrings/comments referencing xbar/bridge → router mesh - Cube-view connectors: rule-based _connector_points helper - PE↔router: single diagonal line (not chevron) - UCIe N/S: 45°→horizontal→45° - UCIe E/W: 45°→vertical→45° - HBM ports: 45°→horizontal→45° Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -385,6 +385,55 @@ def _escape(text: str) -> str:
|
||||
return text.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
|
||||
|
||||
# ── Connector helper ─────────────────────────────────────────────────
|
||||
|
||||
|
||||
def _connector_points(
|
||||
rx: float, ry: float, cx: float, cy: float
|
||||
) -> str:
|
||||
"""Return SVG polyline points for a rule-based connector.
|
||||
|
||||
Horizontal-dominant (|dx| >= |dy|): 45° → horizontal straight → 45°.
|
||||
Vertical-dominant (|dy| > |dx|): 45° → vertical straight → 45°.
|
||||
Near-equal or tiny distance: single straight line.
|
||||
"""
|
||||
dx = cx - rx
|
||||
dy = cy - ry
|
||||
adx, ady = abs(dx), abs(dy)
|
||||
|
||||
# Trivial distance → single line
|
||||
# Near-45° diagonal for short distances only (e.g. PE↔router)
|
||||
if adx + ady < 4 or (abs(adx - ady) < 4 and adx + ady < 80):
|
||||
return f"{rx:.0f},{ry:.0f} {cx:.0f},{cy:.0f}"
|
||||
|
||||
sx = 1 if dx >= 0 else -1
|
||||
sy = 1 if dy >= 0 else -1
|
||||
|
||||
if adx >= ady:
|
||||
# Horizontal-dominant: stubs handle vertical, straight is horizontal
|
||||
stub = ady / 2
|
||||
if stub < 2:
|
||||
return f"{rx:.0f},{ry:.0f} {cx:.0f},{cy:.0f}"
|
||||
r45x = rx + sx * stub
|
||||
r45y = ry + sy * stub
|
||||
c45x = cx - sx * stub
|
||||
c45y = cy - sy * stub # r45y == c45y (horizontal)
|
||||
else:
|
||||
# Vertical-dominant: stubs handle horizontal, straight is vertical
|
||||
stub = adx / 2
|
||||
if stub < 2:
|
||||
return f"{rx:.0f},{ry:.0f} {cx:.0f},{cy:.0f}"
|
||||
r45x = rx + sx * stub
|
||||
r45y = ry + sy * stub
|
||||
c45x = cx - sx * stub
|
||||
c45y = cy - sy * stub # r45x == c45x (vertical)
|
||||
|
||||
return (
|
||||
f"{rx:.0f},{ry:.0f} {r45x:.0f},{r45y:.0f} "
|
||||
f"{c45x:.0f},{c45y:.0f} {cx:.0f},{cy:.0f}"
|
||||
)
|
||||
|
||||
|
||||
# ── Cube-specific renderer ──────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -637,55 +686,39 @@ 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: router ─45°─ straight ─45°─ component
|
||||
# Connector: rule-based (short → 45° line, long → 45°-straight-45°)
|
||||
sc = style["stroke"]
|
||||
d = 12 # 45° stub length (px)
|
||||
|
||||
# Determine start (router edge) and end (component edge) points
|
||||
bxc = bx + blk_w / 2 # component center x
|
||||
if kind == "mcpu":
|
||||
# Router top → 45° NW stub → vertical → 45° into block bottom
|
||||
rx2, ry2 = px, py - r_size
|
||||
bxc, byc = bx + blk_w / 2, by + blk_h
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx2:.0f},{ry2:.0f} {rx2 - d:.0f},{ry2 - d:.0f} '
|
||||
f'{rx2 - d:.0f},{byc + d:.0f} {bxc:.0f},{byc:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
rx0, ry0 = px, py - r_size # router top
|
||||
cx0, cy0 = bxc, by + blk_h # component bottom
|
||||
elif kind == "sram":
|
||||
# Router bottom → 45° SW stub → vertical → 45° into block top
|
||||
rx2, ry2 = px, py + r_size
|
||||
bxc, byc = bx + blk_w / 2, by
|
||||
rx0, ry0 = px, py + r_size # router bottom
|
||||
cx0, cy0 = bxc, by # component top
|
||||
elif is_top:
|
||||
rx0, ry0 = px, py - r_size # router top
|
||||
cx0, cy0 = bx + blk_w / 2 + offset_x, by + blk_h # component bottom
|
||||
else:
|
||||
rx0, ry0 = px, py + r_size # router bottom
|
||||
cx0, cy0 = bx + blk_w / 2 + offset_x, by # component top
|
||||
|
||||
# PE/M_CPU/SRAM directly above/below router (same X):
|
||||
# single diagonal line from router center to component right edge
|
||||
if abs(cx0 - rx0) < 2 and abs(cy0 - ry0) > 4:
|
||||
cx0 = bx + blk_w - 2
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx2:.0f},{ry2:.0f} {rx2 - d:.0f},{ry2 + d:.0f} '
|
||||
f'{rx2 - d:.0f},{byc - d:.0f} {bxc:.0f},{byc:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
f' <line x1="{rx0:.0f}" y1="{ry0:.0f}" '
|
||||
f'x2="{cx0:.0f}" y2="{cy0:.0f}" '
|
||||
f'stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
else:
|
||||
# PE: vertical direction
|
||||
bxc = bx + blk_w / 2 + offset_x
|
||||
if is_top:
|
||||
rx2, ry2 = px, py - r_size # router top
|
||||
byc = by + blk_h # block bottom
|
||||
# 45° stub from router, vertical, 45° into block
|
||||
sx = bxc - px # horizontal shift direction
|
||||
sd = d if sx >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx2:.0f},{ry2:.0f} {rx2 + sd:.0f},{ry2 - d:.0f} '
|
||||
f'{rx2 + sd:.0f},{byc + d:.0f} {bxc:.0f},{byc:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
else:
|
||||
rx2, ry2 = px, py + r_size # router bottom
|
||||
byc = by # block top
|
||||
sx = bxc - px
|
||||
sd = d if sx >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx2:.0f},{ry2:.0f} {rx2 + sd:.0f},{ry2 + d:.0f} '
|
||||
f'{rx2 + sd:.0f},{byc - d:.0f} {bxc:.0f},{byc:.0f}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
pts = _connector_points(rx0, ry0, cx0, cy0)
|
||||
parts.append(
|
||||
f' <polyline points="{pts}" '
|
||||
f'fill="none" stroke="{sc}" stroke-width="1" opacity="0.6"/>'
|
||||
)
|
||||
|
||||
# (PE→HBM BW annotation drawn in the PE→HBM port group section above)
|
||||
|
||||
@@ -705,26 +738,13 @@ 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° stub from router → vertical → 45° into HBM port
|
||||
d = 12 # stub length
|
||||
sx = tgx - rpx
|
||||
sd = d if sx >= 0 else -d
|
||||
if rpy < hbm_y:
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rpx:.0f},{r_edge_y:.0f} {rpx + sd:.0f},{r_edge_y + d:.0f} '
|
||||
f'{rpx + sd:.0f},{tgy - d:.0f} {tgx:.0f},{tgy:.0f}" '
|
||||
f'fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" '
|
||||
f'stroke-dasharray="4,3"/>'
|
||||
)
|
||||
else:
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rpx:.0f},{r_edge_y:.0f} {rpx + sd:.0f},{r_edge_y - d:.0f} '
|
||||
f'{rpx + sd:.0f},{tgy + d:.0f} {tgx:.0f},{tgy:.0f}" '
|
||||
f'fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" '
|
||||
f'stroke-dasharray="4,3"/>'
|
||||
)
|
||||
# Rule-based connector: router → HBM port group
|
||||
pts = _connector_points(rpx, r_edge_y, tgx, tgy)
|
||||
parts.append(
|
||||
f' <polyline points="{pts}" '
|
||||
f'fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.6" '
|
||||
f'stroke-dasharray="4,3"/>'
|
||||
)
|
||||
# BW annotation at midpoint
|
||||
mx = (rpx + tgx) / 2 + 10
|
||||
my = (r_edge_y + tgy) / 2
|
||||
@@ -818,53 +838,27 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
|
||||
f'{conn}</text>'
|
||||
)
|
||||
|
||||
# Connector: router ─45°stub─ straight ─45°stub─ UCIe port
|
||||
# Connector: rule-based router → UCIe port
|
||||
rpx, rpy = mm2px(crx, cry)
|
||||
d = 10
|
||||
if direction == "N":
|
||||
rx, ry = rpx, rpy - r_size
|
||||
tx, ty = lx, cy_box + ch
|
||||
sx = tx - rx
|
||||
sd = d if sx >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx:.0f},{ry:.0f} {rx + sd:.0f},{ry - d:.0f} '
|
||||
f'{rx + sd:.0f},{ty + d:.0f} {tx:.0f},{ty:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "S":
|
||||
rx, ry = rpx, rpy + r_size
|
||||
tx, ty = lx, cy_box
|
||||
sx = tx - rx
|
||||
sd = d if sx >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx:.0f},{ry:.0f} {rx + sd:.0f},{ry + d:.0f} '
|
||||
f'{rx + sd:.0f},{ty - d:.0f} {tx:.0f},{ty:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "W":
|
||||
rx, ry = rpx - r_size, rpy
|
||||
tx, ty = cx + cw, cy_box + ch / 2
|
||||
sy = ty - ry
|
||||
sd = d if sy >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx:.0f},{ry:.0f} {rx - d:.0f},{ry + sd:.0f} '
|
||||
f'{tx + d:.0f},{ry + sd:.0f} {tx:.0f},{ty:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
elif direction == "E":
|
||||
rx, ry = rpx + r_size, rpy
|
||||
tx, ty = cx, cy_box + ch / 2
|
||||
sy = ty - ry
|
||||
sd = d if sy >= 0 else -d
|
||||
parts.append(
|
||||
f' <polyline points="'
|
||||
f'{rx:.0f},{ry:.0f} {rx + d:.0f},{ry + sd:.0f} '
|
||||
f'{tx - d:.0f},{ry + sd:.0f} {tx:.0f},{ty:.0f}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
else:
|
||||
continue
|
||||
pts = _connector_points(rx, ry, tx, ty)
|
||||
parts.append(
|
||||
f' <polyline points="{pts}" '
|
||||
f'fill="none" stroke="{c_color}" stroke-width="1" opacity="0.5"/>'
|
||||
)
|
||||
|
||||
# ── Legend ──
|
||||
ly = h_px - 35
|
||||
|
||||
Reference in New Issue
Block a user