This is a little file I wrote some time ago, intended for
students who want to use magic to do layout for coursework,
and aren't interested in reading the tutorials.  I don't
think many have read it, but rather just asked someone
who's used it how it works.  I tried.  To get the macros
mentioned below, put the dot.magic file into your home
directory as ".magic".  Good Luck

---------------------------------------------------------

Getting started with Magic

Magic is a relatively simple VLSI layout editor.  Unfortunately
Magic is not menu driven; this quick start document just might
give you enough information to get going...

A set of tutorials are available.  The tutorials are available
in the directory ~cad/doc.  Please don't print the tutorials
on the ECE laser printers.

Magic operates with two displays, one for graphics and the other 
for text.  The text display is used for any commands you type in 
and messages that Magic gives you.  In the graphics window will be 
the layout, your cursor, and the box.  You should use X-windows
to run Magic.  If Magic has trouble opening this special graphics
window, try first typing "setenv DISPLAY machine:0" with the name
of your X-windows machine substituted for 'machine'.  You may
also need to type "rhosts +".  Finally, after typing these, try
opening a new xterm (type "xterm &") and then try to run Magic
from with that xterm.

When using Magic, you will typically manipulate the box and then 
issue commands which effect the area within the box.  The box is 
displayed with a thick white line.  You may also select a portion 
of the layout.  Selected layout is shown with thin white lines.  
Most of the commands will operate on the layout specified by some 
combination of the selection, the box, and the position of the 
cursor.  For example, you may fill the area of the box with 
metal2.  You may select all the layout within the box and later 
copy the selected shapes.  Yet another example, you may position 
the box over an area containing many layers, and delete on of the 
layers specified by positioning your cursor over the desired layer 
elsewhere.  The important point to remember is that the various 
layout commands operate on some combination of the layout that is 
selected, the area inside the box, and sometimes the position 
of the cursor.

To give commands to Magic, you can press the buttons on the mouse, 
press single key 'macros' on the keyboard, or type in long 
commands at a prompt.  Most of the common functions in Magic can 
be done with the mouse and keyboard macros, you should not need to 
type in many of the long commands.  Ordinarily, pressing a key 
will execute an entire command.  To type in a command, press the 
colon (: or ;) to get the prompt.

The buttons on the mouse can have several different functions 
depending on which 'tool' is active.  The default tool, and the 
only one discussed here is the 'box' tool.  Pressing the spacebar 
should switch between the tools.  A common difficulty with Magic 
is to switch tools accidentally and find that the mouse isn't 
working anymore.  Pressing space will cycle through the available 
tools until you get the 'box' tool back.

When using the 'box' tool, the right and left mouse buttons are 
used to manipulate the box in the graphics window.   Clicking the 
left button places the lower left corner of the box at the 
position of the cursor.  Clicking the right button places the 
diagonally opposite corner which then defines a new box.  In other 
words, clicking the left mouse button will move the lower left 
corner of the existing box to the position of the mouse.  Clicking 
the right button will redefine the shape of the box.  To make any 
arbitrary box, in general the left and right buttons must be 
clicked in sequence.  However, when drawing layout, one typically 
makes several operations on the same sized area, using only the 
left button to move the existing box to a new location. Some click 
and hold operations exist for manipulating the box, but they are 
not covered here.  To draw boxes as described above, click the 
mouse buttons, but do not hold them down as you move the mouse.

Before describing the function of the middle mouse button, it's a 
good idea to mention that Magic has an undo buffer, which can be 
used to undo many of the recent operations.  To undo mistakes, 
just press 'u' on the keyboard.  It must be lowercase.  Uppercase 
'U' will redo the things you've undone.  The middle button fills 
the area within the box with whatever layers are underneath the 
cursor when it is pressed.  If no layers are underneath the 
cursor, then the area within the box is deleted.  It does not 
matter if the cursor is inside or outside the box nor does it 
matter if anything is selected or not.  If you accidentally touch 
the middle button, don't be alarmed, just press 'u' to undo.

