\documentstyle[11pt]{article}
\renewcommand{\baselinestretch}{1.2}
\begin{document}

\begin{center}
{\LARGE\bf Getting started with Mentor\footnote{See the acknowledgements
at the back of this document for its history.}}\\
\vspace{0.5cm}
{\large CS/ECE 552-2}\\
{\large Prof: Guri Sohi}\\
{\large TA: Sonny Pham}\\ [.2in]
\end{center}


\section{Introduction}

The {\bf Mentor Graphics} system is a complete, integrated package for
digital system design, simulation and IC layout. In addition, it has a
variety of tools related to Printed Circuit Board (PCB) design and
analysis.

For purposes of CS552, we are interested in the schematic capture and
simulation of digital circuits capabilities of Mentor.  The components
of the system we are going to use are:

 \begin{itemize}
   \item  Design Manager (\texttt{dmgr})
   \item  Design Architect (\texttt{da})
   \item  QuicksimII (\texttt{quicksim})
   \item  Bold Browser (\texttt{bold\_browser -color})
 \end{itemize}

We will be using the \texttt{nova} UltraSPARC 10s in the Computer
Sciences building.  The \texttt{sol} machines will execute the Mentor
Graphics software very slowly.

\section{Setting up your environment}

 Put the following at the end of your \texttt{.cshrc.local} file in your home 
 directory:
\texttt{
\begin{verse}
 setenv MGC\_HOME /s/mentor/\\
 setenv MGC\_WD\ \$HOME/mentor\\
 setenv MGC\_LOCATION\_MAP \$HOME/mentor/.location\\
 set path = (\$path /s/mentor/bin)\\
\end{verse}
}

Now type the following to your shell (start in your home directory):
\texttt{
\begin{verse}
  source .cshrc (for the first time only)\\
  mkdir mentor\\
  cd mentor\\
  cp \~{}cs552-1/public/Mentor/.location .location\\
\end{verse}
}

Edit your \texttt{.location} file and replace the last line with the
path to your mentor directory. Mentor applications use the
\texttt{.location} file (called \textit{location map}) to determine the
location in the file system of the libraries they may need.
   

\section{Design Manager}

 Design Manager or {\em dmgr} for short, is the tool for managing your designs.
It provides for:
\begin{itemize}
  \item  Navigation through the filesystem.
  \item Manipulation (copy/move) of design objects.
  \item Launching of the various mentor tools.
\end{itemize}

\texttt{Dmgr} is the tool you should run first and normally you would
like to invoke all other tools through it.

To invoke Design Manager type \texttt{dmgr} on your shell prompt.  {\bf
You should make sure that you are in your \texttt{\~{}/mentor} directory
when running} dmgr.

After \texttt{dmgr} starts up, you will see three windows and a menu bar
at the top.  The leftmost window is the tools window where each icon
represents a mentor tool. We are interested in the {\bf design\_arch} and
the {\bf QuicksimII} icons.  Icons appear alphabeticaly and it should
not be hard to locate them.  Use the scroll bars located on the right
side of the Tools window to move up and down. Double-clicking on an icon
launches that tool.

The window at the center is the navigator window which you can use to browse
the filesystem. Since Mentor uses files to store the objects of your
designs these appear as icons in the Navigator window.

Finally the window on the right side provides shortcuts to various menu
options.  Depending on which window is currently active it will provide
shortcuts to the actions available.  If either the Tools or the
Navigator window does not show up you can click at the corresponding
icons to open a copies of them. 

Pressing the mouse's right button opens a menu whose options depend on
where the cursor is located. For example you can turn on the scroll
bars of the Tools window using the corresponding option. The left mouse
button is used to perform actions. For example, in the Tools window,
double clicking on a tool icon invokes that tool. We will explain the
use of the middle button when talking about Design Architect.

{\bf Do not use shell commands to move or copy design objects!} 
Use \texttt{dmgr} to do it when it is necessary.
 
\section{Bold Browser} 

