Magic

From Vlsiwiki
Revision as of 20:53, 10 March 2015 by Mrg (Talk | contribs) (Starting Magic, Text and Graphics Windows)

Jump to: navigation, search

Magic is an interactive system for creating and modifying VLSI circuit layouts. With Magic, you use a color graphics display and a mouse to design basic cells and to combine them hierarchically into larger structures. Magic has built-in knowledge of layout rules - as you are editing, it continuously checks for rule violations. It has a built-in circuit extractor: from the layout, the extractor creates an output file suitable for use with circuit simulation tools such as Spice (for detailed, mixed-signal simulation) or IRSIM (for digital simulation).

Starting Magic, Text and Graphics Windows

Magic must be run from a workstation that supports the Unix X Windows system (although it can be easily compiled for Linux or OSX at home is also available in Macports). It is *highly* recommended that you have a three button mouse for X Windows programs. Once you login to the Unix machine that runs Magic and setup your environmental variables (using source magic.cshrc), Magic is started by the shell command:

   prompt> magic [-Ttechnology] [file without .mag extension]

where technology is the name of the fabrication technology that the design is intended for, and file is the name of the file that you edit. You could type any file name for file, and Magic would start editing that file. If a file with this name does not exist, Magic will create it. If the technology option is omitted, the layout is done in a default technology. Fortunately, I have set up the default technology as AMI C5N 0.5u which is the technology we plan on using for this class. Therefore, just invoking magic is sufficient. If you wish to learn how to set up the default technology, feel free to contact me.

After starting Magic, a graphics (paint) window pops up, and a ">" prompt appears in the text (shell) window. Magic starts editing the file.

Magic is not a menu-driven program: the layout shows up in the graphics window, but all commands must be entered in the text window. The graphics window is an ordinary X window, and can be moved and resized using the mouse. With a two-button mouse (on a PC with X-server), pressing both buttons at the same time is equivalent to pressing the middle button (which is available on Unix systems). The graphics window is where you draw your layout. To work in this window, move the cursor to the window and click the left mouse button. This makes the graphics window active. The mouse should always point to the graphics window.

The text window is the same window from which you started Magic. It is convenient to position this window under the graphics window so that both windows are visible at the same time. All commands you want to invoke should be typed in the text window. All error messages are also displayed in this window. Commands can be invoked in Magic in three ways:

  1. By pressing buttons on the mouse;
  2. By typing long commands on the keyboard at the prompt ">" in the text window. The long commands are preceded by a colon :
  3. By typing single-character macros on the keyboard at the prompt ">" in the text window.

Before trying to use any command, make sure you have the graphics window active and that the mouse cursor is pointing to the active graphics window. The commands show up in the text window, but affect only the active graphics window.

Scalable Design, Lambda and the Grid

Magic uses what is called scalable or "lambda-based" design. In scalable design, layout items are aligned to a grid which represents a basic unit of spacing. For a particular technology, lambda represents an actual distance (e.g., lambda = 0.3 um for the AMI C5N 0.5u SCMOS technology. However, in Magic all designs are done in terms of lambda, not in terms of actual distances. The paint window is a layout surface on which items can be placed with a resolution of one lambda.

Magic has a grid which can be set to an arbitrary multiple of lambda. The default value of this grid is one lambda by one lambda. The grid of n lambda by n lambda can be displayed using the :grid n command. The g macro toggles the grid on and off.

The Cursor and the Tools

The mouse cursor is used to select, point to, and manipulate objects on the graphics window. The shape of the cursor indicates which of the four available tools is currently being used. Pressing the space bar macro toggles between the 4 tools available:

The box tool is sufficient for basic editing. The purpose of the box tool is to specify a rectangular area of the layout for editing. The left and right mouse buttons are used to position the box. If you click on the left mouse button, the box will move so that its lower left corner is at the cursor position. If you click on the right mouse button, the upper right corner of the box will move to the cursor position, but the lower left corner will not change. The two mouse clicks are sufficient to position the box with arbitrary size anywhere on the screen.