Command-line REPL

Minimal command-line interface for reASITIC.

A tiny REPL that loads a tech file, parses ASITIC-style NAME=VALUE arguments, and runs a subset of the original commands.

Currently supported:

  • LOAD-TECH <path> (alias: T) — load a .tek file

  • Geometry builders: * W NAME=...:LEN=...:WID=...:METAL=... — wire * SQ NAME=...:LEN=...:W=...:S=...:N=...:METAL=... — square spiral * SP NAME=...:RADIUS=...:W=...:S=...:N=...:SIDES=...:METAL=... — polygon spiral * RING NAME=...:RADIUS=...:W=...:METAL=...:SIDES=... — ring * VIA NAME=...:VIA=<idx>:NX=...:NY=...:XORG=...:YORG=... — via * 3DTRANS NAME=...:LEN=...:W=...:S=...:N=...:METAL_TOP=...:METAL_BOTTOM=...:VIA=...

  • Analysis commands: * IND <name> — self-inductance in nH * RES <name> [freq_ghz] — DC (and optional AC) resistance in Ω * Q <name> <freq_ghz> — metal-only quality factor * K <name1> <name2> — mutual inductance / coupling coefficient * 2PORT <name> <f0> <f1> <step> — frequency sweep, prints each f * PI <name> <freq_ghz> — Pi-model L/R/C breakout * ZIN <name> <freq_ghz> [Z_re Z_im] — input impedance with load * SELFRES <name> <f_lo> <f_hi> — self-resonance frequency * CAP <name> — substrate shunt capacitance in F * METAREA <name> — metal area in μm² * LISTSEGS <name> — print all segments * LRMAT <name> [path] — partial-L matrix * SHUNTR <name> <freq_ghz> [S|D] — parallel resistance * PI3 <name> <freq_ghz> [<gnd_name>] — 3-port Pi model * PI4 <name> <freq_ghz> [<pad1> [<pad2>]] — 4-port Pi model * CALCTRANS <pri> <sec> <freq_ghz> — transformer analysis

  • Export / persistence: * SAVE <path> / LOAD <path> — JSON session round-trip * CIFSAVE <path> [name [name ...]] — write CIF * TEKSAVE <path> [name [name ...]] — write Tek/gnuplot dump * SONNETSAVE <path> [name [name ...]] — write Sonnet .son * S2PSAVE <name> <f0> <f1> <step> <path> — Touchstone export

  • Optimisation: * OPTSQ <target_L_nH> <freq_ghz> [metal] — square-spiral OptSq * OPTPOLY <target_L_nH> <freq_ghz> [sides] [metal] — polygon-spiral * OPTAREA <target_L_nH> <freq_ghz> [metal] — minimise footprint * OPTSYMSQ <target_L_nH> <freq_ghz> [metal] — symmetric square * BATCHOPT [<targets_file>] — batch optimise across many points * SWEEP LMIN=...:LMAX=...:...:FREQ=...:[PATH=...] — Cartesian (L, W, S, N) sweep * SPICESAVE <name> <freq_ghz> <path> — emit SPICE Pi-model

  • Misc: * GEOM <name> — geometry summary * LIST — list shapes * QUIT / EXIT

class reasitic.cli.Repl[source]

Bases: object

__init__(tech=None)[source]
Parameters:

tech (Tech | None)

Return type:

None

cmd_load_tech(path)[source]
Parameters:

path (str)

Return type:

None

