Engineering2 min read

Plain-text schematics that merge object by object

Placeholder

Two or three sentences: a schematic file that git can merge is rare, and why the author wanted one. The author writes this.

What is in a .shcomp

A Schemify design is plain text. This is a whole cell: a buffer built from two instances of an inverter sub-cell.

schemify 1 shcomp
  doc "Two-inverter buffer: an inverter cell used as a hierarchical sub-cell"

pin IN in -40 0
pin OUT out 40 0

impl sch schematic

inst x00001 ./inv
  at 0 0 R0
  name x1

wire w00001 40 0 100 0

Drawn out, the cell is two inverters in series:

There are three kinds of file:

KindHoldsExample
.shprima symbol and its device definition (SPICE, Verilog-A or Verilog)a PDK transistor
.shcompa symbol, its schematic and a docs pagean OTA, an inverter
.shbencha schematic, a docs page, the simulation setup and SPICE codea testbench, the only kind you can run

One line per object

Placeholder

Explain the stable ids (x00001, w00001) and the sort order, and why moving a part changes exactly one line. Show the diff below in context.

  inst x00001 ./inv
-   at 0 0 R0
+   at 40 0 R0
    name x1

The merge driver

branch amoves x1branch bresizes M1merge-driverota.shcomp
Fig. 1Two branches change different objects in the same file. The driver merges them object by object, so neither change is lost.

# register the merge driver in this clone
schemify git-setup
# object-level diff of two design files
schemify diff a.shcomp b.shcomp

Every command follows the same exit-code convention,1 so the driver fits into scripts and CI.

Placeholder

Walk through a real conflict: both branches touching the same object, and what the driver reports.

Canonical form

schemify fmt rewrites files in canonical form, and schemify fmt --check fails if a file is not, which is a cheap CI gate.

Placeholder

Say why a canonical form matters for diffs, and what it normalises.

Why opening a file runs nothing

Designs are pure data. Simulator commands live in your own config and in plugins, never in a file someone sent you.2

Placeholder

The author’s view on why this matters when designs move between teams and companies.


  1. The CLI exits 0 on success, 1 on design errors and 2 on usage or I/O errors, so scripts can tell them apart. From the command-line reference in the Schemify README. ↩︎

  2. Plugins run sandboxed with the permissions you grant, so a plugin cannot spawn a simulator unless you allowed it, for example with spawn:ngspice in your init.lua. ↩︎