SPICE To Qucs Conversion: Test File 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Qucs

Test Report
SPICE to Qucs conversion: Test File 1

Mike Brinson
Copyright c 2007 Mike Brinson <[email protected]> Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation. A copy of the license is included in the section entitled GNU Free Documentation License.

Introduction
Title
DC and independent voltage pulse generator test.

Test le name SPICE specication


Format:
VX N+ N- [[DC] DC/TRAN VALUE] [AC [ACMAG [ACPHASE]]]

Notes: 1. Characters [ and ] enclose optional items 2. Character / denotes OR 3. Independent voltage source names begin with the letter V 4. X denotes name of source 5. N+ and N- are the positive and negative nodes respectively 6. Voltage sources need not be grounded Specication of SPICE statement being tested: VX N+ N- [[DC] VALUE] [PULSE(V1 V2 [ TD [ TR [ TF [ PW [PER]]]]]] Notes: 1. PULSE generates a periodic pulse, where 2. V1 is the initial value; default: must be specied 3. V2 is the pulsed value; default: must be specied 4. TD is the delay time; default value = TSTEP 5. TR is the rise time; default value = TSTEP 6. TF is the fall time; default value = TSTEP 7. PW is the pulse width; default value = TSTOP 8. PER is the period; default value = TSTOP

Test code and schematic


SPICE code: File S2Q_test1.cir
SPICE t o Qucs s y n t a x t e s t f i l e 1 . DC and i n d e p e n d e n t v o l t a g e p u l s e s o u r c e s , p l u s r e s i s t o r s . . s u b c k t S2Q t e s t 1 p01 p02 p03 p04 p05 p06 p07 p08 p09 p10 p11 v1 p01 0 1v r 1 p01 0 10 k v2 p02 0 dc 1v r 2 p02 0 10 k v3 p03 0 p u l s e ( 0 5 ) r 3 p03 0 10 k v4 p04 0 p u l s e ( 0 5 20n ) r 4 p04 0 10 k v5 p05 0 p u l s e ( 0 5 20n 10n ) r 5 p05 0 10 k v6 p06 0 p u l s e ( 0 5 20n 10n 10n ) r 6 p06 0 10 k v7 p07 0 p u l s e ( 0 5 20n 10n 10n 50n ) r 7 p07 0 10 k v8 p08 0 p u l s e ( 0 5 20n 10n 10n 50n 100n ) r 8 p08 0 10 k v9 p09 0 p u l s e ( 0 5 20n 1n 1n 20n 40n ) r 9 p09 0 10 k v10 p10 0 p u l s e ( 0 5 20n 0 . 1n 0 . 1n 5n 50n ) r 1 0 p10 0 10 k v11 p11 0 dc 5v p u l s e ( 0 5 20n 0 . 5n 0 . 5n 10n 20n ) r 1 1 p11 0 10 k . ends . end

vp1 1 2 3 4 S2Q_test1 5 6 7 8 9 10 11 SUB1 vp2 vp3 vp4 vp5 vp6 vp7 vp8 vp9 vp10 vp11

dc simulation
DC1

transient simulation
TR1 Type=lin Start=0 Stop=100ns IntegrationMethod=Trapezoidal

Figure 1: SPICE to Qucs conversion: Test1

History of simulation results


March 8 2007, Simulation tests by Mike Brinson
1. Test 1 : Vp1.Vt; Pass correct result. 2. Test 2 : Vp2.Vt; Pass correct result. 3. Test 3 : Vp3.Vt; Fail TR and TF should default to TSTEP [TSTEP=1nS in test] 4. Test 4 : Vp4.Vt; Fail TR and TF should default to TSTEP [TSTEP=1nS in test] 5. Test 5 : Vp5.Vt; Pass. 6. Test 6 : Vp6.Vt; Pass. 7. Test 7 : Vp7.Vt; Pass. 8. Test 8 : Vp8.Vt; Pass. 9. Test 9 : Vp9.Vt; Fail - waveform should repeat after 60ns. 10. Test 10 : Vp10.Vt; Fail - waveform should repeat after 70ns. 11. Test 11 : Vp11.Vt; Fail 1. waveform should repeat after 40ns, 2. Vdc:V11 _cnet8 _ref U="0" incorrect, should be Vdc:V11 _cnet8 _ref U="5"

# Qucs 0 . 0 . 11 . Def : S2Q t e s t 1 Sub : X1 . Def : End net0

/ media / hda2 / s p i c e t o q u c s p r j /s2Q ( t e s t 1 ) . s c h net0 net1 net2 net3 net4 net5 net6 net7 net8 net9 net10 net1 net2 net3 net4 net5 net6 net7 n e t 8 n e t 9 n e t 1 0 gnd Type=S2Q t e s t 1 c i r

. Def : S2Q t e s t 1 c i r netP01 netP02 netP03 netP04 netP05 netP06 netP07 netP08 netP09 netP10 netP11 ref . Def : S2Q TEST1 r e f netP01 netP02 netP03 netP04 netP05 netP06 netP07 netP08 netP09 netP10 netP11 Vpulse : V11 netP11 c n e t 8 U1=0 U2=5 T1=20n Tr=0 . 5n Tf=0 . 5n T2=3 . 1 e 08 Vpulse : V10 netP10 c n e t 7 U1=0 U2=5 T1=20n Tr=0 . 1n Tf=0 . 1n T2=2 . 52 e 08 Vpulse : V9 netP09 c n e t 6 U1=0 U2=5 T1=20n Tr=1n Tf=1n T2=4 . 2 e 08 Vpulse : V8 netP08 c n e t 5 U1=0 U2=5 T1=20n Tr=10n Tf=10n T2=9 e 08 Vpulse : V7 netP07 c n e t 4 U1=0 U2=5 T1=20n Tr=10n Tf=10n T2=9 e 08 Vpulse : V6 netP06 c n e t 3 U1=0 U2=5 T1=20n Tr=10n Tf=10n T2=4 e 08 Vpulse : V5 netP05 c n e t 2 U1=0 U2=5 T1=20n Tr=10n T2=3 e 08 Vpulse : V4 netP04 c n e t 1 U1=0 U2=5 T1=20n T2=2 e 08 Vpulse : V3 netP03 c n e t 0 U1=0 U2=5 T2=0 T1=0 Vdc : V1 netP01 ref U =1V R : R1 netP01 ref R =10 k Vdc : V2 netP02 ref U =1V R : R2 netP02 ref R =10 k ref U =0 Vdc : V3 c n e t 0 R : R3 netP03 ref R =10 k Vdc : V4 c n e t 1 ref U =0 R : R4 netP04 ref R =10 k ref U =0 Vdc : V5 c n e t 2 R : R5 netP05 ref R =10 k Vdc : V6 c n e t 3 ref U =0 R : R6 netP06 ref R =10 k Vdc : V7 c n e t 4 ref U =0 R : R7 netP07 ref R =10 k Vdc : V8 c n e t 5 ref U =0 ref R =10 k R : R8 netP08 Vdc : V9 c n e t 6 ref U =0 R : R9 netP09 ref R =10 k Vdc : V10 c n e t 7 ref U =0 ref R =10 k R : R10 netP10 Vdc : V11 c n e t 8 ref U =0 R : R11 netP11 ref R =10 k . Def : End netP01 netP02 netP03 netP04 netP05 Sub : X1 r e f netP06 netP07 netP08 netP09 netP10 netP11 Type=S2Q TEST1 . Def : End

. DC : DC1 Temp=26 . 85 r e l t o l =0 . 001 a b s t o l=1 pA v n t o l=1 uV saveOPs=no MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU Sub : SUB1 vp1 vp2 vp3 vp4 vp5 vp6 vp7 vp8 vp9 vp10 vp11 Type=S2Q t e s t 1 . TR : TR1 Type= l i n Start=0 Stop=100 ns P o i n t s=500 I n t e g r a t i o n M e t h o d= T r a p e z o i d a l Order=2 I n i t i a l S t e p=1 ns MinStep=1 e 16 MaxIter=150 r e l t o l =0 . 001 a b s t o l=1 pA v n t o l=1 uV Temp=26 . 85 L T E r e l t o l=1 e 3 LTEabstol=1 e 6 LTEfactor=1 S o l v e r=CroutLU relaxTSR=no i n i t i a l D C= y e s MaxStep=0

4 Figure 2: Qucs netlist [Edited to t on page width]

4 vp1.Vt vp2.Vt 1 1 vp7.Vt 0 2e-8 4e-8 time 6 4 4 4 vp3.Vt vp3.Vt 2 2 vp8.Vt 6e-8 8e-8 1e-7

0 0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7 0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 0 2e-8 4e-8 time 4 6e-8 8e-8 1e-7

0 0 1e-9 2e-9 time 6 4 4 vp4.Vt 3e-9 4e-9 5e-9

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

vp4.Vt

vp9.Vt 2e-8 time 2.5e-8

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 1.5e-8 6

0 0 6 2e-8 4e-8 time 6e-8 8e-8 1e-7

vp5.Vt

vp10.Vt 2e-8 2.5e-8 3e-8 time 3.5e-8 4e-8

vp5.Vt

0 0 2e-8 4e-8 time 6 6e-8 8e-8 1e-7

0 1.5e-8

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

4 vp6.Vt vp6.Vt

4 vp11.Vt

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 1.5e-8 2e-8 2.5e-8 3e-8 3.5e-8 4e-8 4.5e-8 5e-8 time

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

Figure 3: SPICE to Qucs conversion: Test1 simulation waveforms

March 10 2007, Simulation tests by Mike Brinson


Code modied * check_spice.cpp: Handling periodic pulse sources correctly. Also default Tr/Tf values for these sources to a given .TRAN step value : Stefan Jahn. Restriction on SPICE code: T D + T R + P W + T F < P ER, otherwise a negative TL time for the repetitive pulse occurs and simulation fails. SPICE test le S2Q_test1.cir modied: Mike Brinson

1. Test 1 : Vp1.Vt; Pass. 2. Test 2 : Vp2.Vt; Pass. 3. Test 3 : Vp3.Vt; Pass 4. Test 4 : Vp4.Vt; Pass 5. Test 5 : Vp5.Vt; Pass. 6. Test 6 : Vp6.Vt; Pass. 7. Test 7 : Vp7.Vt; Pass. 8. Test 8 : Vp8.Vt; Pass. 9. Test 9 : Vp9.Vt; Pass. 10. Test 10 : Vp10.Vt; Pass. 11. Test 11 : Vp11.Vt; Pass

SPICE t o Qucs s y n t a x t e s t f i l e 1 . DC and i n d e p e n d e n t v o l t a g e p u l s e s o u r c e s , p l u s r e s i s t o r s . . s u b c k t S2Q t e s t 1 p01 p02 p03 p04 p05 p06 p07 p08 p09 p10 p11 v1 p01 0 1v r 1 p01 0 10 k v2 p02 0 dc 1v r 2 p02 0 10 k v3 p03 0 p u l s e ( 0 5 ) r 3 p03 0 10 k v4 p04 0 p u l s e ( 0 5 20n ) r 4 p04 0 10 k v5 p05 0 p u l s e ( 0 5 20n 10n ) r 5 p05 0 10 k v6 p06 0 p u l s e ( 0 5 20n 10n 10n ) r 6 p06 0 10 k v7 p07 0 p u l s e ( 0 5 20n 10n 10n 50n ) r 7 p07 0 10 k v8 p08 0 p u l s e ( 0 5 20n 10n 10n 50n 100n ) r 8 p08 0 10 k v9 p09 0 p u l s e ( 0 5 10n 1n 1n 20n 40n ) r 9 p09 0 10 k v10 p10 0 p u l s e ( 0 5 20n 0 . 1n 0 . 1n 5n 50n ) r 1 0 p10 0 10 k v11 p11 0 dc 5v p u l s e ( 3 5 20n 0 . 5n 0 . 5n 10n 40n ) r 1 1 p11 0 10 k . ends . end

Figure 4: Modied SPICE test1 netlist

4 vp1.Vt vp2.Vt 1 1 vp7.Vt 0 2e-8 4e-8 time 6 4 4 4 vp3.Vt vp3.Vt 2 2 vp8.Vt 6e-8 8e-8 1e-7

0 0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7 0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 0 2e-8 4e-8 time 4 6e-8 8e-8 1e-7

0 0 1e-9 2e-9 time 6 4 4 vp4.Vt 3e-9 4e-9 5e-9

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

vp4.Vt

vp9.Vt 2e-8 time 2.5e-8

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 1.5e-8 6

0 0 6 2e-8 4e-8 time 6e-8 8e-8 1e-7

vp5.Vt

vp10.Vt 2e-8 2.5e-8 3e-8 time 3.5e-8 4e-8

vp5.Vt

0 0 2e-8 4e-8 time 6 6e-8 8e-8 1e-7

0 1.5e-8

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

6 10

4 vp6.Vt vp6.Vt

4 vp11.Vt 5

0 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

0 0 1.5e-8 2e-8 2.5e-8 3e-8 3.5e-8 4e-8 4.5e-8 5e-8 time 0 2e-8 4e-8 time 6e-8 8e-8 1e-7

Figure 5: SPICE to Qucs conversion: Modied test1 simulation waveforms

# Qucs 0 . 0 . 11

/ media / hda2 / s p i c e t o q u c s p r j /s2Q ( t e s t 1 ) . s c h

. Def : S2Q t e s t 1 net0 net5 net1 net6 net2 net7 net3 net8 net4 net9 net10 Sub : X1 n e t 0 n e t 5 n e t 1 n e t 6 n e t 2 n e t 7 n e t 3 n e t 8 n e t 4 n e t 9 n e t 1 0 gnd Type=S2Q t e s t 1 c i r . Def : End . Def : S2Q t e s t 1 c i r netP01 netP02 netP03 netP04 netP05 netP06 netP07 netP08 netP09 netP10 netP11 ref . Def : S2Q TEST1 r e f netP01 netP02 netP03 netP04 netP05 netP06 netP07 netP08 netP09 netP10 netP11 V r e c t : V11 netP11 c n e t 8 U =8 Td=20n Tr=0 . 5n Tf=0 . 5n TH =1 . 1 e 08 TL =9 e 09 =5 Td=20n Tr=0 . 1n Tf=0 . 1n TH =5 . 2 e 09 TL =2 . 48 e 08 V r e c t : V10 netP10 c n e t 7 U V r e c t : V9 netP09 c n e t 6 U =5 Td=10n Tr=1n Tf=1n TH =2 . 2 e 08 TL =8 e 09 =5 Td=20n Tr=10n Tf=10n TH =7 e 08 TL =1 e 08 V r e c t : V8 netP08 c n e t 5 U Vpulse : V7 netP07 c n e t 4 U1=0 U2=5 T1=20n Tr=10n Tf=10n T2=9 e 08 Vpulse : V6 netP06 c n e t 3 U1=0 U2=5 T1=20n Tr=10n Tf=10n T2=4 e 08 Vpulse : V5 netP05 c n e t 2 U1=0 U2=5 T1=20n Tr=10n T2=3 e 08 Vpulse : V4 netP04 c n e t 1 U1=0 U2=5 T1=20n T2=2 e 08 Vpulse : V3 netP03 c n e t 0 U1=0 U2=5 T2=0 T1=0 ref U =1V Vdc : V1 netP01 R : R1 netP01 ref R =10 k Vdc : V2 netP02 ref U =1V R : R2 netP02 ref R =10 k ref U =0 Vdc : V3 c n e t 0 R : R3 netP03 ref R =10 k Vdc : V4 c n e t 1 ref U =0 R : R4 netP04 ref R =10 k ref U =0 Vdc : V5 c n e t 2 R : R5 netP05 ref R =10 k Vdc : V6 c n e t 3 ref U =0 R : R6 netP06 ref R =10 k Vdc : V7 c n e t 4 ref U =0 R : R7 netP07 ref R =10 k Vdc : V8 c n e t 5 ref U =0 R : R8 netP08 ref R =10 k Vdc : V9 c n e t 6 ref U =0 R : R9 netP09 ref R =10 k Vdc : V10 c n e t 7 ref U =0 R : R10 netP10 ref R =10 k Vdc : V11 c n e t 8 ref U =2 R : R11 netP11 ref R =10 k . Def : End Sub : X1 r e f netP01 netP02 netP03 netP04 netP05 netP06 netP07 netP08 netP09 netP10 netP11 Type=S2Q TEST1 . Def : End

. DC : DC1 Temp=26 . 85 r e l t o l =0 . 001 a b s t o l=1 pA v n t o l=1 uV saveOPs=no MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU . TR : TR1 Type= l i n Start=0 Stop=100 ns P o i n t s=500 I n t e g r a t i o n M e t h o d= T r a p e z o i d a l Order=2 I n i t i a l S t e p=1 ns MinStep=1 e 16 MaxIter=150 r e l t o l =0 . 001 a b s t o l=1 pA v n t o l=1 uV Temp=26 . 85 L T E r e l t o l=1 e 3 LTEabstol=1 e 6 LTEfactor=1 S o l v e r=CroutLU relaxTSR=no i n i t i a l D C= y e s MaxStep=0 Sub : SUB1 vp1 vp2 vp3 vp4 vp5 vp6 vp7 vp8 vp9 vp10 vp11 Type=S2Q t e s t 1

Figure 6: Qucs netlist for modied test1 SPICE netlist [Edited to t on page width]

References
1. A. Vladimirescu, Kaihe Zhang, A.R. Newton, D.O Pederson A. Sangiovanni-Vincentelli, SPICE 2G Users Guide (10 Aug 1981), Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, Ca., 94720. 2. B. Johnson, T. Quarles, A.R. Newton, P.O. Pederson, A.Sangiovanni-Vincentelli, SPICE3 Version 3f Users Manual (October 1972), Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, Ca., 94720. 3. Andrei Vladimirescu, THE SPICE book,1994, John Wiley and Sons. Inc., ISBN 0-471-609-26-9.

10

You might also like