Files
mxpic_router/WORK_LOG.md
T
2026-06-04 17:56:28 +00:00

138 lines
6.1 KiB
Markdown

# Backend Routing Work Log - PENG KUN
## 2026-06-02
### Scope
Backend routing generation and GDS build consistency in `mxpic_router`.
### Summary
Recent work focused on improving routing correctness in `mxpic_router/mxpic_router/builder.py`, including route width investigation, rotation convention alignment, and perpendicular routing behavior correction.
### Completed Work
#### 1. Route Width Issue Investigation
A mismatch was identified between the route width configured in the EDA frontend and the width exported into the layout YAML/GDS build flow.
Backend tracing showed that the router consumed the width value from the YAML as expected, while the exported YAML still used the default width in several cases. The issue was isolated to the frontend serialization/export logic and reported to the frontend owner for correction.
#### 2. Frontend/Backend Rotation Convention Alignment
A rotation inconsistency was identified between the EDA canvas representation and the generated GDS layout.
For rotated devices such as resistors, the frontend display and backend placement used different rotation conventions, which caused incorrect component orientation or port direction in the final GDS.
The backend build logic was updated to convert EDA instance rotation into layout rotation during component placement and metadata pin registration, while preserving the original behavior for element-based ports and anchors.
#### 3. Perpendicular Routing Behavior Correction
A routing issue was identified for port pairs with a 90-degree or 270-degree angle difference.
The previous automatic route selection fell back to the generic `bend_p2p` method, which could generate a `bend - diagonal straight - bend` path.
The routing method selection logic was updated so perpendicular port-angle cases use `strt_bend_strt_p2p`, producing the expected `straight - bend - straight` routing style.
### Modified Files
mxpic_router/mxpic_router/builder.py
mxpic_router/tests/test_eda_router_contract.py
## 2026-06-04
### Scope
Backend routing spacing behavior and automatic S-bend refinement in `mxpic_router`.
### Summary
Recent work focused on reducing overlap and crossing risks for grouped automatic S-bend connections while keeping the generated GDS impact limited.
### Completed Work
#### 1. S-Bend Spacing Issue Investigation
A route overlap issue was investigated for layouts containing multiple parallel or near-parallel automatic S-bend routes.
The issue was most visible when several component output ports were connected to several port elements. In these cases, the initial straight section of multiple S-bends could overlap or become too close when source and target ports were arranged in parallel.
#### 2. Conservative `Lstart`-Based S-Bend Adjustment
Spacing control was implemented through the native Nazca `sbend_p2p` `Lstart` parameter.
The backend now groups compatible automatic S-bend routes and assigns different `Lstart` values before route generation. This preserves the native S-bend route style and avoids manually constructed detours.
The adjustment applies only to automatic `sbend_p2p` routes. Manual-point routes, U-bends, perpendicular `strt_bend_strt_p2p` routes, and generic bend routes are left unchanged.
#### 3. Bundle-Level Route Grouping and Ordering
Compatible S-bend routes are grouped by routing direction, xsection, width, and radius. The `Lstart` assignment logic was refined for both same-direction fan-out/fan-in routes and symmetric convergence/divergence routes, so outer routes can receive larger offsets when needed.
#### 4. Width-Aware Spacing Step
The base step is now calculated as:
```text
route width + 10um
```
For example, a 0.5um-wide route uses a 10.5um `Lstart` step, while a 40um-wide route uses a 50um `Lstart` step.
#### 5. Test Coverage Update
Contract tests were added and updated to cover automatic S-bend `Lstart` assignment, bundle-level grouping behavior, route ordering, width-aware spacing, and preservation of earlier rotation and perpendicular-routing fixes.
### Modified Files
mxpic_router/mxpic_router/builder.py
mxpic_router/tests/test_eda_router_contract.py
## 2026-06-05
### Scope
Backend S-bend grouping contract and `Lstart` ordering refinement in `mxpic_router`.
### Summary
Recent work focused on improving automatic S-bend spacing behavior for multi-port routing cases, especially MMI-to-port and resistor-array routing patterns.
### Completed Work
#### 1. Explicit Route Group Metadata Support
Backend support was added for explicit link grouping metadata from the layout YAML.
`LinkSpec` now records the parent bundle name and accepts optional route grouping fields such as `route_group`, `routeGroup`, `group`, `bundle_group`, and `bundleGroup`.
This prepares the backend for future frontend-provided bundle/group selection while preserving the existing geometry-based fallback behavior.
#### 2. S-Bend Stage Grouping Refinement
The S-bend grouping key was refined to avoid mixing routes from different routing stages within the same YAML bundle.
Automatic S-bend routes are now grouped by routing axis, direction, route stage/span, xsection, width, and radius unless an explicit route group is provided.
This prevents separate stages such as component-to-component routes and component-to-port routes from interfering with each other's `Lstart` ordering.
#### 3. Lstart Ordering Correction
The `Lstart` ordering logic was reviewed for resistor-array and MMI-to-port routing cases.
The sorting basis was corrected to use the source-side route coordinate for same-direction fan-out/fan-in routes, and S-bend axis detection was updated to prefer port direction over raw geometric span.
This fixes cases where routes with large vertical offset were incorrectly classified and assigned reversed `Lstart` values.
#### 4. Test Coverage Update
Contract tests were added and updated to cover explicit route group metadata parsing, route-stage separation, MMI-to-port two-output fan-out ordering, width-aware `Lstart` spacing, and preservation of earlier S-bend spacing behavior.
### Modified Files
mxpic_router/mxpic_router/eda_loader.py
mxpic_router/mxpic_router/builder.py
mxpic_router/tests/test_eda_router_contract.py