AnalogLib is an open-source Python library for simulating analog in-memory computing (IMC) and neural network inference on resistive crossbar architectures (ReRAM, PCM, and memristive arrays).
It models Ohm's Law (
import analoglib as al
import numpy as np
# 1. Define model weights
W1 = np.random.uniform(-0.5, 0.5, (128, 64))
W2 = np.random.uniform(-0.5, 0.5, (64, 10))
# 2. Build AnalogModel via AIR (Analog Intermediate Representation)
model = al.AnalogModel.from_numpy([W1, W2], activations=["relu", "softmax"])
# 3. Target physical ReRAM crossbars + 8-bit peripherals
model.compile(
device=al.ReRAM(g_min=1e-6, g_max=100e-6, num_states=256, read_noise_sigma=0.01),
adc_bits=8,
dac_bits=8,
)
# 4. Simulate hardware inference
x_input = np.random.uniform(0.0, 1.0, 128)
result = model.simulate(x_input, mode="hardware")
# 5. Print hardware metrics report
result.report()| Component | Supported in v0.1.0 | Planned / Roadmap |
|---|---|---|
| Frameworks | ✅ NumPy, ✅ PyTorch (nn.Module)
|
🚧 TensorFlow / Keras (v0.2.0), 🚧 ONNX (v0.3.0) |
| Device Models | ✅ IdealDevice, ✅ ReRAM | 🚧 Non-linear J4 memristor model |
| Mapping | ✅ Differential ( |
🚧 Multi-bit cell slicing |
| Array Architecture | ✅ Crossbar, ✅ TiledCrossbar | 🚧 3D Crossbar stack |
| Peripherals | ✅ DAC, ✅ ADC | 🚧 Non-uniform logarithmic ADC |
| Simulation Modes | ✅ "ideal", ✅ "device", ✅ "hardware" | 🚧 Transient pulse-based simulation |
| Physical Effects | ✅ IRDrop, ✅ Thermal, ✅ Drift | 🚧 MNA full nodal solver |
| Exporters & Format | ✅ Encrypted .analog, ✅ SPICE (ngspice/LTspice)
|
🚧 Verilog-A behavioral model export |
| Analytics & CLI | ✅ AnalogProfiler, ✅ analog CLI
|
🚧 Graphical dashboard UI |
# Base package
pip install analoglib
# With PyTorch support
pip install "analoglib[torch]"
# With Visualization support
pip install "analoglib[viz]"
# Full developer installation
pip install "analoglib[all]"Explore the full documentation system:
- 🚀 Getting Started — Installation, Quickstart, First VMM, Core Concepts
- 🧠 Physics & Equations — Conductance mapping, state quantization, device noise, hardware modes
- 🔬 Capabilities Matrix — Full v0.1.0 compatibility breakdown
- ❓ FAQ & AI Discoverability — Answers to PyTorch, Keras, VMM, SPICE, and ReRAM questions
- ⚡ Framework Converters — PyTorch (
from_torch) & NumPy (from_numpy) guides - 🔒 File Format Spec — Encrypted
.analogbinary format layout - 🔌 SPICE Exporter — ngspice & LTspice netlist generation
- 📊 Analytics & Profiler — TOPS/W, power, energy, area estimation
- 🛠️ Troubleshooting Reference — Error codes and fix guide
- 📚 API Reference Index — Complete module, class, and method index
- 🗺️ Release Roadmap — Feature roadmap for v0.2.0 and beyond
AnalogLib is released under the MIT License.