1%----------------------------------------------------------------------------
2% Magic tutorial number 10
3%----------------------------------------------------------------------------
4
5\NeedsTeXFormat{LaTeX2e}[1994/12/01]
6\documentclass[letterpaper,twoside,12pt]{article}
7\usepackage{epsfig,times}
8
9\setlength{\textwidth}{8.5in}
10\addtolength{\textwidth}{-2.0in}
11\setlength{\textheight}{11.0in}
12\addtolength{\textheight}{-2.0in}
13\setlength{\oddsidemargin}{0in}
14\setlength{\evensidemargin}{0pt}
15\setlength{\topmargin}{-0.5in}
16\setlength{\headheight}{0.2in}
17\setlength{\headsep}{0.3in}
18\setlength{\topskip}{0pt}
19
20\def\hinch{\hspace*{0.5in}}
21\def\starti{\begin{center}\begin{tabbing}\hinch\=\hinch\=\hinch\=hinch\hinch\=\kill}
22\def\endi{\end{tabbing}\end{center}}
23\def\ii{\>\>\>}
24\def\mytitle{Magic Tutorial \#10: The Interactive Router}
25
26%----------------------------------------------------------------------------
27
28\begin{document}
29
30\makeatletter
31\newcommand{\ps@magic}{%
32	\renewcommand{\@oddhead}{\mytitle\hfil\today}%
33	\renewcommand{\@evenhead}{\today\hfil\mytitle}%
34	\renewcommand{\@evenfoot}{\hfil\textrm{--{\thepage}--}\hfil}%
35	\renewcommand{\@oddfoot}{\@evenfoot}}
36\newcommand{\ps@mplain}{%
37	\renewcommand{\@oddhead}{}%
38	\renewcommand{\@evenhead}{}%
39	\renewcommand{\@evenfoot}{\hfil\textrm{--{\thepage}--}\hfil}%
40	\renewcommand{\@oddfoot}{\@evenfoot}}
41\makeatother
42\pagestyle{magic}
43\thispagestyle{mplain}
44
45
46\begin{center}
47  {\bfseries \Large \mytitle} \\
48  \vspace*{0.5in}
49  {\itshape Michael Arnold} \\
50  \vspace*{0.5in}
51   O Division \\
52   Lawrence Livermore National Laboratory \\
53   Livermore, CA  94550 \\
54  \vspace*{0.25in}
55  This tutorial corresponds to Magic version 7. \\
56\end{center}
57\vspace*{0.5in}
58
59{\noindent\bfseries\large Tutorials to read first:}
60\starti
61   \> Magic Tutorial \#1: Getting Started \\
62   \> Magic Tutorial \#2: Basic Painting and Selection \\
63   \> Magic Tutorial \#4: Cell Hierarchies
64\endi
65
66{\noindent\bfseries\large Commands introduced in this tutorial:}
67\starti
68   \> :iroute
69\endi
70
71{\noindent\bfseries\large Macros introduced in this tutorial:}
72
73\starti
74   \> \^{}R, \^{}N
75\endi
76
77\vspace*{0.25in}
78\section{Introduction}
79
80The Magic interactive router, {\itshape Irouter}, provides an interactive interface
81to Magic's internal maze router.  It is intended as an aid to manual
82routing.  Routing is done one connection at a time, the user specifying
83a starting point and destination areas prior to each connection.  The user
84determines the order in which signals are routed and how multi-point nets
85are decomposed into point-to-area connections.  In addition parameters and
86special Magic {\itshape hint} layers permit the user to control the nature
87of the routes.  Typically the user determines the overall path of a connection,
88and leaves the details of satisfying the design-rules, and detouring around or
89over minor obstacles, to the router.
90
91The interactive router is not designed for fully
92automatic routing:  interactions between nets
93are not considered, and net decomposition is
94not automatic.  Thus netlists are generally
95not suitable input for the Irouter.  However it can be convenient to obtain
96endpoint information from netlists.  The {\itshape Net2ir} program uses
97netlist information to generate commands
98to the Irouter with appropriate endpoints for specified
99signals.  Typically a user might
100setup parameters and hints to river-route a set of connections,
101and then generate Irouter commands with the appropriate endpoints via
102Net2ir.  For details on Net2ir see the
103manual page {\itshape net2ir(1)}.
104
105This tutorial provides detailed information on the use
106of the Irouter.  On-line help, Irouter
107subcommands, Irouter parameters, and hint-layers are explained.
108
109\section{Getting Started---`Cntl-R', `Cntl-N', `:iroute' and `:iroute help'}
110
111To make a connection with the Irouter, place the cursor over one
112end of the desired connection (the {\itshape start-point}) and the box at the
113other end (the {\itshape destination-area}).  Then type
114
115\starti
116   \ii {\bfseries Cntl-R}
117\endi
118
119Note that the box must be big
120enough to allow the route to terminate entirely within it.  A
121design-rule correct connection between the cursor and the box should
122appear.  The macro
123
124\starti
125   \ii {\bfseries Cntl-R}
126\endi
127
128and the long commands
129
130\starti
131   \ii {\bfseries :iroute} \\
132   \ii {\bfseries :iroute route}
133\endi
134
135are all equivalent.  They invoke the Irouter to connect the cursor with
136the interior of the box.  Note that the last connection is always left
137selected.   This allows further terminals to be
138connected to the route with the second Irouter macro, {\bfseries Cntl-N}.  Try
139typing
140
141\starti
142   \ii {\bfseries Cntl-N}
143\endi
144
145A connection between the cursor and the previous route should appear.  In
146general {\bfseries Cntl-N} routes from the cursor to the selection.
147
148There are a number of commands to set parameters and otherwise interact with
149the Irouter.  These commands have the general form
150
151\starti
152   \ii {\bfseries :iroute}{\itshape  subcommand }[{\itshape arguments}]
153\endi
154
155For a list of subcommands and a short description of each, type
156
157\starti
158   \ii {\bfseries :iroute help}
159\endi
160
161Usage information on a subcommand can be obtained by typing
162
163\starti
164   \ii {\bfseries :iroute help }[{\itshape subcommand}]
165\endi
166
167As with Magic in general, unique abbreviations of subcommands and most of their
168arguments are permitted.  Case is generally ignored.
169
170\section{:Undo and Cntl-C}
171
172As with other Magic commands, the results of {\bfseries :iroute} can be undone
173with {\bfseries :undo}, and if the Irouter is taking too long it can be interrupted
174with {\bfseries Cntl-C}.  This makes it easy to refine the results of the Irouter
175by trial and error.  If you don't like the
176results of a route, undo it, tweak the Irouter parameters or hints you are
177using and try again.  If the Irouter is taking too long, you can very
178likely speed things up by interrupting it, resetting
179performance related parameters, and trying again.  The details of
180parameters and
181hints are described later in this document.
182
183\section{More about Making Connections---`:iroute route'}
184
185Start points for routes can be specified via the cursor,
186labels, or coordinates.  Destination areas can be specified via the box,
187labels, coordinates or the selection.  In addition start and destination
188layers can be specified explicitly.  For the syntax of all these options
189type
190
191\starti
192   \ii {\bfseries :iroute help route}
193\endi
194
195When a start point lies on top of existing geometry
196it is assumed that a connection to that material is desired.  If this is
197not the case, the desired starting layer must be explicitly
198specified.  When routing to the selection it is assumed that connection
199to the selected material is desired.  By default, routes to the box
200may terminate on any active route layer.  If you are having trouble connecting
201to a large region, it may
202be because the connection point or area is too far in the interior of the
203region.  Try moving it toward the edge.  (Alternately see the discussion
204of the {\itshape penetration} parameter in the wizard section below.)
205
206\section{Hints}
207
208Magic has three built-in layers for graphical
209control of the Irouter, {\bfseries fence} ({\bfseries f}),
210{\bfseries magnet} ({\bfseries mag}), and {\bfseries rotate}
211({\bfseries r}).  These layers
212can be painted and erased just like other Magic layers.  The effect
213each has on the Irouter is described below.
214
215\subsection{The Fence Layer}
216
217The Irouter won't cross fence boundaries.  Thus the fence layer is useful
218both for carving out routing-regions and for blocking routing in given
219areas.  It is frequently useful to indicate the broad path of one or
220a series of routes with fence.  In addition to guiding the route, the
221use of fences can greatly speed up the router by limiting the search.
222
223\subsection{The Magnet Layer}
224
225Magnets attract the route.  They can be used to pull routes in a
226given direction, e.g., towards one edge of a channel.  Over use of
227magnets can make routing slow.  In particular magnets that are long and
228far away from the actual route can cause performance problems.  (If
229you are having problems with magnets and performance, see also the
230discussion of the {\itshape penalty} parameter in the wizard section below.)
231
232\subsection{The Rotate Layer}
233
234The Irouter associates different weights with horizontal and vertical
235routes (see the layer-parameter section below).  This is so that
236a preferred routing direction can be established for each layer.  When
237two good route-layers are available (as in a two-layer-metal process)
238interference between routes can be minimized by assigning opposite
239preferred directions to the layers.
240
241The rotate layer locally inverts the preferred directions.  An example
242use of the rotate layer might involve an {\bfseries L}-shaped bus.
243The natural preferred directions on one leg of the {\bfseries L} are the opposite
244from the other, and thus one leg needs to be
245marked with the rotate layer.
246
247\section{Subcells}
248
249As with painting and other operations in Magic, the Irouter's
250output is written to the cell being edited.  What the router sees, that
251is which features act as obstacles, is determined by the
252window the route is issued to (or other designated reference window -
253see the wizard
254section.)  The contents of subcells expanded in the route window
255are visible to the Irouter, but it only sees the bounding boxes
256of unexpanded subcells.  These bounding boxes appear on a special
257{\bfseries SUBCELL}  pseudo-layer.  The spacing parameters to the {\bfseries SUBCELL}
258layer determine exactly how the Irouter treats unexpanded subcells.
259(See the section on spacing parameters below.)  By default, the
260spacings to the {\bfseries SUBCELL} layer are large enough to guarantee that
261no design-rules will be violated, regardless of the contents of
262unexpanded subcells.  Routes can be terminated
263at unexpanded subcells in the same fashion that connections to
264other pre-existing features are made.
265
266\section{Layer Parameters---`:iroute layers'}
267
268{\itshape Route-layers}, specified in the {\bfseries mzrouter} section of the
269technology file, are the layers potentially available
270to the Irouter for routing.  The {\bfseries layer} subcommand gives access
271to parameters associated with these route-layers.   Many of the
272parameters are weights for factors in the Irouter cost-function.  The
273Irouter strives for the cheapest possible route.  Thus the balance between
274the factors in the cost-function determines the character of the
275routes:  which layers are used in which directions, and the number of
276contacts and jogs can be controlled in this way.  But
277be careful!  Changes in these parameters can also
278profoundly influence performance.  Other parameters determine
279which of the route-layers are actually available for routing and
280the width of routes on each layer.  It is a good idea to inactivate
281route-layers not being used anyway, as this speeds up routing.
282
283The layers subcommand takes a variable number of arguments.
284
285\starti
286   \ii {\bfseries :iroute layers}
287\endi
288
289prints a table with one row for each route-layer giving all parameter
290values.
291
292\starti
293   \ii {\bfseries :iroute layers}{\itshape  type}
294\endi
295
296prints all parameters associated with route-layer {\itshape type}.
297
298\starti
299   \ii {\bfseries :iroute layers}{\itshape  type parameter}
300\endi
301
302prints the value of {\itshape parameter} for layer {\itshape type}.
303If {\itshape type} is `{\bfseries *}', the value of {\itshape parameter}
304is printed for all layers.
305
306\starti
307   \ii {\bfseries :iroute layers} {\itshape type parameter value}
308\endi
309
310sets {\itshape parameter} to {\itshape value} on layer {\itshape type}.
311If {\itshape type} is `{\bfseries *}', {\itshape parameter} is set to
312{\itshape value} on all layers.
313
314\starti
315   \ii {\bfseries :iroute layers} {\itshape type} {\bfseries *}
316	{\itshape  value1 value2 }\dots{\itshape  valuen}
317\endi
318
319sets a row in the parameter table.
320
321\starti
322   \ii {\bfseries :iroute layers *}{\itshape  parameter value1 \dots valuen}
323\endi
324
325sets a column in the table.
326
327There are six layer parameters.
328
329\begin{itemize}
330   \item {\bfseries active} \\
331	Takes the value of {\bfseries YES} (the default) or {\bfseries NO}.  Only
332	active layers are used by the Irouter.
333
334   \item {\bfseries width} \\
335	Width of routing created by the Irouter on the given layer.  The
336	default is the minimum width permitted by the design rules.
337
338   \item {\bfseries hcost} \\
339	Cost per unit-length for horizontal segments on this layer.
340
341   \item {\bfseries vcost} \\
342	Cost per unit-length for vertical segments.
343
344   \item {\bfseries jogcost} \\
345	Cost per jog (transition from horizontal to vertical segment).
346
347   \item {\bfseries hintcost} \\
348	Cost per unit-area between actual route and magnet segment.
349\end{itemize}
350
351\section{Contact Parameters---`:iroute contacts'}
352
353The {\bfseries contacts} subcommand gives access to a table of parameters for
354contact-types used in routing, one row of parameters per type.  The syntax is
355identical to that of the {\bfseries layers} subcommand described above, and
356parameters are printed and set in the same way.
357
358There are three contact-parameters.
359
360\begin{itemize}
361   \item {\bfseries active} \\
362	Takes the value of {\bfseries YES} (the default) or {\bfseries NO}.  Only
363	active contact types are used by the Irouter.
364
365   \item {\bfseries width} \\
366	Diameter of contacts of this type created by the Irouter.  The
367	default is the minimum width permitted by the design-rules.
368
369   \item {\bfseries cost} \\
370	Cost per contact charged by the Irouter cost-function.
371\end{itemize}
372
373\section{Spacing Parameters---`:iroute spacing'}
374
375The spacing parameters specify minimum
376spacings between the route-types
377(route-layers and route-contacts) and arbitrary Magic types.
378These spacings are the design-rules
379used internally by the Irouter during routing.  Default
380values are derived from the {\bfseries drc} section
381of the technology file.  These values can be
382overridden in the {\bfseries mzrouter} section of the
383technology file.  (See the {\itshape Magic Maintainers Manual on Technology Files}
384for details.)  Spacings can be examined and changed at any
385time with the {\bfseries spacing} subcommand.  Spacing values can
386be {\bfseries nil}, {\bfseries 0}, or positive integers.  A value of {\bfseries nil}
387means there is no spacing constraint between the route-layer and the given type.  A
388value of {\bfseries 0} means the route-layer may not overlap the given type.  If
389a positive value is specified, the Irouter will maintain the
390given spacing between new routing on the specified
391route-layer and pre-existing features of the specified type (except when
392connecting to the type at an end-point of the new route).
393
394The {\bfseries spacing} subcommand takes several forms.
395
396\starti
397   \ii {\bfseries :iroute spacing}
398\endi
399
400prints spacings for all route-types.  (Nil spacings are omitted.)
401
402\starti
403   \ii {\bfseries :iroute spacing} {\itshape route-type}
404\endi
405
406prints spacings for {\itshape route-type}.  (Nil spacings are omitted.)
407
408\starti
409   \ii {\bfseries :iroute spacing} {\itshape route-type type}
410\endi
411
412prints the spacing between {\itshape route-type} and {\itshape type}.
413
414\starti
415   \ii {\bfseries :iroute spacing} {\itshape route-type type value}
416\endi
417
418sets the spacing between {\itshape route-type} and {\itshape type} to {\itshape value}.
419
420The spacings associated with each route-type are
421the ones that are observed when the
422Irouter places that route-type.  To change the spacing between two
423route-types, two spacing parameters must be changed:  the spacing to
424the first type when routing on the second, and the spacing to
425the second type when routing on the first.
426
427Spacings to the {\bfseries SUBCELL} pseudo-type give the minimum spacing between
428a route-type and unexpanded subcells.  The {\bfseries SUBCELL} spacing for a given
429route-layer defaults to the maximum spacing to the route-layer required
430by the design-rules (in the
431{\bfseries drc} section of the technology file).  This ensures that
432no design-rules will be violated regardless of the contents of the
433subcell.  If subcell designs are constrained in a fashion that permits
434closer spacings to some layers, the {\bfseries SUBCELL} spacings can be
435changed to take advantage of this.
436
437\section{Search Parameters---`:search'}
438
439The Mzrouter search is windowed.  Early in the search only partial paths
440near the start point are considered; as the search progresses the window
441is moved towards the goal.  This prevents combinatorial explosion during
442the search, but still permits the exploration of alternatives at all stages.
443The {\bfseries search} subcommand permits access to two parameters
444controlling the windowed search, {\bfseries rate}, and {\bfseries width}.  The {\bfseries rate}
445parameter determines how fast the window is shifted towards the goal, and
446the {\bfseries width} parameter gives the width of the window.  The units are
447comparable with those used in the cost parameters.  If the router is taking
448too long to complete, try increasing {\bfseries rate}.  If the router is
449choosing poor routes, try decreasing {\bfseries rate}.  The window width should
450probably be at least twice the rate.
451
452The subcommand has this form:
453
454\starti
455   \ii {\bfseries :iroute search} [{\itshape parameter}] [{\itshape value}]
456\endi
457
458If {\itshape value} is omitted, the current value is printed, if {\itshape parameter}
459is omitted as well, both parameter values are printed.
460
461\section{Messages---`:iroute verbosity'}
462
463The number of messages printed by the Irouter is controlled by
464
465\starti
466   \ii {\bfseries :iroute verbosity}{\itshape  value}
467\endi
468
469If verbosity is set to {\bfseries 0}, only errors and warnings
470are printed.  A value
471of {\bfseries 1} (the default) results in short messages.
472A value of {\bfseries 2} causes statistics to be printed.
473
474\section{Version---`:iroute version'}
475
476The subcommand
477
478\starti
479   \ii {\bfseries :iroute version}
480\endi
481
482prints the Irouter version in use.
483
484\section{Saving and Restoring Parameters---`:iroute save'}
485
486The command
487
488\starti
489   \ii {\bfseries :iroute save} {\itshape file}{\bfseries .ir}
490\endi
491
492saves away the current settings of all the Irouter parameters in file
493{\itshape file}{\bfseries .ir}.  Parameters can be reset to these values
494at any time with the command
495
496\starti
497   \ii {\bfseries :source} {\itshape file}{\bfseries .ir}
498\endi
499
500This feature can be used to setup parameter-sets appropriate to different
501routing contexts.  Note that the extension {\bfseries .ir} is recommended
502for Irouter parameter-files.
503
504\section{Wizard Parameters---`:iroute wizard'}
505
506Miscellaneous parameters that are probably not of interest
507to the casual user are
508accessed via the {\bfseries wizard} subcommand.  The parameters are as follows:
509
510\begin{itemize}
511\item {\bfseries bloom}
512Takes on a non-negative integer value.  This controls the amount of
513compulsory searching from a focus, before the next focus is picked
514based on the cost-function and window position.  In practice {\bfseries 1}
515(the default value)
516seems to be the best value.  This parameter may be removed in the future.
517
518\item {\bfseries boundsIncrement}
519Takes on the value {\bfseries AUTOMATIC} or a positive integer.  Determines in
520what size chunks the layout is preprocessed for routing.  This
521preprocessing (blockage generation) takes a significant fraction of the
522routing time, thus performance may well be improved by experimenting with
523this parameter.
524
525\item {\bfseries estimate}
526Takes on a boolean value.  If {\bfseries ON} (the default) an estimation plane
527is generated prior to each route that permits
528cost-to-completion estimates to factor in subcells and fence regions.  This
529can be very important to efficient routing.  Its rarely useful to turn
530estimation off.
531
532\item {\bfseries expandDests}
533Takes on a boolean value.  If {\bfseries ON} (not the default) destination areas
534are expanded to include all of any nodes they overlap.  This is particularly
535useful if the Irouter is being invoked from a script, since it is
536difficult to determine optimal destination areas automatically.
537
538\item {\bfseries penalty}
539Takes on a rational value (default is 1024.0).  It is not strictly
540true that the router searches only within its window.  Paths behind
541the window are also considered, but with cost penalized by the
542product of their distance to the window
543and the penalty factor.  It was originally thought that small
544penalties might be desirable, but experience, so far, has shown that large
545penalties work better.  In particular it is important that the ratio between
546the actual cost of a route and the initial estimate is less than the
547value of {\bfseries penalty}, otherwise the search can explode (take
548practically forever).  If you suspect this is happening, you can set
549{\bfseries verbosity} to {\bfseries 2} to check, or just increase the value
550of {\bfseries penalty}.  In summary it appears that the value of penalty doesn't
551matter much as long as it is large (but not so large as to cause
552overflows).  It will probably be removed in the future.
553
554\item {\bfseries penetration}
555This parameter takes the value {\bfseries AUTOMATIC} or a positive integer.  It
556determines how far into a blocked area the router will
557penetrate to make a connection.  Note however the router will in no case
558violate spacing constraints to nodes not involved in the route.
559
560\item {\bfseries window}
561This parameter takes the value {\bfseries COMMAND} (the default) or a window id
562(small integers).  It determines the reference window for routes.  The router
563sees the world as it appears in the reference window, e.g., it sees the
564contents of subcells expanded in the reference window.  If {\bfseries window}
565is set to {\bfseries COMMAND} the reference window is the one that contained the
566cursor when the route was invoked.  To set the reference window to a fixed
567window, place the cursor in that window and type:
568\starti
569   \ii {\bfseries :iroute wizard window .}
570\endi
571\end{itemize}
572
573\begin{thebibliography}{1}
574   \bibitem{arnold} M.H. Arnold and W.S. Scott,
575	\newblock ``An Interactive Maze Router with Hints'',
576	\newblock {\itshape Proceedings of the 25th Design Automation Conference},
577	\newblock June 1988, pp. 672--676.
578\end{thebibliography}
579
580\end{document}
581