- Rust 100%
| crates | ||
| docs | ||
| examples | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
GAS — GPU-Accelerated SPICE
An open-source mixed-signal circuit simulator in Rust. Parses SPICE netlists, runs DC/AC/transient/noise analyses on CPU, and targets GPU compute acceleration via wgpu for the heavy lifting.
Current state: working CLI, SPICE netlist parser, linear MNA solver core, RF/noise analysis, mixed-signal LUT/RNM support, and GPU compute benchmarks for targeted workloads (frequency grids, envelope reduction, LUT interpolation, RF periodic, digital timing). Not ready for production use — but the foundation is solid.
Build & Run
cargo build
cargo test
Run example circuits:
cargo run -p gas-cli -- run-linear-spice examples/analog/rc_lowpass_ac.sp --analysis ac --freq-hz 1.0e6
cargo run -p gas-cli -- run-linear-spice examples/analog/rc_settling_tran.sp --analysis transient
cargo run -p gas-cli -- run-noise-spice examples/analog/rc_lowpass_noise.sp --temp-k 300
cargo run -p gas-cli -- inspect-spice examples/analog/rc_lowpass_ac.sp
cargo run -p gas-cli -- render-viz-tui crates/gas-tui/src/sample_session.json
cargo run -p gas-cli -- render-viz-web crates/gas-tui/src/sample_session.json --out /tmp/viz.html
What Works
- SPICE parsing: resistors, capacitors, inductors, sources, MOSFETs, diodes, switches, behavioral sources, subcircuits,
.param,.model,.include,.control/.endc,.meas— numeric suffixes, continuation lines, curly-brace expressions - Analog analyses: DC operating point, AC sweep, transient, noise
- Mixed-signal: LUT-based delay models, RNM generation
- Visualization: TUI (ratatui) and static HTML output from session files
- GPU benchmarks: wgpu compute shaders for frequency grids, envelope reduction, RF periodic, digital timing, LUT batch interpolation
- PDK loading: reads foundry PDK contracts (SkyWater 130nm, GF 180nm, IHP 130nm BiCMOS referenced in
inspiration/)
Every GPU code path has an explicit CPU fallback.
Workspace Crates
The project is 12 Rust crates in a Cargo workspace:
| Crate | What it does |
|---|---|
gas-cli |
CLI binary (gas) — ties everything together |
gas-core |
Shared types, diagnostics, backend selection |
gas-spice |
SPICE netlist parser and elaborator |
gas-analog |
Linear MNA DC/AC/noise solver |
gas-ms |
Mixed-signal LUT/RNM evaluation |
gas-sv |
SystemVerilog/RNM generation |
gas-pdk |
PDK contract loading |
gas-viz |
Visualization session types |
gas-tui |
Terminal UI (ratatui) |
gas-web |
HTML visualization output |
gas-evidence |
Machine-readable reports |
gas-artifact |
Open artifact detection |
GPU Strategy
The simulator uses wgpu (WebGPU) — not CUDA or OpenCL directly. Compute shaders are WGSL embedded in Rust source. This gives us Vulkan/Metal/DX12/OpenGL ES coverage from one codebase.
Current GPU workloads are benchmark-stage (measuring speedup vs CPU fallback for specific kernels). The linear solver itself is still CPU-based.
Philosophy
- Rust-first. The simulator and all tooling are Rust. SystemVerilog/RNM output is the only non-Rust artifact emitted.
- Open tooling required, proprietary optional. Output formats are always open. If a proprietary tool wants to consume them, fine — but nothing proprietary is required to build or run.
- Honest claims. GPU benchmarks report what's accelerated and what's not, with fallback reasons.
Examples
Circuit decks live in examples/:
examples/analog/— RC lowpass AC, transient, noiseexamples/digital/— standard-cell pulse, SERDES PHY lane (RTL + testbench)examples/mixed_signal/— LUT-based TX delay modelexamples/modern/— coverage/claim catalogs
License
Dual-licensed MIT OR Apache-2.0 — your choice.
This is a young project. If something's broken or missing, that's probably because it's on the backlog.