API
A (formal) overview of syntax
#
The syntax#
The semanticsmake-circuit
#
Grow your circuit withThis syntax makes it easy to define a composite. The syntax is:
This declares a circuit, with external pins named o1
and o2
respectively. It
contains a resistor, a capacitor, and a crystal, lined together linearly. In the
meantime, the physical layout is defined as horizontally append the three
components.
To make the circuit capable of using line connection syntax, define the left
and right
external pins and connect accordingly. E.g.
#
Connection syntax and semanticsComposing circuit is the process of combining smaller circuits and atoms with
netlist. There are 4 syntax for composing Composites. The return value is a
Composite that contains the used components, and the external pin for the
returned Composite is denoted as out.X
.
The line connection:
Results in the netlist:
The split connection:
results in the netlist:
The vectorized connection:
results in the netlist:
Note that the vector supports two slightly different syntax: the component can
be write once. I.e. (a [1 2 3])
is equivalent to ([a.1 a.2 a.3])
.
And finally the netlist syntax:
results in the netlis:
#
Layout co-designThe layout is inspired by racket's functional picture library. The following combinators are provided:
The *-append
family of functions append its arguments horizontally or
vertically:
The *-superimpose
family of functions overlap its arguments.
You can also rotate or pin-over at a absolute location in terms of (x,y) coordinates:
#
Visualization and exportingThe layout can be visualized via
To export KiCAD files, use circuit-export
:
The arguments:
#:auto-place
determins whether to run placement engine. This requires a backend placement engine running on specific port (by default 8082)#:formats
: this is a list of export formats- kicad: kicad_pcb file
- dsn: Spectre DSN
- ses: run freerouting on dsn. This requires dsn is exported, freerouting.jar executable can be found, and you are running a GUI session so that the freerouting.jar window can pop up (which means it cannot run in jupyter notebook)