# fossee/esim architecture

> Architecture diagram of the GitHub repository fossee/esim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fossee/esim
- Repository: https://github.com/fossee/esim

## Overview

eSim is a desktop EDA application for circuit design, simulation, analysis, and PCB design. Its principal workflow is to work in the GUI with a KiCad schematic, convert it to an Ngspice-compatible netlist, run simulation, and inspect plotted results. Separate branches support reusable subcircuits, device models, schematic import, mixed-signal and Verilog design, and Modelica conversion. The README documents the high-level workflow; source-index references identify module relationships, but unsampled implementation details are not inferred.

Main entry points: [`src/frontEnd/Workspace.py`](https://github.com/fossee/esim/blob/master/src/frontEnd/Workspace.py) (Workspace UI), [`src/frontEnd/Application.py`](https://github.com/fossee/esim/blob/master/src/frontEnd/Application.py) (eSim application), [`src/kicadtoNgspice`](https://github.com/fossee/esim/tree/master/src/kicadtoNgspice) (KiCad netlister), [`src/kicadtoNgspice/KicadtoNgspice.py`](https://github.com/fossee/esim/blob/master/src/kicadtoNgspice/KicadtoNgspice.py) (Simulation controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application and Projects"]
  node_application["eSim application<br/>[Application.py]"]
  node_workspace["Workspace UI<br/>[Workspace.py]"]
  node_project["Project management"]
end

subgraph group_simulation["Circuit Simulation"]
  node_converter["KiCad netlister"]
  node_simulation_ui["Simulation controls<br/>[KicadtoNgspice.py]"]
  node_extraction["Result extraction<br/>[data_extraction.py]"]
  node_plots["Waveform plotting<br/>[plot_window.py]"]
end

subgraph group_design["Design and Models"]
  node_model_editor["Device model editor<br/>[ModelEditor.py]"]
  node_subcircuits["Subcircuit builder<br/>[Subcircuit.py]"]
  node_pcb["PCB layout<br/>[Kicad.py]"]
  node_pdk["PDK support"]
end

subgraph group_integration["HDL and Converters"]
  node_schematic_import["Schematic converters"]
  node_nghdl["NGHDL co-simulation<br/>[ngspice_ghdl.py]"]
  node_verilog["Makerchip and NgVeri"]
  node_modelica["Modelica conversion"]
end

node_engineer(("Circuit engineer"))
node_kicad["KiCad schematic"]
node_netlist["SPICE netlist"]
node_ngspice["Ngspice engine"]
node_results["Simulation output"]
node_ghdl["GHDL engine"]

node_engineer -->|"uses"| node_application
node_application -->|"presents"| node_workspace
node_application -->|"manages"| node_project
node_workspace -->|"opens"| node_converter
node_kicad -->|"provides schematic"| node_converter
node_converter -->|"generates"| node_netlist
node_netlist -->|"feeds"| node_ngspice
node_workspace -->|"opens"| node_simulation_ui
node_simulation_ui -->|"runs analysis"| node_ngspice
node_ngspice -->|"outputs"| node_results
node_results -->|"provides data"| node_extraction
node_extraction -->|"supplies traces"| node_plots
node_workspace -->|"opens"| node_model_editor
node_workspace -->|"opens"| node_subcircuits
node_engineer -->|"designs layout"| node_pcb
node_engineer -.->|"uses PDK"| node_pdk
node_workspace -->|"opens"| node_schematic_import
node_workspace -.->|"opens"| node_nghdl
node_nghdl -->|"simulates VHDL"| node_ghdl
node_ghdl -->|"co-simulates"| node_ngspice
node_workspace -->|"opens"| node_verilog
node_workspace -.->|"opens"| node_modelica

click node_application "https://github.com/fossee/esim/blob/master/src/frontEnd/Application.py"
click node_workspace "https://github.com/fossee/esim/blob/master/src/frontEnd/Workspace.py"
click node_project "https://github.com/fossee/esim/tree/master/src/projManagement"
click node_converter "https://github.com/fossee/esim/tree/master/src/kicadtoNgspice"
click node_simulation_ui "https://github.com/fossee/esim/blob/master/src/kicadtoNgspice/KicadtoNgspice.py"
click node_extraction "https://github.com/fossee/esim/blob/master/src/ngspiceSimulation/data_extraction.py"
click node_plots "https://github.com/fossee/esim/blob/master/src/ngspiceSimulation/plot_window.py"
click node_model_editor "https://github.com/fossee/esim/blob/master/src/modelEditor/ModelEditor.py"
click node_subcircuits "https://github.com/fossee/esim/blob/master/src/subcircuit/Subcircuit.py"
click node_pcb "https://github.com/fossee/esim/blob/master/src/projManagement/Kicad.py"
click node_pdk "https://github.com/fossee/esim/tree/master/src/configuration"
click node_schematic_import "https://github.com/fossee/esim/tree/master/src/converter"
click node_nghdl "https://github.com/fossee/esim/blob/master/nghdl/src/ngspice_ghdl.py"
click node_verilog "https://github.com/fossee/esim/tree/master/src/maker"
click node_modelica "https://github.com/fossee/esim/blob/master/src/ngspicetoModelica/NgspicetoModelica.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_workspace,node_project toneBlue
class node_converter,node_simulation_ui,node_extraction,node_plots toneAmber
class node_model_editor,node_subcircuits,node_pcb,node_pdk toneMint
class node_schematic_import,node_nghdl,node_verilog,node_modelica toneRose
class node_engineer,node_kicad,node_netlist,node_ngspice,node_results,node_ghdl toneIndigo
```

## Components

### Application and Projects

- [eSim application](https://github.com/fossee/esim/blob/master/src/frontEnd/Application.py): `src/frontEnd/Application.py`
- [Workspace UI](https://github.com/fossee/esim/blob/master/src/frontEnd/Workspace.py): `src/frontEnd/Workspace.py`
- [Project management](https://github.com/fossee/esim/tree/master/src/projManagement): `src/projManagement`

### Circuit Simulation

- [KiCad netlister](https://github.com/fossee/esim/tree/master/src/kicadtoNgspice): `src/kicadtoNgspice`
- [Simulation controls](https://github.com/fossee/esim/blob/master/src/kicadtoNgspice/KicadtoNgspice.py): `src/kicadtoNgspice/KicadtoNgspice.py`
- [Result extraction](https://github.com/fossee/esim/blob/master/src/ngspiceSimulation/data_extraction.py): `src/ngspiceSimulation/data_extraction.py`
- [Waveform plotting](https://github.com/fossee/esim/blob/master/src/ngspiceSimulation/plot_window.py): `src/ngspiceSimulation/plot_window.py`

### Design and Models

- [Device model editor](https://github.com/fossee/esim/blob/master/src/modelEditor/ModelEditor.py): `src/modelEditor/ModelEditor.py`
- [Subcircuit builder](https://github.com/fossee/esim/blob/master/src/subcircuit/Subcircuit.py): `src/subcircuit/Subcircuit.py`
- [PCB layout](https://github.com/fossee/esim/blob/master/src/projManagement/Kicad.py): `src/projManagement/Kicad.py`
- [PDK support](https://github.com/fossee/esim/tree/master/src/configuration): `src/configuration`

### HDL and Converters

- [Schematic converters](https://github.com/fossee/esim/tree/master/src/converter): `src/converter`
- [NGHDL co-simulation](https://github.com/fossee/esim/blob/master/nghdl/src/ngspice_ghdl.py): `nghdl/src/ngspice_ghdl.py`
- [Makerchip and NgVeri](https://github.com/fossee/esim/tree/master/src/maker): `src/maker`
- [Modelica conversion](https://github.com/fossee/esim/blob/master/src/ngspicetoModelica/NgspicetoModelica.py): `src/ngspicetoModelica/NgspicetoModelica.py`

### Other components

- **Circuit engineer**
- **KiCad schematic**
- **SPICE netlist**
- **Ngspice engine**
- **Simulation output**
- **GHDL engine**

## Connections

- Circuit engineer → eSim application: uses
- eSim application → Workspace UI: presents (evidence: `src/frontEnd/Application.py`)
- eSim application → Project management: manages (evidence: `src/frontEnd/Application.py`)
- Workspace UI → KiCad netlister: opens
- KiCad schematic → KiCad netlister: provides schematic
- KiCad netlister → SPICE netlist: generates
- SPICE netlist → Ngspice engine: feeds
- Workspace UI → Simulation controls: opens
- Simulation controls → Ngspice engine: runs analysis
- Ngspice engine → Simulation output: outputs
- Simulation output → Result extraction: provides data
- Result extraction → Waveform plotting: supplies traces (evidence: `src/ngspiceSimulation/plot_window.py`)
- Workspace UI → Device model editor: opens
- Workspace UI → Subcircuit builder: opens
- Circuit engineer → PCB layout: designs layout
- Circuit engineer → PDK support: uses PDK
- Workspace UI → Schematic converters: opens
- Workspace UI → NGHDL co-simulation: opens
- NGHDL co-simulation → GHDL engine: simulates VHDL
- GHDL engine → Ngspice engine: co-simulates
- Workspace UI → Makerchip and NgVeri: opens
- Workspace UI → Modelica conversion: opens
