Compare commits

...

11 Commits

Author SHA1 Message Date
PhillipRambo 5df59654e3
Merge pull request #47 from engrvip123/gmid_check
Replace hardcoded PDK paths with environment variable based paths in gmid .py scripts for NMOS and PMOS
2025-07-14 12:06:27 +02:00
PhillipRambo 8e1518b883
Update foundations.md 2025-07-14 11:59:43 +02:00
PhillipRambo d91421fe8f
Update foundations.md 2025-07-14 11:58:44 +02:00
PhillipRambo cba2c15226
Add files via upload 2025-07-14 11:48:52 +02:00
PhillipRambo d9851848c6 change gitignore 2025-07-14 11:45:17 +02:00
PhillipRambo 7f9518aac6 remove external folder and add to .gitignore 2025-07-14 11:44:14 +02:00
PhillipRambo 4c204a61db push new gmid explination 2025-07-14 11:37:10 +02:00
PhillipRambo 46bb7b55aa create gmid_content 2025-07-14 11:36:41 +02:00
engrvip123 f399a5e6e5 Replace hardcoded PDK paths with environment variable based paths for portability 2025-07-11 12:03:46 +05:30
PhillipRambo 6a5a313acb Merge branch 'main' of github.com:IHP-GmbH/IHP-AnalogAcademy 2025-07-07 18:24:43 +02:00
PhillipRambo bf0768be74 change s-parameter files 2025-06-25 09:02:44 +02:00
15 changed files with 65 additions and 95 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
/misc/ /misc/
modules/module_3_8_bit_SAR_ADC/part_2_digital_comps/bootstrap_switch/python/ modules/module_3_8_bit_SAR_ADC/part_2_digital_comps/bootstrap_switch/python/
modules/module_0_foundations/gmid
modules/module_0_foundations/gmid_env
**/.vscode/ **/.vscode/
**/sar_logic_obj_dir/ **/sar_logic_obj_dir/
**/.ipynb_checkpoints/ **/.ipynb_checkpoints/

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

View File

