summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/tclspice/tcl
diff options
context:
space:
mode:
Diffstat (limited to 'Windows/spice/examples/tclspice/tcl')
-rw-r--r--Windows/spice/examples/tclspice/tcl/diffpair.cir29
-rw-r--r--Windows/spice/examples/tclspice/tcl/test_vectoblt.sh59
2 files changed, 88 insertions, 0 deletions
diff --git a/Windows/spice/examples/tclspice/tcl/diffpair.cir b/Windows/spice/examples/tclspice/tcl/diffpair.cir
new file mode 100644
index 00000000..c926364f
--- /dev/null
+++ b/Windows/spice/examples/tclspice/tcl/diffpair.cir
@@ -0,0 +1,29 @@
+simple differential pair - CM and DM dc sensitivity
+
+* Models:
+.model qnl npn(bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf va=50)
+.model qnr npn(bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf va=50)
+
+* Circuit description:
+q1 4 2 6 qnr
+q2 5 3 6 qnl
+rs1 11 2 1k
+rs2 3 1 1k
+rc1 4 8 10k
+rc2 5 8 10k
+q3 7 7 9 qnl
+q4 6 7 9 qnr
+rbias 7 8 20k
+
+* Inputs/Supplies:
+vcm 1 0 dc 0 sin(0 0.1 5meg) ac 1
+vdm 1 11 dc 0 sin(0 0.1 5meg) ac 1
+vcc 8 0 12
+vee 9 0 -12
+
+* Analysys:
+.tf v(5) vcm
+.tf v(5) vdm
+.sens v(5,4)
+
+.end
diff --git a/Windows/spice/examples/tclspice/tcl/test_vectoblt.sh b/Windows/spice/examples/tclspice/tcl/test_vectoblt.sh
new file mode 100644
index 00000000..28f04b96
--- /dev/null
+++ b/Windows/spice/examples/tclspice/tcl/test_vectoblt.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# -*- mode: tcl -*- \
+ exec wish -f "$0" ${1+"$@"}
+
+package require BLT
+load ../../../src/.libs/libspice.so
+
+spice::source "diffpair.cir"
+spice::op
+spice::let Vd = V(5) - V(4)
+blt::vector create imag
+blt::vector create real
+
+set ok 0
+###################
+puts " Vd is a real vector of length 1"
+###################
+#too many arguments
+if {[catch {spice::vectoblt raul ibrahim ector karim} erreur] != 0} {puts "ERROR EXPECTED: TEST 1 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 1 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable argument
+if {[catch {spice::vectoblt raul ibrahim ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 2 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 2 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable blt vector
+if {[catch {spice::vectoblt Vd ibrahim} erreur] != 0} {puts "ERROR EXPECTED: TEST 3 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 3 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#real part affectation
+if {[catch {spice::vectoblt Vd real} erreur] == 0} {puts "NO ERROR IN AFFECTATION. TEST 4 OK:\n\t (Blank line)"; set ok [expr {$ok + 1}]} else {puts "TEST 4 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable blt vector (2 vectors)
+if {[catch {spice::vectoblt Vd ibrahim ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 5 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 5 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable imaginary vector
+if {[catch {spice::vectoblt Vd real ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 6 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 6 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#real and imaginary part affectation
+if {[catch {spice::vectoblt Vd real imag} erreur] == 0} {puts "NO ERROR IN AFFECTATION. TEST 7 OK:\n\t (Blank line)"; set ok [expr {$ok + 1}]} else {puts "TEST 7 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#all good vectors, but another argument invited himself
+if {[catch {spice::vectoblt Vd real imag karim} erreur] != 0} {puts "ERROR EXPECTED: TEST 8 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 8 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+
+###################
+puts " Vd is a complex vector of length 10"
+###################
+spice::op
+spice::ac dec 10 100 1000
+spice::let Vd = V(5) - V(4)
+#too many arguments
+if {[catch {spice::vectoblt raul ibrahim ector karim} erreur] != 0} {puts "ERROR EXPECTED: TEST 1 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 1 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable argument
+if {[catch {spice::vectoblt raul ibrahim ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 2 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 2 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable blt vector
+if {[catch {spice::vectoblt Vd ibrahim} erreur] != 0} {puts "ERROR EXPECTED: TEST 3 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 3 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#real part affectation
+if {[catch {spice::vectoblt Vd real} erreur] == 0} {puts "NO ERROR IN AFFECTATION. TEST 4 OK:\n\t (Blank line)"; set ok [expr {$ok + 1}]} else {puts "TEST 4 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable blt vector (2 vectors)
+if {[catch {spice::vectoblt Vd ibrahim ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 5 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 5 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#no acceptable imaginary vector
+if {[catch {spice::vectoblt Vd real ector} erreur] != 0} {puts "ERROR EXPECTED: TEST 6 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 6 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#real and imaginary part affectation
+if {[catch {spice::vectoblt Vd real imag} erreur] == 0} {puts "NO ERROR IN AFFECTATION. TEST 7 OK:\n\t (Blank line)"; set ok [expr {$ok + 1}]} else {puts "TEST 7 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+#all good vectors, but another argument invited himself
+if {[catch {spice::vectoblt Vd real imag karim} erreur] != 0} {puts "ERROR EXPECTED: TEST 8 OK:\n\t$erreur"; set ok [expr {$ok + 1}]} else {puts "TEST 8 ERROR\n\t Test 1 should return TCL_ERROR, but it does not"}
+
+puts "\n\n"
+if {$ok == 16} {puts "spice::vectoblt OK ($ok/16 tests ok)"} else {puts "spice::vectoblt KO:\n\t$ok/16 tests ok"}