A Python package for translating simulation expressions between COMSOL and SPICE. Developed at Infineon Technologies to reduce repetitive model-conversion work in integrated-circuit design.
- Parses COMSOL and SPICE expressions into an abstract syntax tree (AST).
- Converts expressions in both directions while preserving their mathematical structure.
- Evaluates expressions with supplied variable values.
- Includes automated tests and example data for validating parser and translation behavior.
In the Infineon workflow, the tool reduced translation time from approximately 10 minutes to 10 seconds. End-to-end parity tests achieved 100% translation accuracy on the validation cases used for the project.
src/— expression parser, language-specific parsers, and evaluatorstests/— automated testsdata/— example and test inputsscripts/— utilities for working with parser test cases
Requires Python 3 and pip.
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtpytestThe parser can evaluate a SPICE expression by substituting a value for its variable:
from src.expr_parser import ExprParser
parser = ExprParser(
"(-0.1111*(temp+273.15)**2+5.5555*(temp+273.15)-444.44)*3333",
["temp"],
initial_lang="spice",
)
result = parser.aeval(25)
print(result)See the source and tests for supported syntax and conversion details.