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.tekfileGeometry 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 analysisExport / 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 exportOptimisation: *
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-modelMisc: *
GEOM <name>— geometry summary *LIST— list shapes *QUIT/EXIT
- class reasitic.cli.Repl[source]¶
Bases:
object- cmd_modify_tech_layer(prop, layer_index, value)[source]¶
MODIFYTECHLAYER <rho|t|eps> <layer> <value> (case 222).
- 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.
- 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).
- cmd_eddy(on=None)[source]¶
CALCEDDY [on|off] (case 221).
- Parameters:
on (bool | None)
- 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_input(path=None)[source]¶
INPUT [<filename>] (case 215) — redirect stdin from a file.
We just exec the file like
EXECbut accept the alias for binary compatibility.- Parameters:
path (str | None)
- 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_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.
- 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.
- 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.
- 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_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
orientationfield).
- 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.
- 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.
- 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).
- cmd_2port_pad(name, pad1_name, pad2_name, f0, f1, step)[source]¶
2-port sweep with pad capacitors at each port (case 530).
- cmd_3port(name, gnd_name, freq_ghz)[source]¶
3-port reduction to 2-port Y at one frequency (case 536).
- 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.
- 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).
- 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.
- 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.
- 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.
- 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.
- 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.
- cmd_sweep(args)[source]¶
SWEEP NAME=…:LMIN=…:LMAX=…:LSTEP=…:WMIN=…:WMAX=…:WSTEP=… SMIN=…:SMAX=…:SSTEP=…:NMIN=…:NMAX=…:NSTEP=…:FREQ=…:METAL=… [PATH=<output.tsv>]
- 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).
- 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).