* To run an eye diagram you must put an option like this into your schematic .option baudrate=2.64e9 delay=0.0 * In LTSpice, it seems you can use a parameter or an expression in many places, but need to enclose either in 'express' or {expression} I'm not sure which is preferred ' ' or { } A parameter definition inside a subckt overrides an external one If a parameter is defined twice in a subckt, the first seems to take presidence If a parameter is defined twice at the main level, you get an error * ******************************************************** * Use the .FUNC for LTSpice, and .PARAM for Spectre * ******************************************************** * .FUNC GMOSI(BETA, VGST, VDS) {IF((VGST <= 0.0), 0.0, IF((VDS < VGST), (BETA*(2*VGST - VDS)*VDS), (BETA*VGST*VGST)))} * .FUNC GLOGI1(X,A) {(((X >= 0.5) == A))} * .FUNC GLOGI2(X,Y,A,B) {(((X >= 0.5) == A) & ((Y >= 0.5) == B))} * .FUNC GLOGI3(X,Y,Z,A,B,C) {(((X >= 0.5) == A) & ((Y >= 0.5) == B) & ((Z >= 0.5) == C))} .PARAM GMOSI(BETA, VGST, VDS)='(VGST <= 0.0) ? (0.0) : ((VDS < VGST) ? (BETA*(2*VGST - VDS)*VDS) : (BETA*VGST*VGST))' .PARAM GLOGI1(X,A)='(((X >= 0.5) == A))' .PARAM GLOGI2(X,Y,A,B)='(((X >= 0.5) == A) && ((Y >= 0.5) == B))' .PARAM GLOGI3(X,Y,Z,A,B,C)='(((X >= 0.5) == A) && ((Y >= 0.5) == B) && ((Z >= 0.5) == C))' * ******************************************************** * Three dimensional sweep .step param VAL0 0.0 1.0 0.025 .step param VAL1 LIST 0.50 0.55 0.60 .step param VAL2 LIST 0.0 -1.0 this sets up a thee dimensional sweep suitable for use with a .op analysis The x axis is the first sweep variable. The other two are parametric Set you output to ASCII, and you automatically get all the data If you set your options to save all device currents you get Id, Ig, Is, Ib, Ix * The log file does give you the basic transistor parameters at the DC operating point. I can't seem to get these any other way, and I can't control how many digits. You only seem to get three * Example * Hello World * .param VGREG=0.7 v1 ndd pss {VGREG} v7 VBS pss {VJACK} .step param VGREG LIST 0.0 0.05 0.1 0.2 0.4 0.6 1.0 .step param VSHAN list 0.50 0.55 0.60 .step param VJACK list 0.0 -0.5 .savebias junk.txt .meas OP SHELBY FIND I(v1) AT 0.5 .meas OP YABI FIND Ix(M10:ND) at 0.6 .meas OP YAMI FIND '-Ix(M10:NS)*3 + Id(M10:MNN)' at 0.6 .option measdgt=10 .option numdgt=10 * Monte Carlo Analysis http://k6jca.blogspot.com/2012/07/monte-carlo-and-worst-case-circuit.html https://www.analog.com/en/technical-articles/ltspice-worst-case-circuit-analysis-with-minimal-simulations-runs.html https://www.analog.com/en/technical-articles/how-to-model-statistical-tolerance-analysis.html Control_Panel-->Hacks-->Use_Clock_MC .param gtol=0.1 .param jack=10+mc(1, gtol) .param shan=10+mc(1, gtol) .param shelby=10+gauss(1.0) .step param x 0 25 1 .op (set a voltage source value 'shelby' or {shelby}) * There are three places in the LTSpice Help where functions are listed. See the "Waveform Arithmetic" for the most complete list Im() Re() Ph() Mag(), conj() pi, E, K, Q * When you make your own symbol for example a special buried gate device with : name : nfmos nodes : nd ngt ngb ns nb params : wp lp mp model file : gregdevices.lib (note : use lower case for everything, especially the file names) 1. Open a new symbol sheet "nfmos.asy" 2. Draw a large rectangle while you edit the symbol, otherwise the screen jumps 3. Edit-->Attributes-->Edit_Attributes Symbol_Type --> Cell (this is radio button at top) Prefix : x SpiceModel : nfmos Value : wp=1.2 Value2 : lp=0.18 SpiceLine : mp=1 SpiceLine2 : (note that the 5 parameters SpiceModel, ... , SpiceLine2 are really just 5 strings that will appear on the subckt call, so you can actually put multiple parameters on each) ModeFile : gregdevices.lib (note that multiple subckts can be in the same .lib file) 4. Edit-->Attributes-->Edit_Attributes (place all the attributes) * put this into gregdevices.lib .subckt nfmos nd ngt ngb ns nb + wp=0.0 + lp=0.0 + mp=0 .parameter wval='wp*1.0e-6' .parameter lval='lp*1.0e-6' .parameter mval='mp' .parameter adval='wval*0.27e-6' .parameter asval='adval + wval*0.21e-6' .parameter pdval='wval*0.21e-6' .parameter psval='pdval + 2.0 * wval' .parameter nrdval='0.27e-6/wval' .parameter nrsval='0.27e-6/wval' .parameter ccgval='wp*lp*mp*5e-15' cgg ngt ngb ccgval mpmos090 nd ngb ns nb PMOS090_BSIM461 W=wval L=lval M=mval + AS=asval AD=adval PS=psval PD=pdval NRS=nrsval NRD=nrdval .ends * *********************************************************************** * you can make a symbol from scratch there is a fixed list of attributes you can add New Symbol add pins, they automatically snap to 16 grid the grid coordinates show From LTSpice Documentation * ************************************************************************************************************* The symbol's attributes can be overridden in the instance of the symbol as a component in a schematic. For example, if you have a symbol for a MOSFET with a prefix attribute of 'M', it's possible to override the prefix to an 'X' on an instance-by-instance basis so that the transistor can be modeled as subcircuit instead. There is a special combination of attributes that will cause a required library to be automatically included in every schematic that uses the symbol: Prefix: X SpiceModel: Value: Value2: Value2 would be made to coincide with a subcircuit name defined in the file including the spicemodel and may pass additional parameters to the subcircuit. When a symbol is defined in this manner, an instance of the symbol as a component on a schematic cannot be edited to have different attributes. If you wish the symbol to represent another page of a hierarchical schematic, all attributes should be left blank the symbol type should be changed from "Cell" to "Block". No attribute values need be set. There is a symbol attribute, ModelFile, that may be specified. This is used for the name of a file to be included in the netlist as a library. If the prefix attribute is 'X' and there is a symbol attribute SpiceModel defined that is subcircuit defined in the model file, then a drop list of all subcircuits names will be available when an instance of the symbol is edited on a schematic. * ************************************************************************************************************* * you can plot d(V(vout)) for derivatives * See https://www.eecg.utoronto.ca/~johns/LTSpice/LTSpice_gmid.html#:~:text=LTSpice&text=It%20is%20useful%20to%20plot,with%20some%20generic%20Mosfet%20models. for interesting way to plot gm * Measurements --> Important!!!!! .options meascplxfmt=cartesian .options measdgt=15 * Starting Schematic Version 4 SHEET 1 1060 680 LINE Normal 16 0 0 0 2 LINE Normal 0 16 0 0 2 LINE Normal 1040 608 1056 608 2 LINE Normal 1056 592 1056 608 2 * cursors --> right-click a signal label Attached_Cursor : (1st) (2nd) or (1st & 2nd) --> left-click a signal label (sets 1st cursor only) If you want to print the terminal node currents of a subckt Xmd pndd pngg pnss pnbb nmos13 wp=5.0 lp=0.13 mp=20 .save ix(md) (this will then save Ix(md:ND) Ix(md:NG) Ix(md:NS) Ix(md:NB)) Sadly, you CAN NOT use these currents in an equation If there is an internal node in the subckt, you can access it (in the actual spice netlist you will have subckt "xmd") V(md:nmid) You CAN use this node in an equation eshan shan 0 value='(v(md:nmid) * 1.0 + 0)' Note the use of the ':' separator ToDo Get zplot compiled on Linux Get berkely models and STMicro Models Put models into gregbox and simuate refering to these Draw some symbols and heirarchical schematics (use python uaa to LTS converter, and document its use Undocumented stuff http://ltwiki.org/index.php5?title=Undocumented_LTspice alias LTSpice='wine $HOME/.wine/drive_c/Program\ Files/LTC/LTspiceXVII/XVIIx64.exe' * convert a schematic to netlist LTSpice -netlist junkR.asc * run a simulation LTSpice -b -ascii -Run junkR.net