Exports

CIF (Caltech Intermediate Format) exporter.

CIF is a 1970s-era ASCII layout format still in use as the lingua franca for academic IC tooling and as a Sonnet/Mosis input. The binary’s CIFSAVE command (case 300) emits this format.

The format is line-oriented with semicolon terminators:

DS 1 1 1;             // start a symbol, scale=1/1
L NM3;                // switch to layer NM3
B 100 50 0 0;         // box of width 100, height 50, centred at (0,0)
P 0 0 100 0 100 50 0 50 0 0;   // polygon path
DF;                   // end symbol
C 1;                  // call symbol 1
E                     // end of file

We use the polygon P form because it preserves arbitrary spiral geometry. Each metal layer becomes a separate L directive named after the metal in the tech file (uppercased, prefixed with N).

Coordinates default to centi-microns (1 unit = 0.01 μm), matching the convention most downstream tools expect.

reasitic.exports.cif.write_cif(shapes, tech, *, symbol_id=1, scale_a=1, scale_b=1, units_per_um=100)[source]

Render shapes to a CIF string.

Parameters:
Return type:

str

reasitic.exports.cif.write_cif_file(path, shapes, tech, **kwargs)[source]

Write the CIF rendering of shapes to path.

Parameters:
Return type:

None

reasitic.exports.cif.read_cif(text, tech, *, units_per_um=100)[source]

Parse a CIF string back into reasitic Shapes.

Supports the subset emitted by write_cif(): DS symbol open, L <name> layer switch, P <coords> polygon, DF symbol close, C <id> symbol call, E end of file. All other CIF directives are silently skipped.

The polygon’s metal layer is resolved from the L name by matching against the tech file’s metal names (case-insensitive, with a leading N stripped). Unknown layers fall back to metal 0.

Parameters:
Return type:

list[Shape]

reasitic.exports.cif.read_cif_file(path, tech, **kwargs)[source]

Read a CIF file and parse into Shapes.

Parameters:
Return type:

list[Shape]

Sonnet-em .son exporter (subset).

The binary’s SonnetSave command (case 302) writes a Sonnet project file that loads directly into Sonnet’s full-wave EM solver. Sonnet’s format is verbose and mostly metadata; we emit the subset needed to reproduce the spiral’s geometry and layer stack within a Sonnet project.

The header layout is:

FTYP SONPROJ 16 ! Sonnet Project File
HEADER
LIC ...
DAT ...
BUILT_BY_AUTHOR <user>
MDATE ...
HDATE ...
END HEADER
DIM
FREQUENCY GHZ
INDUCTANCE NH
LENGTH UM
...
END DIM
GEO
  ... per-layer geometry ...
END GEO
END

This module emits a working but minimal subset: the geometry block, plus a few required metadata lines. Sonnet itself fills in defaults for omitted sections.

Mirrors cmd_sonnet_emit (cases referencing the SONNETSAVE command).

reasitic.exports.sonnet.write_sonnet(shapes, tech)[source]

Emit a minimal Sonnet .son string for shapes.

Parameters:
Return type:

str

reasitic.exports.sonnet.write_sonnet_file(path, shapes, tech)[source]

Write the Sonnet rendering to path.

Parameters:
Return type:

None

reasitic.exports.sonnet.read_sonnet(text, tech)[source]

Parse the GEO block of a Sonnet .son file into Shapes.

Supports the subset emitted by write_sonnet(): NUM polygon-size lines followed by LAYER and vertex coordinates, terminated by END. Other Sonnet directives are skipped. Returns one Shape per file (combining all polygons).

Parameters:
Return type:

list[Shape]

reasitic.exports.sonnet.read_sonnet_file(path, tech)[source]

Read a Sonnet .son file and parse the GEO block.

Parameters:
Return type:

list[Shape]

Tektronix-style line-drawing dumps.

The binary’s PrintTekFile command (case 214) writes a Tek 4014- emulator command stream that draws the current view to a vector plotter / terminal. We support two outputs:

  • write_tek() — gnuplot-friendly x/y text format:

    # name=L1 metal=2
    x1 y1
    x2 y2
    ...
    (blank line)
    

    Loads via plot 'foo.tek' with lines.

  • write_tek4014() — true Tek 4014 escape-code stream (GS for graphics, US for ASCII, addressed-vector mode HiY/HiX/LoY/LoX bytes). Mirrors the binary’s textual output byte-for-byte for tools that expect that format (Tektronix terminal emulators).

