|
1 | | -# Device Testing Directory |
| 1 | +# Device Testing |
2 | 2 |
|
3 | | -## Introduction |
| 3 | +This directory provides setup files, Makefile targets, and scripts to run **device-level verification** for the IHP SG13 PDK. |
| 4 | +Tests can be executed with either **pytest** or the custom **`models_verifier`** runner. |
4 | 5 |
|
5 | | -This directory contains setup files, templates, scripts, and reports for device-level verification of the IHP SG13 PDK. |
6 | | -It is organized by device type (MOS, HBT, PNP) and includes a custom test runner (`models_verifier`) and Makefile. |
| 6 | +# Table of contents |
| 7 | + |
| 8 | +- [Device Testing](#device-testing) |
| 9 | +- [Table of contents](#table-of-contents) |
| 10 | + |
| 11 | + - [Folder Structure](#folder-structure) |
| 12 | + - [Prerequisites](#prerequisites) |
| 13 | + - [Usage](#usage) |
| 14 | + |
| 15 | + - [Running with Makefile](#running-with-makefile) |
| 16 | + - [Examples](#examples) |
7 | 17 |
|
8 | 18 | ## Folder Structure |
9 | 19 |
|
| 20 | +```text |
| 21 | +📁 devices |
| 22 | + ┣ 📜 Makefile Main entrypoint for running device tests. |
| 23 | + ┣ 📁 devices_configs YAML configs and templates for MOS, HBT, PNP devices. |
| 24 | + ┣ 📁 models_verifier Python package for simulation & verification. |
| 25 | + ┣ 📁 models_run Generated outputs (netlists, CSVs, reports). |
| 26 | + ┣ 📁 verification Pytest tests and notebooks. |
| 27 | + ┗ 📜 README.md Documentation (this file). |
| 28 | +``` |
| 29 | + |
| 30 | +## Prerequisites |
| 31 | + |
| 32 | +You need the following tools to run the SG13G2 device tests: |
| 33 | + |
| 34 | +- **Python 3.9+** |
| 35 | +- **ngspice** (for running simulations) |
| 36 | +- **openvaf** (for compiling Verilog-A models) |
| 37 | + |
| 38 | +To build the required OSDI models, please follow the instructions in: |
| 39 | +[`ihp-sg13g2/libs.tech/verilog-a/README.md`](../../../verilog-a/README.md) |
| 40 | + |
| 41 | +### Setup Python Virtual Environment |
| 42 | + |
| 43 | +It is recommended to use a local virtual environment: |
| 44 | + |
| 45 | +```bash |
| 46 | +# Create and activate venv |
| 47 | +python3 -m venv .venv |
| 48 | +source .venv/bin/activate |
| 49 | + |
| 50 | +# Install required packages |
| 51 | +pip install -r requirements.txt |
| 52 | +``` |
| 53 | + |
| 54 | +## Usage |
| 55 | + |
| 56 | +> Always run from this directory: |
| 57 | +> `ihp-sg13g2/libs.tech/ngspice/testing/devices` |
| 58 | +
|
| 59 | +### Running with Makefile |
| 60 | + |
| 61 | +The Makefile defines groups and individual device targets. |
| 62 | +The **default runner** is `models_verifier`. To switch, use `RUNNER=pytest`. |
| 63 | + |
| 64 | +**Available targets:** |
| 65 | + |
| 66 | +- **Groups**: |
| 67 | + |
| 68 | + - `make test-all` → all devices |
| 69 | + - `make test-mos` → NMOS/PMOS (LV/HV) |
| 70 | + - `make test-hbt` → HBT (NPN13G2 variants) |
| 71 | + - `make test-pnp` → PNP MPA |
| 72 | + |
| 73 | +- **Devices**: |
| 74 | + |
| 75 | + - `nmos_lv`, `pmos_lv`, `nmos_hv`, `pmos_hv`, |
| 76 | + - `npn13g2`, `npn13g2l`, `npn13g2v`, |
| 77 | + - `pnp_mpa` |
| 78 | + |
| 79 | +### Examples |
| 80 | + |
| 81 | +Run all devices with default runner (`models_verifier`): |
| 82 | + |
| 83 | +```bash |
| 84 | +make test-all |
10 | 85 | ``` |
11 | | -📁devices |
12 | | - ┣ 📜Makefile Make targets to run device tests (pytest or models_verifier). |
13 | | - ┣ 📁mos Directory for MOSFET device testing (NMOS/PMOS, LV/HV). |
14 | | - ┃ ┣ 📜cap_template.spice.j2 Template for MOS capacitance simulation. |
15 | | - ┃ ┣ 📜dc_template.spice.j2 Template for MOS DC sweep simulation. |
16 | | - ┃ ┣ 📁nmos_lv Low-voltage NMOS device configs and results. |
17 | | - ┃ ┃ ┣ 📜sg13_lv_nmos.yaml Config file for LV NMOS tests. |
18 | | - ┃ ┣ 📁nmos_hv High-voltage NMOS device configs. |
19 | | - ┃ ┃ ┗ 📜sg13_hv_nmos.yaml Config file for HV NMOS tests. |
20 | | - ┃ ┣ 📁pmos_lv Low-voltage PMOS device configs. |
21 | | - ┃ ┃ ┗ 📜sg13_lv_pmos.yaml Config file for LV PMOS tests. |
22 | | - ┃ ┗ 📁pmos_hv High-voltage PMOS device configs. |
23 | | - ┃ ┗ 📜sg13_hv_pmos.yaml Config file for HV PMOS tests. |
24 | | - ┣ 📁hbt Directory for HBT (NPN) device testing. |
25 | | - ┃ ┣ 📜hbt_dc.spice.j2 Template for HBT DC sweep simulation. |
26 | | - ┃ ┣ 📁npn13g2 NPN13G2 variant device configs and results. |
27 | | - ┃ ┃ ┣ 📜npn13g2.yaml Config file for NPN13G2. |
28 | | - ┃ ┣ 📁npn13g2l NPN13G2L variant configs and results (same structure). |
29 | | - ┃ ┗ 📁npn13g2v NPN13G2V variant configs and results (same structure). |
30 | | - ┣ 📁pnp_mpa Directory for PNP MPA device testing. |
31 | | - ┃ ┣ 📜pnpmpa.yaml Config file for PNP MPA device. |
32 | | - ┃ ┣ 📜pnpMPA_dc.spice.j2 Template for PNP DC sweep. |
33 | | - ┣ 📁models_verifier Python package for running simulations and verification. |
34 | | - ┃ ┣ 📜models_verifier.py CLI entry point for running verification with a config. |
35 | | - ┃ ┣ 📜mdm_aggregator.py Combines measurement data into dataframes. |
36 | | - ┃ ┣ 📜mdm_parser.py Parser for raw MDM measurement files. |
37 | | - ┃ ┣ 📜mdm_parser_utils.py Helper utilities for parsing MDM files. |
38 | | - ┃ ┣ 📜mdm_parser_const.py Constants for parsing and verification. |
39 | | - ┃ ┣ 📁dc_runner Module for DC sweep simulation. |
40 | | - ┃ ┃ ┣ 📜dc_sweep_runner.py Orchestrates ngspice DC runs. |
41 | | - ┃ ┃ ┗ 📜helper.py Helper functions for simulation configs. |
42 | | - ┃ ┣ 📁error_analyzer Module for analyzing simulation vs measurement results. |
43 | | - ┃ ┃ ┣ 📜config.py Metric and threshold specification. |
44 | | - ┃ ┃ ┗ 📜range_checker.py Range/tolerance checking of results. |
45 | | - ┃ ┗ 📜README.md Package-level documentation. |
46 | | - ┣ 📁tests Pytest test suite for device verification. |
47 | | - ┃ ┗ 📜test_devices.py Runs pytest-based device verification. |
48 | | - ┗ 📁run_test_flow Example notebooks / workflows. |
49 | | - ┗ 📜IHP_devices_testing.ipynb Notebook demonstrating device testing flow. |
| 86 | + |
| 87 | +Run only MOS devices with pytest: |
| 88 | + |
| 89 | +```bash |
| 90 | +make test-mos RUNNER=pytest |
50 | 91 | ``` |
| 92 | + |
| 93 | +Run a single device (e.g., LV NMOS) with verifier: |
| 94 | + |
| 95 | +```bash |
| 96 | +make nmos_lv |
| 97 | +``` |
| 98 | + |
| 99 | +Run PNP MPA with pytest: |
| 100 | + |
| 101 | +```bash |
| 102 | +make pnp_mpa RUNNER=pytest |
| 103 | +``` |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +For more details on available targets and options, run: |
| 108 | + |
| 109 | +```bash |
| 110 | +make help |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
0 commit comments