@ -64,18 +64,46 @@ For a deeper dive into the gm/Id methodology, consider watching this video by Ma
Refer to the next section for instructions on setting up the gm/Id tools. Refer to the next section for instructions on setting up the gm/Id tools.
## Setting Up gm/Id Methodology (Optional) ### Lookup Table Generation
In the repository, under the module_0 folder, youll find a directory called gmid. This directory is based on the repository from Medwatt, which can be accessed at the following link: To generate the lookup tables (LUTs) used in this chapter, we utilized resources from the GitHub repository by [medwatt](https://github.com/medwatt). Specifically, the LUT generation was based on his excellent [`gmid`](https://github.com/medwatt/gmid) project, which provides detailed documentation and well-structured scripts for generating lookup tables. Many thanks to medwatt for making this resource available — if you're working on similar tasks, I highly recommend taking a look at the repository!
Repository URL: https://github.com/medwatt/gmid The scripts that was made for generating the LUTs can be found as:
Modifications have been made to the Lookup Table (LUT) generator class to ensure compatibility with the IHP Open PDK. As a result, you can easily generate gm/Id LUTs by running: - `sg13_nmos_lv.py`
``` - `sg13_pmos_lv.py`
python gmid_launcher.py
``` > **🔧 REMARK:**
This will open a simple terminal-based GUI, allowing you to select which transistor you would like to generate the gm/Id LUT for. You just need to specify the sweeping parameters, and the tool will parse a netlist to Ngspice. The generated LUTs will be saved in a folder named LUTs. From here, you can navigate to the scripting folder and open JupyterLab, where an implemented GUI for viewing the data has been created. NOTE: The LUT data is not provided in the repository since the datasets are quite large. You can refer to the slides over module_1 to see a more graphic explination on how to generate the LUTs. > Make sure to update the path to match your naming convention under `lib_mappings` in **both** files.
## 📘 Usage Overview
### 🔧 Setup Procedure
1. **Clone the Metwatts GMID repository**
Follow the installation instructions provided in the repo ([`gmid`](https://github.com/medwatt/gmid))
> 💡 It is recommended to use a virtual environment.
2. **Generate Lookup Tables**
Run the following Python script to generate lookup tables:
```bash
python sg13_nmos_lv.py
```
3. **Install Additional Requirements**
Navigate to `module_0_foundations/scripting` and install dependencies:
```bash
pip install -r requirements.txt
```
4. **Launch the GMID GUI**
From the same directory, launch the Jupyter notebook:
```bash
jupyter lab _gmid_test.ipynb
```
This notebook will open a GUI for exploring the GMID lookup tables, which should look like the following (make sure the paths match yours accordingly):
<p align="center"> <img src=".media/gmid.png" width="800" height="400" /> </p>

View File

@ -1,10 +0,0 @@
### Lookup Table Generation
To generate the lookup tables (LUTs) used in this chapter, we utilized resources from the GitHub repository by [medwatt](https://github.com/medwatt). Specifically, the LUT generation was based on his excellent [`gmid`](https://github.com/medwatt/gmid) project, which provides detailed documentation and well-structured scripts for generating lookup tables. Many thanks to medwatt for making this resource available — if you're working on similar tasks, I highly recommend taking a look at the repository!
The scripts that was made for generating the LUTs can be found as:
- `sg13_nmos_lv.py`
- `sg13_pmos_lv.py`
For a practical use case and a more detailed explanation of how these LUTs are applied, please refer to the slides (Introduction_and_welcome_1).

View File

@ -1,8 +1,15 @@
import os
from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator
from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep
# One of `include_paths` or `lib_mappings` must be specified. # One of `include_paths` or `lib_mappings` must be specified.
# The rest are optional. # The rest are optional.
# Read environment variables to build model path
PDK_ROOT = os.environ["PDK_ROOT"]
PDK = os.environ["PDK"]
model_path = os.path.join(PDK_ROOT, PDK, "libs.tech/ngspice/models/cornerMOSlv.lib")
ngspice = NgspiceSimulator( ngspice = NgspiceSimulator(
# Provide path to simulator if simulator is not in system path. # Provide path to simulator if simulator is not in system path.
simulator_path="ngspice", simulator_path="ngspice",
@ -15,8 +22,8 @@ ngspice = NgspiceSimulator(
# Files to include with `.LIB`. # Files to include with `.LIB`.
lib_mappings = [ lib_mappings = [
("/home/pedersen/IHP-Open-PDK/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib", " mos_tt") # Put your own path to the corner lib (model_path, "mos_tt")
], ],
# If the transistor is defined inside a subcircuit in # If the transistor is defined inside a subcircuit in

View File

@ -1,8 +1,15 @@
import os
from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator from mosplot.lookup_table_generator.simulators import NgspiceSimulator, HspiceSimulator
from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep from mosplot.lookup_table_generator import LookupTableGenerator, TransistorSweep
# One of `include_paths` or `lib_mappings` must be specified. # One of `include_paths` or `lib_mappings` must be specified.
# The rest are optional. # The rest are optional.
# Read environment variables to build model path
PDK_ROOT = os.environ["PDK_ROOT"]
PDK = os.environ["PDK"]
model_path = os.path.join(PDK_ROOT, PDK, "libs.tech/ngspice/models/cornerMOSlv.lib")
ngspice = NgspiceSimulator( ngspice = NgspiceSimulator(
# Provide path to simulator if simulator is not in system path. # Provide path to simulator if simulator is not in system path.
simulator_path="ngspice", simulator_path="ngspice",
@ -15,8 +22,8 @@ ngspice = NgspiceSimulator(
# Files to include with `.LIB`. # Files to include with `.LIB`.
lib_mappings = [ lib_mappings = [
("/home/pedersen/IHP-Open-PDK/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib", " mos_tt") # Put your own path to the corner lib (model_path, "mos_tt")
], ],
# If the transistor is defined inside a subcircuit in # If the transistor is defined inside a subcircuit in

View File

@ -1,4 +1,4 @@
% time-domain current integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain current integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-7.276e-05,-4.4427e-05,0.000161037) m -> [25,68,60] % start-coordinates: (-7.276e-05,-4.4427e-05,0.000161037) m -> [25,68,60]
% stop-coordinates: (-7.196e-05,-4.11275e-05,0.000161037) m -> [27,75,60] % stop-coordinates: (-7.196e-05,-4.11275e-05,0.000161037) m -> [27,75,60]
% t/s current % t/s current
@ -6,11 +6,3 @@
3.57024492566e-13 -2.36289130623e-11 3.57024492566e-13 -2.36289130623e-11
7.13804949251e-13 -2.68896710454e-11 7.13804949251e-13 -2.68896710454e-11
1.07058540594e-12 -1.46053872122e-12 1.07058540594e-12 -1.46053872122e-12
1.42736586262e-12 9.69331004352e-11
1.78414631931e-12 3.43515688117e-10
2.14092677599e-12 8.23605628142e-10
2.49770723268e-12 1.57702484405e-09
2.85448768937e-12 2.49009812769e-09
3.21126814605e-12 3.15044235144e-09
3.56804860274e-12 2.73826339381e-09
3.92482905942e-12 7.52182066632e-11

View File

@ -1,4 +1,4 @@
% time-domain current integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain current integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-1.274e-05,-4.4427e-05,0.000161037) m -> [156,68,60] % start-coordinates: (-1.274e-05,-4.4427e-05,0.000161037) m -> [156,68,60]
% stop-coordinates: (-1.194e-05,-4.11275e-05,0.000161037) m -> [158,75,60] % stop-coordinates: (-1.194e-05,-4.11275e-05,0.000161037) m -> [158,75,60]
% t/s current % t/s current
@ -6,11 +6,3 @@
3.57024492566e-13 7.98288369544e-14 3.57024492566e-13 7.98288369544e-14
7.13804949251e-13 1.08618094987e-12 7.13804949251e-13 1.08618094987e-12
1.07058540594e-12 7.5270844245e-13 1.07058540594e-12 7.5270844245e-13
1.42736586262e-12 -8.20086782771e-13
1.78414631931e-12 -4.42067172798e-12
2.14092677599e-12 -1.20884665125e-11
2.49770723268e-12 -2.50343131641e-11
2.85448768937e-12 -4.1945030782e-11
3.21126814605e-12 -5.60602224364e-11
3.56804860274e-12 -5.17331143202e-11
3.92482905942e-12 -5.58773426834e-12

View File

@ -1,4 +1,4 @@
% time-domain current integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain current integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-4.6935e-05,-5.22e-05,0.00015527) m -> [81,46,39] % start-coordinates: (-4.6935e-05,-5.22e-05,0.00015527) m -> [81,46,39]
% stop-coordinates: (-4.6935e-05,-3.33525e-05,0.00015624) m -> [81,96,42] % stop-coordinates: (-4.6935e-05,-3.33525e-05,0.00015624) m -> [81,96,42]
% t/s current % t/s current
@ -6,11 +6,3 @@
3.57024492566e-13 9.1240591471e-12 3.57024492566e-13 9.1240591471e-12
7.13804949251e-13 2.19632749487e-11 7.13804949251e-13 2.19632749487e-11
1.07058540594e-12 2.29866386342e-11 1.07058540594e-12 2.29866386342e-11
1.42736586262e-12 -7.1528963308e-12
1.78414631931e-12 -1.15567604098e-10
2.14092677599e-12 -3.73915814977e-10
2.49770723268e-12 -8.60476079279e-10
2.85448768937e-12 -1.5994725544e-09
3.21126814605e-12 -2.45495979101e-09
3.56804860274e-12 -2.99610269927e-09
3.92482905942e-12 -2.40779218785e-09

View File

@ -1,4 +1,4 @@
% time-domain current integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain current integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-3.82975e-05,-5.22e-05,0.00015527) m -> [101,46,39] % start-coordinates: (-3.82975e-05,-5.22e-05,0.00015527) m -> [101,46,39]
% stop-coordinates: (-3.82975e-05,-3.33525e-05,0.00015624) m -> [101,96,42] % stop-coordinates: (-3.82975e-05,-3.33525e-05,0.00015624) m -> [101,96,42]
% t/s current % t/s current
@ -6,11 +6,3 @@
3.57024492566e-13 -2.66369527347e-13 3.57024492566e-13 -2.66369527347e-13
7.13804949251e-13 5.72306633508e-13 7.13804949251e-13 5.72306633508e-13
1.07058540594e-12 2.0503809425e-13 1.07058540594e-12 2.0503809425e-13
1.42736586262e-12 -5.71874416311e-13
1.78414631931e-12 -2.21018971354e-12
2.14092677599e-12 -5.73595121053e-12
2.49770723268e-12 -1.13060498463e-11
2.85448768937e-12 -1.78233244136e-11
3.21126814605e-12 -2.12624553381e-11
3.56804860274e-12 -1.42608416395e-11
3.92482905942e-12 1.31045660434e-11

View File

@ -1,4 +1,4 @@
% time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-7.246e-05,-4.26269e-05,0.00015727) m -> [26,72,46] % start-coordinates: (-7.246e-05,-4.26269e-05,0.00015727) m -> [26,72,46]
% stop-coordinates: (-7.246e-05,-4.26269e-05,0.00016498) m -> [26,72,74] % stop-coordinates: (-7.246e-05,-4.26269e-05,0.00016498) m -> [26,72,74]
% t/s voltage % t/s voltage
@ -6,11 +6,3 @@
3.56780456686e-13 -1.08553834324e-09 3.56780456686e-13 -1.08553834324e-09
7.13560913371e-13 -1.07722674877e-09 7.13560913371e-13 -1.07722674877e-09
1.07034137006e-12 5.61411677563e-10 1.07034137006e-12 5.61411677563e-10
1.42712182674e-12 6.39254287005e-09
1.78390228343e-12 2.00185794053e-08
2.14068274011e-12 4.52563277964e-08
2.4974631968e-12 8.29345458975e-08
2.85424365349e-12 1.25303394327e-07
3.21102411017e-12 1.49470912092e-07
3.56780456686e-12 1.13413920033e-07
3.92458502354e-12 -3.9448140754e-08

View File

@ -1,4 +1,4 @@
% time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-1.244e-05,-4.26269e-05,0.00015727) m -> [157,72,46] % start-coordinates: (-1.244e-05,-4.26269e-05,0.00015727) m -> [157,72,46]
% stop-coordinates: (-1.244e-05,-4.26269e-05,0.00016498) m -> [157,72,74] % stop-coordinates: (-1.244e-05,-4.26269e-05,0.00016498) m -> [157,72,74]
% t/s voltage % t/s voltage
@ -6,11 +6,3 @@
3.56780456686e-13 -3.56798952498e-12 3.56780456686e-13 -3.56798952498e-12
7.13560913371e-13 -5.45528151732e-11 7.13560913371e-13 -5.45528151732e-11
1.07034137006e-12 -3.61752977834e-11 1.07034137006e-12 -3.61752977834e-11
1.42712182674e-12 3.89006691442e-11
1.78390228343e-12 2.16148981092e-10
2.14068274011e-12 5.95244138701e-10
2.4974631968e-12 1.23926499965e-09
2.85424365349e-12 2.08458642015e-09
3.21102411017e-12 2.79395974412e-09
3.56780456686e-12 2.59388116541e-09
3.92458502354e-12 3.19669108025e-10

View File

@ -1,4 +1,4 @@
% time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-4.4935e-05,-4.26269e-05,0.000155995) m -> [87,72,41] % start-coordinates: (-4.4935e-05,-4.26269e-05,0.000155995) m -> [87,72,41]
% stop-coordinates: (-4.8335e-05,-4.26269e-05,0.000155995) m -> [77,72,41] % stop-coordinates: (-4.8335e-05,-4.26269e-05,0.000155995) m -> [77,72,41]
% t/s voltage % t/s voltage
@ -6,11 +6,3 @@
3.56780456686e-13 -4.17605613284e-10 3.56780456686e-13 -4.17605613284e-10
7.13560913371e-13 -1.08776993663e-09 7.13560913371e-13 -1.08776993663e-09
1.07034137006e-12 -1.17565671781e-09 1.07034137006e-12 -1.17565671781e-09
1.42712182674e-12 2.23312448394e-10
1.78390228343e-12 5.40015371309e-09
2.14068274011e-12 1.79046149018e-08
2.4974631968e-12 4.16881946741e-08
2.85424365349e-12 7.81819733398e-08
3.21102411017e-12 1.2109349079e-07
3.56780456686e-12 1.49648993641e-07
3.92458502354e-12 1.23891370052e-07

View File

@ -1,4 +1,4 @@
% time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Fri May 16 11:07:48 2025 % time-domain voltage integration by openEMS v0.0.35-108-gc651cce @Sat Jun 21 22:34:37 2025
% start-coordinates: (-3.993e-05,-4.26269e-05,0.000155995) m -> [97,72,41] % start-coordinates: (-3.993e-05,-4.26269e-05,0.000155995) m -> [97,72,41]
% stop-coordinates: (-3.6065e-05,-4.26269e-05,0.000155995) m -> [107,72,41] % stop-coordinates: (-3.6065e-05,-4.26269e-05,0.000155995) m -> [107,72,41]
% t/s voltage % t/s voltage
@ -6,11 +6,3 @@
3.56780456686e-13 3.15549134131e-11 3.56780456686e-13 3.15549134131e-11
7.13560913371e-13 -3.44705401376e-11 7.13560913371e-13 -3.44705401376e-11
1.07034137006e-12 -1.32001081073e-11 1.07034137006e-12 -1.32001081073e-11
1.42712182674e-12 1.12302746312e-11
1.78390228343e-12 5.60911208973e-11
2.14068274011e-12 1.6139112876e-10
2.4974631968e-12 3.56886471764e-10
2.85424365349e-12 5.98027360271e-10
3.21102411017e-12 7.67107540683e-10
3.56780456686e-12 6.24953193362e-10
3.92458502354e-12 -2.08011365944e-10

View File

@ -22,7 +22,7 @@ from openEMS.physical_constants import *
# preview model/mesh only? # preview model/mesh only?
# postprocess existing data without re-running simulation? # postprocess existing data without re-running simulation?
preview_only = False preview_only = True
postprocess_only = False postprocess_only = False
# ===================== input files and path settings ======================= # ===================== input files and path settings =======================