Repository navigation
feat(hdl-schematic-editor): add HDL schematic editor demo for Yosys JSON - #82
Open
Geliogabalus wants to merge 4 commits into
Open
Geliogabalus wants to merge 4 commits into
Geliogabalus wants to merge 4 commits into
Conversation
Schematic editor for Yosys JSON netlists built on the workflow-builder architecture (data-driven system/ engine with ELK auto-layout via @joint/layout-elk). - Import/export between Yosys JSON and the diagram data, with bus split/join and constant inference from bit vectors - Cell registry describing the supported Yosys cells (gates, arithmetic, comparison, mux, registers); unknown cells shown as generic blocks - Workflow-builder interactions: port and wire menus, cell picker, drag-to-connect, inspector bound to the data, undo/redo - Live Yosys JSON sidebar highlighting the selected element - KiCad default schematic color theme, bus widths and junction dots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rework the editor from a fixed ELK layout to free placement: - Stencil with all the shapes (drag and drop); nodes can be moved freely, their positions are stored in the diagram data (undoable) - Wires routed with libavoid (@joint/router-avoid), aligned to the grid; junction points where the wires of a net split, one bus width label per net - "Auto layout" toolbar button (ELK), ordered by the diagram data so it matches the layout of a loaded netlist - Pins of all shapes aligned to the paper grid - Collapsible Yosys JSON panel below the inspector (collapsed by default) - Constant hitbox of the wires (hover/selection drawn by a separate path) - Hover tools kept while moving the pointer to them (e.g. the menu button) - Minimal JointJS+ theme (design tokens, Lucide icons) replacing the local copy of the light theme Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New TypeScript demo: a schematic editor for Yosys JSON netlists (
write_jsonoutput). The netlist is shown as a schematic laid out with ELK (@joint/layout-elk), and the Yosys JSON in the left sidebar stays in sync as you edit.How it's built
The demo uses the workflow-builder architecture.
src/system/is copied from workflow-builder with three small changes: the default port ids areA/Y, the ELK options are tuned for schematics (junction points are collected and wire labels are left out of the layout), and there is one new attribute.src/yosys/converts between Yosys JSON and the diagram data.src/registry/describes each supported Yosys cell type in one definition: ports, parameters, shape and parameter mapping. To support another cell type, you add one definition.$not $and $or $xor $xnor $_NAND_ $_NOR_ $add $sub $mul $eq $ne $lt $gt $mux $dff $dffe $adff.+button on wires to insert a cell⋮node menu (change cell type, delete)Note on dependencies
@joint/layout-elk4.4.0 has not been published yet. Like the demos onelk-layout-demos-refactor,package.jsonpoints to the local tarballs:file:../../.packages/joint-layout-elk.tgzplus an override that pins@joint/coreto.packages/joint-core.tgz. Once the package is released, both should switch to registry versions.Testing
tsc --noEmit,eslint, and the webpack build all pass.I ran the example netlist through the converters, saved it and loaded it again; the connections came back the same.
I tested the interactions in a headless browser with Playwright:
No console errors came up.
The example
counter.jsonis written by hand inwrite_jsonformat. It's worth also checking the demo with a netlist that Yosys actually generated.🤖 Generated with Claude Code