updated with github
This commit is contained in:
@@ -1,88 +1,4 @@
|
||||
# mxpic_EDA
|
||||
The EDA coding for the layout for optihk
|
||||
# requirements
|
||||
flask
|
||||
|
||||
# Frontend - backend GDS bridge
|
||||
Each canvas in the fronend should create a same name **.yaml** file.
|
||||
This **.yaml** should contain the following parts.
|
||||
|
||||
- basic description : name, type, version
|
||||
- ports : the output connection ports for this canvas object
|
||||
- instances : the instance objects from **PDK** or other **canvas**, together with their **x, y, a, mirror** informations.
|
||||
- bundles : 1-1 or N-N conenctions that used for auto routing. "***This***" refers to the canvas ports.
|
||||
|
||||
```
|
||||
[ Project Canvas ]
|
||||
│ (Contains instances of Component A and Component B)
|
||||
▼
|
||||
[ Component A Canvas ]
|
||||
│ (Contains instances of DC_2x2 and Ubend)
|
||||
▼
|
||||
[ PDK Primitives ] ──> (Loads raw .gds + physical port data .yml)
|
||||
```
|
||||
|
||||
``` yaml
|
||||
# ==========================================
|
||||
# mxPIC Cell/Project Definition File
|
||||
# ==========================================
|
||||
name: MMI_Splitter_Module # Name of this cell/component/project
|
||||
type: composite # "primitive" (PDK base) or "composite" (hierarchical)
|
||||
version: "1.0.0"
|
||||
|
||||
# 1. External Ports (How this cell connects to the outside world)
|
||||
ports:
|
||||
- name: in0
|
||||
layer: WG_CORE
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
angle: 180.0
|
||||
width: 0.5
|
||||
- name: out0
|
||||
layer: WG_CORE
|
||||
x: 100.0
|
||||
y: 10.0
|
||||
angle: 0.0
|
||||
width: 0.5
|
||||
- name: out1
|
||||
layer: WG_CORE
|
||||
x: 100.0
|
||||
y: -10.0
|
||||
angle: 0.0
|
||||
width: 0.5
|
||||
|
||||
# 2. Instances (The sub-components dropped onto this canvas)
|
||||
instances:
|
||||
mmi_inst1:
|
||||
component: MMI_2x2 # References another PDK cell or composite YAML
|
||||
x: 20.0 # Placement origin X
|
||||
y: 0.0 # Placement origin Y
|
||||
rotation: 0.0 # Rotation angle in degrees
|
||||
mirror: false # True/False for layout mirroring
|
||||
settings: # Local parameter overrides if parametric
|
||||
length: 25.5
|
||||
|
||||
ubend_top:
|
||||
component: Ubend
|
||||
x: 60.0
|
||||
y: 5.0
|
||||
rotation: 0.0
|
||||
mirror: false
|
||||
|
||||
ubend_bottom:
|
||||
component: Ubend
|
||||
x: 60.0
|
||||
y: -5.0
|
||||
rotation: 0.0
|
||||
mirror: true # Flipped for symmetrical routing
|
||||
|
||||
# 3. Bundles (Grouped links for multi-bus/parallel routing)
|
||||
bundles:
|
||||
output_bus:
|
||||
routing_type: euler_bend # Metadata for the backend router
|
||||
links:
|
||||
- from: ubend_top:out0
|
||||
to: this:out0
|
||||
- from: ubend_bottom:out0
|
||||
to: this:out1
|
||||
```
|
||||
flask
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
+35
@@ -0,0 +1,35 @@
|
||||
name: EC_SiN400_1310_1p0dB_L635_A0_QY_202604
|
||||
foundry: Silterra
|
||||
process: EMO1_2ML_Cu_RDL
|
||||
year: '2026'
|
||||
type: primitive
|
||||
dependency: None
|
||||
maturity: development
|
||||
tapeout_history:
|
||||
- run: Silterra_EMO1_2ML_Cu_RDL_2026_Q2
|
||||
status: Pending testing
|
||||
center_wavelength: 1310
|
||||
version: 1.0
|
||||
designer: Qin Yue
|
||||
update_notes: New SiN edge couplers with high efficiency
|
||||
ports:
|
||||
a1:
|
||||
x: -642.6
|
||||
y: 0.0
|
||||
a: 180.0
|
||||
width: 0.7
|
||||
b0:
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
a: 0.0
|
||||
width: None
|
||||
a0:
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
a: 180.0
|
||||
width: 0.0
|
||||
time: 20260505-170136
|
||||
box_size:
|
||||
- 646.0
|
||||
- 75.0
|
||||
file_size: 1.36 KB
|
||||
@@ -0,0 +1,17 @@
|
||||
level : 4
|
||||
|
||||
root :
|
||||
- PDK_libs
|
||||
- primitives
|
||||
- directional_couplers
|
||||
- edge_couplers
|
||||
- crossings
|
||||
- multimode_interferometers
|
||||
- photodectors
|
||||
- compotites
|
||||
- MZIs
|
||||
- electronics
|
||||
- resistors
|
||||
- capacitors
|
||||
- others
|
||||
- logos
|
||||
@@ -0,0 +1,62 @@
|
||||
# =============================================
|
||||
# mxPIC Cell/Project Definition File
|
||||
# =============================================
|
||||
name: comp_1
|
||||
type: composite
|
||||
version: "1.0.0"
|
||||
|
||||
# 1. External Ports (How this cell connects to the outside world)
|
||||
ports:
|
||||
- name: in0
|
||||
layer: WG_CORE
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
angle: 180.0
|
||||
width: 0.5
|
||||
- name: out0
|
||||
layer: WG_CORE
|
||||
x: 100.0
|
||||
y: 10.0
|
||||
angle: 0.0
|
||||
width: 0.5
|
||||
- name: out1
|
||||
layer: WG_CORE
|
||||
x: 100.0
|
||||
y: -10.0
|
||||
angle: 0.0
|
||||
width: 0.5
|
||||
|
||||
# 2. Instances (The sub-components dropped onto this canvas)
|
||||
instances:
|
||||
component_1:
|
||||
component: EMO1_2ML_CU_Al_RDL/composite/Mach_Zender_modulators/MZM_800G_L3000_GSSG_TRAIL_TypeX5_QY_v1_20260303
|
||||
x: 100.0
|
||||
y: 100.0
|
||||
rotation: 0.0
|
||||
mirror: false
|
||||
settings:
|
||||
length:
|
||||
|
||||
component_2:
|
||||
component: EMO1_2ML_CU_Al_RDL/electronics/inductors/INDC_200pH_SiNPP_QY_202604
|
||||
x: 400.0
|
||||
y: 100.0
|
||||
rotation: 0.0
|
||||
mirror: false
|
||||
settings:
|
||||
length:
|
||||
|
||||
component_3:
|
||||
component: EMO1_2ML_CU_Al_RDL/electronics/pads/Spec_PADs_ABCD_292_P125_250_W80_80_QY_20260324
|
||||
x: 700.0
|
||||
y: 100.0
|
||||
rotation: 0.0
|
||||
mirror: false
|
||||
settings:
|
||||
length:
|
||||
|
||||
# 3. Bundles (Grouped links for multi-bus/parallel routing)
|
||||
bundles:
|
||||
output_bus:
|
||||
routing_type: euler_bend
|
||||
links:
|
||||
Binary file not shown.
+45
-105
@@ -1,103 +1,3 @@
|
||||
# import os
|
||||
# import yaml
|
||||
# from collections import OrderedDict
|
||||
# from flask import Flask, jsonify, send_from_directory, request, redirect, url_for, session, render_template
|
||||
# from werkzeug.security import check_password_hash
|
||||
# import database # Imports the database.py you created earlier
|
||||
|
||||
# # --- Path Configurations ---
|
||||
# BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
# FRONTEND_DIR = os.path.join(BASE_DIR, '..', 'frontend')
|
||||
|
||||
# # Use os.path.join exclusively for cross-platform safety
|
||||
# YML_PATH = os.path.join(BASE_DIR, '..', 'mxpic', 'PDKs', 'Silterra', 'directories.yaml')
|
||||
# COMPS_ROOT = os.path.join(BASE_DIR, '..', 'mxpic', 'PDKs', 'Silterra')
|
||||
|
||||
# # Initialize Flask, pointing to the frontend folder for HTML/CSS/JS
|
||||
# app = Flask(__name__, template_folder=FRONTEND_DIR, static_folder=FRONTEND_DIR)
|
||||
# app.secret_key = 'super_secret_mxpic_key' # Required for session management
|
||||
# app.json.sort_keys = False # Keep dictionary order
|
||||
|
||||
# # Ensure database tables exist when the server boots
|
||||
# database.init_db()
|
||||
|
||||
# # --- YAML & PDK Parsing Helper Functions (Unchanged) ---
|
||||
# def countSpaces(line):
|
||||
# """Count leading spaces (tab=4)."""
|
||||
# expanded = line.expandtabs(4)
|
||||
# return len(expanded) - len(expanded.lstrip(' '))
|
||||
|
||||
# def buildTree(filepath):
|
||||
# """Build nested tree from indented yaml."""
|
||||
# if not os.path.exists(filepath):
|
||||
# return OrderedDict()
|
||||
|
||||
# with open(filepath, 'r', encoding='utf-8') as f:
|
||||
# lines = f.readlines()
|
||||
|
||||
# rootIdx = None
|
||||
# for i, line in enumerate(lines):
|
||||
# if line.strip().startswith('root') and ':' in line.strip():
|
||||
# rootIdx = i
|
||||
# break
|
||||
# if rootIdx is None:
|
||||
# return OrderedDict()
|
||||
|
||||
# entries = []
|
||||
# for line in lines[rootIdx + 1:]:
|
||||
# stripped = line.strip()
|
||||
# if not stripped or stripped.startswith('#'):
|
||||
# continue
|
||||
# if stripped.startswith('- '):
|
||||
# spaceNum = countSpaces(line)
|
||||
# # FIX 1: Strip trailing colons off the string so 'composites:' becomes 'composites'
|
||||
# name = stripped[2:].strip().rstrip(':')
|
||||
# if name:
|
||||
# entries.append((spaceNum, name))
|
||||
|
||||
# if not entries:
|
||||
# return OrderedDict()
|
||||
|
||||
# minIndent = min(indent for indent, _ in entries)
|
||||
# nest = OrderedDict()
|
||||
# levelStack = [(minIndent - 1, nest)]
|
||||
|
||||
# for spaceNum, name in entries:
|
||||
# while levelStack and levelStack[-1][0] >= spaceNum:
|
||||
# levelStack.pop()
|
||||
# parent = levelStack[-1][1]
|
||||
# child = OrderedDict()
|
||||
# parent[name] = child
|
||||
# levelStack.append((spaceNum, child))
|
||||
|
||||
# return nest
|
||||
|
||||
# def addCompsToTree(compMap):
|
||||
# """
|
||||
# Build a completely fresh tree from scratch and insert component nodes.
|
||||
# No previous tree object or inspection required.
|
||||
# """
|
||||
# # Initialize a clean, empty root tree
|
||||
# fresh_tree = OrderedDict()
|
||||
|
||||
# for pathSeg, compItem in compMap.items():
|
||||
# compName = compItem['folder']
|
||||
# curNode = fresh_tree
|
||||
|
||||
# # Sequentially build the nested path segments dynamically
|
||||
# for seg in pathSeg:
|
||||
# if seg not in curNode:
|
||||
# curNode[seg] = OrderedDict()
|
||||
# curNode = curNode[seg]
|
||||
|
||||
# # Place the component metadata dictionary into its leaf node
|
||||
# curNode[compName] = OrderedDict({
|
||||
# "__type__": "component",
|
||||
# "__name__": compName,
|
||||
# "__yml__": compItem['yml']
|
||||
# })
|
||||
|
||||
# return fresh_tree
|
||||
|
||||
import os
|
||||
import yaml
|
||||
@@ -105,6 +5,7 @@ from collections import OrderedDict
|
||||
from flask import Flask, jsonify, send_from_directory, request, redirect, url_for, session, render_template
|
||||
from werkzeug.security import check_password_hash
|
||||
import database
|
||||
from flask import Response
|
||||
|
||||
# --- Path Configurations ---
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -115,6 +16,10 @@ COMPS_ROOT = os.path.join(BASE_DIR, '..', 'mxpic', 'PDKs', 'Silterra')
|
||||
# Define where your new icons folder is located (adjust if it's placed elsewhere)
|
||||
ICONS_DIR = os.path.join(BASE_DIR, 'icons')
|
||||
|
||||
#build layout save path
|
||||
SAVE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'generated_layouts')
|
||||
|
||||
|
||||
app = Flask(__name__, template_folder=FRONTEND_DIR, static_folder=FRONTEND_DIR)
|
||||
app.secret_key = 'super_secret_mxpic_key'
|
||||
app.json.sort_keys = False
|
||||
@@ -175,18 +80,22 @@ def addCompsToTree(compMap):
|
||||
@app.route('/api/icon/<category>')
|
||||
def getIcon(category):
|
||||
"""Serve the icon corresponding to the component category."""
|
||||
# Look for an image matching the category name (e.g., edge_coupler.png)
|
||||
for ext in ('.png', '.svg', '.jpg'):
|
||||
icon_path = os.path.join(ICONS_DIR, f"{category}{ext}")
|
||||
if os.path.exists(icon_path):
|
||||
return send_from_directory(ICONS_DIR, f"{category}{ext}")
|
||||
|
||||
# Optional: Return a default fallback icon if the specific one is missing
|
||||
fallback = os.path.join(ICONS_DIR, "default.png")
|
||||
if os.path.exists(fallback):
|
||||
return send_from_directory(ICONS_DIR, "default.png")
|
||||
|
||||
return jsonify({"error": "Icon not found"}), 404
|
||||
|
||||
# return png if not found
|
||||
transparent_png = (
|
||||
b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01'
|
||||
b'\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\nIDATx\x9cc\x00\x01'
|
||||
b'\x00\x00\x05\x00\x01\r\n\xf4\xc0\x00\x00\x00\x00IEND\xaeB`\x82'
|
||||
)
|
||||
return Response(transparent_png, mimetype='image/png')
|
||||
|
||||
# ... [Keep existing API routes below] ...
|
||||
|
||||
@@ -249,6 +158,33 @@ def logout():
|
||||
session.clear()
|
||||
return redirect(url_for('home'))
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route('/api/save-layout', methods=['POST'])
|
||||
def save_layout():
|
||||
try:
|
||||
data = request.get_json()
|
||||
filename = data.get('filename', 'layout.yaml')
|
||||
content = data.get('content', '')
|
||||
|
||||
os.makedirs(SAVE_DIR, exist_ok=True)
|
||||
|
||||
save_path = os.path.join(SAVE_DIR, filename)
|
||||
|
||||
with open(save_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
return jsonify({
|
||||
"message": "successfully saved",
|
||||
"path": save_path
|
||||
}), 200
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
|
||||
|
||||
# --- API ROUTES (Library & Components) ---
|
||||
@app.route('/api/library')
|
||||
def getLib():
|
||||
@@ -284,4 +220,8 @@ def getCompImg(component_name):
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Starting mxpic EDA Server on http://127.0.0.1:3000")
|
||||
app.run(host='127.0.0.1', port=3000, debug=True)
|
||||
app.run(host='127.0.0.1', port=3000, debug=True)
|
||||
|
||||
|
||||
|
||||
|
||||
+1635
-279
File diff suppressed because it is too large
Load Diff
@@ -126,10 +126,10 @@
|
||||
.toggle-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.2em;
|
||||
font-size: 1.5em;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: 2px 6px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Canvas with PDK Library – Component Name & Rotation</title>
|
||||
<title>Canvas</title>
|
||||
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
|
||||
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
|
||||
<script src="https://unpkg.com/reactflow@11/dist/umd/index.js" crossorigin></script>
|
||||
|
||||
+20
-10
@@ -1,12 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard</title>
|
||||
<!-- Importing a clean, modern font -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
|
||||
|
||||
|
||||
<style>
|
||||
/* Base Dark Theme for EDA */
|
||||
:root {
|
||||
@@ -60,7 +61,8 @@
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
color: #ef4444; /* Red hover for logout */
|
||||
color: #ef4444;
|
||||
/* Red hover for logout */
|
||||
}
|
||||
|
||||
/* Main Content Container */
|
||||
@@ -137,7 +139,7 @@
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
transition: background-color 0.2s ease, transform 0.1s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -163,6 +165,7 @@
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Top Navigation -->
|
||||
@@ -174,7 +177,7 @@
|
||||
<!-- Main Dashboard -->
|
||||
<div class="container">
|
||||
<h2>Welcome back, <strong>{{ username }}</strong>!</h2>
|
||||
|
||||
|
||||
<div class="section-title">Your Recent Layouts</div>
|
||||
<ul class="project-list">
|
||||
<li class="project-card">
|
||||
@@ -186,19 +189,26 @@
|
||||
Ring_Modulator_Test.gds
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<!-- Canvas Link -->
|
||||
<form action="/canvas" method="GET" class="new-project-form">
|
||||
<button type="submit" class="new-project-btn">
|
||||
<span>+</span> New PIC Layout
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- System Footer -->
|
||||
<footer>
|
||||
Powered by mxpic core
|
||||
</footer>
|
||||
|
||||
<div class="new-project-form" style="margin-top: 15px;">
|
||||
<button type="button" class="new-project-btn" onclick="location.href='/open-project'">
|
||||
Open Project
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- System Footer -->
|
||||
<footer>
|
||||
Powered by mxpic core
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user