Skip to main content

A symbolic circuit explorer and design tool with SPICE simulators binding

Project description

SymXplorer: Symbolic and Optimization-Based Analog Design Automation

PyPI version License: GPL v3

SymXplorer is an open-source Python toolbox for the symbolic analysis and optimization-driven design of analog circuits. It leverages the power of SymPy for symbolic calculations and integrates with SPICE simulators and advanced optimization libraries to automate the circuit design process.

From transistor-level circuits to active filters with multiple feedback loops, SymXplorer provides tools to analyze, size, and explore the design space of analog topologies.

Core Features

  • Symbolic Circuit Analysis:

    • Derive and analyze symbolic transfer functions, impedances, and nodal equations using SymPy.
    • Includes pre-defined symbolic models for various topologies like Sallen-Key, Multiple-Feedback, Differential, and Dual-Amplifier circuits.
    • Optionally automate the extraction of nodal equations from netlists using lcapy.
    • Model non-idealities of circuit components, such as the T-matrix representation of FETs.
  • Optimization-Based Sizing:

    • Utilize SPICE-in-the-loop optimization to size transistors and passive components based on performance specifications.
    • High-level Orchestrator to manage complex optimization tasks.
    • Supports multiple optimization strategies:
      • Bayesian Optimization via Ax.
      • Evolutionary Algorithms via Nevergrad.
    • Define objective functions and constraints to guide the optimization process.
  • Design Space Exploration & Visualization:

    • Explore higher-order transfer functions for filter design.
    • A built-in Visualizer to plot design spaces, performance boundaries, and trade-offs within a given PDK.
  • SPICE Integration:

    • Interfaces with ngspice and other SPICE-based simulators through the spicelib library.
    • Run simulations to validate symbolic expressions and evaluate circuit performance during optimization.
  • Advanced Capabilities:

    • Includes functionality for device modeling using TensorFlow (tf_models), allowing for more accurate and flexible component models.
    • Generate automatic LaTeX reports summarizing the results of your analysis and optimization runs.

Architecture and Vision

Swappable Optimization Engines

The optimization framework is built on an abstract base class, allowing the core optimization engine to be easily swapped. This class-based hierarchy makes SymXplorer an ideal platform for research and development in optimization strategies. You can seamlessly switch between industry-proven optimizers like Ax (for Bayesian Optimization) and Nevergrad (for Evolutionary Algorithms), or integrate your own custom-built optimizer. This flexibility is key for comparing optimization techniques and advancing the field of analog circuit design automation.

The Optimization Plan: project_setup.yaml

Every optimization task is guided by a project_setup.yaml file, which acts as a comprehensive "Optimization Plan" document. This file orchestrates the entire sizing process:

  • Metrics & Goals: The optimization targets are defined under target_specs. Each metric directly corresponds to a .MEAS statement in the SPICE netlist. This powerful feature means that if you can measure a performance metric in ngspice, you can optimize for it.
  • Parameters: The YAML file clearly separates tunable device parameters (dut_params) from fixed testbench parameters (testbench_params), giving you precise control over the optimization variables.
  • Constraints: Technology-specific constraints (e.g., min/max transistor dimensions for a given PDK) are defined in the tech_spec section, ensuring the optimizer explores a valid and manufacturable design space.

Vision: Towards Agentic Design Workflows

The long-term vision for SymXplorer is to serve as a core tool within an agentic design workflow. The project_setup.yaml is not just a configuration file; it's a blueprint for an optimization task. In the future, we envision Large Language Models (LLMs) acting as AI design assistants, automatically generating these "Optimization Plans".

Recent research has shown that the convergence of optimizers like Bayesian Optimization is critically dependent on having a good starting point or a well-defined trust region. LLMs are increasingly capable of:

  • Understanding circuit topologies and symmetry considerations.
  • Applying circuit design guidelines (e.g., for biasing).
  • Interpreting performance metrics.

By leveraging these capabilities, an LLM agent could intelligently create the optimization plan, setting up a more efficient and effective design process. SymXplorer is being developed to be the engine that these future agents will use to explore, size, and verify analog circuits.

Installation

Clone the repository and install the necessary dependencies. It is recommended to use a virtual environment.

git clone https://github.com/Nooridan/SymXplorer.git
cd SymXplorer
pip install -e .

This will install the SymXplorer package in editable mode and all the required dependencies listed in pyproject.toml.

Getting Started

A simple way to see SymXplorer in action is to run the pre-defined symbolic exploration script from the command line:

run-symbolix

This command executes the symbolic analysis for a differential common-gate circuit defined in src/symxplorer/symbolic_exploration/main.py.

Examples

The examples directory contains comprehensive Jupyter notebooks and project setups demonstrating how to use SymXplorer for various circuit design tasks.

1. 5-Transistor OTA (/examples/5t-ota)

This example provides a complete design flow for a 5-transistor OTA using the IHP SG13G2 open-source PDK. It includes:

  • Schematics: xschem directory for circuit diagrams.
  • SPICE: Netlists and simulation setups.
  • Sizing: Jupyter notebooks for automated sizing using both Ax and Nevergrad.
    • 5t_ota_sizing_with_multi_spec_constraint_sat_ax.ipynb
    • 5t_ota_sizing_with_multi_spec_constraint_sat_nevergrad.ipynb
  • Layout: klayout directory for the physical layout.

2. CMFM Filter (/examples/CMFM-filter)

This example showcases the symbolic exploration and sizing of a current-mode, multiple-feedback (CMFM) biquadratic filter.

  • Symbolic Exploration: A rich set of notebooks for analyzing filter transfer functions, including the effects of Gain-Bandwidth product limitations.
    • CMMF_filters.ipynb
    • TIA_CMMF_filters_with_GB_limitation.ipynb
  • Sizing: Demonstrates multiple approaches to sizing the filter.
    • ltspice-sizing: Sizing using LTspice.
    • sym-sizing-bode-ax: Sizing with symbolic expressions and Ax.
    • sym-sizing-bode-nevergrad: Sizing with symbolic expressions and Nevergrad.

3. Tunable TIA (/examples/tunable-tia)

This example explores the design of a tunable transimpedance amplifier (TIA).

  • Symbolic Exploration: Notebooks for symbolic analysis of a common-gate TIA.
    • CG_TIA_Exploration.ipynb
    • CG_TIA_Sym_Sizing.ipynb
  • Automated Sizing: A notebook demonstrating automated sizing of the TIA using an optimizer.
    • CG_TIA_Sym_Sizing_w_Optimizer.ipynb

License

This project is licensed under the GNU General Public License v3 (GPLv3). See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symxplorer-1.2.0.tar.gz (123.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

symxplorer-1.2.0-py3-none-any.whl (131.1 kB view details)

Uploaded Python 3

File details

Details for the file symxplorer-1.2.0.tar.gz.

File metadata

  • Download URL: symxplorer-1.2.0.tar.gz
  • Upload date:
  • Size: 123.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for symxplorer-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7c6782993db5ceac8daa7a97d29abac22d395e23eafc61309f01df13a9714f75
MD5 cbc2894897b0242e439166b8e9f5fde6
BLAKE2b-256 5e9eeb1e386109c37799c0a8d7be3a50875db42ab264e468ab06ffb36377da40

See more details on using hashes here.

File details

Details for the file symxplorer-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: symxplorer-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 131.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for symxplorer-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a025fec56ed9a3509cf92ca43bb0cb114291d9dbf24771917255a7ca1af6182d
MD5 381a290e33b131e53923673dc9e9b65d
BLAKE2b-256 3eb374c58dd1279b58d1e112668cae61776fb13e8dcca48ac76fda396d64c601

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page