Skip to content

gdsfactory/schelectron

 
 

Repository files navigation

schelectron logo

schelectron

A VSCode Editor for End-to-End Analog/RF IC Design

Build Docs Python

schelectron is an open-source schematic capture and symbol design tool built as a VSCode extension. It uses an SVG-based file format that's portable, git-friendly, and viewable anywhere.

Jump to Installation | Development | Roadmap


Features

Hierarchical Schematic Design

  • Design Hierarchy View: Visual tree representation of your full design structure in the sidebar
  • Script Integration: Python generator scripts (.py) integrate directly with the hierarchy
  • Automatic Symbol Linking: Scripts automatically link to symbols via naming convention (Name.py → Name.sym.svg)

Integrated Symbol Editor

  • Drawing Tools: Lines, rectangles, circles, and text with click-to-click placement
  • Port Status Panel: Color-coded indicators showing port mapping between symbols and schematics
  • Double-Click Navigation: Jump directly to associated schematics or generator scripts

Schematic Editor

  • Wire Drawing: Intuitive wire routing with single-click termination
  • PDK Component Browser: Sidebar-based component selector for PDK primitives
  • Power Ports: Built-in VSS/VDD port support

Python Generator Integration

  • Hdl21 Compatible: Schematics import seamlessly into Hdl21-based Python programs
  • Script Templates: Create new generator scripts with HDL21 templates
  • Validation: Visual indicators for script and symbol consistency

Why SVG?

schelectron schematics are not like SVGs—they are SVGs.

  • Single File: Each schematic is one file. No dependencies, no linked database.
  • Universal: Any browser, any OS can render them. GitHub displays them natively.
  • Git-Friendly: Text-based format diffs and merges cleanly.
  • Extensible: Embed custom annotations, layout intent, or links to related documents.

Schematics use the .sch.svg extension. Symbols use .sym.svg. The VSCode extension automatically opens these in the appropriate editor mode.


Installation

Building the VSCode Extension

The editor requires Yarn as its only dependency.

On macOS:

brew install yarn

On Debian/Ubuntu:

sudo apt install nodejs npm
sudo npm install -g n && sudo n stable

Build and install:

cd Hdl21SchematicEditor/packages/VsCodePlugin/
yarn
yarn package
code --install-extension hdl21-schematics-vscode-0.0.1.vsix

Python Importer

The Python importer enables importing schematics as Hdl21 generators:

pip install hdl21schematicimporter

Usage:

import hdl21schematicimporter

# Import a schematic as a generator
from . import my_circuit  # imports my_circuit.sch.svg

The SVG Schematic Schema

SVG schematics are interpreted by two categories of programs:

  1. General-purpose viewers (browsers, InkScape) that render them as pictures
  2. Circuit importers that extract connectivity and device information

This section specifies the schema for circuit importers.

Schematic Structure

Each schematic is an SVG element stored in a .sch.svg file:

<?xml version="1.0" encoding="utf-8"?>
<svg width="1600" height="800" xmlns="http://www.w3.org/2000/svg">
  <!-- Content -->
</svg>

Size: Default is 1600x800 pixels. Dictated by width and height attributes.

Coordinates: Origin at top-left, x increases right, y increases down. All elements placed on a 10x10 pixel grid.

Schematic Elements

Each schematic contains four types of elements:

  • Instances: Circuit element placements
  • Wires: Connections between elements
  • Ports: External interface annotations
  • Dots: Junction indicators for wire connections

Instances

Instances are SVG groups with class hdl21-instance:

<g class="hdl21-instance" transform="matrix(1 0 0 1 X Y)">
    <g class="hdl21-elements-nmos">
        <!-- Symbol graphics -->
    </g>
    <text class="hdl21-instance-name">inst_name</text>
    <text class="hdl21-instance-of">Nmos(w=1*µ, l=20*n)</text>
</g>

Fields:

  • name: Unique instance identifier
  • of: Python code string defining the device type
  • kind: Element type (from the symbol class)

Wires

Wires are SVG groups with class hdl21-wire:

<g class="hdl21-wire">
    <path class="hdl21-wire" d="M 100 150 L 100 350 L 200 350" />
    <text class="hdl21-wire-name">net1</text>
</g>

Wire paths follow Manhattan routing (orthogonal segments only). Wires with the same name are connected.

Ports

Ports annotate wires as external interfaces:

<g class="hdl21-port" transform="matrix(1 0 0 1 X Y)">
    <g class="hdl21-ports-input">
        <!-- Symbol graphics -->
    </g>
    <text class="hdl21-port-name">portname</text>
</g>

Dots

Dots indicate wire junctions:

<circle cx="100" cy="200" class="hdl21-dot" />

Dots are visual aids only—they don't affect circuit semantics.

Orientation

Elements support 8 orientations: 4 rotations × optional reflection. Encoded in the SVG matrix transform:

a b c d Rotation Reflected
1 0 0 1 No
0 1 -1 0 90° No
-1 0 0 -1 180° No
0 -1 1 0 270° No
1 0 0 -1 Yes
0 1 1 0 90° Yes
-1 0 0 1 180° Yes
0 -1 -1 0 270° Yes

Element Library

The built-in element library includes SPICE primitives: NMOS, PMOS, NPN, PNP, resistors, capacitors, inductors, diodes, and voltage/current sources.

Each element defines:

  • A pictorial symbol
  • A list of named, located ports

The of string on each instance determines the actual device—symbols are technology-agnostic.


Development

Quick Start

VSCode Extension (debug mode):

cd Hdl21SchematicEditor/packages/VsCodePlugin/
yarn
yarn watch
# Press F5 in VSCode to launch debug mode

Or open the repository root in VSCode and press F5.

Python Importer:

cd Hdl21SchematicImporter
pip install -e ".[dev]"
pytest

Project Structure

The editor is a TypeScript monorepo:


Roadmap

schelectron is building toward end-to-end analog/RF IC design:

  • SPICE/FDTD simulation integration
  • GDSFactory pcell conversion
  • Layout editing capabilities
  • DRC/LVS/PEX tooling

Contributors

Thanks to these wonderful people who have contributed to this project:

Dan Fritchman
Dan Fritchman

💻 📖 🎨 🤔 🚧
Arya Reais-Parsi
Arya Reais-Parsi

💻
Zeyi Wang
Zeyi Wang

💻
Thomas Pluck
Thomas Pluck

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

About

A VSCode Editor for End-to-End Analog/RF IC Design

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 86.6%
  • Python 9.6%
  • JavaScript 3.4%
  • Other 0.4%