CppSim

From WICS
Revision as of 14:19, 20 May 2025 by Wics (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CppSim is a tool for system level simulation, similar to simulink. However, it was built with performance in mind and specifically targetting the simulation of transceivers and PLLs. It's an academic tool that's freely available on the CppSim Website. The CppSim website has lots of useful information, both on the tool itself and on design of PLLs and transceivers. If you are interested in using CppSim, the online primer is the best place to start.

CppSim for Cadence

While CppSim is available (and easily installable) for Windows, the schematic editor and library manager can be aggravating to use. Fortunately there is a better alternative. CppSim for Cadence is a package which is easy to set up in linux, and allows you to use the Virtuoso library manager and schematic editor in order to set up CppSim simulations.

To setup CppSim for Cadence, use the following steps:

  1. Copy CppSim from the Group Workspace into your home directory. From a terminal, run cp -r /afs/eecs.umich.edu/wics/tools/CppSim/* ~ . This is almost 400MB of stuff, so it can take a few seconds. Make sure you include the asterisk so you wind up with the correct hierarchy. "CppSim", "CppSimShared", "menus", and "AMSD" should all be directly in your home directory.
  2. Change to the run directory. Run cd ~/CppSim/cds/
  3. Source the .cshrc file which configures CppSim. Run source .cshrc_cppsim.
  4. Run virtuoso &.

You can now use CppSim just like in the windows version, through the Cadence interface. In order to run the simulation, open a CppSim schematic and choose the menu item Options -> . Simulations results will appear in ~/CppSim/SimRuns/ in tr0 format. Viewing and analysis is best done in Matlab, using the Hspice Toolbox explained below. More details on what's possible in this environment are provided in the primer.

Changes to this setup, such as moving the run directory, may be made to some extent modifying the source .cshrc_cppsim. As the name implies, CppSimShared does not need to be copied for every user; however, since its location may not be permanent on our server it seemed better not to break anyones code in the future. It is also possible to combine the settings provided by this setup with the settings for a PDK, allowing you to run CppSim simulations and do circuit design work from the same virtuoso window; however, no one in our group has set this up at this time. It's even possible to use the same cells for design and for CppSim by giving them appropriate CppSim discriptions, in theory.

Hspice Toolbox

The Hspice Toolbox toolbox is a collection matlab scripts that provide some quick signal analysis capability for simulation output. It's bundled into both the Windows and Linux versions of CppSim, and makes it easy to do more complicated analysis on the output.

To make the functions available you need to add the toolbox to your MATLAB path. In CppSim for Cadence, this can be done with the following MATLAB command (assuming the default setup): addpath(~/CppSimShared/HspiceToolbox'). In other setups or on Windows simply change the path appropriately.

To permanently add the toolbox to your path, create (or edit) a startup.m file in the directory you run MATLAB from, and add the command to it. This will automatically run the command when you start MATLAB.

Documentation for the Toolbox

PLL Design Assistant

The Windows version of CppSim includes a tool called the PLL Design Assistant. This is covered in the primer and is extremely handy for figuring out the basic closed loop behavior of a PLL.