= APPLICATION NOTE =
= Using ARM Model Manager (version 1.1.0) with Cadence NC-Verilog =

Introduction
============

Intended audience
-----------------

This application note provides information for users of models managed
with version 1.1.0 of the ARM Model Manager for Cadence NC-Verilog.

It describes:

 - an introduction to the Model Manager
 - initial preparations for simulation
 - configuring the simulator to use the Model Manager
 - how the Model Manager loads a model (including SWIFT models)

Please read this document even if you are familiar with previous model
releases, because some of the details have changed.


The Model Manager
-----------------

Your model is called a "foreign-language model", because it was written
using a language other than the native HDL of the simulator.  You have
been supplied with this model in the form of an object file.  Different
simulators can have different interfaces for communicating with foreign-
language models.  The purpose of the Model Manager is to provide a
standard (that is, simulator-independent) interface to the models it
manages and to handle all communication between those models and the
simulator.

The Model Manager (or MM) has been designed so that you do not have to
load each model separately into the simulation.  Instead, the simulator
opens or links against a single copy of the MM, which handles all the
requests to load MM models in that simulation.  A single MM can service
multiple instances of multiple models in a simulation.  You do not have
to rebuild the simulator executable or libraries when a new MM model is
added to a simulation.

The instructions on using the Model Manager vary between simulators
because different simulators have different methods of integrating
foreign models into their simulations.


Initial preparations
====================

You must set the environment variable MG_LIB to point to the directory
containing the Model Manager before you can run any simulation which
uses the MM.  Set MG_LIB to:

   On Solaris (32-bit)   <Model_Manager_root>/SunOS/MM

   On Solaris (64-bit)   <Model_Manager_root>/SunOS-64/MM

   On HP-UX (32-bit)     <Model_Manager_root>/HP-UX/MM

   On HP-UX (64-bit)     <Model_Manager_root>/HP-UX-64/MM

   On Linux (32-bit x86) <Model_Manager_root>/Linux/MM
   
   On Linux (64-bit AMD) <Model_Manager_root>/Linux-64/MM

where <Model_Manager_root> is the Model Manager root directory,
as described in the model-specific documentation.

Some Model Managers are not supported on some of the platforms above.


Configuring NC-Verilog to use the Model Manager
===============================================

Foreign-language models can be loaded into NC-Verilog using the Verilog
PLI (Programming Language Interface).

To include the MM in your simulation, use the "-loadpli1" command line 
option when you run "ncelab", which will dynamically load the MM.  The
name of the MM library is:

  On Solaris and Linux  ${MG_LIB}/cadence_nc_verilog/mm_nc_dynamic.so

  On HP-UX              ${MG_LIB}/cadence_nc_verilog/mm_nc_dynamic.sl

The entry point function is "mgboot_nc".

For example, if your simulation contains two MM models with a top-level
Verilog module "testtop", you can elaborate the simulation (having
already compiled the Verilog) using the command:

  ncelab -loadpli1 \
    ${MG_LIB}/cadence_nc_verilog/mm_nc_dynamic:mgboot_nc \
    testtop

You do not have to rebuild "libpli.so" or any other library.


How the Model Manager loads a model
===================================

The Model Manager extends the syntax of Verilog by adding the command
"$mm".  This command takes a number of arguments, and the first of
these is the model's device name.  The Verilog shell for the model
contains a call to the "$mm" command, with this name as its argument.

The shared library containing the model must have the same name as the
device (which we will call <device>), plus the appropriate OS-specific
shared library filename extension.

The Model Manager first looks for the library in the directory specified
in the MG_OBJECT generic or parameter in the model's HDL wrapper.  This
generic is set to the environment variable DIR_<device> by default.

If the MM cannot find the library there, it looks in the current
directory.


SWIFT models
------------

The Model Manager can handle models which have SWIFT models (such as 
those built with VMC from Synopsys) as sub-components.  The model-
specific documentation describes the details.  Before you can simulate
these models you must ensure that the environment variable LMC_HOME is
set appropriately.

The Synopsys VMC documentation provides further details and is available
on-line at the Synopsys website, "www.synopsys.com".


Timing
------

A model can have an SDF-annotatable timing shell associated with it,
or can be simulated without any timing.  To choose the kind of
simulation you want, select the appropriate HDL wrapper.  The name and
location of HDL wrappers are described in the model-specific
documentation.