This is the online help system of Mentor graphics. All of its
documentation can be accessed through this tool. To access these
documents you have to launch the Bold Browser program: either double
click on the ``bold\_browser'' icon in the Tools window or select
the ``Help'' option from the menu bar. To open the documents from the
browser, pull down the {\bf File} menu, drag down the ``{\bf Open} $>$''
hierarchical menu, and choose ``{\bf Document \dots}'' ({\bf File} $>$
{\bf Open} $>$ {\bf Document \dots} in the shorthand notation used
throughout the Mentor documentation.) Select the documents that you are
interested in from the pop-up list. The following documents are useful:


 \begin{itemize}
   \item ``Getting Started with the Falcon Framework Training Workbook''
   in the \underline{Falcon Framework} book.  This includes information
   about the Design Manager and using the Bold Browser to access the
   on-line documentation.  Most of the important information here is
   also contained in ``Design Architect Training Workbook.''

   \item ``Design Architect Training Workbook'' in the
   \underline{Design Creation} book.  This includes information about
   using the help system and creating individual circuits and circuit
   hierarchies.

   \item ``Getting Started with Design Architect Trainging Workbook'' in
   the \underline{Design Creation} book.  This is a less complete and
   shorter version of ``Design Architect Training Workbook.''

   \item ``QuickSim II Training Workbook'' in the \underline{Digital
   Simulation} book. This covers the use of QuickSimII, including
   setting up input signals and creating traces.

   \item ``Getting Started with QuickSimII'' in the \underline{Digital
   Simulation} book.  This is a less complete and shorter version of
   ``QuickSim II Training Workbook.''

   \item ``Design Architect User's Manual'' and ``Design Architect
   Reference Manual'' in the \underline{Design Creation} book.  Use
   these as a reference by looking at the index.

   \item ``QuickSim II User's Manual'' in the \underline{Digital
   Simulation} book.  Use this as a reference by looking at the index.

 \end{itemize}

 Other useful documents appear in the books listed above.  You can
 identify what will be useful to you by looking through the bookcase
 entries for each tool.  There are also some Quick Reference cards
 available online.


\section{Design Architect}

 Design Architect or \texttt{da} for short, is the schematic capture tool.
To get started find the ``design\_arch'' icon in the Tools window in 
dmgr and launch it by double clicking on it. Alternatively you can
invoke it directly from a shell by typing in \texttt{da}.

Here are few points regarding \texttt{da}.

 \begin{itemize}

  \item  Once \texttt{da} is open you will a see a menu bar at the top,
  on the left side a large blank window, on the right two smaller
  windows, and at the bottom a series of boxes marked F1 to F12 which
  describe the binding of the keyboard's function keys. Under the
  function keys description boxes there is an empty row which
  \texttt{da} uses to provide information or report error messages.

  \item  The top right window is called the {\em Symbol Window}.  It is
  used to display objects you can place in your schematic. The window at
  the bottom right is called the {\em Session Pallette}. While you are
  working with \texttt{da}, various menus will appear within this
  window.

  The window at the left, which initially will be empty, is used to
  display the active design and is called the {\em Context Window}.

  \item  You can select which windows will be opened each time you run
  \texttt{da} through the {\bf MGC} $>$ {\bf Setup} $>$ {\bf Session
  options}.  \end{itemize}


\subsection{Opening a new schematic sheet}

The first thing you need to do if you have not already created a
schematic sheet is to open a new one. To do so click on the {\bf
Open\_Sheet} icon in the session window or alternatively do {\bf File}
$>$ {\bf Open} $>$ {\bf Sheet}.  Note that while the cursor is over the
session window you can use the right mouse button to add scroll bars
etc. Due to some bug in the software you might find the Session window
blank. To fix this problem, press the right mouse button in the window
and select {\bf Show Scroll Bars} or {\bf Hide Scroll Bars}.

You will be asked to provide a name for your design in the dialogue box
that appears. Enter the name in the {\em Component} box (see the {\bf
Overview} file for an explanation of the relations between components
and sheets).  Include your full path in the name, i.\ e. if you want to
name your design as \texttt{and\_gate} then type {\em
your\_home\_path}\texttt{/mentor/and\_gate} in the component box (e.\ g.
\texttt{/u/p/h/phamson/mentor/and\_gate}).

