Tcl script which will create a list of models and subcircuit names contained within a Spice .lib file. The script should be called find_lib_parts. The name of the .lib file should be given on the...

Tcl script which will create a list of models and subcircuit names contained within a Spice .lib file. The script should be called find_lib_parts. The name of the .lib file should be given on the command line. It should work
whether or not the .lib extension is typed in by the user. It should also accept one command
line option, -f, followed by an output file name. If the –f option is not given, then the results
should just be displayed on the screen. If the -f option is given, then the results should be
written into a file. Some sample invocations.
find_lib_parts ece476.lib
find_lib_parts ece476
find_lib_parts ece476.lib –f my_parts.txt
find_lib_parts ece476 -f my_parts.txt
Implementing error checking is encouraged.


* Sample standard device library * .model Q2N2222 NPN(Is=14.34f Xti=3 Eg=1.11 Vaf=74.03 Bf=255.9 Ne=1.307 +Ise=14.34f Ikf=.2847 Xtb=1.5 Br=6.092 Nc=2 Isc=0 Ikr=0 Rc=1 +Cjc=7.306p Mjc=.3416 Vjc=.75 Fc=.5 Cje=22.01p Mje=.377 Vje=.75 +Tr=46.91n Tf=411.1p Itf=.6 Vtf=1.7 Xtf=3 Rb=10) *Nationalpid=19case=TO18 *88-09-07 bamcreation *$ .model Q2N3904NPN(Is=6.734f Xti=3 Eg=1.11 Vaf=74.03 Bf=416.4 Ne=1.259 +Ise=6.734f Ikf=66.78m Xtb=1.5 Br=.7371 Nc=2 Isc=0 Ikr=0 Rc=1 +Cjc=3.638p Mjc=.3085 Vjc=.75 Fc=.5 Cje=4.493p Mje=.2593 Vje=.75 +Tr=239.5n Tf=301.2p Itf=.4 Vtf=4 Xtf=2 Rb=10) *Nationalpid=23case=TO92 *88-09-08 bamcreation *$ .model Q2N3906PNP(Is=1.41f Xti=3 Eg=1.11 Vaf=18.7 Bf=180.7 Ne=1.5 Ise=0 +Ikf=80m Xtb=1.5 Br=4.977 Nc=2 Isc=0 Ikr=0 Rc=2.5 Cjc=9.728p +Mjc=.5776 Vjc=.75 Fc=.5 Cje=8.063p Mje=.3677 Vje=.75 Tr=33.42n +Tf=179.3p Itf=.4 Vtf=4 Xtf=6 Rb=10) *Nationalpid=66case=TO92 *88-09-09 bamcreation *$ *** Power Diode *** .MODEL D1N4002 D (IS=14.11E-9 N=1.984 RS=33.89E-3 IKF=94.81 XTI=3 + EG=1.110 CJO=51.17E-12 M=.2762 VJ=.3905 FC=.5 ISR=100.0E-12 + NR=2 BV=100.1 IBV=10 TT=4.761E-6) *$ *** General Purpose Fast Rectifier *** .model D1N914 D(Is=168.1E-21 N=1 Rs=.1 Ikf=0 Xti=3 Eg=1.11 Cjo=4p M=.3333 + Vj=.75 Fc=.5 Isr=100p Nr=2 Bv=100 Ibv=100u Tt=11.54n) *$ .model CA3086 NPN ( + IS=1E-014 XTI=3 EG=1.11 VAF=100 VAR=100 + BF=145.7 ISE=1.14286E-013 NE=1.48 IKF=0.0467 XTB=0 + BR=0.1 ISC=1.0005E-014 NC=2 IKR=0.01 RC=10 + CJC=9.9171E-013 MJC=0.333 VJC=0.75 FC=0.5 CJE=1.02E-012 + MJE=0.336 VJE=0.75 TR=1E-008 TF=2.7701E-010 ITF=1.75 + XTF=309.38 VTF=16.37 PTF=0 RE=0 RB=0 ) *$ .model CA3046 NPN ( + IS=1E-015 XTI=3 EG=1.11 VAF=100 VAR=100 + BF=145.7 ISE=1.14286E-014 NE=1.48 IKF=0.0467 XTB=0 + BR=0.1 ISC=1.0005E-015 NC=2 IKR=0.01 RC=10 + CJC=9.9171E-013 MJC=0.333 VJC=0.75 FC=0.5 CJE=1.02E-012 + MJE=0.336 VJE=0.75 TR=1E-008 TF=2.7701E-010 ITF=1.75 + XTF=309.38 VTF=16.37 PTF=0 RE=0 RB=0 ) *$ .model CA3046_OLD NPN ( + IS=1E-014 XTI=3 EG=1.11 VAF=100 VAR=100 + BF=145.7 ISE=1.14286E-013 NE=1.48 IKF=0.0467 XTB=0 + BR=0.1 ISC=1.0005E-014 NC=2 IKR=0.01 RC=10 + CJC=9.9171E-013 MJC=0.333 VJC=0.75 FC=0.5 CJE=1.02E-012 + MJE=0.336 VJE=0.75 TR=1E-008 TF=2.7701E-010 ITF=1.75 + XTF=309.38 VTF=16.37 PTF=0 RE=0 RB=0 ) *$ .model D1N5817D(Is=2.835u Rs=47.12m Ikf=.3227 N=1 Xti=0 Eg=1.11 Cjo=472.4p +M=.6215 Vj=.75 Fc=.5 Isr=37.75u Nr=2) *Motorolapid=1N5817case=59-04 *88-09-12 rmn *$ *TopSPICE library: Models\Vendor\SUPERTEX.MDB *PART NUMBER: TP0604 *MODEL NAME: TP0604 *SYMBOL: MPMOS *SYNTAX: Mname d g s b TP0604 * * Supertex DMOS * * *TN0604 MODEL * .MODEL TN0604 NMOS (LEVEL=3 RS=3.56E-3 NSUB=1.0E15 +DELTA=0.1 KAPPA=0.10123 TPG=1 CGDO=4.3432E-11 +RD=0.0239 VTO=1.327 VMAX=1.0E7 ETA=0.0223089 +NFS=6.6E10 TOX=1.0E-7 LD=1.698E-9 UO=862.425 +XJ=6.4666E-7 THETA=1.0E-5 CGSO=1.21798E-10 L=2.5E-6 +W=2.0E-2) .MODEL TP0604 PMOS ( + LEVEL=3 RS=0.0238 NSUB=5E+014 DELTA=0.1 KAPPA=0.08214 + TPG=-1 CGDO=5.22123E-011 RD=0.0239 VTO=-1.9 VMAX=3E+006 + ETA=0.121 NFS=3.3841E+011 TOX=1E-007 LD=1.14E-009 UO=365.45 + XJ=6.5E-007 THETA=4.06E-005 CGSO=8.532E-011 L=2.5E-006 W=0.02 ) * *$ .model D1N5818D(Is=2.835u Rs=47.12m Ikf=.3227 N=1 Xti=0 Eg=1.11 Cjo=359.3p +M=.6513 Vj=.75 Fc=.5 Isr=26.46u Nr=2) *Motorolapid=1N5817case=59-04 *88-09-12 rmn *$ * TLC3702 VOLTAGE COMPARATOR "MACROMODEL" SUBCIRCUIT * CREATED USING PARTS VERSION 4.03 ON 03/14/90 AT 10:09 * REV (N/A) * NOTE: COMPONENTS ADDED TO SIMULATE ACTIVE PULL-UP * CONNECTIONS: NON-INVERTING INPUT * | INVERTING INPUT * | | POSITIVE POWER SUPPLY * | | | NEGATIVE POWER SUPPLY * | | | | OUTPUT * | | | | | .SUBCKT TLC3702 1 2 3 4 5 * F1 9 3 V1 1 * FOUT 30 5 POLY(1),(V1) 4E-3 -40 ;THESE COMPONENTS * EO1 30 0 POLY(1),(3,0) -.75 1 ;ADDED TO SIMULATE * DO1 5 30 DX * ;ACTIVE PULL-UP * Added pull-up resistor to make model work * RGLE 5 3 2.2K * IEE 3 7 DC 100.0E-6 VI1 21 1 DC .75 VI2 22 2 DC .75 Q1 9 21 7 QIN Q2 8 22 7 QIN Q3 9 8 4 QMO Q4 8 8 4 QMI .MODEL QIN PNP(IS=800.0E-18 BF=10.00E6) .MODEL QMI NPN(IS=800.0E-18 BF=1002) .MODEL QMO NPN(IS=800.0E-18 BF=1000 CJC=1E-15 TR=807.4E-9) E1 10 4 9 4 1 V1 10 11 DC 0 Q5 5 11 4 QOC .MODEL QOC NPN(IS=800.0E-18 BF=1.810E3 CJC=1E-15 TF=1.357E-9 TR=1.129E-6) DP 4 3 DX RP 3 4 -70E3 .MODEL DX D(IS=800.0E-18) * .ENDS *$ ****************************************************************************** * TLC555 TIMER MACROMODEL * 4/1/92 DBB * REV N/A ****************************************************************************** * COMMON * | TRIGGER * | | OUTPUT * | | | RESET * | | | | CONTROL * | | | | | THRESHOLD * | | | | | | DISCHARGE * | | | | | | |VDD * | | | | | | || .SUBCKT TLC555 1 2 3 4 5 6 78 EREF 15 1 (8,1) .5 GSOURCE 8 3 (8,26) 12.5E-3 GSINK 3 1 (26,1) 67E-3 VD1 8 27 DC .8 VD2 28 1 DC .85 VREF 30 1 DC 1.2 C1 29 1 700E-15 RREF2 30 1 100E3 RREF 15 1 100E3 ROUT 3 1 100K R1 6 1 500E9 R2 2 1 500E9 R3 8 5 75E3 R4 5 9 75E3 R5 9 1 75E3 R6 10 11 1E3 R7 13 14 1E3 R8 8 12 150E3 R9 4 8 500E9 R10 20 19 1E3 R11 16 17 1E3 R12 8 18 150E3 R13 8 21 150E3 R14 22 23 1E3 R15 8 26 150E3 R16 24 25 1E3 R19 7 1 500E9 R20 29 26 1E6 D1 1 11 DMOD D2 12 11 DMOD D3 12 14 DMOD D4 1 14 DMOD D5 18 17 DMOD D6 1 17 DMOD D7 18 19 DMOD D8 1 19 DMOD D9 21 14 DMOD D10 21 25 DMOD D11 1 23 DMOD D12 18 23 DMOD D13 26 25 DMOD D14 1 25 DMOD1 D15 3 27 DMOD D16 28 3 DMOD E1 10 1 (6,5) 1000 E2 13 1 (2,9) 1000 E3 16 1 (15,12) 1000 E4 22 1 (15,21) 1000 E5 24 1 (15,18) 1000 E7 20 1 (4,30) 1000 M1 7 29 1 1 MOSMOD .MODEL MOSMOD NMOS (LEVEL=1 KP=1 VTO=1 RD=5) .MODEL DMOD D (RS=1E-6) .MODEL DMOD1 D (RS=1E-6 IS=1E-9) .ENDS *$ * TLC2272 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT * CREATED USING PARTS RELEASE 4.03 ON 10/29/91 AT 11:26 * REV (N/A) SUPPLIES +/-5V * CONNECTIONS: NON-INVERTING INPUT * | INVERTING INPUT * | | POSITIVE POWER SUPPLY * | | | NEGATIVE POWER SUPPLY * | | | | OUTPUT * | | | | | .SUBCKT TLC2272 1 2 3 4 5 C1 11 12 14E-12 C2 6 7 60.00E-12 DC 5 53 DX DE 54 5 DX DLP 90 91 DX DLN 92 90 DX DP 4 3 DX EGND 99 0 POLY(2) (3,0) (4,0) 0 .5 .5 FB 7 99 POLY(5) VB VC VE VLP VLN 0 130E4 -1E6 1E6 1E6 -1E6 GA 6 0 11 12 452.4E-6 GCM 0 6 10 99 50.44E-9 ISS 3 10 DC 228.0E-6 HLIM 90 0 VLIM 1K J1 11 2 10 JX J2 12 1
May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here