Generating `.qsch` schematics programmatically (AI-assisted): file-format notes + 5 questions

Hi all,

I’m a hardware engineer using QSPICE for signal-integrity study. Recently I started letting an AI assistant
build my example circuits for me, and it had to produce real schematics — not netlists — so that I can
open them, click nodes, and run them.

Scope first, because I’d rather ask than assume: we did not decompile, disassemble, patch or modify
QSPICE in any way. We only read files that QSPICE itself writes when you save a schematic (.qsch) or run a
simulation (.cir, .qraw), and we generated our own .qsch files in that same format. If that is not
acceptable under the EULA, please tell me and I’ll stop — and if it is fine, a short note in the docs would
save the next person a week.

Sharing what we learned in case it’s useful, plus a few “is there an official way” questions.


What we found (all verified against the installed QSPICE)

File envelope

bytes: FF D8 FF DB  AB "schematic" \n     ← header
0xAB («)  opens a statement
0xBB (»)  closes a statement

Heads-up: the file starts with a JPEG-like FF D8 FF DB, presumably so that drag-and-drop and file-type
registration behave; the rest is plain ASCII/latin-1.

Statement kinds

«component (x,y) rot 0        ← placement; rot 0 = vertical, rot 6 = 90°
  «symbol <DESIGNATOR>        ← the reference designator lives here
    «type: R»
    «line (0,-200) (0,-150) …»      ← symbol graphics are EMBEDDED per instance
    «text (50,0) 1 7 0 0x1000000 -1 -1 "R1"»
    «text (-50,0) 1 7 0 0x1000000 -1 -1 "10K"»
    «pin (0,200) (0,0) 1 64 0 0x0 -1 "2"»
  »
»
«wire (0,200) (1000,200) "n1"»
«net (1000,600) 1 13 0 "GND"»       ← net label (this is how "ground" is done)
«junction (600,200)»
«text (0,-900) 1 8 0 0x1000000 -1 -1 ".tran 0 40n 0 1p"»

Gotchas that cost us the most time

  1. A component needs two text primitives (designator + value). With only one, the netlister emits a
    malformed device line such as RL + garbage + 1MEG and the simulation fails silently.
  2. Any free text is copied verbatim into the netlist. An annotation like (a) open load becomes a syntax
    error; it must start with *.
  3. Pin coordinates are instance-relative, and rotation 6 maps (0,±200) → (∓200,0). If you get one
    wire endpoint wrong, you get a floating node and no error — just a wrong netlist.
  4. .plot panes are ordered bottom-up: the last .plot statement is drawn at the top. One .plot per
    pane works exactly as the help file says.
  5. QUX.exe -Export silently downsamples to ~1000 points if NPOINTS is omitted — a 100 ps edge disappears
    and you chase ghosts for an hour. QUX -Export x.qraw "V(out)" 40000 CSV fixed it.

Headless pipeline that works

QSPICE64.exe circuit.cir                        → runs, writes .qraw
QUX.exe -Netlist circuit.qsch                   → schematic → netlist (great as a syntax check)
QUX.exe -Run     circuit.qsch                   → opens GUI and runs
QUX.exe -Export  circuit.qraw "V(a),V(b)" 40000 CSV   → data out

The -Netlist round-trip is what made this project feasible: the AI could verify its own schematic by
checking that the netlist says T1 n1 0 out 0 Z0=50 Td=1n instead of eyeballing a PNG.


The five things that blocked us

  1. The .qsch format is undocumented. We inferred everything above by comparing files that QSPICE itself
    saved; nothing here came from inspecting the binaries. Is there any chance of a published spec (even a
    minimal one), or a stability guarantee? Right now every QSPICE update is a regression risk for generated
    schematics.
  2. Built-in symbols are not available as files. C:\Program Files\QSPICE ships ~200 .qsym, but
    Builtin Symbols (Native Devices) — including T-Lossless Transmission Line — are not among them; we could
    find neither a .qsym nor a plain string for them in QUX.exe (likely a compiled resource).
    Since .qsch embeds graphics per instance, a generated file cannot reference the native
    symbol by name
    ; we have to draw our own (and it never looks exactly like yours).
    Request: export the native symbols as .qsym, or allow a component to reference a built-in by name.
  3. No netlist → schematic CLI. Ctrl-Shift-V (“paste netlist as graphical symbols”) is GUI-only and we
    couldn’t drive it reliably through automation. A QUX.exe -Schematic netlist.cir out.qsch would be a
    game-changer for AI/tooling integration — and would also let us start from a simulator-verified netlist.
  4. Silent failure mode. An invalid .qsch produced a netlist containing only .end, with no diagnostic.
    Any hint in the console (“component at (x,y) has no value text”) would have saved hours.
  5. Pane labels. .plot V(OUT_A) shows V(OUT_A), which is fine — but only because we forced net names
    with «net …». Node auto-naming (N01, N02…) makes generated .plot directives brittle. A
    «probe name="…" node="…"» or a .plot … ; title syntax would help.

Result (if anyone wants to reproduce it)

Five terminations of the same 50 Ω link (open / parallel / series / Thevenin / AC), one .qsch,
one Run, five auto-plotted panes:

  • .plot V(OUT_A) … .plot V(OUT_E) in the netlist
  • verified: T1 … Z0=50 Td=1n uses the built-in lossless line
  • waveforms: open ≈ ringing to 1.5 V, parallel 0…0.667 V, series 0…1 V, Thevenin 0.167…0.833 V, AC ≈ 0…0.667 V

