Magic Frequently Asked Questions

bug or comment to pgolani@usc.edu

FAQ : Magic IRSIM HSPICE PowerView Verilog Cadence Misc

CAD Home

Q: Where are the magic tutorials?

The exact tutorials can be found at www.hpl.hp.com/techreports/Compaq-DEC/WRL-90-7.pdf

Q: How can I add a directory to the magic search path?

Everytime you start magic it looks for a .magic file in $CAD_HOME/lib/magic/sys/, your home dir, and the dir that you invoked magic from. Edit the .magic file in your working(or home) dir and add the line

:addpath DIR_TO_ADD

For example, say I wanted to add hw1 dir to the search path so that I can use inverter in hw2. I would add the line

:addpath ~/ee577/hw1

If your hw1 directory has inverter1.mag file, then you can use this layout as if it is located in hw2 directory (getc,load,etc).

Q: When I bring up magic, it says that I am running version 6.4.4. I thought we were using 6.5. I have sourced the ~ee577/vlsi_setup.csh file. What gives?

You have /usr/usc/cad/bin in your path before ~ee577/cad/bin. There is an older version of magic located in /usr/usc/cad/bin. Edit your .cshrc so that ~ee577/cad/bin appears before /usr/usc/cad/bin in your path. Best way to resolve this problem is to delete /usr/usc/cad/bin path from your .cshrc file because we don't use any of programs in that directory.

Q: I'm in magic and trying to access the layout window(s) with the mouse I keep clicking and clicking, but nothing happens. Has magic crashed?

Maybe, but maybe not. Make sure that there is not a ":" on the text entry screen. If there is, it means that magic is waiting for you to finish entering your text command. Just hit return, and the layout window will respond normally again.

Q: I try to type a text command (not a macro) into magic, and it goes crazy and does a bunch of weird stuff.

You might have forgotten to put a ":" before entering the text command. You enter macros (e.g. z for zoom) without the ":", but text commands must have the ":" (e.g. :open /usr/class/ee271/palette). Otherwise magic interprets each text command letter as a separate macro. Hence the bunch of weird stuff that happens.

Q: When I activate the grid all I see is a single black dot. This does not make me happy ...

You are zoomed too far out, and magic cannot display the grid lines because they are too close together. Try zooming into the layout. The black dot that you see is the origin of the coordinate system.

Q: I want to edit this layout, but everytime I try Magic says: "The box isn't in a window on the edit cell." Help!!

You need to make the cell you want to edit the edit cell. Do this by putting the cursor in that window over empty space. Now type the s macro to select the entire cell. Now type :edit. That cell is now the edit cell.

If you look at the title bar of the layout windows you will either see a little message indicating which cell is the edit cell.

Q: How can I print out my magic layout?

See pplot basic usage or pplot man page.

Q: When I generate a .cif file, I get a "parent-child don't agree" error. What is the problem?

The problem is a quirk of magic. Magic bloats the diffusions (normal diff and well contacts) to be a little larger than what you specify. The way that the hierarchy works in magic, an upper level cannot remove paint from a lower level. What has happened is that the diff bloat in a lower level (child) conflicts with some feature on the upper level (parent).

Say in the child, you have some n-diff for a transistor. In the parent, you put a well contact (p+ diff) right next to that n-diff. In the child, the n-diff is bloated around the drawn feature. In the parent the well contact precludes the well bloat in that area. Thus there is a conflict.

You will have to modify the cell in some way so that this does not happen. In the example above, the easiest thing to do would be to move the well contact into the child.

Q: When I extract my layout magic says I have warnings. What are these warnings and how can I fix them?

These warnings usually have to do with labelling. Magic paints little white hash marks over the area that causes the warnings. You can use the command ":feedback find" to list out the warnings one by one (repeat the command for the next warning). Magic will put the box over the warning, so you can just do a zoom box (macro z) to locate the warning area.

The command ":feedback clear" will clear away all of the white hash mark area. Magic won't do this automatically after you fix the warning, so you will have to do it manually.

For a more complete list of commands dealing with feedback do ":feedback help".

Q: Is there a command for repeat-last-command?

The macro "." will repeat the last command.

Q: Is there online help?

The command ":help" will list out all the commands available in magic. If you want help on a specific command you can do a ":command help", replacing command with the desired command. For instance, ":drc help".

Q: Labelling is a real pain. I have to type ":label" every time. Is there an easier way?

You can use the netlist window for faster labelling. Look in the magic tutorials for a full explanation. Basically all you need to do is enter the command ":spec netlist". This will open up the netlist menu.

Left click on the label field, and enter all of the labels that you want to use. For multi-line buses, you only need to enter one of the bits (Bus_v1[0]), and you can increment the number from inside the netlist menu. End your list with a blank line.

Now you can place labels by clicking in the grey grid. Where you click in the grid determines where the label text is placed relative to the layout box.

Q: I am a lazy person. Do I really have to type whole commands?

You only need to type in as much of the command as it requires for magic to determine uniquely what that command is. So for the command "specialopen", the minimum that you need to type in is "sp". Since there are numerous other commands that start with "s", just typing "s" is not sufficient, but no other command begins with "sp".

Q: I just erased all of my .mag files. Is there any way to recover my layout from the other files?

First, you can frantically notify UCS people and see if you can get a copy of your files from the last time they were backed up. You probably won't get the most recent copy back, but you will get something.

Next, if you have the .cif specification of your design, you can read that back into magic, and restore the layout. You have to set the cif input style to whatever the output style you used was. The command would look something like ":cif istyl lambda=1.0(nwell)". Now you need to read in your .cif file with ":cif read file", replacing file with the file name.

Q: How do I make a cool layout like the palette that shows no DRC errors even though there are errors?

If you just want to see no error paint, you can issue the command :see no error. If you want to create a cell like the palette, that never shows error paint, you need to first create the cell. Then use a text editor to delete all lines in the .mag file that are for error paint and check paint (error_p,check_p). Now as long as you don't edit the cell again, magic will assume that the cell has been checked for DRC errors, and not check again.

Q: How do we move parts of the layout without breaking the connections?

First you have to select the part you want to move. You do that by pacing the box over the area to select and type "a" (select area). Then you can move the selected area by pressing Q(left), W (down), E (up) and R(right). Shift + one of these keys moves the area without braking the connections.

Q: Are two different layers automatically assumed connected when they are next to one other?

No, the connection between two different layers is defined only by a contact. For example, a pdiff area and metal1 line are not assumed connected when they touch unless there is a metal-to-pdiff contact.

Q: Why the substrate contact next to the p-type transistor is of n-type?

The substrate contact (or tub-tie) is in fact connecting the power line with the substrate, which in this case is of n-type.

Q: Is there a way to know the size of the layout without actually counting the boxes of the grid?

Yes, there is a command in Magic called ":box" (or "b" bindkey) which returns the size of the box. If you place the box over your design, this command will actually return the size of your cell.

Q: How can I fit my layout in the Magic window?

Just use the "v" bindkey(view). You can also zoom in and out using "z" or "Z" bindkeys.