diff --git a/AUTHORS b/AUTHORS index a7aeec540..df0a4883f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -@c This file will be processed with texinfo. +ngspice authors Spice was originally written at The University of California at Berkeley (USA). Since then, there have been many people working on the software, most of them diff --git a/COPYING b/COPYING index e3b586aaa..cc07981ca 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,6 @@ Ngspice Licensing -Copyright (c) 2022 by ngspice team +Copyright (c) 2023 by ngspice team All rights reserved. license for this document: CC-BY-SA v4.0 @@ -16,9 +16,6 @@ its source code, test and example files except for the files listed below. ************** files with licenses different to 'Modified BSD' **************** -* ngspice/contrib -GPL, Public Domain - * ngspice/m4 unnamed, compatible to DFSG diff --git a/DEVICES b/DEVICES index fa9dd3b1d..71415a168 100644 --- a/DEVICES +++ b/DEVICES @@ -69,6 +69,7 @@ Table of contents 13.4 HICUM0 Bipolar Model 13.5 Mextram Bipolar Model 14. XSPICE code models +15. Digital Building Blocks (U instances) ------------------ @@ -814,59 +815,33 @@ will be updated every time the device specific code is altered or changed to ref 13. Verilog-A models - Configuring ngspice with ADMS (see Readme.adms) following - devices are available: + ngspice inherits the OSDI interface for compiled Verilog-A models + OpenVAF from https://openvaf.semimod.de/ is required to compile + LRM2.x-conforming Verilog-A models into shared libraries which + may be loaded into ngspice dynamically at run-time. - 13.1 EKV MOS Model + The following models have been tested, example netlists are available: - Ver: 2.6 - Level: 44 - Dir: devices/adms/ekv - Status: TO BE TESTED - - EKV version based on a contribution of Ivan Riis Nielsen 11/2006 - - Web site at: https://www.epfl.ch/labs/iclab/ekv/model/ - (The model from https://github.com/ekv26/model is not compatible - to the current ngspice adms implementation) + 13.1 BSIMBULK 107 + 13.2 BSIM-CMG + 13.3 HICUM L0 + 13.4 ASM-HEMT + 13.5 VBIC + 13.6 MEXTRAM 504/505 + 13.7 PSP 103.8 + 13.8 r2_cmc + + More may be made available, user compiled models are possible as well + (See ngspice manual, chapter 13). - 13.2 PSP MOS Model 102 - - Ver: 102.1 - Level: 45 - Dir: devices/adms/psp102 - Status: TO BE TESTED - - Philips SimKit 2.5. - - 13.3 PSP MOS Model 103 - - Ver: 103.1 - Level: 69 - Dir: devices/adms/psp103 - Status: TO BE TESTED - - Philips SimKit 2.5. - - 13.4 HICUM0 Bipolar Model - - Ver: Level_0 Version_1.12 - Level: 7 - Dir: devices/adms/hicum0 - Status: TO BE TESTED - - A simplified version of HICUM Level2 model for BJT - Web site at: http://www.iee.et.tu-dresden.de/iee/eb/hic_new - - - 13.5 Mextram Bipolar Model - - Ver: 504.6.1 - Level: 6 - Dir: devices/adms/mextram - Status: TO BE TESTED - - Web site at: http://mextram.ewi.tudelft.nl/ and http://mextram.sourceforge.net/ - - 14. XSpice code models, see ngspice manual chapt. 12 + 14. XSpice code models + + more than 100 models are available, please see ngspice manual chapt. 12 + + 15. Digital Building Blocks (U instances) + + U instances are digital primitives which may be used (in proper combination) to + model digital devices, e.g. from the 74xx or 40xx families. ngspice maps them + onto XSPICE models, which allows a fast event based simulation. Please see the + ngspice manual, chapter 14. diff --git a/FAQ b/FAQ index c4b922fdc..391970f65 100644 --- a/FAQ +++ b/FAQ @@ -1,7 +1,7 @@ - Ngspice F.A.Q.Version 2.7 (ngspice-37 release) + Ngspice F.A.Q.Version 2.9 (ngspice-39 release) Maintained by Holger Vogt - Last update: May 11 2022 + Last update: Jan 24 2023 This document contains the Frequently Asked Questions (and Answers) for ngspice project. @@ -123,7 +123,7 @@ capabilities) and user interface are other goals. - 1.6 What you are going to do? + 1.6 What are you going to do? An official roadmap for ngspice was never drawn. Contributions made by developers drive ngspice development and the roadmap is built day by @@ -140,18 +140,18 @@ + Compact models: The interest in using ngspice is intimately connected to the available models. To provide the latest models available for active and passive devices is a fundamental goal of the project. In - this direction we are integrating ADMS model compiler into ngspice. + this direction we are integrating OSDI interface into ngspice for + reading OpenVAF compiled Verilog-A compact models. + Documentation: Commercial simulators come with very good manuals containing tutorials, description of models equations, example of use, suggestions, etc. Spice came with little documentation. The Spice3f manual, available on the Internet has been used as the basis - for the new manual. It will be constantly improved during ngspice - development and integrated with the documentation accompanying Xspice - and Cider. The ngspice manual today contains description of all + for the ngspice manual. It will be constantly improved during ngspice + development. The ngspice manual today contains description of all features ngspice is offering. It is however not a tutorial of ngspice - usage, but there are now several good ones available on the internet - (see http://ngspice.sourceforge.net/tutorials.html). + usage, but there are several good ones available on the internet + (see https://ngspice.sourceforge.io/tutorials.html). 1.7 Legal issues @@ -208,37 +208,40 @@ web server and then moved to sourceforge. Sourceforge provides an archiving service that cam be accessed via the summary page: - http://sourceforge.net/p/ngspice/mailman/ + https://sourceforge.net/p/ngspice/mailman/ 1.11 Where can I get a copy of ngspice? - You can download ngspice from: + You can download ngspice source code or MS Windows executables from: - http://sourceforge.net/projects/ngspice/files/ng-spice-rework/ + https://sourceforge.net/projects/ngspice/files/ng-spice-rework/ + + Nearly all distributions for MINGW, Cygwin, Linux, macOS and + others offer install-ready copies of ngspice. 1.12 Where should I look on the World Wide Web for ngspice stuff? Look at the official Ngpice Web Page: - http://ngspice.sourceforge.net + https://ngspice.sourceforge.io 1.13 Where should I look on the World Wide Web for Spice documentation? There is a detailed ngspice manual available at: - http://ngspice.sourceforge.net/docs.html + https://ngspice.sourceforge.io/docs.html Others docs are assembled at: - http://ngspice.sourceforge.net/literature.html + https://ngspice.sourceforge.io/literature.html 1.14 Are there some (official) tutorials available? Yes, they are, for ngspice, ngspice within KiCAD and on eletro-thermal simulation. You may find them at: - http://ngspice.sourceforge.net/tutorials.html + https://ngspice.sourceforge.io/tutorials.html @@ -249,43 +252,20 @@ The latest version released is: - * ngspice-37 (released on May 22 2022) + * ngspice-39 (released on Jan 31 2023) 2.2. What are the latest features in the current release? -- New features: - + Reduce XSPICE memory consumption dramatically - (> factor of 10). - + Add source stepping to B source - + Add 'esave' command to save only specific event nodes. - + Accept '.temp=125' or .temp='param'. - + Enable output redirection for meas command. - + Use total current for diffcap calculation in diode model. - + Speed output and reduces file size when plotting large - result vectors (Windows). - + Enable RKM notation also for inductors (e.g. 1u2 for 1.2u). - + Add S parameter simulation (command '.sp'). - + Add new flag 'digitop' for the 'plot' command. - + Add a flag 'alle' (all event nodes) to the plot command. - + New code model d_pwm: hybrid oscillator (analg control in, - digital out) with PWM. - + Make "nogrid" plotting option work. - + Add current measurement for all nodes of a device, - e.g. .probe i(Q1) will measure Ic, Ib, Ie (and Is). - + .probe P(dev): Add measurement of power dissipation in a device. - + Add new flags -type and -flags to command devhelp. - -- Bug fixes: - + many bugs fixed and code improvements (see bugs 557 and up) - + making error messages more verbose - + memory leaks removed + Please see file NEWS accompaniing this FAQ. 2.3. What does it look like? Ngspice, as the original Spice3 (and Xspice and Cider) is a command - line simulator, but with a graphics output capability. + line simulator, but with a graphics output capability. Excellent + open source third party tool for schematic capture (KiCad, XSCHEM, + Qucs-S and others) are available. 2.4. Who are the authors of ngspice? @@ -303,7 +283,7 @@ feature-request and bugs trackers. You can use them or subscribe to mailing lists and post there. The former is preferred since almost it allows to track all necessary actions upon a bug. The web site at - http://ngspice.sourceforge.net/bugrep.html will give you more details. + https://ngspice.sourceforge.io/bugrep.html will give you more details. 2.6. How can I join the development? @@ -370,7 +350,7 @@ 4.4. Disclaimer and Copyright - Copyright: Holger Vogt, 2022 + Copyright: Holger Vogt, 2023 License: Creative Commons Attribution Share-Alike (CC-BY-SA) v4.0. This document is provided as is. The information in it is not warranted to be correct: you use it at your own risk. diff --git a/INSTALL b/INSTALL index 716c3e55d..3923a7b80 100644 --- a/INSTALL +++ b/INSTALL @@ -11,7 +11,7 @@ Table of contents 1 Ngspice installation (LINUX) 1.1 Prerequisites - 1.2 Install from tarball (e.g. ngspice-36.tar.gz) + 1.2 Install from tarball (e.g. ngspice-38.tar.gz) 1.3 Install from git repository 1.4 ngspice as a shared library 1.5 Advanced Install @@ -28,7 +28,7 @@ Table of contents 8 Operation Controls 9 NGSPICE COMPILATION UNDER WINDOWS OS 9.1 How to make ngspice with MINGW and MSYS - 9.2 make ngspice with MS Visual Studio 2019 + 9.2 make ngspice with MS Visual Studio 2019 or 2022 9.3 make ngspice with pure CYGWIN 9.4 ngspice console app with MINGW or CYGWIN 9.5 cross compiling ngspice for Windows from LINUX @@ -133,7 +133,7 @@ This file describes the procedures to install ngspice from sources. sections titled 'Install from tarball' and 'Advanced Install'. Download ngspice sources from the git repository as described on the sourceforge project page - (see http://ngspice.sourceforge.net/download.html and click on the git link) + (see https://ngspice.sourceforge.io/download.html and click on the git link) Now change directories in to the top-level source directory (where this INSTALL file can be found). @@ -240,7 +240,15 @@ This file describes the procedures to install ngspice from sources. --with-editline=yes Enables the use of the BSD editline library (libedit) instead of readline. - See http://www.thrysoee.dk/editline/ + See https://www.thrysoee.dk/editline/ + + --enable-shortcheck + Enables a 'make check' with strongly reduced runtime. Besides some + regression tests only BSIM3 and BSM4 devices are checked. + + --enable-shortcheck + Enables a 'make check' with strongly reduced runtime. Besides some + regression tests only BSIM3 and BSM4 devices are checked. --enable-shortcheck Enables a 'make check' with strongly reduced runtime. Besides some @@ -509,7 +517,7 @@ This file describes the procedures to install ngspice from sources. $ make install However, to compile code extracted from the git repository the procedure is - a little different. Firstly install git, e.g. from http://git-scm.com/download/win + a little different. Firstly install git, e.g. from https://git-scm.com/download/win To obtain ngspice, you may do the following: Open the git command window. Go to a directory of your choice, e.g. D:\Spice @@ -580,7 +588,7 @@ This file describes the procedures to install ngspice from sources. script compile_min_shared.sh. -9.2 make ngspice with MS Visual Studio 2019 +9.2 make ngspice with MS Visual Studio 2019 and 2022 ngspice may be compiled with MS Visual Studio 2019 or newer. @@ -704,7 +712,7 @@ cross-compile-shared.sh. 10.2 Compile NGSPICE manually from a tarball 1. Install an X11 interface (like Xquartz) - 2. Install MacPorts from http://www.macports.org + 2. Install MacPorts from https://www.macports.org 3. Execute this command: sudo port install autoconf automake libtool bison flex ncurses readline fontconfig freetype libomp xorg-libXaw @@ -717,7 +725,7 @@ cross-compile-shared.sh. 10.3 Compile NGSPICE manually from git 1. Install an X11 interface (like Xquartz) - 2. Install MacPorts from http://www.macports.org + 2. Install MacPorts from https://www.macports.org 3. Execute this command: sudo port install automake autoconf libtool bison flex ncurses xorg-libXaw readline fontconfig freetype libomp SM ICE diff --git a/INTERNALS b/INTERNALS index 5a3aff93d..cf0f63f51 100644 --- a/INTERNALS +++ b/INTERNALS @@ -17,22 +17,21 @@ CODE ORGANIZATION "visualc/" project files to enable compilation with MS Visual Studio. "src/" and its subdirectories contain all of the C source code. - It contains the top level files "main.c" used by ngspice console - as entry point, "winmain.c" as entry and setup of the MS Windows GUI, - and "sharedspice.c" used as entry for ngspice as a shared library. + It contains the top level files "main.c" used by ngspice and + "sharedspice.c" used by ngspice as shared library. There are also main files for outdated ngnutmeg, nghelp, ngmultidec, ngproc2mod, and ngsconvert. - + "src/ciderlib" hosts the code for the CIDER extension to ngspice, a 2D process simulator offering connection between process and devices to be simulated by ngspice. - + "src/xspice" contains the code for the XSPICE extension to ngspice, an - interface to analog and digital code models for true mixed signal simulation. + interface to analog and digital code models for true mixed signal simulation. "src/misc" Miscellaneous utility and portability routines. - - "src/include" Header files for all *.c files of ngspice. + + "src/include" Header files for all *.c files of ngspice. "src/spicelib" is the device library and analysis portion of ngspice. Within it are the following subdirectories: @@ -40,7 +39,7 @@ CODE ORGANIZATION each device implementation. analysis/ All of the analysis code. parser/ To set up the matrix derived from the netlist. - + "src/maths" contains all maths functions of ngspice with ni/ Numerical algorithms (used by ckt routines). sparse/ Sparse matrix package (used by ckt and ni). @@ -50,20 +49,20 @@ CODE ORGANIZATION misc/ Various math support algorithms deriv/ Various partial derivatives used by some device models (bjt, MOS1-9) dense/ Matrix operations used by S-parameter simulation - + "src/frontend" contains the code for interfacing ngspice to its input and output. Files com_*.c contain the control language commands. outitf.c organizes the output file structure, rawfile.c writes output files, parse.c is the control language function parser. svg and postscript output are handled as well. - inp.c, inpcom.c and subckt.c serve the main input handling functions: - reading the netlist, parsing it, dealing with compatibility, expanding + inp.c, inpcom.c and subckt.c serve the main input handling functions: + reading the netlist, parsing it, dealing with compatibility, expanding subcircuits and preparing the internal circuit structure. - - Furthermore it contains subdirs + + Furthermore it contains subdirs help/ The windowed help system (outdated). numparam/ Parser for .param and .func statements. parser/ More front end -- "C shell". - wdisp/ MS Windows GUI for plotting - trannoise/ random number and noise generators - plotting/ plot interface to X11, gnuplot, and preparing output graphs + wdisp/ MS Windows GUI + trannoise/ random number and noise generator + plotting/ plot interface to X11, gnuplot, and preparing output graphs (curves and grid), interpreter for 'plot' command (plotit.c) diff --git a/Makefile.am b/Makefile.am index f0f40c8e3..6b40d10aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,13 +7,13 @@ EXTRA_DIST = FAQ autogen.sh Stuarts_Poly_Notes \ ANALYSES BUGS AUTHORS ChangeLog \ DEVICES NEWS README README.tcl \ README.shared-xspice README.vdmos \ - README.adms README-old.adms README.utf8 \ + README.adms README.utf8 \ examples m4 visualc \ cross-compile.sh cross-compile-shared.sh \ compile_min.sh compile_linux.sh compile_min_shared.sh \ compile_linux_shared.sh compile_cyg_make_short_check_64.sh \ compile_macos_clang.sh compile_macos_gcc.sh \ - ngspice.pc.in .gitignore + compile_linux_dist.sh ngspice.pc.in .gitignore MAINTAINERCLEANFILES = Makefile.in aclocal.m4 ar-lib compile config.guess \ src/include/ngspice/config.h.in config.sub configure install-sh \ diff --git a/NEWS b/NEWS index fe978977c..a744b6a9b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,73 @@ +Ngspice-39, Jan 31st, 2023 +============ +- New features: + + OSDI interface integrated to read und simulate with + OpenVAF-compiled Verilog-A compact models delivers + access to open CMC models and many others. + + Visual Studio 2022 is required. + + ADMS is declared deprecated. + + Extended support of digital U devices with f_logicexp and f_pindly, + ngspice now fully simulates 74xx ICs. + + BSIM4 updated to 4.8.2 + + Examples for Laplace model x_fer added + + String-valued parameters enabled + + Add --enable-shortcheck as configure option to reduce check time + + Add a function ddt (derivative versus time) to the B-source + + The 8th parameter on a voltage or current source now is 'number of pulses' + + Add a new compatibility mode xs (for XSPICE legacy behavior) + + Add new functions for operators x**y or x^y + + Add a user definable variable enable_noisy_r (for .spiceinit) + + Replace obscure warning "singular matrix: check nodes mymode1 and mynode1" + by "singular matrix: check node mynode1", if both node names are equal. + + Preprocessor flag PREDICTOR is enabled + + Search path for *.osdi lib files extended: current, inputdir, relative + to executable + +- Bug fixes: + + many bugs fixed and code improvements (see bugs 608 and up) + + making error messages more verbose + + memory leaks removed + +Ngspice-38, Oct 30th, 2022 +============ +- New features: + + Add multiplier flag 'm' to behavioral capacitor and inductor. + + Re-enable dc sweep after transient sim. + + When plotting the phase, standard now is "Radiant". + + Add Lundin's geometry correction to the inductance formula. + + New variable keep#branch to write the current to raw file + in the old fashion 1 v1#branch current + + Translate PSPICE U instances into equivaalent XSPICE code models. + + New configure flag --enable-shortcheck to enable a shortened make check + (only BSIM3 and BSIM4). + + B source will accept parameters in statistical functions like agauss. + + WinGUI: Add a button 'Stop' to stop a simulation in intercative + or control mode. + + Update to the .probe p (power measurement) and .probe alli commands. + + Update to XSPICE aswitch and pswitch. + + Make FROM/TO work in TRIG/TARG and WHEN variants of .meas/meas command. + + Limits to exp function, allow 0 for log (returning -1e99), used + when starting iterations. + + Insert XSPICE bridging devices automatically when an analogue node + has the same name as an XSPICE event node. + + New options savecurrents_bsim3, savecurrents_bsim4, savecurrents_mos1. + + pwlts: a pwl v/i source with time input, smoothing and limiting + functions. + + New functions to the Code Model Library: cm_get_node_name() + and cm_probe_node(). + + XSPICE: Add bidirectional digital/analog bridge. + + Search for .spiceinit firstly in a user defined directory named in env + SPICE_USERINIT_DIR, then in the current directory, then in HOME, then + in USERPROFILE. + + If compatmode is lt, change the pow(x,y) and x**y functions: + If x < 0, output only if y is integer number, otherwise output 0. + + Add a limit of 0.999 to bipolar parameters mje, mjc, and mjs. + +- Bug fixes: + + many bugs fixed and code improvements (see bugs 583 and up) + + making error messages more verbose + + memory leaks removed + Ngspice-37, May 22nd, 2022 ============ - New features: diff --git a/README b/README index 8d4bd1dbe..665622acf 100644 --- a/README +++ b/README @@ -9,9 +9,10 @@ Spice3 does not need any introduction, is the most popular circuit simulator. In over 30 years of its life Spice3 has become a de-facto standard for simulating circuits. -Cider couples Spice3f5 circuit level simulator to DSIM device simulator -to provide greater simulation accuracy of critical devices. DSIM -devices are described in terms of their structures and materials. +Cider couples Spice3f5 circuit level simulator to a device simulator +to provide greater simulation accuracy of critical devices. So you may +create device models for diodes, bipolar, JFet and MOSFETs derived +from their cross-sectional structures and materials. Xspice is an extension to Spice3C1 that provides code modelling support and simulation of digital components through an embedded event driven @@ -62,6 +63,6 @@ WEB SITEs: -------- This project is hosted on Sourceforge.net. -The home page is http://ngspice.sourceforge.net -The page offering source code and user interaction is - http://sourceforge.net/projects/ngspice +The home page is https://ngspice.sourceforge.io +The page offering source code, MS Windows executables, and user interaction is +https://sourceforge.net/projects/ngspice diff --git a/README.adms b/README.adms index 86d861466..799c73d0f 100644 --- a/README.adms +++ b/README.adms @@ -1,6 +1,6 @@ This document is covered by the Creative Commons Attribution Share-Alike (CC-BY-SA) v4.0. . -As of Jan. 23 ADMS is deprectated and replaced by OpenVAF/OSDI. +As of Jan. 2023 ADMS is deprectated and replaced by OpenVAF/OSDI. See README_OSDI.md and README_OSDI_howto. All references to ADMS will be removed in a future ngspice release. diff --git a/README_OSDI.md b/README_OSDI.md index 8c529b37a..e09d46212 100644 --- a/README_OSDI.md +++ b/README_OSDI.md @@ -21,7 +21,7 @@ This ensures that netlists can be simulated from any directory ## Build Instructions To compile NGSPICE with OSDI support ensure that the `--enable-predictor` and `--enable-osdi` flags are used. -The `compile_linus.sh` file enables these flags by default. +The `compile_linux.sh` file enables these flags by default. ## Example/Test Case diff --git a/compile_linux_dist.sh b/compile_linux_dist.sh new file mode 100644 index 000000000..fb49f61c1 --- /dev/null +++ b/compile_linux_dist.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# ngspice build script for Linux distributable, 64 bit +# compile_linux_dist.sh + +# Procedure: +# Install gcc, bison, flex, libtool, autoconf, automake, +# libx11 and libx11-dev (headers), libXaw and libXaw-dev, libreadline and dev +# Declare 'compile_linux_dist.sh' executable and start compiling with +# './compile_linux_dist.sh' from the ngspice directory. + +SECONDS=0 + + +if [ ! -d "release" ]; then + mkdir release + if [ $? -ne 0 ]; then echo "mkdir release failed"; exit 1 ; fi +fi + + +# If compiling sources from git, you may need to uncomment the following two lines: +./autogen.sh +if [ $? -ne 0 ]; then echo "./autogen.sh failed"; exit 1 ; fi + +echo +cd release +if [ $? -ne 0 ]; then echo "cd release failed"; exit 1 ; fi +echo "configuring for 64 bit release" +echo + +../configure --with-x --enable-xspice --enable-cider --with-readline=yes --enable-openmp --enable-osdi --disable-debug CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" + +if [ $? -ne 0 ]; then echo "../configure failed"; exit 1 ; fi + +echo +# make clean is required for properly making the code models +echo "cleaning (see make_clean.log)" +make clean 2>&1 -j8 | tee make_clean.log +exitcode=${PIPESTATUS[0]} +if [ $exitcode -ne 0 ]; then echo "make clean failed"; exit 1 ; fi +echo "generate distribution (see make_dist.log)" +make dist 2>&1 -j8 | tee make_dist.log +exitcode=${PIPESTATUS[0]} +if [ $exitcode -ne 0 ]; then echo "make dist failed"; exit 1 ; fi + +ELAPSED="Elapsed compile time: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" +echo +echo $ELAPSED +echo "success" +exit 0 diff --git a/compile_linux_shared.sh b/compile_linux_shared.sh index 16671bf1e..5d28d3930 100755 --- a/compile_linux_shared.sh +++ b/compile_linux_shared.sh @@ -8,10 +8,9 @@ # Declare 'compile_linux_shared.sh' as being executable and start compiling with # './compile_linux_shared.sh' or './compile_linux_shared.sh d' from the ngspice directory. # Options: -# --adms and --enable-adms will install extra HICUM, EKV, PSP and MEXTRAM models via the -# adms interface. You need to download and install the *.va files via ng-adms-va.tgz -# and have adms installed. -# Please see the ngspice manual, chapt. 13, for more info on adms. +# --enable-osdi will add the osdi interface which allows to dynamically load compiled Verilog-A +# compact models. Compiling the VA code of the models is done by the OpenVAF compiler. +# Please see the ngspice manual, chapt. 13, for more info on OSDI/OpenVAF. # CIDER, XSPICE, and OpenMP may be selected at will. # --disable-debug will give O2 optimization (versus O0 for debug) and removes all debugging info. @@ -37,31 +36,23 @@ fi ./autogen.sh if [ $? -ne 0 ]; then echo "./autogen.sh failed"; exit 1 ; fi -# Alternatively, if compiling sources from git, and want to add adms created devices, -# you may need to uncomment the following two lines (and don't forget to add adms option -# to the ../configure statement): -#./autogen.sh --adms -#if [ $? -ne 0 ]; then echo "./autogen.sh failed"; exit 1 ; fi - echo if test "$1" = "d"; then cd debugsh if [ $? -ne 0 ]; then echo "cd debugsh failed"; exit 1 ; fi echo "configuring shared lib for 64 bit, debug enabled" echo -# You may add --enable-adms to the following command for adding adms generated devices. # The --prefix (and perhaps --libdir) may be used to determine a different install location # (depending on the Linux distribution, and on the calling programs search path). - ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --prefix=/usr CFLAGS="-g -m64 -O0 -Wall" LDFLAGS="-m64 -g" + ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --enable-osdi --prefix=/usr CFLAGS="-g -m64 -O0 -Wall" LDFLAGS="-m64 -g" else cd releasesh if [ $? -ne 0 ]; then echo "cd releasesh failed"; exit 1 ; fi echo "configuring shared lib for 64 bit release" echo -# You may add --enable-adms to the following command for adding adms generated devices. # The --prefix (and perhaps --libdir) may be used to determine a different install location # (depending on the Linux distribution, and on the calling programs search path). - ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --disable-debug --prefix=/usr CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" + ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --disable-debug --enable-osdi --prefix=/usr CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" fi if [ $? -ne 0 ]; then echo "../configure failed"; exit 1 ; fi diff --git a/compile_min_shared.sh b/compile_min_shared.sh index ad27fde3d..ce8bc9565 100644 --- a/compile_min_shared.sh +++ b/compile_min_shared.sh @@ -51,14 +51,14 @@ if test "$1" = "d"; then echo "configuring for 64 bit debug" echo # You may add --enable-adms to the following command for adding adms generated devices - ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --enable-relpath --disable-debug prefix="C:/Spice64d" CFLAGS="-m64 -g -O0 -Wall" LDFLAGS="-m64" + ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --enable-osdi --enable-relpath --disable-debug prefix="C:/Spice64d" CFLAGS="-m64 -g -O0 -Wall" LDFLAGS="-m64" else cd release-sh if [ $? -ne 0 ]; then echo "cd release-sh failed"; exit 1 ; fi echo "configuring for 64 bit release" echo # You may add --enable-adms to the following command for adding adms generated devices - ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --enable-relpath --disable-debug prefix="C:/Spice64" CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" + ../configure --with-ngshared --enable-xspice --enable-cider --enable-openmp --enable-osdi --enable-relpath --disable-debug prefix="C:/Spice64" CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" fi if [ $? -ne 0 ]; then echo "../configure failed"; exit 1 ; fi diff --git a/configure.ac b/configure.ac index a69e3b32b..5492f6bf0 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ # problem to the user. AC_PREREQ([2.59]) -m4_define([ngspice_major_version], [38+]) +m4_define([ngspice_major_version], [39]) m4_define([ngspice_minor_version], [0]) m4_define([ngspice_version], [ngspice_major_version]) @@ -117,7 +117,7 @@ LT_INIT([shared static]) # --> Set 'LT_NGSPICE_AGE' to 0. LT_NGSPICE_CURRENT=0 -LT_NGSPICE_REVISION=5 +LT_NGSPICE_REVISION=6 LT_NGSPICE_AGE=1 LIBNGSPICE_SO_VERSION=$LT_NGSPICE_CURRENT.$LT_NGSPICE_REVISION.$LT_NGSPICE_AGE diff --git a/examples/TransmissionLines/URC-TM-SUB.cir b/examples/TransmissionLines/URC-TM-SUB.cir new file mode 100644 index 000000000..39d4e062a --- /dev/null +++ b/examples/TransmissionLines/URC-TM-SUB.cir @@ -0,0 +1,16 @@ +URC transmission line + +.subckt UTM in out gnd1 +U1 in out gnd1 URCMOD L =20m +.model URCMOD URC CPERL=100p RPERL=100k FMAX=10G +.ends + +XUTM 1 2 0 UTM + +VS 1 0 dc 0 PULSE (0 5 15.9NS 0.2NS 0.2NS 15.8NS 32NS ) +.control +TRAN 0.2N 47N 0 0.1N +plot v(1) v(2) +.endc + +.end diff --git a/examples/digital/digital_devices/ex4.cir b/examples/digital/digital_devices/ex4.cir index 941cd193b..9c632de90 100644 --- a/examples/digital/digital_devices/ex4.cir +++ b/examples/digital/digital_devices/ex4.cir @@ -78,7 +78,8 @@ run display edisplay eprint a b cin sum cout -*plot cout sum -quit +set xbrushwidth=3 +plot a b cin cout sum digitop +*quit .endc .end diff --git a/examples/digital/digital_devices/ex5.cir b/examples/digital/digital_devices/ex5.cir index 1063382c5..059cc6c30 100644 --- a/examples/digital/digital_devices/ex5.cir +++ b/examples/digital/digital_devices/ex5.cir @@ -125,7 +125,8 @@ run *edisplay eprint o1 o2 o3 o4 o5 o6 o7 o8 eprint q1 q2 q3 q4 q5 q6 q7 q8 -*plot q4 o6 -quit +*set xbrushwidth=2 +plot o1 o2 o3 o4 o5 o6 o7 o8 q1 q2 q3 q4 q5 q6 q7 q8 digitop +*quit .endc .end diff --git a/examples/osdi/EKV2.6/ekv26_mod.va b/examples/osdi/EKV2.6/ekv26_mod.va new file mode 100644 index 000000000..e386a9608 --- /dev/null +++ b/examples/osdi/EKV2.6/ekv26_mod.va @@ -0,0 +1,922 @@ +/* +EKV MOS model version 2.6 rev.15 with documentation at: http://ekv.epfl.ch +Matthias Bucher, Christophe Lallement, Christian Enz, Fabien Theodoloz, Francois Krummenacher +Electronics Laboratories, Swiss Federal Institute of Technology Lausanne, Switzerland +This Verilog-A was developed by Wladek Grabinski with modifications +by Tiburon Design Automation (www.tiburon-da.com). +This software has been provided pursuant to a License Agreement containing restrictions on its use. +It may not be copied or distributed in any form or medium, disclosed to third parties, +reverse engineered or used in any manner not provided for in said License Agreement +except with the prior written authorization. +Licensed under the Educational Community License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. + +You may obtain a copy of the License at http://opensource.org/licenses/ECL-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied. See the License for the specific language governing permissions +and limitations under the License. + +$RCSfile: ekv.va,v $ $Revision: 1.9 $ $Date: 2003/12/17 01:20:10 $ +$RCSfile: ekv.va,v $ $Revision: 2.6.15 $ $Date: 2020/05/29 11:50:10 $ +*/ +/* +`include "disciplines.vams" +`include "constants.vams" +`include "compact.vams" +*/ + +// Macros for the model/instance parameters +// +// MPRxx model parameter real +// MPIxx model parameter integer +// IPRxx instance parameter real +// IPIxx instance parameter integer +// || +// cc closed lower bound, closed upper bound +// oo open lower bound, open upper bound +// co closed lower bound, open upper bound +// oc open lower bound, closed upper bound +// cz closed lower bound=0, open upper bound=inf +// oz open lower bound=0, open upper bound=inf +// nb no bounds +// ex no bounds with exclude +// sw switch(integer only, values 0=false and 1=true) +// ty switch(integer only, values -1=p-type and +1=n-type) +// +// IPM instance parameter mFactor(multiplicity, implicit for LRM 2.2) +// OPP operating point parameter, includes units and description for printing + +`define OPP(nam,uni,des) (* units=uni, desc=des *) real nam; +`define OPM(nam,uni,des) (* units=uni, desc=des, multiplicity="multiply" *) real nam; +`define OPD(nam,uni,des) (* units=uni, desc=des, multiplicity="divide" *) real nam; + +`define MPRnb(nam,def,uni, des) (* units=uni, desc=des *) parameter real nam=def; +`define MPRex(nam,def,uni,exc, des) (* units=uni, desc=des *) parameter real nam=def exclude exc; +`define MPRcc(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter real nam=def from[lwr:upr]; +`define MPRoo(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter real nam=def from(lwr:upr); +`define MPRco(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter real nam=def from[lwr:upr); +`define MPRoc(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter real nam=def from(lwr:upr]; +`define MPRcz(nam,def,uni, des) (* units=uni, desc=des *) parameter real nam=def from[ 0:inf); +`define MPRoz(nam,def,uni, des) (* units=uni, desc=des *) parameter real nam=def from( 0:inf); + +`define MPInb(nam,def,uni, des) (* units=uni, desc=des *) parameter integer nam=def; +`define MPIex(nam,def,uni,exc, des) (* units=uni, desc=des *) parameter integer nam=def exclude exc; +`define MPIcc(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter integer nam=def from[lwr:upr]; +`define MPIoo(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter integer nam=def from(lwr:upr); +`define MPIco(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter integer nam=def from[lwr:upr); +`define MPIoc(nam,def,uni,lwr,upr,des) (* units=uni, desc=des *) parameter integer nam=def from(lwr:upr]; +`define MPIcz(nam,def,uni, des) (* units=uni, desc=des *) parameter integer nam=def from[ 0:inf); +`define MPIoz(nam,def,uni, des) (* units=uni, desc=des *) parameter integer nam=def from( 0:inf); +`define MPIsw(nam,def,uni, des) (* units=uni, desc=des *) parameter integer nam=def from[ 0: 1]; +`define MPIty(nam,def,uni, des) (* units=uni, desc=des *) parameter integer nam=def from[ -1: 1] exclude 0; +`define IPRnb(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter real nam=def; +`define IPRex(nam,def,uni,exc, des) (* units=uni, type = "instance", desc=des *) parameter real nam=def exclude exc; +`define IPRcc(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from[lwr:upr]; +`define IPRoo(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from(lwr:upr); +`define IPRco(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from[lwr:upr); +`define IPRoc(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from(lwr:upr]; +`define IPRcz(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from[ 0:inf); +`define IPRoz(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter real nam=def from( 0:inf); +`define IPInb(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def; +`define IPIex(nam,def,uni,exc, des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def exclude exc; +`define IPIcc(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from[lwr:upr]; +`define IPIoo(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from(lwr:upr); +`define IPIco(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from[lwr:upr); +`define IPIoc(nam,def,uni,lwr,upr,des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from(lwr:upr]; +`define IPIcz(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from[ 0:inf); +`define IPIoz(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def from( 0:inf); +`define BPRco(nam, def, uni, lwr, upr, des) (* units = uni, type = "instance", desc = des *) parameter real nam = def from[lwr : upr); +`define BPRoz(nam, def, uni, des) (* units = uni, type = "instance", desc = des *) parameter real nam = def from(0.0 : inf); +`define BPRcz(nam, def, uni, des) (* units = uni, type = "instance", desc = des *) parameter real nam = def from[0.0 : inf); +`define BPIcc(nam, def, uni, lwr, upr, des) (* units = uni, type = "instance", desc = des *) parameter integer nam = def from[lwr : upr]; +`define BPInb(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter integer nam=def; +`define BPRnb(nam,def,uni, des) (* units=uni, type = "instance", desc=des *) parameter real nam=def; + +// includes: in case we do not want to include any other file [AB:040902] +// we can just add the following section in this file +// AB: i hope this may help our code to be easily transported +//---------------------------------------- +// from disciplines.h we need: +// Electrical +// Current in amperes +nature Current + units = "A"; + access = I; + idt_nature = Charge; +`ifdef CURRENT_ABSTOL + abstol = `CURRENT_ABSTOL; +`else + abstol = 1e-12; +`endif +endnature +// Charge in coulombs +nature Charge + units = "coul"; + access = Q; + ddt_nature = Current; +`ifdef CHARGE_ABSTOL + abstol = `CHARGE_ABSTOL; +`else + abstol = 1e-14; +`endif +endnature +// Potential in volts +nature Voltage + units = "V"; + access = V; + idt_nature = Flux; +`ifdef VOLTAGE_ABSTOL + abstol = `VOLTAGE_ABSTOL; +`else + abstol = 1e-6; +`endif +endnature +// Flux in Webers +nature Flux + units = "Wb"; + access = Phi; + ddt_nature = Voltage; +`ifdef FLUX_ABSTOL + abstol = `FLUX_ABSTOL; +`else + abstol = 1e-9; +`endif +endnature +// Conservative discipline +discipline electrical + potential Voltage; + flow Current; +enddiscipline +// Signal flow disciplines +discipline voltage + potential Voltage; +enddiscipline +discipline current + potential Current; +enddiscipline +//from constants.h we need +`define C_EPSSIL 1.03594314e-10 +`define C_EPSOX 34.5e-12 +`define C_QE 1.602e-19 +`define C_K 1.3807e-23 +`define P_K 1.3806226e-23 +`define P_EPS0 8.85418792394420013968e-12 +`define P_CELSIUS0 273.15 +`define POS_MIN 1.0E-6 +`define SQRT2 1.4142135623730950488016887242097 +`define ONE3RD 0.33333333333333333333333333333333 +`define ONESQRT2 0.70710678118654752440084436210485 +//if any other constant is needed it may be copied from the constants.h and be put above. +//------------------------------------------ end of includes +`define FWD 1 +`define REV -1 +// AB 040902 +`define NOT_GIVEN -1.0e21 +`define DEFAULT_TNOM 25 +module ekv_va(d,g,s,b); + // %%DEVICE_CLASS=MOS(NMOS:TYPE=1,PMOS:TYPE=-1)%% + // Node definitions + inout d,g,s,b; // external nodes + electrical d,g,s,b; // external nodes + // Branch definitions + branch (d,s) ds; + branch (d,b) db; + branch (s,b) sb; + branch (g,b) gb; + // * Local variables + real tmp1, tmp2, tmp3; // temporary variables + real VGprime, GAMMAprime;// short and narrow channel effect + real VP, VPprime; // pinch-off voltage + real if_, ir, irprime; // normalized currents + real VDSS, VDSSprime;// saturation voltage + real deltaL, Leq; // channel length reduction + real beta; // transconductance factor + real n; // slope factor + real Ispec; // specific current + real Vt; // k*T/q + real gm, gms, gmbs, gds; + real isub, Isub; + real inv_Vt, Vt_01, Vt_2, Vt_4, Vt_Vt, Vt_Vt_2, Vt_Vt_16; + real eps_COX, eps_COX_W, eps_COX_L; + real Lc, Lc_LAMBDA, IBN_2, T0, T1, eta_qi; + real inv_UCRIT, Lc_UCRIT, Lc_IBB, IBA_IBB; + integer Mode; + real WETA_W, LETA_L; + real E0_Q_1, AWL; + real T, KP_Weff; + real Eg, refEg, deltaT, ratioT, Tnom; + real VTO_T, VTO_S, KP_T, UCRIT_T, IBB_T, PHI_T, GAMMA_S; + real sqrt_Lprime_Lmin; + real GAMMAstar, sqrt_GAMMAstar; + real big_sqrt_VP; + real big_sqrt_VP0, VP0; + real PHI_VD, PHI_VS; + real sqrt_PHI; + real sqrt_PHI_VP, sqrt_PHI_VD, sqrt_PHI_VS; + real sqrt_PHI_VD_Vt, sqrt_PHI_VS_Vt; + real Vds, deltaV_2, Vip; + real VDSS_sqrt, sqrt_VDSS_deltaV, sqrt_Vds_VDSS_deltaV; + real VDSSprime_sqrt, sqrt_VDSSprime_deltaV, sqrt_Vds_VDSSprime_deltaV; + real if_ir; + real sqrt_if, sqrt_ir, sqrt_irprime; + real dif_dv, dir_dv, dirprime_dv; + // Charge related variables + real sif, sir, sif2, sir2, sif3, sir3; + real sif_sir_2; + real qi, qb; + real QD, QS, QI, QB, QG; + real VP_PHI_eps, sqrt_PHI_VP_2, WLCox; + real n_Vt_COX, n_1, n_1_n; + // Variables used for derivatives computation + real dVP_dVD, dVP_dVG, dVP_dVS; + real dif_dVD, dif_dVS, dif_dVG; + real dir_dVD, dir_dVS, dir_dVG; + real dVDSS_dVD, dVDSS_dVG, dVDSS_dVS; + real ddeltaV_dVD, ddeltaV_dVG, ddeltaV_dVS; + real dVip_dVD, dVip_dVG, dVip_dVS; + real dVDSSprime_dVD, dVDSSprime_dVG, dVDSSprime_dVS; + real dirprime_dVD, dirprime_dVG, dirprime_dVS; + real dLeq_dVD, dLeq_dVG, dLeq_dVS; + real dbeta_dVD, dbeta_dVG, dbeta_dVS; + real VGstar, sqrt_VGstar; + real VG, VD, VS; + real Von, Vdsat, Id, Ibd; + real Gn; + real GAMMA_sqrt_PHI, Lmin, Lprime, T0_GAMMA_1, THETA_VP_1, Vc; + real Vdsprime, Vt_Vc, dGAMMAprime_dVD, dGAMMAprime_dVG, dGAMMAprime_dVS; + real dVPprime_dVD, dVPprime_dVG, dVPprime_dVS, ddeltaL_dVD, ddeltaL_dVG; + real ddeltaL_dVS, dn_dVD, dn_dVG, dn_dVS; + real log_Vc_Vt, sqrt_PHI_VP0, sqrt_VP_Vt; + real Lc_IBB_Vib, Vib, dIsub_factor, exp_ib; + real inv_Vib, sqrt_PHI_VP2_2; + real V0, deltaVFB, vL; + real dQI_dVD, dQI_dVS, dQI_dVG; + real dQB_dVD, dQB_dVS, dQB_dVG; + real Leff, Weff; + real RSeff, RDeff; + real yk, z0, zk; + real EPSOX, epssil; + real ddt_QD, ddt_QS; + //DIODES realted variables [AB: 040902] + real as_i, ad_i, ps_i, pd_i, v_di_b, v_si_b; + real temp_arg, tmp0; + real js_t, jsw_t, jswg_t; + real pb_t, pbsw_t, pbswg_t; + real cj_t, cjsw_t, cjswg_t; + real njts_t, njtssw_t, njtsswg_t; + real is_d, arg_d, is_s, arg_s; + real f_breakdown_d, f_breakdown_s, idb_tun, isb_tun; + real csb_d, cssw_d, csswg_d; + real csb_s, cssw_s, csswg_s; + real qjd, qjs; + + // parameter definitions + parameter integer TYPE = 1 from [-1:1] exclude 0; // NMOS=1, PMOS=-1 + parameter integer Noise = 1 from [0:1]; // Set to zero to prevent noise calculation + parameter real Trise = 0.0 from [-inf:inf]; // Difference sim. temp and device temp [C deg] +// parameter real Temp = -`NOT_GIVEN from [`P_CELSIUS0:inf]; // Device temp [C] +//AB: the parameter name Temp is not working for no obvious reason; changed to TEMP + parameter real TEMP = -`NOT_GIVEN from [`P_CELSIUS0:inf]; // Device temp [C] + parameter real TNOM = -`NOT_GIVEN; // Temperature [C] + + + // Instance parameters + + // - intrinsic model +`IPRoz( L ,1.0e-5 ,"m" ,"Length" ) +`IPRoz( W ,1.0e-5 ,"m" ,"Total width including fingers" ) +`IPIco( M ,1 ,"" ,1 ,inf ,"Parallel multiplier" ) +`IPIco( NS ,1 ,"" ,1 ,inf ,"Series multiplier" ) +`BPRnb( DTEMP ,0.0 ,"K" ,"Offset of device temperature" ) + + // - external parasitics +`IPRcz( AS ,0.0 ,"m^2" ,"Source-to-substrate junction area" ) +`IPRcz( AD ,0.0 ,"m^2" ,"Drain-to-substrate junction area" ) +`IPRcz( PS ,0.0 ,"m" ,"Source-to-substrate junction perimeter" ) +`IPRcz( PD ,0.0 ,"m" ,"Drain-to-substrate junction perimeter" ) + +`IPRcz( NRS ,1.0 ,"" ,"Number of squares in source" ) +`IPRcz( NRD ,1.0 ,"" ,"Number of squares in drain" ) + + + // *** Process related parameters + parameter real COX = 2.0E-3 from [0.0:inf]; // Gate oxide capacitance per unit area [F] + parameter real XJ = 300E-9 from [0.0:inf]; // Junction depth [m] + //*** Threshold voltage/substrate effect parameters (long-channel) + parameter real VTO = 0.5 from [-inf:inf]; // Long-channel threshold voltage [V] + parameter real TCV = 1.0e-3; // Threshold voltage temperature coefficient [V/K] + parameter real GAMMA = 0.7 from [0.0:inf]; // Body effect parameter + parameter real PHI = 0.5 from [0.2:inf]; // Bulk Fermi potential [V] + //*** Mobility parameters (long-channel) *** + parameter real KP = 150E-6 from [0.0:inf]; // Transconductance parameter [A/V/V] + parameter real BEX = -1.5; // Mobility temperature exponent + parameter real THETA = 0.0 from [0.0:inf]; // Mobility reduction coefficient [1/V] + parameter real E0 = 1.0E8; // Mobility reduction coefficient [V/m] + //*** Velocity sat./channel length mod. parameters (short-channel) + parameter real UCRIT = 2.0E6 from [0.0:inf]; // Longitudinal critical field [V/m] + parameter real UCEX = 0.8; // Longitudinal critical field temperature exponent + parameter real LAMBDA = 0.8 from [0.0:inf]; // Depletion length coefficient (channel length modulation) + //*** Process related parameters + parameter real DL = -0.01E-6; // Channel width correction [m] + parameter real DW = -0.01E-6; // Channel length correction [m] + //*** Threshold voltage/substrate effect parameter (narrow-channel) + parameter real WETA = 0.2 from [0.0:inf]; // Narrow-channel effect coefficient + //*** Threshold voltage/substrate effect parameters (short-channel) + parameter real LETA = 0.3 from [0.0:inf]; // Short-channel effect coefficient + parameter real Q0 = 230E-6 from [0.0:inf]; // Reverse short channel effect peak charge density + parameter real LK = 0.4E-6 from [0.0:inf]; // Reverse short channel effect characteristic length [m] + //*** Substrate current parameters + parameter real IBA = 5.0E8 from [0.0:inf]; // First impact ionization coefficient [1/m] + parameter real IBB = 4.0E8 from [0.0:inf]; // Second impact ionization coefficient [V/m] + parameter real IBBT = 9.0e-4; // Temperature coefficient for IBB [1/K] + parameter real IBN = 1.0 from [0.0:inf]; // Saturation voltage factor for impact ionization + //*** Series resistance parameters + parameter real RSH = 0.0 from [0.0:inf]; // Sheet resistance [Ohms] + parameter real HDIF = 0.5E-6 from [0.0:inf]; // Sheet resistance multipler + //*** for MC analysis fk 25/05/97 + parameter real AVTO = 1E-6 from [0.0:inf]; // Area related threshold voltage mismatch parameter [Vm] + parameter real AKP = 1E-6 from [0.0:inf]; // Area related gain mismatch parameter [m] + parameter real AGAMMA = 1E-6 from [0.0:inf]; // Area related body effect mismatch parameter [sqr(V) m] + parameter real AF = 1.0 from (0:inf); // Flicker noise exponent + parameter real KF = 0.0 from [0:inf); // Flicker noise coefficient + //*** JUNCTION DRAIN-BULK AND SOURCE-BULK AREA, CURRENT, CAPACITANCE [AB:040902] + parameter real xd_n = 1.0 from [0.0:inf); + parameter real xd_js = 1.0E-09 from [0.0:inf); + parameter real xd_jsw = 1.0E-12 from [0.0:inf); + parameter real xd_jswg = 1.0E-12 from [0.0:inf); + parameter real xd_mj = 0.900 from [0.0:1.0]; + parameter real xd_mjsw = 0.700 from [0.0:1.0]; + parameter real xd_mjswg = 0.700 from [0.0:1.0]; + parameter real xd_pb = 0.800 from (0.0:inf); + parameter real xd_pbsw = 0.600 from (0.0:inf); + parameter real xd_pbswg = 0.600 from (0.0:inf); + parameter real xd_cj = 1.0E-09 from [0.0:inf); + parameter real xd_cjsw = 1.0E-12 from [0.0:inf); + parameter real xd_cjswg = 1.0E-12 from [0.0:inf); + parameter real xd_gmin = 0.0 from [0.0:inf); + parameter real xd_xjbv = 0.0 from [0.0:inf); + parameter real xd_bv = 10.0 from [0.0:inf); + parameter real xd_njts = 1.0 from [0.0:inf); + parameter real xd_njtssw = 1.0 from [0.0:inf); + parameter real xd_njtsswg = 1.0 from [0.0:inf); + parameter real xd_vts = 0.0 from [0.0:inf); + parameter real xd_vtssw = 0.0 from [0.0:inf); + parameter real xd_vtsswg = 0.0 from [0.0:inf); + parameter real tp_xti = 3.0 from (-inf:inf); + parameter real tp_cj = 0.0 from (-inf:inf); + parameter real tp_cjsw = 0.0 from (-inf:inf); + parameter real tp_cjswg = 0.0 from (-inf:inf); + parameter real tp_pb = 0.0 from (-inf:inf); + parameter real tp_pbsw = 0.0 from (-inf:inf); + parameter real tp_pbswg = 0.0 from (-inf:inf); + parameter real tp_njts = 0.0 from [0.0:inf); + parameter real tp_njtssw = 0.0 from [0.0:inf); + parameter real tp_njtsswg = 0.0 from [0.0:inf); + analog begin + // Set constant + EPSOX = 3.9 * `P_EPS0; + epssil = 11.7 * `P_EPS0; + Ibd = 0.0; + // The following are necessary to prevent memory states being reserved: + THETA_VP_1 = 0.0; + VPprime = 0.0; + sqrt_VP_Vt = 0.0; + // Geometry, voltage and temperature independent model variables + eps_COX = epssil/COX; + Lc = sqrt(eps_COX*XJ); + Lc_LAMBDA = Lc * LAMBDA; + eps_COX_W = 3.0 * eps_COX * WETA; + eps_COX_L = eps_COX * LETA; + IBN_2 = IBN + IBN; + T0 = COX / (epssil*E0); + V0 = (Q0+Q0) / COX; + eta_qi = TYPE > 0 ? 0.5 : 0.3333333333333; + /* Model working variables, geometry and voltage independent, + * which need to be updated after temperature change + * EKV model internal variables depending on temperature. + */ + /* If Temp is explicitly specified, use that value + otherwise use Tckt+Trise */ + if (TEMP == -`NOT_GIVEN) //AB: 040902 Temp -> TEMP + T = $temperature + Trise; + else + T = TEMP + `P_CELSIUS0; //AB: 040902 Temp -> TEMP + if (TNOM == -`NOT_GIVEN) + Tnom = `DEFAULT_TNOM + `P_CELSIUS0; + else + Tnom = TNOM + `P_CELSIUS0; + Vt = $vt(T); + Vt_01 = 0.1 * Vt; + inv_Vt = 1.0 / Vt; + Vt_2 = Vt + Vt; + Vt_4 = Vt_2 + Vt_2; + Vt_Vt = Vt * Vt; + Vt_Vt_2 = Vt_Vt + Vt_Vt; + Vt_Vt_16 = 16.0 * Vt_Vt; + + Eg = 1.16 - 7.02e-4 * T * T / (T + 1108.0); + refEg = 1.16 - (7.02e-4*Tnom*Tnom) / (Tnom + 1108.0); + deltaT = T - Tnom; + ratioT = T / Tnom; + VTO_T = VTO - TCV * deltaT; + KP_T = KP * pow(ratioT, BEX); + UCRIT_T = UCRIT * pow(ratioT, UCEX); + IBB_T = IBB * (1.0 + IBBT * deltaT); + PHI_T = PHI * ratioT - 3.0 * Vt * ln(ratioT) - refEg * ratioT + Eg; + // !! mb 99/07/30 prevents PHI from becoming smaller than 0.2 + tmp1 = 0.2; + tmp2 = PHI_T - tmp1; + PHI_T = 0.5*(tmp2 + sqrt(tmp2*tmp2 + Vt*Vt)) + tmp1; + sqrt_PHI = sqrt(PHI_T); + inv_UCRIT = 1.0/UCRIT_T; + Lc_UCRIT = Lc * UCRIT_T; + Lc_IBB = Lc * IBB_T; + IBA_IBB = IBA / IBB_T; + /* VTO, KP and GAMMA with variation for MC analysis if required. + * The default value for model parameters AVTO, AKP and AGAMMA + * is set to 1e-6 to allow meaningful sensitivity analysis. Only + * the deviation from this value has to be taken into account + */ + // wg: for userc.c and verilog implementations + Leff = L + DL; + // wg: for userc.c and verilog implementations + Weff = W + DW; + Vc = UCRIT_T*Leff; // NOTE: use L if necessary + log_Vc_Vt = Vt*(ln(0.5*Vc*inv_Vt)-0.6); // mb 98/02/05 (r1) + // de-normalization + AWL = 1.0/sqrt(Weff*Leff); + if (TYPE > 0) + VTO_S = ((AVTO != 1e-6) ? AWL*(AVTO - 1e-6) + VTO_T : VTO_T); + else + VTO_S = ((AVTO != 1e-6) ? AWL*(1e-6 - AVTO) - VTO_T: -VTO_T); + KP_Weff = Weff * ((AKP != 1e-6) ? KP_T*(1 + (AKP - 1e-6)*AWL) : KP_T); + GAMMA_S = ((AGAMMA !=1e-6) ? GAMMA + (AGAMMA - 1e-6)*AWL : GAMMA); + GAMMA_sqrt_PHI = GAMMA_S*sqrt_PHI; + /* ************************************ + * STATIC MODEL EQUATIONS + * *************************************/ + // VGprime: + if (V0 == 0.0) + deltaVFB = 0.0; +// else begin : VGprime //AB: 040902 VGPrime is also a variable and + else begin : VGprime_block //AB: 040902 VGPrime -> VGprime_block + real sqv; + // mb 99/03/26 corrected for multiple device number + vL = 0.28 * (Leff/(LK*NS) - 0.1); + sqv = 1.0 / (1.0 + 0.5*(vL + sqrt(vL*vL + 1.936e-3))); + deltaVFB = V0 * sqv * sqv; + end + VG = TYPE * V(g,b); // wg 22/04/08 corrected for device TYPE + VS = TYPE * V(s,b); + VD = TYPE * V(d,b); + if (VD - VS < 0) begin + Mode = `REV; + T1 = VS; + VS = VD; + VD = T1; + end + else + Mode = `FWD; + // VGB = VGS - VBS; + // VBD = VBS - VDS; + VGstar = VG - VTO_S - deltaVFB + PHI_T + GAMMA_sqrt_PHI; + sqrt_VGstar = sqrt(VGstar*VGstar + 2.0*Vt_Vt_16); + VGprime = 0.5*(VGstar + sqrt_VGstar); + // Pinch-off voltage VP, limited to VP >= -PHI + PHI_VS = PHI_T+VS; + sqrt_PHI_VS_Vt = sqrt(PHI_VS*PHI_VS+Vt_Vt_16); + sqrt_PHI_VS = sqrt(0.5*(PHI_VS+sqrt_PHI_VS_Vt)); + PHI_VD = PHI_T+VD; + sqrt_PHI_VD_Vt = sqrt(PHI_VD*PHI_VD+Vt_Vt_16); + sqrt_PHI_VD = sqrt(0.5*(PHI_VD+sqrt_PHI_VD_Vt)); + WETA_W = eps_COX_W * M / Weff; + LETA_L = eps_COX_L * NS / Leff; + // mb: symmetric version of GAMMAprime necessary with charges model + big_sqrt_VP0 = sqrt(VGprime + 0.25*GAMMA_S*GAMMA_S); + VP0 = VGprime - PHI_T - GAMMA_S*(big_sqrt_VP0 - 0.5*GAMMA_S); + sqrt_PHI_VP0 = sqrt(VP0+PHI_T+Vt_01); + GAMMAstar = GAMMA_S - LETA_L * (sqrt_PHI_VS+sqrt_PHI_VD) + + WETA_W * sqrt_PHI_VP0; + // keep GAMMAprime from becoming negative + sqrt_GAMMAstar = sqrt(GAMMAstar*GAMMAstar+Vt_01); + GAMMAprime = 0.5*(GAMMAstar+sqrt_GAMMAstar); + big_sqrt_VP = sqrt(VGprime+0.25*GAMMAprime*GAMMAprime); + VP = VGprime-PHI_T-GAMMAprime*(big_sqrt_VP-0.5*GAMMAprime); + // Forward normalized current: + tmp1 = (VP - VS) * inv_Vt; + if (tmp1 > -0.35) begin + z0 = 2.0/(1.3 + tmp1 - ln(tmp1 + 1.6)); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -15.0) begin + z0 = 1.55 + exp(-tmp1); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -23.0) begin + yk = 1.0/(2.0 + exp(-tmp1)); + end else begin + yk = exp(tmp1) + 1E-64; + end + end + end + if_ = yk*(1.0 + yk); + sqrt_if = sqrt(if_); + dif_dv = yk; + // Saturation voltage: + Vt_Vc = Vt / Vc; + VDSS_sqrt = sqrt(0.25+sqrt_if*Vt_Vc); + VDSS = Vc*(VDSS_sqrt-0.5); + Vds = 0.5*(VD-VS); + deltaV_2 = Vt_Vt_16*(LAMBDA*(sqrt_if- + VDSS*inv_Vt)+15.625e-3); + sqrt_VDSS_deltaV = sqrt(VDSS*VDSS+deltaV_2); + sqrt_Vds_VDSS_deltaV = sqrt((Vds-VDSS)*(Vds-VDSS)+deltaV_2); + Vip = sqrt_VDSS_deltaV-sqrt_Vds_VDSS_deltaV; + VDSSprime_sqrt = sqrt(0.25+(sqrt_if-0.75*ln(if_))*Vt_Vc); + VDSSprime = Vc*(VDSSprime_sqrt-0.5)+log_Vc_Vt; + // Reverse normalized current: + Vdsprime = Vds-VDSSprime; // mb 97/07/18 introduced Vdsprime + sqrt_VDSSprime_deltaV = sqrt(VDSSprime*VDSSprime+deltaV_2); + sqrt_Vds_VDSSprime_deltaV = sqrt(Vdsprime*Vdsprime+deltaV_2); + tmp1 = (VP-Vds-VS-sqrt_VDSSprime_deltaV+ + sqrt_Vds_VDSSprime_deltaV)*inv_Vt; + // include -> Charge F(x) interpolate function + if (tmp1 > -0.35) begin + z0 = 2.0/(1.3 + tmp1 - ln(tmp1 + 1.6)); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -15.0) begin + z0 = 1.55 + exp(-tmp1); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -23.0) begin + yk = 1.0/(2.0 + exp(-tmp1)); + end else begin + yk = exp(tmp1) + 1E-64; + end + end + end + irprime = yk*(1.0 + yk); + sqrt_irprime = sqrt(irprime); + dirprime_dv = yk; + /* Channel length modulation & mobility reduction due + * to longitudinal field */ + deltaL = Lc_LAMBDA*ln(1.0+(Vds-Vip)/Lc_UCRIT); + Lprime = Leff-deltaL+(Vds+Vip)*inv_UCRIT; + Lmin = 0.1*Leff; + sqrt_Lprime_Lmin = sqrt(Lprime*Lprime+Lmin*Lmin); + Leq = 0.5*(Lprime+sqrt_Lprime_Lmin); + // Transconductance factor: + // Mobility reduction due to vertical field + // Reverse normalized current: + // ratioV_ir + tmp1 = (VP - VD) * inv_Vt; + if (tmp1 > -0.35) begin + z0 = 2.0/(1.3 + tmp1 - ln(tmp1 + 1.6)); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -15.0) begin + z0 = 1.55 + exp(-tmp1); + zk = (2.0 + z0)/(1.0 + tmp1 + ln(z0)); + yk = (1.0 + tmp1 + ln(zk))/(2.0 + zk); + end else begin + if (tmp1 > -23.0) begin + yk = 1.0/(2.0 + exp(-tmp1)); + end else begin + yk = exp(tmp1) + 1E-64; + end + end + end + ir = yk*(1.0 + yk); + sqrt_ir = sqrt(ir); + dir_dv = yk; + sif2 = 0.25+if_; + sir2 = 0.25+ir; + sif = sqrt(sif2); + sir = sqrt(sir2); + sif_sir_2 = (sif+sir)*(sif+sir); + VP_PHI_eps = VP+PHI_T+1.0e-6; + sqrt_PHI_VP_2 = 2.0*sqrt(VP_PHI_eps); + n_1 = GAMMA_S/sqrt_PHI_VP_2; + n_1_n = GAMMA_S/(sqrt_PHI_VP_2 + GAMMA_S); + // Normalized inversion charge (qi=QI/WLCox) + qi = -(1.0+n_1)*Vt*((0.66666666+0.66666666)* + (sir2+sir*sif+sif2)/(sif+sir) - 1.0); + // Normalized depletion charge (qb=QB/WLCox), for depletion to inversion + qb = -0.5*GAMMA_S*sqrt_PHI_VP_2 - n_1_n*qi; + if (E0 == 0.0) begin + /* NOTE: this version of the simple mobility model from prior + * versions of the EKV model is reinstated. + * In case E0 is *not* specified, this + * simple mobility model is used according to THETA, if specified. + * VPprime: + * mb eliminated discontinuity of derivative of 1+THETA*VP + */ + sqrt_VP_Vt = sqrt(VP*VP + Vt_Vt_2); + VPprime = 0.5 * (VP + sqrt_VP_Vt); + THETA_VP_1 = 1.0+THETA*VPprime; + beta = KP_Weff / (Leq * THETA_VP_1); // mb 97/07/18 + end + else begin + /* new model for mobility reduction, linked to the charges model + * mb 98/10/11 (r10) introduced fabs(Eeff) (jpm) + * E0_Q_1 = 1.0 + T0 * abs(qb+eta_qi*qi); + */ + if ((qb + eta_qi*qi) > 0.0) + E0_Q_1 = 1.0 + T0*(qb + eta_qi*qi); + else + E0_Q_1 = 1.0 - T0*(qb + eta_qi*qi); + T0_GAMMA_1 = 1.0 + T0*GAMMA_sqrt_PHI; + beta = KP_Weff * T0_GAMMA_1 / (Leq * E0_Q_1); + end + /* Slope factor: mb introduced new formula to avoid divergence + * of n for VP->-PHI */ + sqrt_PHI_VP = sqrt(PHI_T+VP+Vt_4); // mb 95/12/19 introduced Vt_4 + n = 1.0 + GAMMA_S/(2.0*sqrt_PHI_VP); + // Drain current: + if_ir = if_-irprime; + Ispec = Vt_Vt_2 * n * beta; + Id = Ispec * if_ir; + /* Return threshold voltage + * Von = Vth(Vs) = Vto + Gamma*(sqrt(Phi + Vsb)-sqrt(Phi)) */ + Von = VTO_S + GAMMAprime*(sqrt_PHI_VS - sqrt_PHI); + // Return saturation voltage (estimate) + Vdsat = Vt * (2.0*sqrt_if + 4.0); + // Return equivalent conductance for thermal noise calculation + Gn = beta * abs(qi); + /* Pinch-off voltage derivatives: + * mb 97/09/14 symmetric version of GAMMAprime necessary with + * charges model + * mb 99/05/10 (r12) New VGprime formulation (REVISION III) allows + * VP derivatives to be expressed with a single equation + */ + tmp1 = GAMMAprime / (sqrt_GAMMAstar+sqrt_GAMMAstar); + tmp2 = VGprime/sqrt_VGstar; // dVGprime_dVG + dGAMMAprime_dVD = -LETA_L * tmp1 * sqrt_PHI_VD / sqrt_PHI_VD_Vt; + dGAMMAprime_dVS = -LETA_L * tmp1 * sqrt_PHI_VS / sqrt_PHI_VS_Vt; + dGAMMAprime_dVG = WETA_W * tmp1 * (big_sqrt_VP0-0.5*GAMMA_S) / + (big_sqrt_VP0*sqrt_PHI_VP0) * tmp2; + tmp3 = (VP+PHI_T) / big_sqrt_VP; + dVP_dVD = -tmp3 * dGAMMAprime_dVD; + dVP_dVS = -tmp3 * dGAMMAprime_dVS; + dVP_dVG = -tmp3 * dGAMMAprime_dVG + (1.0 - + GAMMAprime/(big_sqrt_VP+big_sqrt_VP)) * tmp2; + // Forward normalized current derivatives: + tmp1 = dif_dv * inv_Vt; // mb 95/08/28, 97/04/21 + dif_dVD = tmp1 * dVP_dVD; + dif_dVS = tmp1 * (dVP_dVS-1.0); + dif_dVG = tmp1 * dVP_dVG; + // Saturation voltage derivatives: + tmp1 = Vt / (4.0*VDSS_sqrt*sqrt_if); + dVDSS_dVD = tmp1 * dif_dVD; + dVDSS_dVS = tmp1 * dif_dVS; + dVDSS_dVG = tmp1 * dif_dVG; + // deltaV derivatives: + tmp1 = (Vt_4+Vt_4) * LAMBDA; + tmp2 = Vt / (sqrt_if+sqrt_if); + ddeltaV_dVD = tmp1 * (dif_dVD*tmp2 - dVDSS_dVD); + ddeltaV_dVS = tmp1 * (dif_dVS*tmp2 - dVDSS_dVS); + ddeltaV_dVG = tmp1 * (dif_dVG*tmp2 - dVDSS_dVG); + // Vip derivatives: + tmp1 = 1.0 / sqrt_VDSS_deltaV; + tmp2 = 1.0 / sqrt_Vds_VDSS_deltaV; + tmp3 = Vds-VDSS; + dVip_dVD = (VDSS*dVDSS_dVD + ddeltaV_dVD) * tmp1 - + (tmp3 * (0.5-dVDSS_dVD) + ddeltaV_dVD) * tmp2; + dVip_dVS = (VDSS*dVDSS_dVS + ddeltaV_dVS) * tmp1 - + (tmp3 * (-0.5-dVDSS_dVS) + ddeltaV_dVS) * tmp2; + dVip_dVG = (VDSS*dVDSS_dVG + ddeltaV_dVG) * tmp1 - + (tmp3 * -dVDSS_dVG + ddeltaV_dVG) * tmp2; + // VDSSprime derivatives: + tmp1 = Vt * (sqrt_if-1.5)/(4.0*VDSSprime_sqrt*if_); + dVDSSprime_dVD = tmp1 * dif_dVD; + dVDSSprime_dVS = tmp1 * dif_dVS; + dVDSSprime_dVG = tmp1 * dif_dVG; + // Reverse normalized current derivatives: + tmp1 = dirprime_dv * inv_Vt; // mb 95/08/28, 97/04/21 + tmp2 = 1.0 / sqrt_VDSSprime_deltaV; // mb 97/04/21 + tmp3 = 1.0 / sqrt_Vds_VDSSprime_deltaV; + dirprime_dVD = tmp1 * (dVP_dVD-0.5 - + (VDSSprime*dVDSSprime_dVD+ddeltaV_dVD) * tmp2 + + (Vdsprime*(0.5-dVDSSprime_dVD)+ddeltaV_dVD) * tmp3); + dirprime_dVS = tmp1 * (dVP_dVS-0.5 - + (VDSSprime*dVDSSprime_dVS+ddeltaV_dVS) * tmp2 + + (Vdsprime*(-0.5-dVDSSprime_dVS)+ddeltaV_dVS) * tmp3); + dirprime_dVG = tmp1*(dVP_dVG - + (VDSSprime*dVDSSprime_dVG+ddeltaV_dVG) * tmp2 + + (Vdsprime*(-dVDSSprime_dVG)+ddeltaV_dVG) * tmp3); + // Channel length modulation & mobility reduction derivatives: + // deltaL derivatives: + tmp1 = Lc_LAMBDA / (Lc_UCRIT+Vds-Vip); + ddeltaL_dVD = tmp1 * (0.5-dVip_dVD); + ddeltaL_dVS = tmp1 * (-0.5-dVip_dVS); + ddeltaL_dVG = -tmp1 * dVip_dVG; + // Leq derivatives: + tmp1 = 1.0 / sqrt_Lprime_Lmin; // in fact dLeq_dVX/Leq + dLeq_dVD = tmp1 * (-ddeltaL_dVD + (0.5+dVip_dVD)*inv_UCRIT); + dLeq_dVS = tmp1 * (-ddeltaL_dVS + (-0.5+dVip_dVS)*inv_UCRIT); + dLeq_dVG = tmp1 * (-ddeltaL_dVG + dVip_dVG*inv_UCRIT); + // Transconductance factor derivatives: + tmp1 = dir_dv*inv_Vt; + dir_dVD = tmp1 * (dVP_dVD-1.0); + dir_dVS = tmp1 * dVP_dVS; + dir_dVG = tmp1 * dVP_dVG; + tmp1 = -(1.0+n_1)*Vt*0.66666666/sif_sir_2; + tmp2 = tmp1*(sif+2.0*sir); + tmp3 = tmp1*(sir+2.0*sif); + tmp1 = -n_1*qi/((2.0+n_1+n_1)*VP_PHI_eps); + dQI_dVD = tmp1 * dVP_dVD + tmp2 * dif_dVD + tmp3 * dir_dVD; + dQI_dVS = tmp1 * dVP_dVS + tmp2 * dif_dVS + tmp3 * dir_dVS; + dQI_dVG = tmp1 * dVP_dVG + tmp2 * dif_dVG + tmp3 * dir_dVG; + tmp1 = (1.0+n_1)-qi/(2.0*(1.0+n_1)*VP_PHI_eps); + dQB_dVD = -n_1_n * (tmp1 * dVP_dVD + dQI_dVD); + dQB_dVS = -n_1_n * (tmp1 * dVP_dVS + dQI_dVS); + dQB_dVG = -n_1_n * (tmp1 * dVP_dVG + dQI_dVG); + if (E0 == 0.0) begin + tmp1 = THETA * VPprime / (THETA_VP_1 * sqrt_VP_Vt); + // VPprime derivatives: + dVPprime_dVD = tmp1 * dVP_dVD; + dVPprime_dVS = tmp1 * dVP_dVS; + dVPprime_dVG = tmp1 * dVP_dVG; + dbeta_dVD = -dLeq_dVD - dVPprime_dVD; // in fact dbeta_dVX / beta + dbeta_dVS = -dLeq_dVS - dVPprime_dVS; + dbeta_dVG = -dLeq_dVG - dVPprime_dVG; + end + else begin + tmp1 = T0 / E0_Q_1; + dbeta_dVD = -dLeq_dVD + tmp1 * (dQB_dVD+eta_qi*dQI_dVD); + dbeta_dVS = -dLeq_dVS + tmp1 * (dQB_dVS+eta_qi*dQI_dVS); + dbeta_dVG = -dLeq_dVG + tmp1 * (dQB_dVG+eta_qi*dQI_dVG); + end + // Slope factor derivatives: + tmp1 = -GAMMA_S/(4.0*n*sqrt_PHI_VP*(PHI_T+VP+Vt_4));// mb 95/12/19 + dn_dVD = tmp1 * dVP_dVD; + dn_dVS = tmp1 * dVP_dVS; + dn_dVG = tmp1 * dVP_dVG; + // Transconductances: + gds = Ispec*((dn_dVD + dbeta_dVD)*if_ir + dif_dVD - dirprime_dVD); + gms = -Ispec*((dn_dVS + dbeta_dVS)*if_ir + dif_dVS - dirprime_dVS); + gm = Ispec*((dn_dVG + dbeta_dVG)*if_ir + dif_dVG - dirprime_dVG); + gmbs = gms - gm - gds; + // S/D resistance corrections including W and DW + RSeff = (RSH*HDIF)/(Weff-DW); + RDeff = (RSH*HDIF)/(Weff-DW); + tmp1 = 1.0/(1.0 + gms*RSeff + gds*RDeff); + Id = Id*tmp1; + /****** Impact ionization current ****** + * mb 95/12/19 introduced impact ionization + * This current component is flowing from the intrinsic drain terminal + * to the bulk (for NMOS) in parallel with the junction current. + * The simulator should also take into account the corresponding + * conductances. + */ + // Substrate current: + Vib = VD-VS-IBN_2*VDSS; + if ((Vib > 0.0) && (IBA_IBB > 0.0)) begin + inv_Vib = 1.0/Vib; + Lc_IBB_Vib = -Lc_IBB*inv_Vib; + if (Lc_IBB_Vib < -35.0) // math precision check + Lc_IBB_Vib = -35.0; + exp_ib = exp(Lc_IBB_Vib); + isub = IBA_IBB*Vib*exp_ib; + Isub = isub*Id; + dIsub_factor = Isub*inv_Vib*(1.0-Lc_IBB_Vib); + end + else begin + Lc_IBB_Vib = 0.0; + Isub = 0.0; + end + // END: substrate current computation + Ibd = Ibd - Isub; + // --- Charge calculations --- + WLCox = Weff * Leff * COX; + sif3 = sif*sif2; + sir3 = sir*sir2; + tmp1 = sqrt(PHI_T + 0.5 * VP); + sqrt_PHI_VP2_2 = tmp1+tmp1; + n_Vt_COX = (1.0 + GAMMAprime/sqrt_PHI_VP2_2) * Vt*WLCox; + QD = -n_Vt_COX*(0.266666666*(3.0*sir3+6.0*sir2*sif+4.0* + sir*sif2+2.0*sif3)/sif_sir_2 - 0.5); + QS = -n_Vt_COX*(0.266666666*(3.0*sif3+6.0*sif2*sir+4.0* + sif*sir2+2.0*sir3)/sif_sir_2 - 0.5); + QI = QS + QD; + QB = WLCox * (-0.5*GAMMAprime*sqrt_PHI_VP_2 + VGprime - VGstar) - + QI*GAMMAprime/(GAMMAprime+sqrt_PHI_VP2_2); + QG = -QI -QB; + I(ds) <+ TYPE * Mode * Id; // wg 22/04/08 corrected for device TYPE + ddt_QD = ddt(QD); + ddt_QS = ddt(QS); + if (Mode == `FWD) begin + I(db) <+ TYPE * ddt_QD; // wg 22/04/08 corrected for device TYPE + I(sb) <+ TYPE * ddt_QS; + I(db) <+ TYPE * Isub; + end + else begin + I(sb) <+ TYPE * ddt_QD; // wg 22/04/08 corrected for device TYPE + I(db) <+ TYPE * ddt_QS; + I(sb) <+ TYPE * Isub; + end + I(gb) <+ TYPE * ddt(QG); // wg 22/04/08 corrected for device TYPE +// if (Noise) begin : Noise //AB: 040902 Noise is also a variable and + if (Noise) begin : Noise_block //AB: 040902 Noise -> Noise_block + real S_flicker, S_thermal; + S_thermal = 4 * `P_K * T * Gn; + S_flicker = KF * gm * gm / (Weff * NS * Leff * COX); + I(ds) <+ white_noise(S_thermal, "thermal") + + flicker_noise(S_flicker, AF, "flicker"); + end + /////////////////////////////////// + //EXTRINSIC PART: JUNCTION DIODES// + /////////////////////////////////// + //diode area and perimeter computation + if ((AS == 0.0) && (HDIF>0.0)) as_i = 2.0*HDIF*Weff; + else as_i = AS; + if ((PS == 0.0) && (HDIF>0.0)) ps_i = 4.0*HDIF+1.0*Weff; + else ps_i = PS; + if ((AD == 0.0) && (HDIF>0.0)) ad_i = 2.0*HDIF*Weff; + else ad_i = AD; + if ((PD == 0.0) && (HDIF>0.0)) pd_i = 4.0*HDIF+1.0*Weff; + else pd_i = PD; + //temperature update for diodes + temp_arg = exp((refEg/$vt(Tnom) - Eg/Vt + tp_xti*ln(ratioT))/xd_n); + js_t = xd_js*temp_arg; + jsw_t = xd_jsw*temp_arg; + jswg_t = xd_jswg*temp_arg; + pb_t = xd_pb - tp_pb*deltaT; + pbsw_t = xd_pbsw - tp_pbsw*deltaT; + pbswg_t = xd_pbswg - tp_pbswg*deltaT; + cj_t = xd_cj*(1.0+tp_cj*deltaT); + cjsw_t = xd_cjsw*(1.0+tp_cjsw*deltaT); + cjswg_t = xd_cjswg*(1.0+tp_cjswg*deltaT); + njts_t = xd_njts*(1.0+(ratioT-1.0)*tp_njts); + njtssw_t = xd_njtssw*(1.0+(ratioT-1.0)*tp_njtssw); + njtsswg_t = xd_njtsswg*(1.0+(ratioT-1.0)*tp_njtsswg); + //DC + v_di_b = TYPE*V(d,b); + v_si_b = TYPE*V(s,b); + //DRAIN - BULK + is_d = js_t*ad_i+jsw_t*pd_i+jswg_t*Weff; + arg_d = -v_di_b*ratioT/(Vt*xd_n); + if (arg_d < -40.0) arg_d = -40.0; + tmp0 = (-v_di_b+xd_bv)*ratioT/(Vt*xd_n); + if (tmp0>70) f_breakdown_d = 1.0; + else f_breakdown_d = 1.0 + xd_xjbv*exp(-tmp0); + // TRAP-ASSISTED TUNNELING CURRENT + idb_tun = -Weff*jswg_t*(exp(v_di_b*ratioT/(Vt*njtsswg_t) * xd_vtsswg/max(xd_vtsswg+v_di_b,1.0e-3))-1.0); + idb_tun = idb_tun - pd_i*jsw_t*(exp(v_di_b*ratioT/(Vt*njtssw_t) * xd_vtssw/max(xd_vtssw+v_di_b,1.0e-3))-1.0); + idb_tun = idb_tun - ad_i*js_t*(exp(v_di_b*ratioT/(Vt*njts_t) * xd_vts/max(xd_vts+v_di_b,1.0e-3))-1.0); + I(d,b) <+ (is_d * (1.0 - exp(arg_d))*f_breakdown_d+v_di_b*xd_gmin + idb_tun)*TYPE*M; + //SOURCE - BULK + is_s = js_t*as_i+jsw_t*ps_i+jswg_t*Weff; + arg_s = -v_si_b*ratioT/(Vt*xd_n); + if (arg_s < -40.0) arg_s = -40.0; + tmp0 = (-v_si_b+xd_bv)*ratioT/(Vt*xd_n); + if (tmp0>70) f_breakdown_s = 1.0; + else f_breakdown_s = 1.0 + xd_xjbv*exp(-tmp0); + // TRAP-ASSISTED TUNNELING CURRENT + isb_tun = -Weff*jswg_t*(exp(v_si_b*ratioT/(Vt*njtsswg_t) * xd_vtsswg/max(xd_vtsswg+v_si_b,1.0e-3))-1.0); + isb_tun = isb_tun - ps_i*jsw_t*(exp(v_si_b*ratioT/(Vt*njtssw_t) * xd_vtssw/max(xd_vtssw+v_si_b,1.0e-3))-1.0); + isb_tun = isb_tun - as_i*js_t*(exp(v_si_b*ratioT/(Vt*njts_t) * xd_vts/max(xd_vts+v_si_b,1.0e-3))-1.0); + I(s,b) <+ (is_s * (1.0 - exp(arg_s))*f_breakdown_s+v_si_b*xd_gmin + isb_tun)*TYPE*M; + //AC + + //DRAIN - BULK + if (v_di_b>0.0) + begin + csb_d = cj_t * ad_i * exp(-xd_mj*ln(1.0+v_di_b/pb_t)); + cssw_d = cjsw_t * pd_i * exp(-xd_mjsw*ln(1.0+v_di_b/pbsw_t)); + csswg_d = cjswg_t * Weff * exp(-xd_mjswg*ln(1.0+v_di_b/pbswg_t)); + end + else + begin + csb_d = cj_t * ad_i * (1.0 - xd_mj*v_di_b/pb_t); + cssw_d = cjsw_t * pd_i * (1.0 - xd_mjsw*v_di_b/pbsw_t); + csswg_d = cjswg_t * Weff * (1.0 - xd_mjswg*v_di_b/pbswg_t); + end + qjd = (csb_d+cssw_d+csswg_d) * v_di_b; + I(d,b) <+ ddt(qjd)*TYPE*M; + //SOURCE - BULK + if (v_si_b>0.0) + begin + csb_s = cj_t * as_i * exp(-xd_mj*ln(1.0+v_si_b/pb_t)); + cssw_s = cjsw_t * ps_i * exp(-xd_mjsw*ln(1.0+v_si_b/pbsw_t)); + csswg_s = cjswg_t * Weff * exp(-xd_mjswg*ln(1.0+v_si_b/pbswg_t)); + end + else + begin + csb_s = cj_t * as_i * (1.0 - xd_mj*v_si_b/pb_t); + cssw_s = cjsw_t * ps_i * (1.0 - xd_mjsw*v_si_b/pbsw_t); + csswg_s = cjswg_t * Weff * (1.0 - xd_mjswg*v_si_b/pbswg_t); + end + qjs = (csb_s+cssw_s+csswg_s) * v_si_b; + I(s,b) <+ ddt(qjs)*TYPE*M; + //END OF DIODES + end +endmodule diff --git a/examples/various/roessler-attractor.cir b/examples/various/roessler-attractor.cir index 46c58d6a9..7fc4b0ee7 100644 --- a/examples/various/roessler-attractor.cir +++ b/examples/various/roessler-attractor.cir @@ -1,5 +1,6 @@ Model the rossler attractor *https://www.glensstuff.com/rosslerattractor/rossler.htm +* provided by Giles Atkinson .param a=0.2 b=0.2 c=5.7 diff --git a/src/Makefile.am b/src/Makefile.am index 3988837e3..59c33f4a1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in SUBDIRS = include/ngspice include/cppduals/duals misc maths frontend spicelib -DIST_SUBDIRS = include/ngspice include/cppduals/duals misc maths frontend spicelib xspice ciderlib +DIST_SUBDIRS = include/ngspice include/cppduals/duals misc maths frontend spicelib xspice ciderlib osdi if XSPICE_WANTED SUBDIRS += xspice @@ -593,8 +593,9 @@ libngspice_la_LIBADD += \ ciderlib/support/libcidersuprt.la endif - -libngspice_la_LIBADD += osdi/libosdi.la +if OSDI_WANTED +libngspice_la_LIBADD += osdi/libosdi.la +endif libngspice_la_LIBADD += \ maths/deriv/libderiv.la \ diff --git a/src/frontend/Makefile.am b/src/frontend/Makefile.am index 90ac17a57..9c765ab27 100644 --- a/src/frontend/Makefile.am +++ b/src/frontend/Makefile.am @@ -137,7 +137,6 @@ libfte_la_SOURCES = \ linear.c \ linear.h \ logicexp.c \ - logicexp.h \ measure.c \ misccoms.c \ misccoms.h \ @@ -187,7 +186,6 @@ libfte_la_SOURCES = \ typesdef.c \ typesdef.h \ udevices.c \ - udevices.h \ vectors.c \ vectors.h \ where.c \ diff --git a/src/frontend/com_measure2.c b/src/frontend/com_measure2.c index 89b80ecb5..91dbffa7b 100644 --- a/src/frontend/com_measure2.c +++ b/src/frontend/com_measure2.c @@ -427,12 +427,7 @@ com_measure_when( value = get_value(meas, d, i); //d->v_compdata[i].cx_real; else value = d->v_realdata[i]; - if (dScale->v_compdata) - scaleValue = dScale->v_compdata[i].cx_real; - else { - fprintf(cp_err, "Error: no valid frequency scale for 'meas ac ...'\n"); - return MEASUREMENT_FAILURE; - } + scaleValue = dScale->v_compdata[i].cx_real; } else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; @@ -685,12 +680,7 @@ measure_at( value = d->v_realdata[i]; // fprintf(cp_err, "Warning: 'meas ac' input vector is real!\n"); } - if (dScale->v_compdata) - svalue = dScale->v_compdata[i].cx_real; - else { - fprintf(cp_err, "Error: no valid frequency scale for 'meas ac ...'\n"); - return MEASUREMENT_FAILURE; - } + svalue = dScale->v_compdata[i].cx_real; } else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; @@ -792,12 +782,7 @@ measure_minMaxAvg( value = d->v_realdata[i]; // fprintf(cp_err, "Warning: 'meas ac' input vector is real!\n"); } - if (dScale->v_compdata) - svalue = dScale->v_compdata[i].cx_real; - else { - fprintf(cp_err, "Error: no valid frequency scale for 'meas ac ...'\n"); - return MEASUREMENT_FAILURE; - } + svalue = dScale->v_compdata[i].cx_real; } else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 6fc3cd446..86652c08e 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -1907,10 +1907,10 @@ void create_circbyline(char *line, bool reset, bool lastline) } char *p_src = skip_ws(line); - /* return if line is empty */ - if (*p_src == '\0') + /* An empty line may have been received. Skip it. */ + if (*p_src == '\0') { return; - + } /* Remove any leading whitespace by shifting */ if (p_src != line) { char *p_dst = line; diff --git a/src/frontend/inpc_probe.c b/src/frontend/inpc_probe.c index 2c78dc2ad..112b1208d 100644 --- a/src/frontend/inpc_probe.c +++ b/src/frontend/inpc_probe.c @@ -1030,10 +1030,17 @@ static char *get_terminal_name(char* element, char *numberstr, NGHASHPTR instanc for (i = 0; i <= numnodes; i++) thisline = nexttok(thisline); subcktname = gettok(&thisline); + /*Search for the corresponding .subckt line*/ struct card_assoc* allsubs = xcard->level->subckts; + while (allsubs) { xcardsubsline = allsubs->line->line; + /* safeguard against NULL pointers) */ + if (!subcktname || !allsubs->name) { + tfree(subcktname); + return tprintf("n%s", numberstr); + } if (cieq(subcktname, allsubs->name)) break; allsubs = allsubs->next; @@ -1230,7 +1237,7 @@ static char* get_terminal_number(char* element, char* namestr) Called from inp.c*/ void modprobenames(INPtables* tab) { GENinstance* GENinst; - if (tab->defVmod) { + if (tab && tab->defVmod && tab->defVmod->GENinstances) { for (GENinst = tab->defVmod->GENinstances; GENinst; GENinst = GENinst->GENnextInstance) { char* name = GENinst->GENname; if (prefix("vcurr_", name)) { diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index d1291559b..16fea8644 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2490,6 +2490,8 @@ static int is_a_modelname(char *s, const char* line) case 'P': case 'f': case 'F': + case 'a': + case 'A': st = st + 1; break; case 'm': @@ -4534,9 +4536,24 @@ static int inp_get_param_level( int param_num, struct dependency *deps, int num_params) { int i, k, l, level = 0; + static int recounter = 0; + recounter++; - if (deps[param_num].level != -1) + if (recounter > 1000) { /* magic number 1000: if larger, stack overflow occurs */ + fprintf(stderr, + "ERROR: A level depth greater 1000 for dependent parameters is not supported!\n"); + fprintf(stderr, + " You probably do have a circular parameter dependency at line\n"); + fprintf(stderr, + " %s\n", deps[param_num].card->line); + recounter = 0; + controlled_exit(EXIT_FAILURE); + } + + if (deps[param_num].level != -1) { + recounter = 0; return deps[param_num].level; + } for (i = 0; deps[param_num].depends_on[i]; i++) { @@ -4548,6 +4565,7 @@ static int inp_get_param_level( fprintf(stderr, "ERROR: unable to find dependency parameter for %s!\n", deps[param_num].param_name); + recounter = 0; controlled_exit(EXIT_FAILURE); } @@ -4558,6 +4576,7 @@ static int inp_get_param_level( } deps[param_num].level = level; + recounter = 0; return level; } diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index d8e8efd44..a74d5b870 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -273,6 +273,9 @@ com_version(wordlist *wl) #endif #ifdef EXP_DEV fprintf(cp_out, "** Experimental devices enabled.\n"); +#endif +#ifdef SHARED_MODULE + fprintf(cp_out, "** ngspice shared library.\n"); #endif fprintf(cp_out, "******\n"); diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index fd0749bc3..2a59f807d 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -610,6 +610,7 @@ parseunit(const char *s) case 'N': return 1e-9; case 'P': return 1e-12; case 'F': return 1e-15; + case 'A': return 1e-18; default : return 1; } } diff --git a/src/frontend/parser/numparse.c b/src/frontend/parser/numparse.c index ccb2d5e83..3ea6c62d6 100644 --- a/src/frontend/parser/numparse.c +++ b/src/frontend/parser/numparse.c @@ -95,6 +95,11 @@ int ft_numparse(char **p_str, bool whole, double *p_val) expo = -15.0; ++p_cur; break; + case 'a': + case 'A': + expo = -18.0; + ++p_cur; + break; case 'm': case 'M': { char ch_cur; diff --git a/src/frontend/plotting/grid.c b/src/frontend/plotting/grid.c index 1be3257ae..52d4b6073 100644 --- a/src/frontend/plotting/grid.c +++ b/src/frontend/plotting/grid.c @@ -639,12 +639,12 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis) dd[1] = hi; /* Reset the max coordinate to deal with round-off error. */ - if (nsp) { + if (nsp && (delta == 0.0)) { if (axis == x_axis) graph->viewport.width = (int)(spacing * nsp); else graph->viewport.height = (int)(spacing * nsp); - } else { + } else if (!nsp) { nsp = 1; } diff --git a/src/include/ngspice/Makefile.am b/src/include/ngspice/Makefile.am index 917c1dba5..3d39f57c9 100644 --- a/src/include/ngspice/Makefile.am +++ b/src/include/ngspice/Makefile.am @@ -62,6 +62,7 @@ noinst_HEADERS = \ ipcproto.h \ ipctiein.h \ jobdefs.h \ + logicexp.h \ lsort.h \ macros.h \ material.h \ @@ -92,6 +93,7 @@ noinst_HEADERS = \ opdefs.h \ optdefs.h \ optndefs.h \ + osdiitf.h \ outpdefs.h \ plot.h \ pnode.h \ @@ -119,6 +121,7 @@ noinst_HEADERS = \ twodev.h \ twomesh.h \ typedefs.h \ + udevices.h \ wordlist.h \ 1-f-code.h \ FastNorm3.h \ diff --git a/src/include/ngspice/sharedspice.h b/src/include/ngspice/sharedspice.h index 77a048150..8c3b3084f 100644 --- a/src/include/ngspice/sharedspice.h +++ b/src/include/ngspice/sharedspice.h @@ -97,7 +97,7 @@ are of type bool if sharedspice.h is used externally. */ #ifndef NGSPICE_PACKAGE_VERSION -#define NGSPICE_PACKAGE_VERSION "38+" +#define NGSPICE_PACKAGE_VERSION "39" #endif /* we have NG_BOOL instead of BOOL */ #ifndef HAS_NG_BOOL diff --git a/src/osdi/Makefile.am b/src/osdi/Makefile.am index 9cdd27fed..2d4716aab 100644 --- a/src/osdi/Makefile.am +++ b/src/osdi/Makefile.am @@ -12,7 +12,6 @@ libosdi_la_SOURCES = \ osdiparam.c \ osdiregistry.c \ osdisetup.c \ - osdiitf.h \ osditrunc.c \ osdipzld.c \ osdicallbacks.c diff --git a/src/osdi/osdicallbacks.c b/src/osdi/osdicallbacks.c index de7b1dc97..1efecf212 100644 --- a/src/osdi/osdicallbacks.c +++ b/src/osdi/osdicallbacks.c @@ -50,6 +50,18 @@ double osdi_pnjlim(bool init, bool *check, double vnew, double vold, double vt, return res; } +double osdi_typedpnjlim(bool init, bool *check, double vnew, double vold, double vt, + double vcrit, double type) { + if (init) { + *check = true; + return vcrit; + } + int icheck = 0; + double res = DEVpnjlim(type*vnew, vold, vt, vcrit, &icheck); + *check = icheck != 0; + return res; +} + double osdi_limvds(bool init, bool *check, double vnew, double vold) { if (init) { *check = true; diff --git a/src/osdi/osdidefs.h b/src/osdi/osdidefs.h index 45d117336..d1108b666 100644 --- a/src/osdi/osdidefs.h +++ b/src/osdi/osdidefs.h @@ -25,6 +25,9 @@ #include #include +#ifndef _MSC_VER +#include +#endif #ifdef _MSC_VER typedef struct { @@ -44,7 +47,7 @@ typedef struct { #ifdef _MSC_VER #define MAX_ALIGN 8 #else -#define MAX_ALIGN sizeof(max_align_t) +#define MAX_ALIGN alignof(max_align_t) #endif @@ -93,7 +96,8 @@ typedef void (*osdi_log_ptr)(void *handle, char *msg, uint32_t lvl); double osdi_pnjlim(bool init, bool *icheck, double vnew, double vold, double vt, double vcrit); - +double osdi_typedpnjlim(bool init, bool *icheck, double vnew, double vold, double vt, + double vcrit, double type); double osdi_limvds(bool init, bool *icheck, double vnew, double vold); double osdi_limitlog(bool init, bool *icheck, double vnew, double vold, double LIM_TOL); diff --git a/src/osdi/osdiinit.c b/src/osdi/osdiinit.c index 852737abb..7d83b5dfe 100644 --- a/src/osdi/osdiinit.c +++ b/src/osdi/osdiinit.c @@ -65,7 +65,7 @@ static int write_param_info(IFparm **dst, const OsdiDescriptor *descr, for (uint32_t j = 0; j < num_names; j++) { if (j != 0) { - dataType = IF_UNINTERESTING; + dataType |= IF_UNINTERESTING; } char *para_name = copy(para->name[j]); strtolower(para_name); diff --git a/src/osdi/osdiregistry.c b/src/osdi/osdiregistry.c index 6da846451..66d14704b 100644 --- a/src/osdi/osdiregistry.c +++ b/src/osdi/osdiregistry.c @@ -338,6 +338,7 @@ extern OsdiObjectFile load_object_file(const char *input) { for (uint32_t i = 0; i < lim_table_len; i++) { int expected_args = -1; IS_LIM_FUN("pnjlim", 2, osdi_pnjlim) + IS_LIM_FUN("typedpnjlim", 3, osdi_typedpnjlim) IS_LIM_FUN("limvds", 0, osdi_limvds) IS_LIM_FUN("fetlim", 1, osdi_fetlim) IS_LIM_FUN("limitlog", 1, osdi_limitlog) diff --git a/src/spicelib/parser/inpeval.c b/src/spicelib/parser/inpeval.c index 8e8b24c9b..13dcaa81b 100644 --- a/src/spicelib/parser/inpeval.c +++ b/src/spicelib/parser/inpeval.c @@ -169,6 +169,10 @@ INPevaluate(char **line, int *error, int gobble) case 'F': expo1 = expo1 - 15; break; + case 'a': + case 'A': + expo1 = expo1 - 18; + break; case 'm': case 'M': if (((here[1] == 'E') || (here[1] == 'e')) && @@ -626,6 +630,10 @@ INPevaluateRKM_C(char** line, int* error, int gobble) expo1 = expo1 - 15; hasmulti = TRUE; break; + case 'a': + case 'A': + expo1 = expo1 - 18; + break; case 'm': case 'M': if (((here[1] == 'E') || (here[1] == 'e')) && @@ -860,6 +868,10 @@ INPevaluateRKM_L(char** line, int* error, int gobble) expo1 = expo1 - 15; hasmulti = TRUE; break; + case 'a': + case 'A': + expo1 = expo1 - 18; + break; case 'm': case 'M': if (((here[1] == 'E') || (here[1] == 'e')) && diff --git a/src/xspice/evt/evtcheck_nodes.c b/src/xspice/evt/evtcheck_nodes.c index 64eda2e12..a95e0e82a 100644 --- a/src/xspice/evt/evtcheck_nodes.c +++ b/src/xspice/evt/evtcheck_nodes.c @@ -195,15 +195,10 @@ static struct card *expand_deck(struct card *head) struct card *card, *next; char **pointers; int i, dico; - bool save_debug; - /* Save the current parameter symbol table and debug global. - * Prevent overwriting of debug output in inp_readall(). - */ + /* Save the current parameter symbol table. */ dico = nupa_add_dicoslist(); - save_debug = ft_ngdebug; - ft_ngdebug = FALSE; /* Count the cards, allocate and fill a pointer array. */ @@ -226,7 +221,6 @@ static struct card *expand_deck(struct card *head) circarray = pointers; card = inp_readall(NULL, Infile_Path, FALSE, TRUE, NULL); card = inp_subcktexpand(card); - ft_ngdebug = save_debug; /* Destroy the parameter table that was created in subcircuit/parameter * expansion and restore the previous version. diff --git a/src/xspice/icm/digital/d_source/cfunc.mod b/src/xspice/icm/digital/d_source/cfunc.mod index da428c4a5..716ebb387 100644 --- a/src/xspice/icm/digital/d_source/cfunc.mod +++ b/src/xspice/icm/digital/d_source/cfunc.mod @@ -429,6 +429,10 @@ double *p_value ) /* OUT - The numerical value */ scale_factor = 1.0e-15; break; + case 'a': + scale_factor = 1.0e-18; + break; + case 'm': i++; if(i >= len) { diff --git a/src/xspice/icm/digital/d_state/cfunc.mod b/src/xspice/icm/digital/d_state/cfunc.mod index 472738f98..4666e8b8d 100644 --- a/src/xspice/icm/digital/d_state/cfunc.mod +++ b/src/xspice/icm/digital/d_state/cfunc.mod @@ -441,6 +441,10 @@ double *p_value ) /* OUT - The numerical value */ scale_factor = 1.0e-15; break; + case 'a': + scale_factor = 1.0e-18; + break; + case 'm': i++; if(i >= len) { diff --git a/src/xspice/mif/mif_inp2.c b/src/xspice/mif/mif_inp2.c index ef990afa3..bb603f78a 100644 --- a/src/xspice/mif/mif_inp2.c +++ b/src/xspice/mif/mif_inp2.c @@ -567,13 +567,9 @@ MIF_INP2A ( param_info = &(DEVices[type]->DEVpublic.param[i]); - /* Don't check for model iron core with hysteresis (type 110) due to always missing defaults */ - /* FIXME: preliminary, bug is generated elsewhere */ - if (mdfast->param[i]->is_null && type != 110) { - if (!param_info->has_default) { - char* emessage = tprintf("Parameter %s on model %s has no default", param_info->name, mdfast->gen.GENmodName); - LITERR(emessage); - tfree(emessage); + if(mdfast->param[i]->is_null) { + if(! param_info->has_default) { + LITERR("Parameter on model has no default"); gc_end(); return; } else if((param_info->is_array) && (! param_info->has_conn_ref)) { diff --git a/visualc/src/include/ngspice/config.h b/visualc/src/include/ngspice/config.h index e0e160020..47a327dcc 100644 --- a/visualc/src/include/ngspice/config.h +++ b/visualc/src/include/ngspice/config.h @@ -15,7 +15,7 @@ #define PACKAGE "ngspice" /* Version number of package */ -#define VERSION "38+" +#define VERSION "39" /* Define the directory for executables */ #define NGSPICEBINDIR "../bin" @@ -491,7 +491,7 @@ #define PACKAGE_VERSION VERSION /* Define if we want predictor algorithm */ -#define PREDICTOR +/* #undef PREDICTOR */ /* Define to 1 if the C compiler supports function prototypes. */ /* #undef PROTOTYPES */