Skip to content

Commit

Permalink
Merge pull request google#79 from mabrains/xyce_regression
Browse files Browse the repository at this point in the history
xyce add mos cv
  • Loading branch information
FaragElsayed2 authored Jan 22, 2023
2 parents bafca6b + c1557bf commit fa1f671
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 67 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ xmn1 0 G_tn 0 S_tn {{device}} W = {{width}}u L = {{length}}u nf={{nf}} ad={{AD}}
*****************
** Analysis
*****************
.DC Vgs {{vgs}} Vbs {{vbs}}
.TRAN 0 0.0001ms
.STEP Vgs {{vgs}}
.STEP Vbs {{vbs}}
.STEP TEMP 25 -60 200
.print DC FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgc/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgs)} v(S_tn) v(G_tn)

.print tran FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgc/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgs) - 1.0e15*N(xmn1:m0:cgd)} v(S_tn) v(G_tn)
.include "../../../design.xyce"
.lib "../../../sm141064.xyce" typical
.end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ xmn1 D_tn G_tn 0 0 {{device}} W = {{width}}u L = {{length}}u nf={{nf}} ad={{AD}}
*****************
** Analysis
*****************
.DC Vds {{vds}} Vgs {{vgs}}
.TRAN 0 0.0001ms
.STEP Vds {{vds}}
.STEP Vgs {{vgs}}
.STEP TEMP 25 -60 200
.print DC FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgd/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgd)} v(G_tn) v(D_tn)
.print tran FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgd/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgd)} v(G_tn) v(D_tn)

.include "../../../design.xyce"
.lib "../../../sm141064.xyce" typical
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ xmn1 D_tn G_tn 0 0 {{device}} W = {{width}}u L = {{length}}u nf={{nf}} ad={{AD}}
*****************
** Analysis
*****************
.DC Vds {{vds}} Vgs {{vgs}}
.TRAN 0 0.0001ms
.STEP Vds {{vds}}
.STEP Vgs {{vgs}}
.STEP TEMP 25 -60 200
.print DC FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgs/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgs)} v(D_tn) v(G_tn)
.print tran FORMAT=CSV file=mos_cv_regr/{{device}}/{{device}}_netlists_Cgs/simulated_W{{width}}_L{{length}}.csv {-1.0e15*N(xmn1:m0:cgs)} v(D_tn) v(G_tn)

.include "../../../design.xyce"
.lib "../../../sm141064.xyce" typical
Expand Down
18 changes: 14 additions & 4 deletions models/xyce/testing/regression/mos_cv/models_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ def run_sim(dirpath: str, device: str, width: float, length: float, nf: float) -
vgs = vgsd
vds = vdsd
vbs = vbsc
if width_str == 200:
width_str = 100

s = f"netlist_w{width_str}_l{length_str}.spice"
netlist_path = f"{dirpath}/{device}_netlists_Cg{cap}/{s}"
Expand Down Expand Up @@ -489,12 +487,16 @@ def run_sims(df: pd.DataFrame, dirpath: str, device: str, num_workers=mp.cpu_cou
# sweeping on all generated cvs files
for i in range(len(sf)):
df = pd.read_csv(sf[i])

if cap == "c":
# use the first column as index
v_s = "V(S_TN)"
i_vds = "{-1.0E15*N(XMN1:M0:CGS)}"
i_vds = "{-1.0E15*N(XMN1:M0:CGS) - 1.0E15*N(XMN1:M0:CGD)}"
v1 = "V(G_TN)"
# drop time column
df.drop(df.columns[0], axis=1, inplace=True)
# drop duplicate rows for columns V(S_TN) and V(G_TN)
df.drop_duplicates(subset=["V(S_TN)", "V(G_TN)"], inplace=True)
sdf = df.pivot(index=v1, columns=(v_s), values=i_vds)
# Writing final simulated data 1
sdf.rename(
Expand All @@ -514,6 +516,10 @@ def run_sims(df: pd.DataFrame, dirpath: str, device: str, num_workers=mp.cpu_cou
inplace=True,
)
elif cap == "d":
# drop time column
df.drop(df.columns[0], axis=1, inplace=True)
# drop duplicate rows for columns V(S_TN) and V(G_TN)
df.drop_duplicates(subset=["V(D_TN)", "V(G_TN)"], inplace=True)
# use the first column as index
v_s = "V(G_TN)"
i_vds = "{-1.0E15*N(XMN1:M0:CGD)}"
Expand All @@ -526,6 +532,10 @@ def run_sims(df: pd.DataFrame, dirpath: str, device: str, num_workers=mp.cpu_cou
inplace=True,
)
else:
# drop time column
df.drop(df.columns[0], axis=1, inplace=True)
# drop duplicate rows for columns V(S_TN) and V(G_TN)
df.drop_duplicates(subset=["V(D_TN)", "V(G_TN)"], inplace=True)
# use the first column as index
v_s = "V(G_TN)"
i_vds = "{-1.0E15*N(XMN1:M0:CGS)}"
Expand Down

0 comments on commit fa1f671

Please sign in to comment.