Magic does design rule checking as you draw.  If you make a design
rule violation, it will put a pattern of white dots near where it
found the error(s).  This is can be quite helpful, since you can
fix the error before drawing more pieces around it.  If you see
these white dots, don't be alarmed.  In all likelyhood, the next
shape you are about to draw will fix it.

Most of the basic command in Magic can be executed using keyboard
macros.  Many of the default macros are listed below.  You can add
your own macros by placing them in a file named .magic in your
home directory.  If you define a macro which conflicts with the
default, your terminal will explode (just kidding) your macro
will be use instead of the default.

Now that you've got the functions of the buttons on the mouse and
the keys on the keyboard, you ought to be ready to give Magic a
try.  More documentation can be found in ~cad/doc.  The tutorials
cover Magic's features in great detail.  Many other files are
likely to be found in this directory describing solutions to 
common problems.

Good Luck.  I hope this has helped.  --Paul  (paul@ece.orst.edu)


Key Command          Explaination
 u  :undo             Will undo your mistakes.  Can undo many steps back.
 U  :undo             Will redo the mistakes.
 b  :box              Tells you the size of the box, good for measuring.
 v  :view             View the entire layout
 z  :findbox zoom     Zooms in to view the area inside the box.
 +  :zoom .75         Zoom in
 -  :zoom 1.33        Zoom out
 y  :drc why          Why is that a DRC error?  You must put the box over
			the pattern of white dots you're interested in.
 ?  :help             Prints out some fairly cryptic help.  For more
			cryptic help, try looking at the man pages.
			For easy to read help, look in ~cad/doc
ctrl-d  :erase $      Often times you need to erase a piece of something
			but it's inbetween lots of other things.  Draw
			a box over the section you want to erase, then
			put the mouse over an area with only the layer
			you're interested in, and press ctrl-d.
 x  :expand           Expand a sub-cell to see its layout
 X  :unexpand         Maybe you didn't want to see it afterall
 s  :select           Selects the nearest shape.  If pressed multiple
		        times will select electrically connected shapes.
			This is a VERY easy way to check your layout.
 a  :select area      Selects everything under the box.  To unselect
			you can draw a box on nothing and press a.
 d  :delete           deletes whatever is selected
 q  :move left 1      Moves whatever you've selected left by 1 lambda
 w  :move down 1      Moves whetever you've selected down by 1 lambda
 e  :move up 1        Moves whatever you've selected up by 1 lambda
 r  :move right 1     Moves whatever you've selected right by 1 lambda
 Q  :stretch left 1   Stretches the selected layout left by 1 lambda
 W  :stretch down 1   Stretches the selected layout down by 1 lambda
 E  :stretch up 1     Stretches the selected layout up by 1 lambda
 R  :stretch right 1  Stretches the selected layout right by 1 lambda
 1  :paint ndiff      Fills the box with N-Diffusion, for N transistors
 !  :paint pdiff      Fills the box with P-Diffusion, for P transistors
 2  :paint poly       Fills the box with poly
 @  :paint poly2      Fills the box with poly2 (used for capacitors)
 3  :paint metal1     Fills the box with metal1
 #  :paint via        Fills the box with via -- Magic will fill all via
			and contact areas with the maximum number of
			correctly sized and spaced via/contact cuts,
			when it generates CIF or Calma output for fab!
 4  :paint metal2     Fills the box with metal2
 $  :paint via        Also fills the box with via (metal1 to metal2)
 5  :paint ndc        Fills the box with contacts from metal1 to N-Diff.
			Note: ok to stretch transistors without redrawing
			these contact areas.  Magic does the dirty work.
 %  :paint pdc        Fills the box with contacts from metal1 to P-Diff.
 6  :paint pc         Fills the box with contacts from metal1 to Poly
 ^  :paint p2c        Fills the box with contacts from metal1 to Poly2
 7  :paint pwc        Fills the box with contacts from metal1 to pwell
			Note: use plenty of these near your N transistors
 &  :paint nwc        Fills the box with contacts from metal1 to nwell
			Note: use plenty of these near your P transistors
 <  :dump n_ch_tran   Puts a N transistor at the location of the box
 >  :dump p_ch_tran   Puts a P transistor at the location of the box

