Skip to content
gdsfactoryPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

oxymorph

CI Tests Release

Bidirectional SPICE-family and Verilog-AMS netlist parsing through a shared intermediate representation.

oxymorph began as a Rust port of morphnet and no longer depends on it. The port's verdict is frozen in a committed corpus (357 parse cases, 2142 writer outputs) that the parity test replays offline — see the Equivalence page.

Formats

Flavor Parse Write
SPICE parse_spice write_spice
HSPICE parse_hspice write_hspice
Xyce parse_xyce write_xyce
Spectre parse_spectre write_spectre
Spectre-SPICE parse_spectre_spice write_spectre_spice
Verilog-AMS parse_vams write_vams

Install

pip install oxymorph

Quick start

import oxymorph

circuit = oxymorph.parse_spectre("""\
subckt rc_lowpass (in_ out gnd)
R1 (in_ out) resistor value=1k
C1 (out gnd) capacitor value=100p
ends rc_lowpass
""")

print(oxymorph.write_vams(circuit))
module rc_lowpass (in_, out, gnd);
  inout in_, out, gnd;
  resistor #(.value(1k)) R1 (.p(in_), .n(out));
  capacitor #(.value(100p)) C1 (.p(out), .n(gnd));
endmodule

There is also a programmatic builder that mirrors upstream's morphnet._api:

import oxymorph

inv = oxymorph.module("inverter", parameters=["l", "w"])
inv.add_terminal("inp", direction=oxymorph.PortDirection.INPUT)
inv.add_terminal("out", direction=oxymorph.PortDirection.OUTPUT)
inv.add(oxymorph.module_reference("mn", "nfet", l=100e-9, w=500e-9))
inv.connect("net_out", ("mn", "drain"), ("", "out"))

circuit = oxymorph.circuit("ring")
circuit.add(inv)

WebAssembly

The same core compiles to wasm32-unknown-unknown (crates/oxymorph-wasm) and powers the playground: paste a netlist, pick input and output flavors, convert in the browser.

import init, { convert } from "oxymorph_wasm.js";
await init();
convert("subckt rc (a b)\nR1 (a b) resistor value=1k\nends rc\n", "spectre", "vams");

Rebuild the playground module with tools/build_playground.sh.

Documentation

Published with zensical to GitHub Pages:

Repository layout

crates/oxymorph-schema    # the IR (serde types, builder) — no parsing
crates/oxymorph-netlist   # grammars, parsers, writers
crates/oxymorph           # Rust facade
crates/oxymorph-python    # PyO3 module `oxymorph`
crates/oxymorph-wasm      # wasm-bindgen module
docs/                     # zensical site
tests/corpus/             # committed oracle corpus

This project is decision-driven and spec-driven: see decisions/ (why), specs/ (what), and ROADMAP.md (what's next).

Development

git submodule update --init --recursive
cargo test --workspace          # parity corpus + tests, no Python needed
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
maturin develop                 # build the Python module

License

Apache-2.0.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages