Monte Carlo Simulation
This tutorial will show you how to run Monte Carlo Simulation and some information on using the calculator tool. For this example the a simple inverter will be used. Statistics on the delay through the inverter will be found.
- To begin open the analog environment as normal:
- Under Setup => Model Libraries ...
- Change the last to letters of Section from 'tm' to 'mc' so that your Model Library Setup matches the one shown bellow:

- Hit OK to save the changed and return to the Analog Environment. Note that this will only change these libraries for this session, when you open a new analog environment the defaults will be 'tm', if you want to keep these settings it is recommended that you save the state by going to Session => Save State...
- Optional: Before continuing make sure that (if you are using one) the Hierarchy Editor is set up how you want, and that you are using the right simulator.
- Now you will run one normal simulation to make sure that you have every thing set up before running the multiple Monte Carlo simulations
- First chose what nets you want to save by Outputs => To be saved => select on schematic
- Your Schematic window should come to the front, now just click on the nets you want to save i have selected the nets 'in' and 'out'
- When you are done selecting the nets go back to the Analog Environment and the nets you selected should show up in the Outputs window, shown bellow
- Choose a transient simulation and set this up to your liking
- So that the simulations will run faster we will only keep the nets that we are interested in to do this select Outputs => Save all... and under Select Signals to output select "selected" leave the rest default, it should look like the picture shown bellow

- Now run the normal simulation. Because we choose 'select outputs to be saved' instead of 'select outputs to be plotted' we must now tell it which outputs we want to plot; there are two ways to do this...
- The first way is to select Results => Direct Plot =>
Transient Signal note that if you were running a AC simulation that the 'Transient Signal' the selection would be changed to 'AC [something]')
- The other way and the recommended way is to use the calculator. Select Tools => Calculator
- To select signals check the 'vt' dot under the simulation type at the top of the calculator (shown in the red box bellow)

- Your schematic should then pop up click on the net(s) you want to plot then return to the calculator window and click the
(plot) button to plot the waveform
- Now to calculate the delay through the cell select delay from the list of functions in the calculator window. A menu like the one shown below should open in the calculator window
- To select the net 'in' as Signal 1:
- Put the cursor into the Signal 1 box
- Check the 'vt' dot and select net 'in' from the schematic window
- This should put the string "VT("/in")" in the Signal 1 box
- Repeat the above steps to put 'out' as Signal 2. The rest of the setting should be self explanatory, the settings I chose are shown below, click OK move the expression into the main text line (also knows as the buffer line because the arrow on the right will allow you bring up previous commands)

- Click the Eval button to evaluate the delay (if you have ran a Monte Carlo simulation already it will plot the results for each iterations)
- We will now run a Monte Carlo Simulation:
- From the Analog Design Environment window select Tools => Monte Carlo...
- For now select the settings that are shown in the picture bellow. You can later change the Number of Runs or Sweep different parameters. The Starting Run # and the Append to previous check allows you to add the new results to your previous simulations (so you could of ran one Monte Carlo Simulation to test every thing then run the other 99 simulations and then plot them all together).
- Now we need to add the 'delay' expression from the calculator to the Analog Statistical Analysis window (Monte Carlo window)
- The function delay(VT("/in") 2.5 1 "either" VT("/out") 2.5 1 "either") should still be in the text line, if it is not use the button on the right side of the text window to scroll through the buffer and select that line
- Now go back to the Analog Statistical Analysis window and click the Get Expression button, the expression from your calculator window should now be moved in the box at the bottom
- Name the expression Delay and click the Add button to move the expression into the Outputs box
- Now make sure your Analog Statistical Analysis window looks like the one bellow

- Now that every thing is set up click Simulation => Run, it will simulate the design 100 times (or the amount specified by Number of Runs)
- When the simulator has finished running click Results => Plot => Histogram... then make sure Delay is in the box on the right (if not move it there by selecting Delay it and clicking the Add button, click OK to display the results as a histogram. You can play with the settings of the histogram and the other types of plots if you want
- The result should look something like the one shown bellow (not exact because every simulation is different)
