blob: 8e4162dcd9eb4d356cca33712a4f985eef58585c [file] [log] [blame]
Tim Edwardsdfc24ad2021-04-29 16:18:51 -04001*---------------------------------------------------------------------------
2* SPDX-FileCopyrightText: 2020 Efabless Corporation
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* https://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*
15* SPDX-License-Identifier: Apache-2.0
16*---------------------------------------------------------------------------
17* Simple POR circuit for Caravel current mirror test
18*-------------------------------------------------------------------
19
Tim Edwards35111e92021-05-07 09:52:15 -040020.param mc_mm_switch=0
Tim Edwardsdfc24ad2021-04-29 16:18:51 -040021.lib /usr/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
22
23* Note: 20 resistors of length 25um connected in series
24Xres1 vdda vin vss sky130_fd_pr__res_xhigh_po_0p69 l=500
25Xres2 vin vss vss sky130_fd_pr__res_xhigh_po_0p69 l=149
26
27* voltage sources at 0V for measuring current in each branch
28
29Vm1 vssm1 vss DC=0
30Vm2 vdda vddm2 DC=0
31Vm3 vdda vddm3 DC=0
32Vm4 vssm4 vss DC=0
33Vm5 vssm5 vss DC=0
34Vm6 vdda vddm6 DC=0
35Vm7 vdda vddm7 DC=0
36
37* D G S B
38Xm1 casc1 vin vssm1 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=1
39Xc1 mir1 casc1 casc1 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
40Xm2 mir1 mir1 vddm2 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=8
41Xm3 mir2 mir1 vddm3 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
42Xc2 casc2 casc1 mir2 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
43Xm4 casc2 casc2 vssm4 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=7
44Xm5 casc3 casc2 vssm5 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=1
45Xc3 mir3 casc3 casc3 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
46Xm6 mir3 mir3 vddm6 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=7
47Xm7 mir4 mir3 vddm7 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
48Xc4 vcap casc3 mir4 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1
49
50* Check branch currents in each mirror branch.
51* 1st branch should be 240nA
52* 2nd branch should be 30nA
53* 3rd branch should be 4.3nA
54* 4th branch should be 612pA
55*
56* Result: vin sits at 0.7590 (close to 0.7575 target)
57* I(Vm1/2) = 202.80 nA
58* I(Vm3/4) = 26.10 nA (should be /8) actually /7.77
59* I(Vm5/6) = 4.58 nA (should be /7) actually /5.70
60* I(Vm7) = 0.67 nA (should be /7) actually /6.80
61
62*----------------------------
63* Testbench circuit
64*----------------------------
65Vpwr vdda vss DC=3.3
66Rgnd vss 0 0.01
67Rload vcap vss 1MEG
68*----------------------------
69
70*----------------------------
71* Testbench control
72*----------------------------
73.control
74op
75print V(vin)
76print I(Vm1)
77print I(Vm2)
78print I(Vm3)
79print I(Vm4)
80print I(Vm5)
81print I(Vm6)
82print I(Vm7)
83.endc
84
85.end
86