Skip to content

monostable/replicad

Repository files navigation

replicad

work in progress

Design circuits using Javascript/Typescript.

Goals

  • Confirm Atwood's Law: "Any application that can be written in JavaScript, will eventually be written in JavaScript"
  • Make it easier to design and reason about circuits
  • Offer static analysis and design rule checks to make it hard to introduce errors into your circuit
  • Encourage design re-use
  • Provide an interactive editor and viewer with a visual preview of your circuit

Implementation

work in progress

  • A transform to bind variable names as schematic references
  • A library (in ./lib) that provides classes for circuit description.
  • Creating a circuit involves instantiating the Circuit class and then adding connections to it and exporting it.

Example

import {
  capacitor,
  Circuit,
  ground,
  input,
  output,
  resistor
} from "../lib/index"

const r1 = resistor("1k")
const c1 = capacitor("1uF")

const vin = input()
const vout = output()
const gnd = ground()

const circuit = new Circuit()

circuit.chain(vin, r1, vout, c1, gnd)

export default circuit

Output:

Try it out

npm install
npx ts-node -D7006 -D7016 replicad.ts examples/r_c.ts > out.svg

Related Work

  • PHDL - The PCB hardware description language, an HDL that can be used to generate Eagle, Orcad and other netlists.
  • SKiDL - Extends Python with the ability to design electronic circuits.
  • pycircuit - Ditto, also does footprints, layout and routing. Has some cool experimental support for placement/layout/routing using SMT solvers and has it's own interactive viewer.
  • netlistsvg - The schematic rendering library we will be using for our interactive editor.

About

Design circuits using JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published