Spicy is a small Rust project for running basic circuit simulations using Modified Nodal Analysis (MNA).
- Parser: see
crates/spicy_parser(README) - Simulator: see
crates/spicy_simulate(README) - CLI/TUI: see
crates/spicy_cli(README)
- Run the TUI on a sample netlist
cargo run -p spicy_cli -- --tui crates/spicy_simulate/tests/op_dc/simple_resistor.spicyRun the test suites:
cargo test -p spicy_parser
cargo test -p spicy_simulatewe use cargo-insta for snapshot testing in a lot of the parser tests. to update the snapshot use:
cargo insta reviewFuzzing support exists under fuzz/ (requires cargo-fuzz).
A lot of the surrounding code in this project is vibe coded, like:
- the binaries klu_mtx.rs klu_solve_cmp, some scripts
- spicy_cli, visualizations
Those files are not for the faint of heart, human eyes should not lay eyes on them.
The parser and main simulation code are hand crafted by human intelligence, and only assisted by ai. Those should be readable.
- output raw files
- support libs in parser
- support models in parser
- add diodes
- add BJT transistor
- support underscore in names (maybe we over complicated the lexer)
- implementation of KLU
- refactor errors and metrics in klu
- test KLU implementation - [x] make sure the output is bit exact to c - [x] make sure solve close - [x] make sure unroll optimization doesn't lose numerical stability
- hook up to simulation code
- cleanup device function use
- implement basic newton iteration
- implement diode model
- implement transistor model
- support UIC again (using a simulation mode)
- make from_spec nicer with getting values and defaults somehow
- creating netlist validation step
- implement gmin stepping
- implement source stepping
- implement klu statistics and use them to know when to fully factorize the matrix again.
- implement bench marks for all algorithms and the full algorithms - [x] analyze
- make sure singular matricies work (when not using halt_if_singular)
- refactor the functions and structs of KLU (mostly numeric) to something a little nicer
- support KLU complex?
- create spicyVec for boundary checks
- merge the recorder macro
- generate nice visualizations for btf and amd
MIT (see LICENSE).
This repository also includes solver code derived from SuiteSparse (AMD/BTF/KLU)
under BSD-3-Clause and LGPL-2.1-or-later; see THIRD_PARTY_NOTICES.md.
