Tim Edwards | dfc24ad | 2021-04-29 16:18:51 -0400 | [diff] [blame] | 1 | *--------------------------------------------------------------------------- |
| 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 Edwards | 35111e9 | 2021-05-07 09:52:15 -0400 | [diff] [blame] | 20 | .param mc_mm_switch=0 |
Tim Edwards | dfc24ad | 2021-04-29 16:18:51 -0400 | [diff] [blame] | 21 | .lib /usr/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt |
| 22 | |
| 23 | * Note: 20 resistors of length 25um connected in series |
| 24 | Xres1 vdda vin vss sky130_fd_pr__res_xhigh_po_0p69 l=500 |
| 25 | Xres2 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 | |
| 29 | Vm1 vssm1 vss DC=0 |
| 30 | Vm2 vdda vddm2 DC=0 |
| 31 | Vm3 vdda vddm3 DC=0 |
| 32 | Vm4 vssm4 vss DC=0 |
| 33 | Vm5 vssm5 vss DC=0 |
| 34 | Vm6 vdda vddm6 DC=0 |
| 35 | Vm7 vdda vddm7 DC=0 |
| 36 | |
| 37 | * D G S B |
| 38 | Xm1 casc1 vin vssm1 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 39 | Xc1 mir1 casc1 casc1 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 40 | Xm2 mir1 mir1 vddm2 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=8 |
| 41 | Xm3 mir2 mir1 vddm3 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 42 | Xc2 casc2 casc1 mir2 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 43 | Xm4 casc2 casc2 vssm4 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=7 |
| 44 | Xm5 casc3 casc2 vssm5 vss sky130_fd_pr__nfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 45 | Xc3 mir3 casc3 casc3 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 46 | Xm6 mir3 mir3 vddm6 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=7 |
| 47 | Xm7 mir4 mir3 vddm7 vdda sky130_fd_pr__pfet_g5v0d10v5 w=2 l=0.8 m=1 |
| 48 | Xc4 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 | *---------------------------- |
| 65 | Vpwr vdda vss DC=3.3 |
| 66 | Rgnd vss 0 0.01 |
| 67 | Rload vcap vss 1MEG |
| 68 | *---------------------------- |
| 69 | |
| 70 | *---------------------------- |
| 71 | * Testbench control |
| 72 | *---------------------------- |
| 73 | .control |
| 74 | op |
| 75 | print V(vin) |
| 76 | print I(Vm1) |
| 77 | print I(Vm2) |
| 78 | print I(Vm3) |
| 79 | print I(Vm4) |
| 80 | print I(Vm5) |
| 81 | print I(Vm6) |
| 82 | print I(Vm7) |
| 83 | .endc |
| 84 | |
| 85 | .end |
| 86 | |