Then a new window will appear titled:
\begin{verse}
\texttt{Schematic\#1 and\_gate sheet1}\\
\end{verse}

This is the window in which you will do the actual drawing.  Note also
that the session pallette has changed to {\em schematic\_add\_route}
which provides shortcuts to various commands that are used in drawing
schematics. There are more icons available. To access them press the
mouse's right button while the cursor is on the pallette and turn on the
scrollbars.

\subsection{Commands}

Commands are available from the Session pallette icons or through the
menu bar. Common commands include:

 \begin{description}
   \item[Undo :] Click on the {\bf Undo} icon or {\bf Edit}$>${\bf Undo}.
   \item[Redo :] {\bf Edit}$>${\bf Redo}.
   \item[Zoom :] {\bf Zoom in/out} icon, or {\bf View $>$ Zoom In /View $>$ Zoom Out}.
   \item[View :] 
      \begin{itemize}
	\item Viewing the whole schematic: {\bf View $>$ All}.
	\item Viewing a selected area: {\bf View $>$ Area}.
       \end{itemize}
  \end{description}	

  Note that all these commands can be activated using function keys also.

\subsection{Instantiating Components}

To place a component like an AND gate in your design you must first
select a library that contains it. For our purposes {\em gen\_lib}
(generic library) is the most useful one.  You can see what libraries
are available and open them by clicking on the library icon in session
pallette. Alternatively, you can see the available libraries by doing
{\bf Libraries} $>$~{\bf MGC Digital Libraries} $>$~{\bf Display
Libraries Pallette}. 

The session pallette changes title to ``MGC Digital Libraries.''  Again
you have to activate the scrollbars.  Using the vertical one search for
the ``gen\_lib ''option.  Note that library names appear in alphabetical
order.  Click once on the ``gen\_lib'' option and the session pallette
will change to ``gen\_lib'' providing you with access to the various
components of ``gen\_lib.''

To instantiate a component, for instance \verb+and2+, choose it from the
session pallette by clicking it. Move the cursor to the schematic window
and click the mouse's left button to place the component.


\subsection{Connecting Components}

 We will now draw the wires for our simple design. To draw a wire you have
to access the ``Add'' menu. Go over the schematic window and click the right
button. A menu titled INSTANCE will pop up. Walk down the ``Other Menus''
option and select the ``Add Menu'' option. In place of the ``instance''
menu a new one called ``Add'' will appear.

To connect the components choose {\bf Add $>$ Wire} option. Click on a
pin ( with mouse's left button) to start the net, and click once to place
a vertex, or to connect to another pin. Double click to end the net. 
Alternately, you can use function key {\bf F3} to start the net.

After drawing, press ESC or click on {\bf cancel}  to stop drawing wires.

\subsection{Selecting / Unselecting}

This will be helpful in making corrections like deleting objects, moving
them around etc.  To select an object click (mouse's left button) on it
once and to remove it from to the current selection click on it again.
To add other objects to the current selection click on them once.

Selected objects are indicated by being drawn with white dashed line
segments.

You can select all objcts within an area by dragging out a rectangle
with the left button.

{\bf Edit $>$ Unselect $>$ All} is very useful for unselecting
everything.  Function key {\bf F2} does the same.


\subsection{Editing objects}

You can delete by: {\bf Edit $>$ Edit Commands $>$ Edit operations $>$
Delete} or using the {\em Delete} icon of the session pallette.
Similarly you can copy or move objects by : {\bf Edit $>$ Edit commands
$>$ Edit operations $>$ Copy}(or {\bf Move}) and drag to the new
location. You can also use the {\em Copy/Move} icons in the session
pallette.

\subsection{Ports and Net names}

 To complete our design we have to specify its inputs and outputs.
To do so we have to use the ``gen\_lib'' parts ``portin'' and ``portout''.
You can also access them through the menu in the symbol window:
{\bf Active Symbol Window $>$ Symbol History [c-H] $>$ List}. Alternately,
you can get them from ``gen\_lib''( see {\bf Instantiating Components}).

% Instantiate three ``portin'' and one ``portout'' parts.  Connect them to
%the three get inputs and one gate output left correspondingly.

You will notice that each ``portin'' and ``portout'' has a text label
which reads ``NET'' for every instance. These need to be changed to
unique names. To do this open the Schematic menu (right button over the
schematic window) and do a {\bf Other Menus $>$ Property/Text Menu $>$
Change Values}.  A Dialog box will appear.  Enter as many net names as
there are portins and portouts. When you click OK, you will be prompted
to click on the nets one at a time. Click on the first label (``NET'')
to rename it to the first signal name you typed into the dialog box.
Continue doing this until all ``NET''s have been converted to the names
you specified.

\subsection{Checking for Errors}

You can check if there are any errors in your schematic by doing a {\bf
Check $>$ Sheet $>$ With Defaults}.   A new window will appear after a
while reporting what the automatic checker has found. This is called a
Report window.  If your schematic is ok then you should get ``\verb+ 0
Errors, 0 Warnings+''.   Otherwise information about what is incorrect
will be available.  Close this window by clicking twice on the small
rectangle on the upper left corner.

\subsection{Saving the schematic sheet}

Now that your design is complete you have to save it. For saving the
sheet choose {\bf File $>$ Save Sheet}.  If this option is not available
then make the schematic window active by clicking once on it.

\subsection{Printing}

To print the currently active window (the topmost window with cyan
borders) in \texttt{da} or QuickSimII choose: {\bf File $>$ Print
Sheet}.

You will be asked to enter a printer name.  {\bf Use}
\texttt{mgc-laser}.  {\bf Otherwise you will get a bunch of meaningless
pages as printout}.


\subsection{Closing your schematic}

  Pull down the menu on the left side of the title bar of the schematic
window (box with a line in it) and select ``Close.''

\subsection{Closing Design Architect}

   Pull down the menu on the left side of the title bar of the Design Architect
window and select ``Close.''

\section{QuickSimII}

QuickSimII, \texttt{qs} for short, is a simulator for digital circuits.
You can simulate your Design Architect schematics to validate their
correctness. You add ``traces'' to watch signals change in a graphical
``logic analyzer'' format, and add ``forces'' to apply stimuli to
different networks in your design.

\subsection{Starting QuickSimII}

Find the QuickSimII icon in the Tools window of \texttt{dmgr} and
double-click on it.  A dialog box will pop up and you will be asked to
enter the name of the component to be simulated.  Again, you have to
enter the full path name e.\ g.
\texttt{/u/p/h/phamson/mentor/and\_gate}.  Alternatively, you can select
a design object in the Navigator window (such as your ``and\_gate''
project) and press the right mouse button.  Choosing the {\bf Open $>$
QuicksimII} will invoke QuickSimII on that design.

\subsection{Opening a sheet}

From the Setup window click on the ``OPEN SHEET'' icon or alternatively
choose {\bf File $>$ Open Sheet}. A dialog box will appear with a
selection of available sheets. Select your ``and\_gate'' sheet by
clicking on it so to to inverse the colors and then click on the OK
button.

A new window will appear with your schematic in it.

\subsection{Adding traces}

 To prepare to view signals you have to specify which of them interest you.
You can select a signal by clicking on the wire leading into the port.
When you've finished making your selection choose {\bf Add $>$ Traces $>$ Selected}
from the menu accessed through the right button while in the Schematic
window. This will cause a Trace window to appear at the bottom of the screen.

 Alternatively you can choose {\bf Add $>$ Traces $>$ Specified} then click on the 
``Named Signals'' button of the dialog box that will appear. You will be
then asked to type the names of the signals you are interested in.

\subsection{Adding Forces}

 
Traces correspond to probes placed in your design. Signal stimuli are
called ``Forces'' in QSII. To add a single force, choose {\bf Force $>$
Single Value\dots} by pressing the right button in the Schematic window.
Enter the signal name that you want to stimulate, and specify the value
that it should take (0 or 1), and enter the start and stop times ( by
default in nanoseconds) to indicate when it should take the
aforementioned values. You can force multiple values onto a signal by
choosing the {\bf Force $>$ Multiple Values\dots} menu. Once again,
enter the signal name and a list of force values and ``times''. The time
specifies the instant at which the corresponding force value should be
applied. Alternately, you can click on the ``Stimulus'' button in the
Session window and then use the ADD FORCE icon to add forces to signals.

You can force clock on a signal by choosing {\bf Force $>$ Clock}.
Once again, you enter the signal which you want to put a clock waveform
onto.  Enter the period of the clock, and the two transition times and
values within the clock period. For instance, for a 100ns clock with
50\% duty cycle, enter 100 as period, value 1 at time 0 and value 0 at
time 50.  Clock are alternating signals.

\subsection{Running the simulation}

Now that you have traces and forces set up, you are ready to run the
simulation. This is done by either clicking on the ``Run'' button of the
Session window or by {\bf Run $>$ Simulation}, and specifying how many
nanoseconds to run the simulation. Alternately, you can simply type
``{\em run nnn}'' with cursor inside the QSII window, where {\em nnn} is
the number of nanoseconds to run the simulation. You will see traces
appear in the trace window.

\subsection{Resetting the Simulator}

Choose the {\bf Run $>$ Reset\dots} menu. Click on the ``State'' button
to reset the state of the simulator back to {\em time$=$0}. If you do
not want the results to be saved then uncheck the Save ``results\dots''
button. Click OK to reset.

\subsection{Saving your forces}

You can save any forces you have entered in one of two ways: as a {\bf
Waveform Data Base} (WDB) or as a {\bf Force File}.  A WBD is a compact,
binary representation of any set of waveforms.  A Force File is
human-readable text file which describes what signals are stimulated at
what time.  You can also create a Force File using any text editor and
load it with {\bf Force $>$ From File\dots}.

To save your forces choose {\bf File $>$ Save $>$ Waveform DB}.   From
the dialog box that will appear you can choose the type of the file that
is going to be saved.

\subsection{Printing}

For printing choose: {\bf File $>$ Print $>$ Active Window}. Use
\texttt{mgc-laser} as the printer name.  If your are printing a Trace window
you need to specify from what time to print out.

\subsection{Quitting the simulator}

When you are done simulating, you can quit QSII by pulling down the menu
in the title bar (box on the upper left corner) and choosing ``Close.''

\section {Hierarchical design: Creating and using symbols}

Hierarchical design is a technique used to simplify the design of the
large circuits. For example, to build a 32 bit adder it is easier to
construct the adder using 32 full adders. In this section we discuss how
to create a symbol for a part that you have designed and then use that
symbol to build large circuits.

\subsection{Creating a symbol}

\begin{itemize}
 \item Start Design Architect.

 \item Open the schematic that you want to make into a symbol

 \item Choose: {\bf Miscellaneous $->$ Generate Symbol}

 \item Choosing OK will generate a symbol with the same name as the open schematic

 \item Check the symbol: {\bf Check $->$ With Defaults}.

 \item Save the symbol: {\bf File $->$ Save Symbol}.
 \end{itemize}

 \subsection{Instantiating a symbol}

 Suppose you have created a symbol of a full adder and want to use it as the
 building block when designing the schematic for the 32 bit adder. This can be
 done by selecting the {\bf Choose Symbol} icon in the session palette of the
 Design Architect. Select the symbol you want to instantiate and press OK.

\section {Creating and ripping buses}

 Buses let you represent multiple signal lines without drawing each one of
 them. This helps in efficient design creation and representation.

\subsection{Creating a bus}

 \begin{itemize}
  \item Select {\bf Net $>$ Add Bus} to draw the bus. It is similar to adding
  wires.

  \item The only thing that differentiates a bus from a wire is its
  Property value. The property value for the bus is of the form
  ``bus\_net\_name (msb:lsb)'' e.\ g.  ``sum(3:0)'' for a 4 bit wide
  bus. Unselect the bus and select a single vertex of the bus. To fix
  the property value of the bus, select {\bf Net $>$ Name Nets}. Enter
  the property value (e.\ g. ``sum(3:0)'') in the Property Value box of
  the dialog box. Click OK and place the text in the schematic by
  clicking on the left mouse button.

 \end{itemize}

\subsection{Ripping a bus}

On a schematic sheet, you may be required to run individual lines from
the bus to either another bus or a component. The easiest way to do this
is to just connect the named bus to another wire or bus as normal.  A
box will prompt you for the bits you want to rip.  Enter that value.
Doing this takes advantage of the Automatic Ripper.  To do the same
thing by hand, you nee a component called a {\em bus ripper }. This
component is available in ``gen\_lib'' under the submenu ``rip''. To
connect individual lines of an $n$ bit wide bus you have to use the
$nX1$ ripper. After instantiating the ripper you can go back to the
``gen\_lib'' menu by selecting ``Back'' in the palette window.

  To connect the ripper to the bus follow the steps below:

  \begin{itemize}
    \item Flip/Rotate the ripper so that the wire ends of the ripper
    face the wires of the circuit you want to connect them to.

    \item Use the {\bf Net $>$ Add Wire} choice to connect the wire ends
    of the ripper to the appropriate nets/pins.

    \item Note that each of the wire ends has a ``R'' near it. This is
    the Rule Property of the wire end and stands for the line of the bus
    that is connected to that wire. For example, to connect line 2 of
    the bus to a wire, you have to change the corresponding ``R'' to
    ``2''. Since all the ``R''s will have to be changed to sequential
    numbers you can do this in one step. Select {\bf Text $>$ Sequence
    Text}. Type ``0'' in the {\bf Beginning Index Number} and ``1'' in
    the {\bf Step By} text box and click OK. Click on the ``R''s one
    after another to change them to ``0,'' ``1,'' ``2'' and so on until
    you have done all the ``R''s.

    \item Connect the bundle (thick) end of the ripper to the bus using
    the usual {\bf Net $>$ Add Bus} menu choice. Note that you do not
    have to perform any special actions here.

 \end{itemize}

\section{Mouse's Middle Button}

Mentor uses the middle button in an very interesting way. Go over any
window and press it. While keeping it pressed try to draw a question
mark without a dot. You should see a red line that follows your trace.
A help window should pop up...


\section{Acknowledgements}

This file is based on a previous text written by Ashish Thusoo (for
CS552 Fall '97), Phil Atkinson (for CS552 Fall '96 and Spring '97),
Avinash Sodani (for CS552 Fall '95 and Spring '96), Andreas Moshovos(for
CS552 Spring '94), Subbarao Palacharla (for ECE552 Fall '94), Todd Bezenek (for
CS552, Spring '98, Fall'98 and Spring '99), and Raghav Kaushik (Fall 99).

\end{document}
