### Accessing Online Help for 'cross' MDL Function (Example) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md An example demonstrating how to use the `spectre =mdl -h` command to get help specifically for the `cross` predefined MDL function. ```Shell spectre =mdl -h cross ``` -------------------------------- ### Defining Measurement and Searching Parameter in Simulation Language Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet defines a simulation measurement named `setup` to calculate various timing parameters like setup time (`Tsetup`). It then uses a `search` statement to iteratively adjust the `vdata:delay` parameter until the maximum output voltage (`setup->maxq`) falls below a specified threshold (2.5), effectively finding the critical delay value. ```Simulation Description Language alias measurement setup { export real vddelay, outcross, Tsetup, vcdelay, setdelay, maxq run tran(stop=40n) vddelay=cross(sig=V(data), thresh=2.5, dir=’rise, n=1) vcdelay=cross(sig=V(clock), thresh=2.5, dir=’rise, n=1) outcross=cross(V(q),thresh=2.5) maxq=max(V(q)) setdelay=vdata:delay Tsetup=vcdelay-vddelay } search vdata:delay from binary(start=2n, stop=10n, tol=1p) { run setup } until ( setup->maxq < 2.5) ``` -------------------------------- ### Example Measurement Alias and mvarsearch Usage Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This example demonstrates defining a 'trans' measurement alias to calculate rise and fall times and shows the beginning of an mvarsearch block intended to optimize parameters based on these measurements. ```Simulation Language alias measurement trans { run tran( stop=1u, autostop=’yes )     export real rise=risetime(sig=V(d), initval=0, inittype=’y, finalval=3.0,      finaltype=’y, theta1=10, theta2=90) // measured from 10% to 90%     export real fall=falltime(sig=V(d), initval=3.0, inittype=’y, finalval=0.0,      finaltype=’y, theta1=90, theta2=10) // measured from 10% to 90% } mvarsearch {     option { ``` -------------------------------- ### MDL Ternary Expression Example Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows practical examples of using the ternary operator in MDL assignment statements. It demonstrates conditional assignment based on simple conditions and also includes a more complex example with nested ternary expressions and function calls. ```MDL val2 = (v(11) == 5)&&(val1 != 'nan) ? v(11) : 2*v(11) val3 =(val1 != 'nan)? mag( V(11)==5?max(V(11)):10 )+3 : 2*V(11) ``` -------------------------------- ### Recreating MDL Measure File using processmdl (Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Provides the general command-line syntax for using the `processmdl` script located in the installation tools directory to recreate a `.measure` file from a raw directory. This is useful if the original run was terminated or the file removed, and can also be used to change output format or precision. ```Shell processmdl [options] mdlfilename ``` -------------------------------- ### MDL Macro Expansion Example Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows the resulting MDL code after the macro `insat` is expanded within the `dcmeas` measurement alias when the `+/=mdle` option is used. ```MDL run dc export real insat_M11=Idut.M11.m0:vdss export real insat_M22=Idut.M22.m0:vdss export real insat_M09=Idut.M09.m0:vdss } ``` -------------------------------- ### MDL If/Else with Foreach Example Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Demonstrates the use of an if/else if/else structure within a foreach loop in MDL. It shows how to conditionally execute different run statements based on the current value of the loop counter variable 'count'. ```MDL int count=0 foreach count from swp(start=1, stop=3, step=1) { if (count==1) { run tr3 } else if (count == 2) { if (tr2->val2 == 5) { run tr2 } run tr1 } else { run tr2 } } ``` -------------------------------- ### Example MDL Measurement Alias Definition and Usage Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Illustrates the definition of a measurement alias named 'showmaxmin'. It runs a transient analysis ('tran1') and exports the maximum and minimum values of the 'V(out)' signal. The second part shows how to call this defined alias using the 'run' statement. ```MDL alias measurement showmaxmin { // The measurement alias is defined here.     run tran1(stop=1u)     export real maxout=max(V(out))     export real minout=min(V(out)) } run showmaxmin // This statement runs the measurement. ``` -------------------------------- ### MDL Print Statement Example with Various Types Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Demonstrates using the `print` statement within an MDL alias measurement to output different data types (numbers, strings, enums) and simulation results to a file, utilizing various format specifiers and the `to`/`addto` options. ```MDL alias measurement printmeas { input string out="myfile.out" print fmt("Header is %s\n", out) to=out print fmt("%s\t%s\t\t%s\t%s\t%s\n", "maxq", "minq", "REG", \ "INTREG", "REALREG") addto=out run tran1 export real maxq=max(V(q)) export real minq=min(V(q)) enum REG = i0.mp0:region export int INTREG = i0.mp0:region export real REALREG = real(REG) print fmt("%V\t%V\t%V\t%V\t%V\n",maxq, minq, REG, INTREG, \ REALREG) addto=out print fmt("\n%s\t%s\t%s\t%s\t%s\t%s\t%s\n", \ "%d","%i","%g","%G","%e","%E","%f") addto=out print fmt("%d\t%i\t%g\t%G\t%e\t%E\t%f\n\n", \ 10,10,10,10,10,10,10) addto=out print fmt("\n%s\t%s\t%s\t%s\n", "%o","%x","%X","%u") addto=out print fmt("%o\t%x\t%X\t%u\n",10,10,10,10) addto=out } run printmeas (out="test.dat") ``` -------------------------------- ### Defining AC Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining an AC analysis named 'ac1' in a Spectre netlist, specifying the start frequency, stop frequency, and points per decade. ```Spectre ac1 ac start=0.1G stop=1G dec=25 ``` -------------------------------- ### Defining and Running MDL Measurement Alias Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines a measurement alias 'maxout' in MDL to find the maximum voltage on a specified net. It takes a net as input, runs a transient analysis 'tran1', and exports the maximum voltage as 'out'. The examples demonstrate how to run the alias and access results using the '->' operator, including renaming the run. ```MDL alias measurement maxout { input net mynet; export real out; run tran1; out = max(V(mynet)); } run maxout(mynet=out); // maxout->out = max(V(out)) run maxout(mynet=dout) as maxdout; // maxout->out = max(V(out)) ``` -------------------------------- ### MDL If/Else in Alias Measurement Example Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Illustrates how to use nested if/else statements within an alias measurement block in MDL. It shows conditional assignment of values to exported variables (val1 through val8) based on the simulation result v(11). ```MDL alias measurement tr1 { run tran(stop=160n) export real val2 export real val1 export real val3 export real val4 export real val5 export real val6 export real val7 export real val8 if ( v(11) > 4) { if ( v(11) < 4.06 ) { val1=v(11) } val2 = min(v(11)) } else if ( v(11) > 3 ) { if ( (v(11) > 3.5) && (v(11)<3.7) ) { val3= max( v(11) val4= v(11) } else { val5=v(11) val6=max(v(11)) } } else { val7 = max(v(11)) val8 = v(11) } } run tr1 ``` -------------------------------- ### Accessing Online Help for MDL Functions (Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows the command-line syntax for accessing online help for a specific predefined MDL function by typing the command in a terminal window. ```Shell spectre =mdl -h functionname ``` -------------------------------- ### Running Pre-defined Circuit Information Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a circuit information analysis previously defined in the netlist (e.g., 'dcOpInfo') using the 'run' command. It can optionally be aliased with a new name. ```MDL run dcOpInfo [as dcOpInfo2] ``` -------------------------------- ### Defining Optimization Parameters and Goals in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines the options, parameters, execution steps, and zero-finding goals for an optimization process. It sets convergence tolerance, step size, and iteration limit, specifies design variables (`para_pw`, `para_nw`) with initial values and bounds, defines the simulation to run (`run trans`), and sets up target conditions (`tmp1`, `tmp2`) based on simulation results. The optimization aims to make `trans->rise` and `trans->fall` equal to 3ns. ```MDL accuracy = 1e-3 // convergence tolerance of trans->rise deltax = 1e-3 // numerical difference % of design variables maxiter = 100 // limit to 100 iterations } parameter { {para_pw, 1.2u, 0.1u, 10u} {para_nw, 1.2u, 0.1u, 10u} } exec { run trans } zero { tmp1 = trans->rise - 3ns tmp2 = trans->fall - 3ns } } ``` -------------------------------- ### Running Pre-defined Transient Info Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a transient info analysis previously defined in the netlist (e.g., 'tran3') using the 'run' command. ```MDL run tran3 ``` -------------------------------- ### Defining and Running MDL Measurement Alias with Parameters Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet defines an MDL measurement alias named `falldelay`. It includes input parameters `transtop` (with a default) and `prop_thresh` (required). It specifies a `tran` analysis run and exports a calculated `prop_delay_fall` based on simulation results. The subsequent line demonstrates how to execute this alias using the `run` command, providing explicit values for the input parameters. ```MDL alias measurement falldelay {     input real transtop=2u // This variable is given a default value.     input real prop_thresh // This variable has no default value.     run tran(stop=transtop)   // A run statement is required.  export real prop_delay_fall=deltax(sig1=V(inp), sig2=V(out),           dir1=’fall, n1=1, start1=0, thresh1=prop_thresh,           dir2=’fall, n2=2, start2=0, thresh2=prop_thresh) } run falldelay(transtop=1u, prop_thresh=2) ``` -------------------------------- ### Running Pre-defined Transient AC Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a transient AC analysis previously defined in the netlist (e.g., 'tran2') using the 'run' command. ```MDL run tran2 ``` -------------------------------- ### Listing All Predefined MDL Functions Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Provides the command to list all available predefined MDL functions by typing the command in a terminal window. ```Shell spectre =mdl -h functions ``` -------------------------------- ### Searching Parameter with While Condition and Output Control in Simulation Language Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet demonstrates a `search` statement that uses a `while` condition to control the iteration process. The search continues as long as both `setup->maxq` is greater than 1.8 AND `setup->outcross` is less than 10.3n. The `output='last` option ensures that simulation results are saved to the raw directory only if the final iteration is successful. ```Simulation Description Language search vdata:delay from binary(start=2n,stop=10n,tol=1p) output='last { run setup } while (setup->maxq > 1.8 && setup->outcross < 10.3n) ``` -------------------------------- ### Running Pre-defined S-parameter Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute an S-parameter analysis previously defined in the netlist (e.g., 'sp1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run sp1 [as sp2] ``` -------------------------------- ### Defining MDL Alias On-the-Fly with 'run ... as' Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet illustrates how to create a temporary measurement alias directly from a `run` command using the `as` keyword. The first line defines an alias `pb` for a specific `ac` analysis run, and the second line defines an alias `sb` for another `ac` analysis run. This method allows for quick alias creation without a separate `alias measurement` block. ```MDL run ac(center=1MHz, span=1kHz) as pb run ac(start=1_Hz, stop=10MHz) as sb ``` -------------------------------- ### Nested Foreach with Mvarsearch for Optimization in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL code demonstrates how to perform an optimization (`mvarsearch`) for different operating points defined by nested `foreach` loops. It iterates through voltage (`v_vdd`) and temperature (`temp`) values, running a separate optimization for each combination. The optimization targets `trans->rise` and `trans->fall` to be 25ps by varying parameters `pw` and `nw`. ```MDL foreach v_vdd from {3, 2.5} { foreach temp from {25, 30} { mvarsearch { option { accuracy = 1e-3 // convergence tolerance of trans deltax = 1e-3 // step length maxiter = 100 // limit to 100 iterations restoreParam=1 // a must } parameter { {pw, 2u, 0.05u, 10u} {nw, 2u, 0.05u, 10u} } exec { run trans } zero { tmp1 = trans->rise-25p tmp2 = trans->fall-25p } } } } ``` -------------------------------- ### Defining Circuit Information Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a circuit information analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. ```MDL run info (what='oppoint where='rawfile) [as dcOpInfo2] ``` -------------------------------- ### Running Pre-defined Transient Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a transient analysis previously defined in the netlist (e.g., 'tran1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run tran1 [as tran2] ``` -------------------------------- ### Running Pre-defined Noise Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a noise analysis previously defined in the netlist (e.g., 'findNoise') using the 'run' command. It can optionally be aliased with a new name. ```MDL run findNoise [as findNoise2] ``` -------------------------------- ### Running Pre-defined DC Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a DC analysis previously defined in the netlist (e.g., 'dc1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run dc1 [as dc2] ``` -------------------------------- ### Defining Parameters in SPICE-like Netlist Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows a fragment of a SPICE-like netlist file. It includes global node definitions, an include statement, and a `parameters` statement. The `parameters` statement defines several variables, including `vdd_val`, which is used in the associated MDL measurement alias (`runtran`) to access a circuit-level parameter. ```Netlist global 0 vdd! vss! include "./testmodels.scs" section tt parameters capval=2.5p vss_val=-5 vdd_val=5  // vdd_val is defined here. //top level v2 (vss! 0) vsource dc=vss_val type=dc v1 (vdd! 0) vsource dc=vdd_val type=dc ``` -------------------------------- ### Defining and Running MDL Analysis Alias with 'run ... as' Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define an alias for a specific analysis run using `run ... as`. The first line creates an alias `tran1` for a `tran` analysis with `stop=10u`. The second line then executes this newly defined alias `tran1`, effectively running `tran(stop=10u)`. ```MDL run tran (stop=10u) as tran1 run tran1 ``` -------------------------------- ### Running Pre-defined DC Sweep Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute a DC sweep analysis previously defined in the netlist (e.g., 'dcswp1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run dcswp1 [as dcswp2] ``` -------------------------------- ### Defining Transient Noise Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a transient noise analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. ```MDL run tran ( stop=50n, noiseseed=10, noisefmax=30G, noisefmin=1M ) ``` -------------------------------- ### Defining and Using MDL Macros Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Demonstrates how to define a macro using `#define` and use it within a measurement alias in an MDL control file. Requires the `+/=mdle` command-line option for expansion. ```MDL #define insat(device) export real insat_/**/device = Idut.device.m0:vdss alias measurement dcmeas { run dc insat(M11) insat(M22) insat(M09) } run dcmeas ``` -------------------------------- ### Running Pre-defined AC Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute an AC analysis previously defined in the netlist (e.g., 'ac1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run ac1 [as ac2] ``` -------------------------------- ### Defining Noise Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a noise analysis directly within the MDL control file by specifying its parameters inline with the 'run' command, including output and input probes, frequency range, and terminals. ```MDL run noise( oprobe=out, iprobe=v4, start=1, stop=1M dec=10, terminals={"out","gnd"}) [as findNoise2] ``` -------------------------------- ### Defining Transient AC Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a transient AC analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. ```MDL run tran ( actimes={0, 20n, 40n}, acnames={CaptabInfo, ac-2}, stop=40n} ``` -------------------------------- ### Enabling Autostop in Transient Analysis (Circuit Simulator Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows how to enable the `autostop` feature for a transient analysis (`tran`) statement in a circuit design file. By setting `autostop=yes`, the simulation will halt as soon as sufficient data is collected to evaluate associated MDL expressions, potentially saving simulation time. Other parameters like `stop` and `method` are also shown. ```Circuit Simulator Syntax tran1 tran stop=6u method=gear2only autostop=yes ``` -------------------------------- ### Defining Transient Info Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a transient info analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. ```MDL run tran ( infotimes={10n, 30n}, infoname=opInfo, stop=40n} ``` -------------------------------- ### MDL Print Statement in Foreach Loop Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows how to use the `print` statement within an MDL `foreach` loop to output results from iterative simulation runs, formatting the output into columns using width and alignment specifiers and appending to a file. ```MDL print fmt ("\n****Print Results of Foreach Sweep:****\n\n") addto="print.dat" print fmt ("%-15s%-15s%-15s%-15s\n", "Vdd", "delay", "rise", "fall") addto="print.dat" foreach vdd from {1.5, 1.8, 2} { run tranmeas print fmt("%-15g%-15e%-15S%-15.8S\n", vdd, tranmeas->q_delay, \ tranmeas->q_rise_time, tranmeas->q_fall_time) addto="print.dat" } ``` -------------------------------- ### Including Another MDL File in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows the basic syntax for including the contents of another MDL file (`simple.mdl`) into the current file (`main.mdl`). The `include` statement must be at the top level. After including the file, it executes a run command (`run tr`). ```MDL //File main.mdl include "simple.mdl" run tr ``` -------------------------------- ### Defining Circuit Information Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a circuit information analysis named 'dcOpInfo' in a Spectre netlist, specifying what information to output (operating point) and where (rawfile). ```Spectre dcOpInfo info what=oppoint where=rawfile ``` -------------------------------- ### Printing Intermediate Results in mvarsearch (Simulation Control Language) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet demonstrates how to print intermediate results during an `mvarsearch` optimization analysis. It uses `print fmt` to write formatted output to a file (`print_opt.dat`) both before the search loop and inside the `exec` block for each iteration. It shows how to access variables like `pw`, `nw`, and results from a `trans` run (`trans->rise`, `trans->fall`). ```Simulation Control Language print fmt ("\n****Print Results of Optimization Analysis****\n\n") to="print_opt.dat"\nprint fmt ("%-15s%-15s%-15s%-15s\n", "pw","nw","rise","fall") addto="print_opt.dat"\nmvarsearch {\n    ...\n    exec {\n    print fmt("%-15e%-15e", pw, nw) addto="print_opt.dat"\n    run trans\n    print fmt("%-15e%-15e\n", trans->rise,trans->fall) \\ \n     addto="print_opt.dat" \n } \n ... \n} ``` -------------------------------- ### Including Multiple MDL Files and Defining Measurement Alias in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates including multiple MDL files (`mdl2.2`, `mdl1.2`) from a subdirectory (`meas`) within a single file (`simple.mdl`). It also shows the definition of a measurement alias (`alias measurement t`) and running simulations (`run tran`, `run tr3`, `run tr2`). Note the syntax provided for the measurement alias and export. ```MDL //File simple.mdl include "meas/mdl2.2" alias measurement t run tran(stop=140n) export real val1=3*V(11) } run tr3 include "meas/mdl1.2" run tr2 ``` -------------------------------- ### Syntax Definition of mvarsearch Statement Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet defines the formal syntax structure of the mvarsearch statement, showing its required blocks: option, parameter, exec, and zero, along with the general format. ```Syntax Definition mvarsearch_statement ::= mvarsearch **{** option { _options_statements_ } parameter { _parameter_statements_ } exec { _exec_statement_ } zero { _zero_statements_ } } ``` -------------------------------- ### Defining Monte Carlo Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a Monte Carlo analysis directly within the MDL control file by specifying its parameters inline with the 'run' command, including scalar file, number of runs, variations, seed, and sampling method. ```MDL run montecarlo (scalarfile="monte4.dat", numruns=10, variations='all, seed=1 sampling='lds) { … } ``` -------------------------------- ### MDL Measurement Alias Syntax Definition Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines the formal syntax for creating a measurement alias in MDL. It shows the required keywords, the structure including initialization and export blocks, and how to specify the analysis to run. ```MDL alias_measurement_statement ::= **alias measurement** _measurement_name_ **{** {_initialization_block_} run _analysis_ [ as _othername_] {_export_block_**} }** _analysis_ :: = _BuiltInAnalysis_ | _PredefinedAnalysis_ | _AnalysisVariable_ _BuiltInAnalysis_ :: = dc | ac | tran | noise | info | sp ``` -------------------------------- ### Defining DC Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a DC analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. It can optionally be aliased. ```MDL run dc (oppoint='logfile) [as dc2] ``` -------------------------------- ### Defining S-parameter Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run an S-parameter analysis directly within the MDL control file by specifying its parameters inline with the 'run' command, including ports, points per decade, and frequency range. ```MDL run sp (ports={PORT_1, PORT_2}, dec=20, start=0.1G, stop=20G) [as sp2] ``` -------------------------------- ### Define Parameter Sets in Netlist (Simulation Language) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines two parameter sets, `data_v` and `data_fet`, within a netlist. `data_v` contains pairs of `vhi` and `vlo` values, while `data_fet` contains sets of `nw`, `nl`, `pw`, and `pl` values, intended for sweeping simulation parameters. ```Simulation Language data_v paramset { vhi vlo 1.9 1.32 1.8 1.2 } ``` ```Simulation Language data_fet paramset { nw nl pw pl 5u 3u 9u 3u 4u 3u 7u 3u } ``` -------------------------------- ### Defining Transient Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a transient analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. It can optionally be aliased. ```MDL run tran (stop=1u, errpreset=’conservative) [as tran2] ``` -------------------------------- ### foreach Alternatives Syntax (MDL Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines the different ways to provide the list of values for the parameter being varied: a list, an array, or a sweep definition. ```MDL Syntax alternatives ::= {_list}_| _array_| **swp** **(** swp_param**)** ``` -------------------------------- ### MDL Print Statement Syntax Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines the formal syntax for the MDL `print` statement, including the structure of the format string, arguments, and options for directing output to a file. ```MDL print _statement::= print fmt **(** **"** format**"** , _args_**)** [ **to=**_file_| **addto=**_file_ ] format::= % [ flag ][ width][ .precision ] type [ \n| \t ] flag::= **-** type::= **d,i** | **E,e** | **f** | **G,g** | **o** | S | **s** | **u** | **X,x** | **V** ``` -------------------------------- ### Running Monte Carlo Simulation with Measurement Alias (MDL) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet defines a measurement alias 'tranmeas' to perform a transient simulation and calculate the risetime, then uses the 'run montecarlo' statement to execute this measurement multiple times with specified options like number of runs, seed, variations, and sampling method, outputting results to a scalar file. ```MDL alias measurement tranmeas { export real rise_out run tran(stop=40n, errpreset='conservative) rise_out=risetime(V(q), initval=minq, finalval=maxq, inittype='y, \ finaltype='y, theta1=10, theta2=90) } run montecarlo ( scalarfile="dflip.dat",numruns=50, seed=8, donominal='no, variations='all, sampling='lds firstrun=1) { run tranmeas } ``` -------------------------------- ### Running Primitive Analysis (MDL) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias 'trans' that executes a primitive (built-in) analysis 'tran' with a stop time of 1u. This analysis is provided by the simulator and is not defined in the netlist. The alias then calculates the rise and fall edges of a signal 'V(out)' and exports the pulse width. ```MDL alias measurement trans { run tran(stop=1u) /* This is a built-in, primitive analysis, which is not defined in the netlist. */ real rise_edge=cross(sig=V(out), dir=’rise, n=1, thresh=1.5, start=0) real fall_edge=cross(sig=V(out), dir=’fall, n=1, thresh=1.5, start=0) export real pw=fall_edge-rise_edge } ``` -------------------------------- ### MDL If/Else Statement Syntax Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Provides the general syntax for the if/else statement in MDL, including the structure for the initial if block, optional else if blocks, and an optional else block. It shows how statements are grouped within curly braces based on conditions. ```MDL if ( _CONDITION_ ) { _TRUESTATEMENTS _ } [ ( else if (_ELSEIFCONDITION_) { _ELSEIFSTATEMENTS _ } )+ ] [ else { _FALSEESTATEMENTS _} ] ``` -------------------------------- ### Defining DC Sweep Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a DC sweep analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. It can optionally be aliased. ```MDL run dc (param=temp, start=-40, stop=40, step=10) [as dcswp2] ``` -------------------------------- ### Defining AC Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run an AC analysis directly within the MDL control file by specifying its parameters inline with the 'run' command. It can optionally be aliased. ```MDL run ac (start=0.1G, stop=1G, dec=25) [as ac2] ``` -------------------------------- ### Defining Measurement Alias with Input Parameter - MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines a measurement alias named `myrun` that takes an input analysis run (`tranRun`). It executes the provided run. ```MDL alias measurement myrun {     input analysis tranRun = tran1     run tranRun     } ``` -------------------------------- ### Accessing Total Circuit Noise in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows how to output the total noise for the entire circuit, directed to an output named `out`, in MDL. ```MDL export total_noise noise:out ``` -------------------------------- ### MDL Measurement Alias Demonstrating Variable Propagation Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias `trans`. It first runs a `tran` analysis. Then, it calculates intermediate variables `rise_edge` and `fall_edge` based on the simulation results. Finally, it calculates and exports the variable `pw` by using the previously calculated `fall_edge` and `rise_edge` values, illustrating variable propagation within the alias definition. The last line shows how to execute this alias. ```MDL alias measurement trans {     run tran(stop=5u)     real rise_edge=cross(sig=V(out), dir=’rise, n=1, thresh=1.5, start=0)     real fall_edge=cross(sig=V(out), dir=’fall, n=1, thresh=1.5, start=0)     export real pw=fall_edge-rise_edge } run trans ``` -------------------------------- ### Defining Stability Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a stability analysis directly within the MDL control file by specifying its parameters inline with the 'run' command, including frequency range, points per decade, and probe. ```MDL run stb(start=1, stop=1e10, dec=100, probe=Vprobe) ``` -------------------------------- ### Defining Monte Carlo Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a Monte Carlo analysis named 'mc1' in a Spectre netlist, specifying scalar file output, number of runs, variations, seed, and sampling method. ```Spectre mc1 montecarlo scalarfile=monte5a.dat numruns=10 variations=all seed=1 sampling=lds{ … } ``` -------------------------------- ### Accessing Instance Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows how to access a parameter `vth` of an instance `i1.mp0` in an MDL measurement alias. ```MDL export real par_vth=i1.mp0:vth ``` -------------------------------- ### Defining Transient Noise Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a transient noise analysis in a Spectre netlist, specifying stop time, noise seed, and noise frequency range. ```Spectre tran1 tran stop=50n noiseseed=10 noisefmax=30G noisefmin=1M ``` -------------------------------- ### Running Nested Sweep Analysis in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to perform nested sweeps using 'foreach' loops, iterating over 'temp' and 'vdd' values and running a transient analysis within the inner loop. ```MDL foreach temp swp from{25, 50} { foreach vdd swp from {0.8, 3.3} { run tran(stop=10n) } } ``` -------------------------------- ### Defining Transient Info Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a transient analysis with info analysis points in a Spectre netlist, specifying info times, name, and the transient stop time. ```Spectre tran3 tran infotimes=[10n 30n] infoname=opInfo stop=40n ``` -------------------------------- ### Running Named Analysis (MDL) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias 'trans' that executes a named analysis 'tran1'. This analysis must be defined elsewhere in the netlist. The alias then calculates the rise and fall edges of a signal 'V(out)' and exports the pulse width. ```MDL alias measurement trans { run tran1 // This is an analysis specified in the netlist. real rise_edge=cross(sig=V(out), dir=’rise, n=1, thresh=1.5, start=0) real fall_edge=cross(sig=V(out), dir=’fall, n=1, thresh=1.5, start=0) export real pw=fall_edge-rise_edge } ``` -------------------------------- ### Defining S-parameter Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining an S-parameter analysis named 'sp1' in a Spectre netlist, specifying ports, points per decade, and frequency range. ```Spectre sp1 sp ports=[PORT_1 PORT_2] dec=20 start=0.1G stop=20G ``` -------------------------------- ### foreach Specifier Syntax (MDL Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines how to specify the parameter to vary or use a predefined parameter set within the foreach statement. ```MDL Syntax foreach_specifier ::= ****_param_to_vary_**from** __ alternatives | _paramset_name_ ``` -------------------------------- ### foreach Statement Syntax (MDL Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines the basic structure of the foreach statement, including the specifier, optional error handling, and the block of statements to be executed repeatedly. ```MDL Syntax foreach_statement ::= **foreach** foreach_specifier [ **onerror=** conditions ]**{** block_of_statements **}** ``` -------------------------------- ### Defining DC Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a DC operating point analysis named 'dc1' in a Spectre netlist, specifying that the operating point information should be logged to a file. ```Spectre dc1 dc oppoint=logfile ``` -------------------------------- ### Defining Transient Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a transient analysis named 'tran1' in a Spectre netlist, specifying the stop time and error preset. ```Spectre tran1 tran stop=1u errpreset=conservative ``` -------------------------------- ### Defining Measurement Alias with Autostop (MDL) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias named `trans` that runs a transient analysis (`tran1`) and exports two real values: the output voltage at 1μs (`out_1u`) and the falling propagation delay (`prop_delay_fall`) using the `deltax` function. When used with a transient analysis where `autostop` is enabled, the simulation will stop once these measurements can be determined. ```MDL alias measurement trans {\nrun tran1\n    export real out_1u=V(out)@1u\n    export real prop_delay_fall=deltax(sig1=V(inp), sig2=V(out), dir1=’fall,\n     n1=1, start1=0, thresh1=1.5, dir2=’fall, n2=1, start2=0, thresh2=1.5) \n} \nrun trans ``` -------------------------------- ### Defining Transient AC Analysis in Spectre Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This snippet shows the syntax for defining a transient analysis with AC analysis points in a Spectre netlist, specifying AC analysis times, names, and the transient stop time. ```Spectre tran2 tran actimes=[0 20n 40n] acnames=[CaptabInfo ac-2] stop=40n ``` -------------------------------- ### Accessing Subcircuit Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows how to access a parameter `mm` within a subcircuit instance `x1.xmm0` in an MDL measurement alias. ```MDL export real par_mm=x1.xmm0:mm ``` -------------------------------- ### Defining Reliability Analysis with Parameters in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet shows how to define and run a reliability analysis directly within the MDL control file by specifying its parameters inline with the 'run' command, including age time and delta value. ```MDL run reliability (time_age={10y}, deltad_value = 0.1 ) { …… //run MDL measurement …… } ``` -------------------------------- ### Defining MDL Alias for Analysis with Parameter using 'run ... as' Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates defining a temporary alias for a specific analysis run. It first sets a variable `temp` and then uses `run dc as dcat50` to create an alias `dcat50` that represents running the `dc` analysis with `temp` set to 50. ```MDL temp=50 run dc as dcat50 ``` -------------------------------- ### Accessing Spot Noise in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Shows how to access the spot noise parameter `rd` for an element type `mn` at a specific frequency (1kHz) in an MDL measurement alias. ```MDL export real spot_noise=mn:rd @1k ``` -------------------------------- ### Using Netlist Variables in MDL Measurement Alias Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias `runtran`. It includes input parameters `transtop` and `prop_thresh` and a `run tran` statement. The key feature is the use of `vdd_val` within the `risetime` export expression. `vdd_val` is expected to be a variable defined in the associated netlist, demonstrating how MDL can access netlist parameters without explicitly declaring them as alias inputs. ```MDL alias measurement runtran {     input real transtop=2u     input real prop_thresh     run tran(stop=transtop)  export real rise=risetime(trim(sig=V(out),   from=10n, to=70n), initval=vdd_val/5, // vdd_val is used here...   inittype=’y, finalval=(vdd_val/5)+2, // and here.   finaltype=’y, theta1=10, theta2=90) } ``` -------------------------------- ### Defining Measurement Alias with Foreach Loop - MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines a measurement alias `top_test` that uses a `foreach` loop to iterate through values (10, 20, 30). Inside the loop, it runs the `transient` alias, accumulates the `v1` result into `sum`, and stores each `v1` result in an array `each_v1`. ```MDL alias measurement top_test {     export real sum =0;     export real each_v1[];     int index=0;     foreach aa from {10, 20 ,30} {     run transient as inner;     sum = sum + inner->v1;     each_v1[index] = inner->v1;     index = index+1;     }     } ``` -------------------------------- ### Sweep Parameter Definition Syntax (MDL Syntax) Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines the syntax for specifying sweep parameters using either start/stop or center/span, optionally including a step definition. ```MDL Syntax swp_param ::= **start** **=** _strt_**,** **stop** **=** _stop_ [**,** step_def ] | **center** **=** _cntr_**,** **span** **=** _spn_[**,** step_def ] ``` -------------------------------- ### Defining Transient Analysis Alias - MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md Defines an alias named `transient` for a transient simulation. It exports real variables `v1` and `temper`, sets `temper` to the current temperature, runs a transient simulation up to 7e-08, and calculates `v1` based on the average of `V(vin)`. ```MDL alias transient {     export real v1     export real temper     temper=temp     run tran( stop=7e-08 )     v1=aa*avg(V(vin))     } ``` -------------------------------- ### Running Pre-defined Alter Group in MDL Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet demonstrates how to execute an alter group previously defined in the netlist (e.g., 'alter1') using the 'run' command. It can optionally be aliased with a new name. ```MDL run alter1 [as alter2] ``` -------------------------------- ### Structuring MDL Alias with Analysis Before Export Source: https://github.com/kkkkkom/my_dummy_md/blob/main/README.md This MDL snippet defines a measurement alias `cvmeas`. It illustrates the recommended structure where the simulation analysis command (`run ac1`) is placed before the statement that calculates and exports a result (`cv`). This ensures that the analysis results are available when the calculation is performed. ```MDL alias measurement cvmeas {     run ac1     export real cv = im(DUT:d) / (6.28319 * 100000) } ```