Compiler correctness for circuits
· Joe Cuffney
The core idea behind etch is simple. A circuit is code. Code has a grammar. And code that breaks the rules doesn't build.
This post explains what that means in practice, what etch checks, and why I think it beats an AI that draws a schematic and hopes for the best.
A circuit is a program
When you give etch a prompt, it doesn't draw lines on a canvas. It writes the circuit as code in a language with a defined grammar. Parts, pins, and nets are all named things in that code.
That choice gives me something a drawing can't: a build step. Before a design turns into a schematic, it has to pass the same kind of checks a compiler runs on a program. If it fails, it fails loudly, with an error that points at a line.
| Software | etch |
|---|---|
| Source code | Circuit code |
| Syntax error | Grammar error |
| Unknown import | Part number that doesn't exist or can't be bought |
| Type error | Pin or rating that doesn't match the datasheet |
| Lint or static analysis | Electrical rules, like floating pins |
| Binary | Verified schematic |
What gets checked
etch runs its checks in layers. A design has to clear all of them.
- Grammar. The code has to parse. A missing bracket or a bad keyword stops the build.
- Real parts. Every part has to be a real part number that you can buy.
- Datasheet facts. Pin names and ratings are checked against processed datasheets. If the code uses a pin the part doesn't have, that's an error.
- Electrical rules. Things like a pin left floating, or a net with nothing driving it.
None of these checks depend on the model being right. They are rules. The model writes the code, and the rules decide whether it passes.
An example error
Say you ask for a status LED on a microcontroller pin. The model writes the LED and the resistor, but forgets to tie the LED's cathode to ground. Here is a simplified version of the code:
let d1 = led("D1", part = "...");
let r1 = resistor("R1", ohms = 330);
connect(mcu.pa5, r1.a);
connect(r1.b, d1.a);
// d1.k is never connected
The build stops with an error like this:
error[E101]: pin D1.K is not connected (src/main.rs:23:9)
It names the pin. It names the line. There's no guessing about where the problem is.
The fix is one line:
connect(d1.k, gnd);
Run the checks again, and the design passes. Only then does etch produce a schematic.
The model can read this error too. That's important. An error with a code, a pin name, and a location is something the model can act on. It fixes the line and tries again, the same way you would.
Why this beats "draw and hope"
An AI that draws a schematic directly has no build step. It produces a picture. The picture might look right. Whether it is right depends on whether the model got every pin, every part, and every net correct, with nothing to catch it if it didn't.
In software, nobody would accept that. We don't ship code that hasn't compiled. Hardware should be held to a higher bar, not a lower one, because mistakes cost more. A wrong pin can mean a board that doesn't work and another order from the fab.
Here is how the two approaches compare:
| Draw and hope | Code and check | |
|---|---|---|
| Output | A picture | Code, then a schematic |
| Mistakes | Found by you, later | Found by the checks, first |
| Error location | You have to look | Named pin and line |
| Model can fix itself | Hard to say what to fix | Reads the error and retries |
| Design file | Tool specific | Plain text you can read and diff |
What checks can't do
I want to be honest about limits. Checks catch broken rules. They can't tell you if the circuit does what you meant. A design can pass every check and still be the wrong design for your project.
So you still review the result. The difference is that you review a design that already follows the rules, instead of hunting for a floating pin by eye.
Try it
Designing in etch is free, and the alpha does prompt to schematic today. Next on the roadmap is schematic to PCB. If you want to see the checks for yourself, join the waitlist.