I’m happy to share the generator (≈200 lines of Python, standard library only) if Qorvo is comfortable with
this being done at all
— it’s clearly unofficial and comes with no guarantees.

Questions to Qorvo

  • Is programmatic .qsch generation something you’d support, or would you rather we stay in netlist land and
    treat schematics as GUI-only?
  • Would extending PyQSPICE with a netlist → schematic path be considered?

Thanks — and thanks for a simulator that starts in 0.1 s and has a usable CLI at all; most of the above came
from the fact that we could drive it from a script.

1. -Export by default 1000 points

This is mentioned in the Qspice Help: QUX is used as the waveform viewer for data export.

2. Qspice workflow
Qspice always executes simulations using QSPICE64.exe or QSPICE80.exe from a netlist. When you open a .qsch schematic file with QUX.exe and click run, it just silently converts the .qsch file into a netlist for QSPICE64 or QSPICE80 to generate .qraw datafile, and QUX process .qraw to generate plots in waveform viewer.

3. Projects in related to .qsch
There are community projects dedicated to working with .qsch files or generating them from other SPICE platforms

4. Open a built-in symbols in Symbol Viewer

In Symbol & IP Browser, right click symbol, select Open a Copy & Edit. Or if you have that symbol in schematic, Ctrl+C to copy it, open Symbol Viewer and Ctrl+V to paste it.

1 Like

My comment is that you actually don’t need a schematic for a SPICE simulation. There are still SPICE program that don’t come with a schematic GUI. SPICE always executes from a netlist. A schematic is just for humans to graphically understand the circuit. There are engineers who only work with netlists directly.

Your purpose is either to have AI generate a schematic from a netlist OR to assist with your simulation? For the latter, working directly with a netlist is much easier.

Thanks for the guidance — I went and verified what you said.

The main reason I wanted the AI assistant to generate schematic files is simply that it helps me understand things more intuitively while I’m studying, and makes the material easier to take in.

I’d also really love to see QSPICE come out with an official MCP server (or a skill) at some point — that would make AI-assisted work much easier.

This is MCP server developed by @HAbedini.
QSpice MCP Server, Run QSpice simulations through AI assistants - QSPICE - Qorvo Tech Forum

Thanks for pointing me to the MCP server — that’s a really useful tip!

@shenjian33 Just FYI: I’m working on an open source version of the QSpice GUI which I hope to release in a few weeks. I suspect that that code will answer pretty much all of your questions.

Regarding file record formats, the author (Mike Engelhardt) considers the .qsch/.qsym files “self-documenting” so I don’t expect an official version. I’ve generated an unofficial version based on my QParser2 Project work here.

Hope that helps.

–robert

Hi @Rdunn what is the goal for your Qspice GUI?

Hi, Arief. In short, the goal is to do exactly what QSpice does but add features like user-configurable shortcuts, support for user-defined DLL templates and VSCode IDE, more flexible selection of schematic elements for cut/copy/delete/drag, the print/export and color theme stuff recently released in QSchView and QColorPrefs, and eventually things like renumbering reference designators and align items vertically/horizontally, and, well, whatever folk want.

The hard parts appear to be working (editing schematics, successful netlisting/running simulations with Waveform viewer, etc.). I’ll post an announcement soon and ask folk what features that they’d like to see. Feel free to start your list of desired enhancements. :wink:

–robert

Interesting!

  1. Can we also directly run sim from that custom GUI?

  2. Will it also support click nets on the schematic viewer to plot the waveform?

  3. I would like to hope if you can have an option to en/dis the link between sch viewer and waveform viewer

  4. Option to update the waveform in real time or only after the sim is complete (useful for sim with large qraw file)

The project uses QSpice QUX.exe and QSpice64/80.exe for all of the back-end stuff. So, yes, you can run the sim. Yes, the Waveform viewer displays the traces progressively. Yes, you can click nets on the GUI to add traces to the Waveform viewer.

Not sure what you’re asking for (3). If you’re asking whether we can disable the Waveform viewer, well, we control the interface – see the Appendix I Help topic. So, yes, we could disable the Waveform viewer or increase/reduce the update interval.

Similarly, (4) is unclear. If what you’re asking is can we wait to launch the Waveform viewer until the sim completes, well, currently the code can close the waveform viewer and reopen it – where reopen really means to load/display the .qraw file. So, yeah, don’t display until complete should be doable.

Did that answer your questions?

Your work reminded me of Ngspice, which is a text-based SPICE engine that relies on third-party GUIs.

As I understand it, Qspice64/80.exe is the core executable required if you ever want to develop a custom waveform viewer, but based on your description, your current goal is just schematic.

I have also come across waveform viewer projects and Python libraries capable of opening both LTspice and Qspice data files (I didn’t test them). It hard to imagine you will not continue to the path of having waveform viewer rework if you can get your schematic work done. :rofl:

Well, writing a new GUI is actually a full time job!

1 Like

I’d definitely like to enhance the Waveform viewer. I haven’t looked into it but I suspect there’s more to it than just displaying traces – there are function evaluations, etc. Probably a bigger task than it appears on the surface.

yes… thats what I exactly have in mind for (3) and (4)… thanks for reading my messy writing :smiley: