From 2d9b2b09831ff5cdb6a5166e69c5f7fac906603b Mon Sep 17 00:00:00 2001 From: PotatoMaxwell Date: Fri, 29 May 2026 23:47:26 +0800 Subject: [PATCH] routing link crossover violation added --- .../mxpic_project_1/mxpic_project_1.svg | 174 ++++++++++++++++++ .../mxpic_project_1/mxpic_project_1.yml | 99 ++++++++++ database/mxpic_data.db | Bin 69632 -> 73728 bytes frontend/canvas.html | 10 +- tests/layout-ui-wiring.test.js | 4 +- 5 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 database/admin/layout/mxpic_project_1/mxpic_project_1.svg create mode 100644 database/admin/layout/mxpic_project_1/mxpic_project_1.yml diff --git a/database/admin/layout/mxpic_project_1/mxpic_project_1.svg b/database/admin/layout/mxpic_project_1/mxpic_project_1.svg new file mode 100644 index 0000000..96ba2e6 --- /dev/null +++ b/database/admin/layout/mxpic_project_1/mxpic_project_1.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/database/admin/layout/mxpic_project_1/mxpic_project_1.yml b/database/admin/layout/mxpic_project_1/mxpic_project_1.yml new file mode 100644 index 0000000..0e6c351 --- /dev/null +++ b/database/admin/layout/mxpic_project_1/mxpic_project_1.yml @@ -0,0 +1,99 @@ +# ============================================= +# mxPIC Cell/Project Definition File +# ============================================= +schema_version: "2.0.0" +kind: cell +coordinate_system: gds_y_up +canvas_size: + width: 5000 + height: 5000 +project: mxpic_project_1 +name: mxpic_project_1 +type: project +version: "1.0.0" + +# 1. External Ports (How this cell connects to the outside world) +ports: [] + +# 2. Instances (The sub-components dropped onto this canvas) +instances: + MMI_1: + component: Silterra/EMO1_2ML_CU_Al_RDL/primitives/multimode_interferometers/1x2MMI_1310nm_TE_Silterra_202603_ZKY_v2 + x: 476.0 + y: -2453.2 + rotation: 0.0 + flip: 0 + flop: 0 + mirror: false + settings: + length: + + MMI_2: + component: Silterra/EMO1_2ML_CU_Al_RDL/primitives/multimode_interferometers/1x2MMI_1310nm_TE_Silterra_202603_ZKY_v2 + x: 723.1 + y: -2241.8 + rotation: 0.0 + flip: 0 + flop: 0 + mirror: false + settings: + length: + + MMI_3: + component: Silterra/EMO1_2ML_CU_Al_RDL/primitives/multimode_interferometers/1x2MMI_1310nm_TE_Silterra_202603_ZKY_v2 + x: 438.9 + y: -2230.2 + rotation: 0.0 + flip: 0 + flop: 0 + mirror: false + settings: + length: + + MMI_4: + component: Silterra/EMO1_2ML_CU_Al_RDL/primitives/multimode_interferometers/1x2MMI_1310nm_TE_Silterra_202603_ZKY_v2 + x: 750.9 + y: -2468.7 + rotation: 0.0 + flip: 0 + flop: 0 + mirror: false + settings: + length: + +elements: + anchor_1: + type: anchor + x: 421.9 + y: -2624.7 + angle: 0.0 + layer: WG_CORE + width: 0.5 + description: "" + +# 3. Bundles (Grouped links for multi-bus/parallel routing) +bundles: + output_bus: + routing_type: euler_bend + links: + - from: MMI_2:a1 + to: MMI_1:b1 + xsection: strip + family: optical + width: 0.45 + radius: 10 + routing_type: euler_bend + - from: anchor_1:right + to: MMI_4:a1 + xsection: strip + family: optical + width: 0.45 + radius: 10 + routing_type: euler_bend + - from: anchor_1:left + to: MMI_3:a1 + xsection: strip + family: optical + width: 0.45 + radius: 10 + routing_type: euler_bend \ No newline at end of file diff --git a/database/mxpic_data.db b/database/mxpic_data.db index c9a734f2b36178bfab2e8b08b431d06a37da1c00..6c8560a6d0de54c20492acc9f1af4c299ffe1be5 100644 GIT binary patch delta 195 zcmZozz|wGlWr8%T1Oo$u&_o4$Mv09HQ|t{iI2oD68B2>(i;9_8fl@sDdw?W^5dUxf zZ~Pzm-|#={|f&({uBI%`1fp9ahSo+22>%~q_X*tzuf@=ULc2smz#lKhcANn zGB5XLL4n^qER8Nr8j~j;c40O$Fq!=DZz+$dm5G^^iD6VDW0U&i3mX$B?>ZvRYX}xK mHi&8rXi}Rl$Hmw_y^oR6h11N+&>SSD3KBcT2GnV28U+9X`#5F* delta 80 zcmZoTz|ydQWr8%TI0FNN;6w#`M)8daQ|$FrI2oD68B2>(i;9_8fl}Q3hkzu5ApdXv jZ~Pzm-|#={|f&({uBI%HY)`z;NN`6-|heaN(vaC diff --git a/frontend/canvas.html b/frontend/canvas.html index bf06dfa..bd3d579 100644 --- a/frontend/canvas.html +++ b/frontend/canvas.html @@ -5181,13 +5181,21 @@ style: view.style, data: { route } }; + const nodeMap = Object.fromEntries(activePage.nodes.map(node => [node.id, node])); + const conflict = findSameTypeRouteCrossing(candidate, activePage.edges, nodeMap, technologyManifest); + if (conflict) { + const source = nodeMap[conflict.conflictEdge.source]?.data?.componentDisplayName || conflict.conflictEdge.source; + const target = nodeMap[conflict.conflictEdge.target]?.data?.componentDisplayName || conflict.conflictEdge.target; + addLog(`Connection rejected: ${route.xsection} route crosses ${source} to ${target}.`); + return; + } setPages(prev => prev.map(p => ( p.id === activePageId ? { ...p, edges: addEdge(candidate, p.edges) } : p ))); addLog(`Connected ${connection.sourceHandle} to ${connection.targetHandle}.`); - }, [activePageId, activePage, rulerMode, currentLinkRoute, addLog]); + }, [activePageId, activePage, rulerMode, currentLinkRoute, technologyManifest, addLog]); const handleRouteEdgeMouseDown = useCallback((event) => { if (rulerMode) return false; diff --git a/tests/layout-ui-wiring.test.js b/tests/layout-ui-wiring.test.js index 8cc46f6..a96b069 100644 --- a/tests/layout-ui-wiring.test.js +++ b/tests/layout-ui-wiring.test.js @@ -92,9 +92,11 @@ assert( canvasHtml.includes('onConnect={handleBasicConnection}') && canvasHtml.includes('nodesConnectable={true}') && canvasHtml.includes('connectionMode="loose"') && + canvasHtml.includes('const conflict = findSameTypeRouteCrossing(candidate, activePage.edges, nodeMap, technologyManifest);') && + canvasHtml.includes('Connection rejected:') && canvasHtml.includes('data: { route }') && canvasHtml.includes('addEdge(candidate, p.edges)'), - 'canvas should use React Flow native pin-to-pin connections for new links' + 'canvas should use React Flow native pin-to-pin connections and reject same-xsection crossings for new links' ); assert( !canvasHtml.includes('linkDraft') &&