Name | Parameter | Description | Min | Typ | Max | Unit | |
---|---|---|---|---|---|---|---|
Gain stage gain | a_gain_dB | Spec | 4.00 | 10.00 | 20.00 | dB | |
Sch_typ | 9.38 | ||||||
Sch_tfs | |||||||
Input gain | a_input_dB | Spec | -2.00 | -0.50 | 0.00 | dB | |
Sch_typ | -0.23 | ||||||
Sch_tfs |
*TB_SUN_TR_SKY130NM/TB_NCM
*-----------------------------------------------------------------
* OPTIONS
*-----------------------------------------------------------------
.option TNOM=27 GMIN=1e-15 reltol=1e-3
*-----------------------------------------------------------------
* PARAMETERS
*-----------------------------------------------------------------
.param AVDD = {vdda}
*-----------------------------------------------------------------
* FORCE
*-----------------------------------------------------------------
VSS VSS 0 dc 0
VDD VDD_1V8 0 dc 0 pwl 0 0 10n {AVDD}
VIN VIN 0 dc 0 sin (0 10m 1G 1u 0 0 )
*- Make a bias source
R1 VDD_1V8 VBIAS 10k
XM1 VBIAS VBIAS VSS VSS sky130_fd_pr__nfet_01v8 L=0.2 W=1
R2 VBIAS VG 1k
*- Common source amplifier
C1 VIN VG 1p
R3 VDD_1V8 VOUT 1k
XM2 VOUT VG VSS VSS sky130_fd_pr__nfet_01v8 L=0.2 W=1 M=10
*----------------------------------------------------------------
* NGSPICE control
*----------------------------------------------------------------
.control
set num_threads=8
set color0=white
set color1=black
unset askquit
optran 0 0 0 1n 100n 0
tran 100p 1.1u 1.09u
write
quit
.endc
.end
* Measure nmos
.control
load {cicname}.raw
echo "MEAS_START"
meas tran vpp_vin PP v(vin)
meas tran vpp_vg PP v(vg)
meas tran vpp_vout PP v(vout)
echo "MEAS_END"
.endc
#!/usr/bin/env python3
import pandas as pd
import numpy as np
import yaml
import cicsim as cs
import random
import os
import string
def main(name):
= name + ".yaml"
yamlfile
# Read result yaml file
with open(yamlfile) as fi:
= yaml.safe_load(fi)
obj
"a_input"] = obj["vpp_vg"]/obj["vpp_vin"]
obj["a_input_dB"] = float(20*np.log10(obj["a_input"]))
obj["a_gain"] = obj["vpp_vout"]/obj["vpp_vg"]
obj["a_gain_dB"] = float(20*np.log10(obj["a_gain"]))
obj[
#- use a random string to fool browser caches
= ""
rss if(os.environ.get("CIC_RANDOM_PLOTNAME")):
= "_" + "".join(random.choice(string.ascii_uppercase+string.digits) for _ in range(5))
rss
= name + rss + "_vin_vout.png"
fname print(f"Saving {fname}")
+ ".raw","time","v(vg),v(vout)",ptype="same",fname=fname)
cs.rawplot(name
# Save new yaml file
with open(yamlfile,"w") as fo:
yaml.dump(obj,fo)