diff --git a/configure.ac b/configure.ac index 47ecc9827..c388bd172 100644 --- a/configure.ac +++ b/configure.ac @@ -1181,6 +1181,7 @@ AC_CONFIG_FILES([Makefile tests/regression/lib-processing/Makefile tests/regression/parser/Makefile tests/regression/func/Makefile + tests/regression/model/Makefile tests/sensitivity/Makefile tests/transient/Makefile tests/transmission/Makefile diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am index 41efde2c8..7dd226f81 100644 --- a/tests/regression/Makefile.am +++ b/tests/regression/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = lib-processing parser subckt-processing func +SUBDIRS = lib-processing parser subckt-processing func model MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/regression/model/Makefile.am b/tests/regression/model/Makefile.am new file mode 100644 index 000000000..f331090e7 --- /dev/null +++ b/tests/regression/model/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + + +TESTS = binning-1.cir + +TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice + +EXTRA_DIST = \ + $(TESTS) \ + $(TESTS:.cir=.out) + +MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/regression/model/binning-1.cir b/tests/regression/model/binning-1.cir new file mode 100644 index 000000000..b73349d64 --- /dev/null +++ b/tests/regression/model/binning-1.cir @@ -0,0 +1,52 @@ +check model binning + +* (exec-spice "ngspice -b %s") + +ix1 0 1 dc=5uA +mx1 1 1 0 0 nmos0v7 l=5u w=5u + +ix2 0 2 dc=5uA +mx2 2 2 0 0 nmos_tst l=5u w=5u + +ix3 0 3 dc=6uA +mx3 3 3 0 0 nmos0v9 l=5u w=6u + +ix4 0 4 dc=6uA +mx4 4 4 0 0 nmos_tst l=5u w=6u + +* binned +.model nmos_tst.1 nmos ( version=4.8 level=54 Vth0=0.7 lmin=1u lmax=10u wmin=4.5u wmax=5.5u ) +.model nmos_tst.2 nmos ( version=4.8 level=54 Vth0=0.9 lmin=1u lmax=10u wmin=5.5u wmax=6.5u ) + +* and non binned to compare with +.model nmos0v7 nmos ( version=4.8 level=54 Vth0=0.7 ) +.model nmos0v9 nmos ( version=4.8 level=54 Vth0=0.9 ) + +.control + +define mismatch(a,b,err) abs(a-b)>err + +op + +let fail_count = 0 +let total_count = 2 + +if mismatch(v(2)/v(1), 1.0, 1e-4) + let fail_count = fail_count + 1 +end + +if mismatch(v(4)/v(3), 1.0, 1e-4) + let fail_count = fail_count + 1 +end + +if fail_count > 0 + echo "ERROR: $&fail_count of $&total_count tests failed" + quit 1 +else + echo "INFO: $&fail_count of $&total_count tests failed" + quit 0 +end + +.endc + +.end diff --git a/tests/regression/model/binning-1.out b/tests/regression/model/binning-1.out new file mode 100644 index 000000000..9558556cf --- /dev/null +++ b/tests/regression/model/binning-1.out @@ -0,0 +1,9 @@ + +Circuit: check model binning + +Doing analysis at TEMP = 27.000000 and TNOM = 27.000000 + + + +No. of Data Rows : 1 +INFO: 0 of 2 tests failed