Product Documentation
Spectre AMS Designer Cosimulation with MathWorks MATLAB/Simulink
Product Version IC23.1, June 2023

2


Running Cosimulation from ADE Using the Fixed-Cell Coupler

AMS-MATLAB/Simulink cosimulation stands for cosimulation using the Spectre AMS Designer simulator and The MathWorks MATLAB®/Simulink®. ADE stands for the Virtuoso Analog Design Environment.
Use IC 6.1.3, IUS 8.1 or later, and MATLAB704R14 or MATLAB R2007b or MATLAB R2008a for this tutorial. The estimated time to complete this tutorial is about one hour.

For information about the fixed-cell coupler, see “Creating the Coupler in the Schematic Window”.

To run cosimulation from ADE using the fixed-cell coupler, do the following:

  1. If you have not already done so, open the RF Transmitter System Testbench config.
    Shortcut: You can open the finished config/schematic that we provide with this tutorial: AMSDcouple/tb_ieee_802_11a_demo.
  2. Open the Virtuoso Analog Design Environment (ADE) and set up the analysis.
  3. Choose xrun for simulation.
  4. View AMS simulator options.
  5. Specify values for the design variables.
  6. Set up the MATLAB/Simulink simulation to start before the AMS Designer simulation.
  7. Run cosimulation from ADE.
  8. Rerun the cosimulation after changing a design variable value.
  9. Run cosimulation by starting two simulations separately.

Opening ADE and Setting Up the Analysis

To open ADE and set up the analysis, do the following:

  1. In the schematic window, choose Launch – ADE L.
    Simulator: ams(Spectre) appears on the status bar.
  2. Choose Analyses – Choose.
    The Choosing Analyses form appears.
  3. In the Stop Time field, type 1m.
  4. Turn on the Enabled check box.
  5. Click OK.
    The analysis setup appears in the Analyses section of the ADE window.

Choosing xrun for Simulation

To choose xrun for simulation, do the following:

  1. In ADE, choose Simulation – Netlist and Run Options.
    The Netlist and Run Options form appears.
  2. In the NETLIST AND RUN MODE section at the top of the form, select OSS-based netlister with xrun.
The options that you see in the form depends upon your installation path. If you have Xcelium in your installation path, then, you will see Xcelium-related commands, such as xrun, xmvlog, and xmelab. However, if you have INCISIVE in your installation path, you will see the INCISIVE-related commands, such as irun, ncvlog, and ncelab. However, if you set AMSXLMCOMPATIBLE, environment variable, you will always see the INCISIVE commands in the form even if you have Xcelium in your installation path.

Setting Up Design Variables

To set up design variables, do the following:

  1. Copy the variables from the schematic by choosing Variables – Copy from Cellview in the ADE window.
    Design variables from the schematic appear in the Design Variables section of the ADE window.
    GAIN_PA controls the gain of the RF power amplifier. CP_PA controls the compression point of the RF power amplifier. The compression point is a measurement of the amplifier’s linearity/nonlinearity: The smaller the number, the larger the amplifier’s nonlinearity.
  2. In the Value column for GAIN_PA, click and type 35.
  3. In the Value column for CP_PA, click and type 24.

Starting MATLAB before AMS Starts

To set up MATLAB to start before AMS starts, do the following:

  1. In ADE, choose Setup – MATLAB/Simulink – Start.
    The Setup MATLAB form appears. By default Start MATLAB is no.
  2. For Start MATLAB, select before AMS starts.
    This setting establishes a connection between the MATLAB/Simulink simulator and the AMS Designer simulator. The other fields on the form become active.
    The default MATLAB start command is matlab.
    The default MATLAB start-up directory is your current directory (where you started your Cadence software).
    The default delay to allow MATLAB initialization is 10 seconds. This delay allows MATLAB/Simulink to be ready and running when the AMS simulation starts. For successful cosimulation, you must coordinate start-up times such that MATLAB/Simulink is ready and running before AMS.
    You would set Start MATLAB to now to use the flow that runs the AMS Designer simulator and environment separate from the MATLAB/Simulink simulation. See “Running Cosimulation by Starting the Two Simulations Separately” for more information.
  3. In the MATLAB design name field, type tutorial2r14.
  4. Click OK.
    You are ready to run cosimulation from ADE.

Running Cosimulation from ADE

To start cosimulation from ADE, do the following:

  1. Choose Simulation – Netlist and Run (or click the green Netlist and Run button).
    The testbench schematic appears in Simulink. The MATLAB Command Window does not appear. The AMS Designer simulator starts running. The cosimulation proceeds. The simulation.log and matlab_ade.log files appear in separate windows. Simulation data appears in the Simulink Spectrum Scope and Received Signal windows.
    The input spectrum and output spectrum are different owing to of the non-ideal RF transmitter chain.

Changing a Value and Rerunning Cosimulation

Once you are set up for cosimulation, changing values and rerunning the cosimulation is simple. To change a design variable value and rerun the cosimulation, do the following:

  1. In the ADE window, double-click the value for CP_PA and change it to 18 (from 24).
  2. Click the run button (or choose Simulation – Netlist and Run).
    The cosimulation runs again with the changed value.
    The number of bit errors increases (you can view this information on the testbench scheamtic). The overall system behavior is still reasonable.
    The scatter plot reflects the larger amplifier nonlinearity owing to the change to the value of the CP_PA design variable.

Running Cosimulation by Starting the Two Simulations Separately

Previously, we demonstrated how you can run a cosimulation from ADE by setting the Start MATLAB option to before AMS starts. To leverage the full funtionality of MATLAB, you can start MATLAB from ADE and run cosimulation by starting the two simulations separately.

Before beginning this part of the tutorial, do the following:

To run cosimulation by starting the two simulations separately, do the following:

  1. Start MATLAB from ADE.
  2. Start the two simulations separately.

Starting MATLAB Immediately

To set up MATLAB to start immediately, do the following:

  1. In ADE, choose Setup – MATLAB/Simulink – Start.
    The Setup MATLAB form appears.
  2. For Start MATLAB, select now.
    The Start button appears.
    See “Starting MATLAB before AMS Starts” for information about the before AMS starts selection.
  3. Click Start.
    The MATLAB Command Window appears. The testbench schematic appears in Simulink. You are ready to cosimulate by starting the two simulations separately.

Starting the Two Simulations Separately

To start the two simulations separately, do the following:

  1. In the Simulink testbench window, choose Simulation – Start.
    Messages appear in the MATLAB Command Window. One of the messages is this:
    Waiting for incoming connection on port 5023, timeout: 120 sec ...
  2. In the ADE window, choose Simulation – Netlist and Run (or click the Netlist and Run button) before this time interval expires.
    Once the xmsim simulation starts, the two applications establish a connection and the cosimulation proceeds. When the cosimulation finishes, the Spectrum Scope and Received Signal graph windows appear. You can view the number of bit errors on the testbench schematic.
    If you want to rerun the simulation, you will need to start Simulink and ADE again separately.

Return to top
 ⠀
X