reasitic.exports.tek.write_tek(shapes)[source]

Emit a gnuplot-style x/y dump of every polygon in shapes.

Parameters:

shapes (Iterable[Shape])

Return type:

str

reasitic.exports.tek.write_tek_file(path, shapes)[source]

Write the Tek/gnuplot rendering of shapes to path.

Parameters:
Return type:

None

reasitic.exports.tek.write_tek4014(shapes, *, extent_x=None, extent_y=None)[source]

Emit a Tek 4014-format escape-code byte stream.

Tek 4014 graphics: \x1d (GS) enters graphics mode; coordinates are 12-bit (0..4095) sent as four bytes:

HiY = 0x20 + ((Y >> 7) & 0x1f)
LoY = 0x60 + ((Y >> 2) & 0x1f)
HiX = 0x20 + ((X >> 7) & 0x1f)
LoX = 0x40 + ((X >> 2) & 0x1f)

The first vector after GS is “dark” (move-to); subsequent vectors are “bright” (line-to) until the next GS. Returns bytes since the Tek 4014 stream is not pure ASCII.

Parameters:
Return type:

bytes

reasitic.exports.tek.write_tek4014_file(path, shapes, **kwargs)[source]

Write a Tek 4014 binary stream to path.

Parameters:
Return type:

None

SPICE-style sub-circuit emitter.

Renders a Pi-equivalent inductor model as an Ngspice/HSPICE .subckt block:

.subckt L1_pi p1 p2 gnd
Rseries p1 nA  R={R_series}
Lseries nA p2  L={L_series_nH}n
Cp1 p1 gnd C={C_p1_fF}f
Cp2 p2 gnd C={C_p2_fF}f
.ends

The model is single-frequency (taken from the Pi-extraction at the chosen analysis frequency). For broadband fitting use multiple sub-circuits at different frequencies.

Mirrors the 2Port S|Y|PI text output but in a more useful interchange form for SPICE-flavour simulators.

reasitic.exports.spice.write_spice_subckt(shape, tech, freq_ghz, *, name=None)[source]

Emit a SPICE .subckt block for shape at freq_ghz.

Parameters:
Return type:

str

reasitic.exports.spice.write_spice_subckt_file(path, shape, tech, freq_ghz, *, name=None)[source]

Write the SPICE sub-circuit to path.

Parameters:
Return type:

None

reasitic.exports.spice.write_spice_broadband(shape, tech, freqs_ghz, *, name=None)[source]

Emit a frequency-dependent SPICE model.

Each frequency in freqs_ghz produces a separate .subckt block named <shape>_pi_<f_GHz>. Useful when a single Pi-model isn’t enough — pair with a SPICE .alter or per-band selection.

Parameters:
Return type:

str

reasitic.exports.spice.write_spice_broadband_file(path, shape, tech, freqs_ghz, *, name=None)[source]

Write the broadband SPICE rendering to path.

Parameters:
Return type:

None

FastHenry input-file (.inp) writer.

FastHenry (Kamon, Tsuk, White, MIT 1994) is the de-facto open-source inductance-extraction tool, taking a polygonal-conductor description and producing the full 3-D inductance matrix at user-supplied frequencies. Its .inp format is line-oriented:

.units um
.default sigma=...

N1 x=... y=... z=...
N2 x=... y=... z=...

E1 N1 N2 w=... h=... sigma=...

.external N1 N2

.freq fmin=1e9 fmax=10e9 ndec=1

.end

Lets users feed reASITIC’s geometry into FastHenry for cross- validation against an independent solver.

reasitic.exports.fasthenry.write_fasthenry(shape, tech, *, freqs_ghz=None)[source]

Render shape as a FastHenry .inp string.

Each segment becomes one E element with two named nodes; consecutive segments share end nodes so the spiral forms a proper conductor chain.

Parameters:
Return type:

str

reasitic.exports.fasthenry.write_fasthenry_file(path, shape, tech, *, freqs_ghz=None)[source]

Write the FastHenry rendering of shape to path.

Parameters:
Return type:

None