cmd_wire(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_square(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_spiral(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_ind(name)[source]
Parameters:

name (str)

Return type:

None

cmd_res(name, freq_ghz=None)[source]
Parameters:
Return type:

None

cmd_coupling(name_a, name_b)[source]
Parameters:
Return type:

None

cmd_q(name, freq_ghz)[source]
Parameters:
Return type:

None

cmd_geom(name)[source]
Parameters:

name (str)

Return type:

None

cmd_list()[source]
Return type:

None

cmd_modify_tech_layer(prop, layer_index, value)[source]

MODIFYTECHLAYER <rho|t|eps> <layer> <value> (case 222).

Parameters:
Return type:

None

cmd_cell(*, max_l=0.0, max_w=0.0, max_t=0.0)[source]

CELL [<max_length> <max_width> <max_thickness>] (case 207).

Sets per-direction cell-size limits used by the filament discretiser. We store them on the Repl state for later use.

Parameters:
Return type:

None

cmd_auto_cell(alpha=0.5, beta=1.0)[source]

AUTOCELL <alpha> <beta> (case 212).

Records two scalars used by the filament discretiser to adapt cell size automatically (the binary uses these to scale (alpha)·skin_depth and (beta)·width for cell choice).

Parameters:
Return type:

None

cmd_chip(x=None, y=None)[source]

CHIP [chipx] [chipy] (case 217) — resize the chip extents.

Parameters:
Return type:

None

cmd_eddy(on=None)[source]

CALCEDDY [on|off] (case 221).

Parameters:

on (bool | None)

Return type:

None

cmd_view_set(key, value)[source]

Set a viewport-state field; reported on next LIST.

Parameters:
Return type:

None

cmd_no_op_view(label)[source]

No-op stub for view-related commands (SCALE, PAN, ZOOM, BB, REFRESH, ORIGIN, GRID, SNAP, RULER, SHOWPHASE, etc.). The binary uses these to update the X11 window; we silently accept them so scripts that mix view and analysis commands run without errors.

Parameters:

label (str)

Return type:

None

cmd_pause()[source]

PAUSE (case 216) — wait for keypress (no-op headless).

Return type:

None

cmd_input(path=None)[source]

INPUT [<filename>] (case 215) — redirect stdin from a file.

We just exec the file like EXEC but accept the alias for binary compatibility.

Parameters:

path (str | None)

Return type:

None

cmd_version()[source]
Return type:

None

cmd_help(topic=None)[source]

HELP [topic] — print command help.

Parameters:

topic (str | None)

Return type:

None

cmd_verbose(value=None)[source]

VERBOSE [true|false] — toggle diagnostic output.

Parameters:

value (str | None)

Return type:

None

cmd_timer(value=None)[source]

TIMER [true|false] — toggle per-command timing.

Parameters:

value (str | None)

Return type:

None

cmd_savemat(value=None)[source]

SAVEMAT [true|false] — toggle dumping the L matrix to disk.

Parameters:

value (str | None)

Return type:

None

cmd_log(path=None)[source]

LOG [<filename>] — start/stop logging input + output to a file.

Parameters:

path (str | None)

Return type:

None

cmd_record(path=None)[source]

RECORD [<filename>] — start/stop a macro recording.

Parameters:

path (str | None)

Return type:

None

cmd_exec_script(path)[source]

EXEC <path> — execute commands from a script file.

Parameters:

path (str)

Return type:

None

cmd_cat(path)[source]

CAT <path> — print contents of a file.

Parameters:

path (str)

Return type:

None

cmd_erase(names)[source]

ERASE <name> … — delete one or more shapes.

Parameters:

names (list[str])

Return type:

None

cmd_rename(old, new)[source]

RENAME <old> <new>.

Parameters:
Return type:

None

cmd_copy(src, dst)[source]

COPY <src> <dst>.

Parameters:
Return type:

None

cmd_split(name, index, new_name)[source]

SPLIT <name> <segment_index> <new_name>.

Splits a shape’s polygon list into two halves at the given polygon index, keeping the head as <name> and creating a new shape <new_name> with the tail polygons.

Parameters:
Return type:

None

cmd_join(names)[source]

JOIN <s1> <s2> [<s3> …] — concatenate polygon lists.

The result is stored back into <s1>; the others are deleted from the shapes dict.

Parameters:

names (list[str])

Return type:

None

cmd_movex(name, dx)[source]

MOVEX <name> <dx> — translate in x only.

Parameters:
Return type:

None

cmd_movey(name, dy)[source]

MOVEY <name> <dy> — translate in y only.

Parameters:
Return type:

None

cmd_flip(name)[source]

FLIP <name> — reverse current direction (case 414).

Reverses polygon order and vertex order within each polygon (so the spiral traces in the opposite direction).

Parameters:

name (str)

Return type:

None

cmd_joinshunt(names)[source]

JOINSHUNT <s1> <s2> […] — mark shapes as parallel-friends.

Mirrors case 421. Adds friendship pairs so analysis paths can treat the shapes as a parallel (shunt) combination.

Parameters:

names (list[str])

Return type:

None

cmd_select(name=None)[source]

SELECT [<name>] — highlight a shape (case 422).

Headless mode records the selection but doesn’t draw it.

Parameters:

name (str | None)

Return type:

None

cmd_unselect()[source]

UNSELECT (case 423) — clear the current selection.

Return type:

None

cmd_sptowire(name)[source]

SPTOWIRE <name> — break a spiral into N single-polygon wires.

Mirrors case 424. Useful for analysing each turn of a spiral separately.

Parameters:

name (str)

Return type:

None

cmd_phase(name, sign)[source]

PHASE <name> <+1|-1> — flip current direction (no-op in our simple geometry model; we record the sign on the shape’s orientation field).

Parameters:
Return type:

None

cmd_befriend(name1, name2)[source]

BEFRIEND <s1> <s2> — mark two shapes as electrically connected for analysis (case 417).

We track the friendship pairs in a set on the REPL state; analysis paths can use this to merge segment lists when computing inductance / resistance.

Parameters:
Return type:

None

cmd_unfriend(name1, name2)[source]

UNFRIEND <s1> <s2> — remove the friendship link (case 418).

Parameters:
Return type:

None

cmd_intersect(name)[source]

INTERSECT/FINDI <name> — check if a shape’s polygons self-intersect (case 419).

Parameters:

name (str)

Return type:

None

cmd_hide(names)[source]

HIDE <name> … — toggle visibility (no-op storage flag).

We don’t model the X11 visibility state; HIDE is a no-op included for command-name parity with the binary.

Parameters:

names (list[str])

Return type:

None

cmd_ring(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_via(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_2port_gnd(name, gnd_name, f0, f1, step)[source]

2-port sweep with explicit ground spiral coupling included in the series leg (mirrors case 529, 2PortGnd).

Parameters:
Return type:

None

cmd_2port_pad(name, pad1_name, pad2_name, f0, f1, step)[source]

2-port sweep with pad capacitors at each port (case 530).

Parameters:
Return type:

None

cmd_3port(name, gnd_name, freq_ghz)[source]

3-port reduction to 2-port Y at one frequency (case 536).

Parameters:
Return type:

None

cmd_2port_trans(pri_name, sec_name, f0, f1, step)[source]

2-port transformer sweep (case 524, 2PortTrans).

Reports L_pri, L_sec, M, k, n at every frequency point.

Parameters:
Return type:

None

cmd_2pzin(name, freq_ghz, z_load_re=50.0, z_load_im=0.0)[source]

2-port input impedance with arbitrary load (case 537).

Parameters:
Return type:

None

cmd_2port(name, f0, f1, step)[source]
Parameters:
Return type:

None

cmd_cap(name)[source]
Parameters:

name (str)

Return type:

None

cmd_save(path)[source]
Parameters:

path (str)

Return type:

None

cmd_load(path)[source]
Parameters:

path (str)

Return type:

None

cmd_cifsave(path, names)[source]
Parameters:
Return type:

None

cmd_teksave(path, names)[source]
Parameters:
Return type:

None

cmd_sonnetsave(path, names)[source]
Parameters:
Return type:

None

cmd_spicesave(name, freq_ghz, path)[source]
Parameters:
Return type:

None

cmd_s2psave(name, f0, f1, step, path)[source]
Parameters:
Return type:

None

cmd_move(name, dx, dy)[source]
Parameters:
Return type:

None

cmd_moveto(name, x, y)[source]
Parameters:
Return type:

None

cmd_flipv(name)[source]
Parameters:

name (str)

Return type:

None

cmd_fliph(name)[source]
Parameters:

name (str)

Return type:

None

cmd_rotate(name, angle_deg)[source]
Parameters:
Return type:

None

cmd_report(name, freqs)[source]
Parameters:
Return type:

None

cmd_trans(args)[source]

TRANS: planar two-coil transformer.

Parameters:

args (dict[str, str])

Return type:

None

cmd_balun(args)[source]

BALUN: stacked counter-wound spirals.

Parameters:

args (dict[str, str])

Return type:

None

cmd_capacitor(args)[source]

CAPACITOR: MIM capacitor.

Parameters:

args (dict[str, str])

Return type:

None

cmd_symsq(args)[source]

SYMSQ: symmetric centre-tapped square spiral.

Parameters:

args (dict[str, str])

Return type:

None

cmd_sympoly(args)[source]

SYMPOLY: symmetric centre-tapped polygon spiral.

Parameters:

args (dict[str, str])

Return type:

None

cmd_mmsquare(args)[source]

MMSQUARE: multi-metal series square inductor.

Parameters:

args (dict[str, str])

Return type:

None

cmd_3dtrans(args)[source]
Parameters:

args (dict[str, str])

Return type:

None

cmd_pi2(name, freq_ghz, gnd_name=None)[source]

PI2 <name> <freq> [<gnd>] — same as PI3 but with the binary’s case-515 numbering. Aliased here for parity.

Parameters:
Return type:

None

cmd_2port_x(name, f0, f1, step)[source]

2PORTX <name> <f0> <f1> <step> — sweep using the extended PiX model (case 539). Reports R_sub / C_sub at each f.

Parameters:
Return type:

None

cmd_resishf(name, freq_ghz)[source]

RESISHF <name> <freq_ghz> (case 527).

High-frequency resistance: same as the AC branch of RES. Aliased for binary parity.

Parameters:
Return type:

None

cmd_ccell(max_l=0.0, max_w=0.0)[source]

CCELL [max_l] [max_w] (case 211) — centred-cell constraints.

Unlike CELL, CCELL doesn’t take a thickness; the binary uses it for 2D-only filament discretisation.

Parameters:
Return type:

None

cmd_setmaxnw(value=0)[source]

SETMAXNW [value] (case 218) — set the max sub-filament count.

Parameters:

value (int)

Return type:

None

cmd_sweep_mm(args)[source]

SWEEPMM (case 715) — multi-metal sweep variant of SWEEP.

We treat it as an alias for SWEEP since our SWEEP already accepts a METALS list.

Parameters:

args (dict[str, str])

Return type:

None

cmd_pix(name, freq_ghz)[source]
Parameters:
Return type:

None

cmd_pi(name, freq_ghz)[source]
Parameters:
Return type:

None

cmd_zin(name, freq_ghz, *, z_load=50 + 0j)[source]
Parameters:
Return type:

None

cmd_shuntr(name, freq_ghz, mode='S')[source]
Parameters:
Return type:

None

cmd_pi3(name, freq_ghz, gnd_name=None)[source]
Parameters:
Return type:

None

cmd_pi4(name, freq_ghz, pad1_name=None, pad2_name=None)[source]
Parameters:
  • name (str)

  • freq_ghz (float)

  • pad1_name (str | None)

  • pad2_name (str | None)

Return type:

None

cmd_calctrans(pri_name, sec_name, freq_ghz)[source]
Parameters:
Return type:

None

cmd_selfres(name, f_lo, f_hi)[source]
Parameters:
Return type:

None

cmd_listsegs(name)[source]
Parameters:

name (str)

Return type:

None

cmd_metarea(name)[source]
Parameters:

name (str)

Return type:

None

cmd_lrmat(name, path=None)[source]
Parameters:
  • name (str)

  • path (str | None)

Return type:

None

cmd_sweep(args)[source]

SWEEP NAME=…:LMIN=…:LMAX=…:LSTEP=…:WMIN=…:WMAX=…:WSTEP=… SMIN=…:SMAX=…:SSTEP=…:NMIN=…:NMAX=…:NSTEP=…:FREQ=…:METAL=… [PATH=<output.tsv>]

Parameters:

args (dict[str, str])

Return type:

None

cmd_optsq(target_L_nH, freq_ghz, metal=0)[source]
Parameters:
Return type:

None

cmd_optpoly(target_L_nH, freq_ghz, sides=8, metal=0)[source]
Parameters:
Return type:

None

cmd_optarea(target_L_nH, freq_ghz, metal=0)[source]
Parameters:
Return type:

None

cmd_ldiv(name, n_l, n_w, n_t)[source]

LDIV <name> <n_l> <n_w> <n_t> (case 800).

Print the inductance with given filament discretisation. The binary’s LDIV shows the L matrix split per length / width / thickness; we print the impedance-matrix solve at low freq with the given (n_w, n_t) subdivision (n_l is ignored — we don’t subdivide along length yet).

Parameters:
Return type:

None

cmd_optsympoly(target_L_nH, freq_ghz, sides=8, metal=0)[source]

OPTSYMPOLY (case 714) — symmetric polygon-spiral optimiser.

We implement this as a thin wrapper around the existing polygon-spiral optimiser, treating the SymPoly variant the same as a regular polygon spiral for the purposes of L/Q targeting (the symmetric topology adds a small Q penalty that we don’t model in detail here).

Parameters:
Return type:

None

cmd_optsymsq(target_L_nH, freq_ghz, metal=0)[source]
Parameters:
Return type:

None

cmd_batchopt(path=None)[source]

BatchOpt: read targets from stdin (or file), run OptSq each.

Parameters:

path (str | None)

Return type:

None

execute(line)[source]

Execute one line, catching errors. Returns False on quit.

Parameters:

line (str)

Return type:

bool

reasitic.cli.main(argv=None)[source]

Entry point for the reasitic console script.

Parameters:

argv (list[str] | None)

Return type:

int