-
Notifications
You must be signed in to change notification settings - Fork 0
/
inv.cir
95 lines (82 loc) · 2.68 KB
/
inv.cir
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
* =============================================================================
* Circuit : CMOS Inverter with 1 PMOS + 1 NMOS
* Description: tr = tf when C_L = 0.024pF
*
* Author : Wuqiong Zhao ([email protected])
* Date : 2023-06-01
* License : MIT
* =============================================================================
* Reference:
* https://github.com/cornell-ece5745/ece5745-tut10-spice/blob/master/sim/inv-sim.sp
.title CMOS Inverter
* Parameters and Model
* -----------------------------------------------------------------------------
.param VDD='1.0V'
.temp 27
.inc ./FreePDK45/ff.inc
* Supply Voltage Source
* -----------------------------------------------------------------------------
Vdd vdd gnd VDD
* Inverter
* -----------------------------------------------------------------------------
.inc ./inv.inc
XInv gnd in out vdd INV
* Load Capacitor
* -----------------------------------------------------------------------------
CL out gnd 24fF
* Input Signals
* -----------------------------------------------------------------------------
Vin in gnd PWL
+ (
+ 0.0ns 0V
+ 0.9ns 0V
+ 1.1ns VDD
+ 1.9ns VDD
+ 2.1ns 0V
+ 3.0ns 0V
+ )
* Analysis
* -----------------------------------------------------------------------------
.ic V(out)=VDD
.tran 0.005ns 3ns
.control
run
* >>>>> plot >>>>>>
set xgridwidth = 2
set xbrushwidth = 3
* "svgwidth", "svgheight", "svgfont-size", "svgfont-width", "svguse-color", "svgstroke-width", "svggrid-width",
set svg_intopts = ( 1024 256 16 0 1 2 0 )
* "svgbackground", "svgfont-family", "svgfont"
setcs svg_stropts = ( white Arial Arial )
set hcopydevtype = svg
set color1 = black
set color2 = blue
set color3 = red
hardcopy fig/plot_inv_t.svg
+ out in
+ title 'CMOS Inverter'
+ xlabel 't'
+ ylabel 'Voltage'
+ ylimit 0 1
* for MS Windows, using Edge
if $oscompiled = 1 | $oscompiled = 8
shell Start fig/plot_inv_t.svg
else
if $oscompiled = 7
* macOS (using Safari, no need to install X11)
shell open -a safari fig/plot_inv_t.svg &
else
* for CYGWIN, Linux, using feh and X11
shell feh --magick-timeout 1 fig/plot_inv_t.svg &
end
end
* <<<<< plot <<<<<
.endc
* Measurement
* -----------------------------------------------------------------------------
.measure tran tr trig V(out) val='VDD*0.1' rise=1 targ V(out) val='VDD*0.9' rise=1
.measure tran tf trig V(out) val='VDD*0.9' fall=1 targ V(out) val='VDD*0.1' fall=1
.measure tran tpdr trig V(in) val='VDD/2' fall=1 targ V(out) val='VDD/2' rise=1
.measure tran tpdf trig V(in) val='VDD/2' rise=1 targ V(out) val='VDD/2' fall=1
.measure tran tpd param='(tpdr+tpdf)/2'
.end