Document routing between placed crossings and archive development records

This commit is contained in:
Jan Petykiewicz 2026-11-26 21:37:05 -08:00
commit 2c260e5e95

View file

@ -99,38 +99,37 @@ def _first_route(directory: Path) -> None:
def _placed_crossing(directory: Path) -> None:
(case,) = CASE_GROUPS["crossing-single"]
problem = case.problem
run = route(problem, options=case.options)
assert len(run.results_by_net) == 4
assert all(result.is_valid for result in run.results_by_net.values())
# Match the placed devices and port access in docs/user/route-a-layout.md.
a = box(30, 50, 80, 100)
b = box(260, 90, 310, 140)
a_keepout = a.difference(box(74, 69, 82, 81))
b_keepout = b.difference(box(258, 109, 266, 121))
link = NetSpec("A_east_to_B_west", Port(80, 75, 0), Port(260, 115, 0), width=2)
problem = RoutingProblem((0, 0, 340, 180), (link,), (a_keepout, b_keepout), clearance=4)
options = RoutingOptions(search=SearchOptions(bend_radii=(25,), sbend_radii=(25,)))
result = route(problem, options=options).results_by_net[link.net_id]
assert result.is_valid
assert all(shape.intersection(cell).area == 0 for shape in result.locked_geometry for cell in (a, b))
fig, ax = plt.subplots(figsize=(6.3, 4.5), layout="constrained")
fig, ax = plt.subplots(figsize=(7.1, 3.4), layout="constrained")
_board(ax, problem)
ax.set(xlim=(81, 239), ylim=(102, 218))
ax.plot([146, 174], [160, 160], linestyle="--", color=MUTED, linewidth=1, zorder=3)
ax.plot([160, 160], [146, 174], linestyle="--", color=MUTED, linewidth=1, zorder=3)
ax.set(xlim=(14, 326), ylim=(27, 159))
for name, cell in (("A", a), ("B", b)):
_polygon(ax, cell, fill="none", edge=INK, linestyle="--", linewidth=1.2, zorder=3)
ax.text(cell.centroid.x, cell.centroid.y + 12, f"Crossing {name}", color=INK, fontsize=10, ha="center", va="center")
labels = (
("West leg", (104, 167), (137, 153), "W"),
("East leg", (210, 167), (183, 153), "E"),
("South leg", (173, 115), (167, 132), "S"),
("North leg", (173, 205), (167, 184), "N"),
)
for net, (leg, label_xy, port_xy, port_name) in zip(problem.nets, labels, strict=True):
port = min((net.start, net.target), key=lambda p: abs(p.x - 160) + abs(p.y - 160))
_waveguide(ax, run.results_by_net[net.net_id], color=ROUTE)
_heading(ax, port, 5)
ax.text(*label_xy, leg, color=ROUTE, fontsize=11, ha="center")
ax.text(*port_xy, port_name, color=INK, fontsize=10, weight="bold", ha="center")
_waveguide(ax, result, color=ROUTE)
for label, port, dx, dy in (("A east port", link.start, 14, -13), ("B west port", link.target, -14, 13)):
_heading(ax, port, 10)
ax.text(port.x + dx, port.y + dy, label, color=INK, fontsize=10, ha="left" if dx > 0 else "right")
ax.annotate(
"Device keepout", xy=(144, 176), xytext=(93, 198), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED},
"Port access opening", xy=(76, 79), xytext=(94, 117), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED}, zorder=8,
)
ax.annotate(
"Access slot", xy=(177, 164), xytext=(202, 131), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED},
"External waveguide", xy=(154, 75), xytext=(168, 47), color=ROUTE, fontsize=10,
arrowprops={"arrowstyle": "->", "color": ROUTE},
)
_save(fig, directory, "placed-crossing.png")