Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generator for bin based plots for FETs #237

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3f11b65
Added initial script for generating plots from FET simulator
glatosinski Nov 10, 2020
508c21f
Added script for generating nfet and pfet plots from libraries directory
glatosinski Nov 11, 2020
5ea3ea9
Added grid to plots
glatosinski Nov 12, 2020
414b809
Added closing plots after saving to file
glatosinski Nov 12, 2020
3e57ce2
Comment out not working fet
glatosinski Nov 12, 2020
c64020c
FET simulator code cleanup
glatosinski Nov 12, 2020
2aed534
Added ngspice to environment.yml and PySpice to requirements.txt
glatosinski Nov 16, 2020
ee63e6c
Added grouping FET plots by W
glatosinski Nov 16, 2020
c8b18d8
Changed extension for FET plots from PNG to SVG
glatosinski Nov 16, 2020
f177fa7
Wrapped script in main function
glatosinski Nov 16, 2020
222572a
Added fetching FETs by regular expression
glatosinski Nov 17, 2020
7c4d2fa
Added proper closing of plots
glatosinski Nov 17, 2020
3f0a64b
Fixed directory generation
glatosinski Nov 18, 2020
1c0eeda
Added releasing memory after plotting the FET graphs
glatosinski Nov 18, 2020
6709fdf
Added not failing on invalid bins.csv file
glatosinski Nov 18, 2020
7f0f405
Added notification on successful finish of the script
glatosinski Nov 18, 2020
8d734f0
fet_simulator: added docstrings
glatosinski Nov 24, 2020
d760ac4
fet_simulator: moved fet modules to simulation/analog
glatosinski Nov 25, 2020
77bad0d
fet_simulator: used more elaborate variable names
glatosinski Nov 25, 2020
ee006e4
base: added method for parsing bins.csv files
glatosinski Nov 25, 2020
a4f7529
fet: added using bins.csv parser from skywater_pdk.base
glatosinski Nov 25, 2020
a512ddf
fet: added docstrings for modules
glatosinski Nov 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fet: added using bins.csv parser from skywater_pdk.base
Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
  • Loading branch information
glatosinski committed Nov 25, 2020
commit a4f7529f756923aa3baf3cebf405f09c82e7b51c
Empty file.
Empty file.
38 changes: 14 additions & 24 deletions scripts/python-skywater-pdk/skywater_pdk/simulation/analog/fet.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
from pathlib import Path
import csv
from collections import defaultdict
import os
import sys

sys.path.insert(0, os.path.abspath(__file__ + '/../../../../'))

from skywater_pdk.base import Cell

logger = Logging.setup_logging()


Expand Down Expand Up @@ -156,20 +161,6 @@ def close_plots(figures):
plt.close(figure)


def read_bins(fname):
"""
Reads bins CSV file.
"""
with open(fname, 'r') as f:
r = csv.reader(f)
# drop CSV header
next(r)
res = []
for line in r:
res.append(line)
return res


def generate_fet_plots(
corner_path,
bins_csv,
Expand All @@ -192,12 +183,12 @@ def generate_fet_plots(
print(f'[generate_fet_plots] {corner_path} {bins_csv}' +
f'{outdir} {outprefix} {only_W}')

bins = read_bins(bins_csv)
bins = Cell.parse_bins(bins_csv)

bins_by_W = defaultdict(list)
# group bins by W
for line in bins:
bins_by_W[(line[0], float(line[2]))].append(line)
for fetbin in bins:
bins_by_W[(fetbin.device, fetbin.w)].append(fetbin)

Ws = [key for key in bins_by_W.keys()
if only_W is None or key[1] in only_W]
Expand All @@ -213,14 +204,13 @@ def generate_fet_plots(

figures, plots = init_plots(fet_type, W)
try:
for dev, bin, fet_W, fet_L in bins_by_W[(fet_type, W)]:
fet_W, fet_L = float(fet_W), float(fet_L)
if only_W is not None and fet_W not in only_W:
for fetbin in bins_by_W[(fet_type, W)]:
if only_W is not None and fetbin.w not in only_W:
continue
c.element('XM1').parameters['W'] = fet_W
c.element('XM1').parameters['L'] = fet_L
gm_id, ft, id_W, gm_gds, vsweep = run_sim(c, iparam, fet_W)
gen_plots(gm_id, id_W, ft, gm_gds, vsweep, fet_W, fet_L, plots)
c.element('XM1').parameters['W'] = fetbin.w
c.element('XM1').parameters['L'] = fetbin.l
gm_id, ft, id_W, gm_gds, vsweep = run_sim(c, iparam, fetbin.w)
gen_plots(gm_id, id_W, ft, gm_gds, vsweep, fetbin.w, fetbin.l, plots)
except Exception:
close_plots(figures)
raise
Expand Down