MAGIC(1)

πŸ¦‹ MAGIC(1) πŸ¦‹ β€” the General Commands Manual one, section 1, no cap

okay bestie, sit down, hydrate, because this is THE page. We're talking magic, and it's a whole vibe.


✨ NAME ✨

magic β€” VLSI layout editor πŸ’…


🌸 SYNOPSIS 🌸

magic [ -T technology ] [ -d device_type ] [ -g graphics_port ] [ -m monitor_type ] [ -D ] [ file ]

πŸ’– DESCRIPTION πŸ’–

Magic is an interactive editor for VLSI layouts and it runs under all variants of UNIX, including Mac OS-X and Cygwin. Like, all of them. Iconic behaviour honestly.

This man page is a reference manual β€” so if this is your first time touching Magic, bestie, please go do the Magic tutorials first to get acquainted with the system (check the online resources links below, iykyk).

Magic uses two windows: one for text, and a separate window for displaying layouts. It runs under the window system X11 (and using it under Cygwin requires the presence of an X11 server in Windows β€” the server that comes packaged with Cygwin works well, so that's your girl). The command line switch -d can be used to tell Magic which kind of display you are running. Specifically, this is useful to tell magic to use OpenGL graphics instead of plain X11 (-d OGL), or to use 24 bit plane graphics instead of 8 bit planes (-d 24BITS) if both are available on a video card with overlay support. πŸ”₯

Here are the options accepted by Magic:

  • -T β€” The next argument is the name of a technology. The tile types, display information, and design rules for this technology are read by Magic from a technology file when it starts up. The technology defaults to scmos. (That's double-backtick quoted in the original, and we respect the ancestors.)
  • -d β€” The next argument is the type of workstation or graphics display being used. Magic supports these types:
    • NULL β€” A null device for running Magic without using a graphics display, like for a batch job. πŸ“ Heads up though: the special case -dnull (lowercase, no space) has a more streamlined startup specifically for batch processing. Not the same thing, don't mix them up.
    • X11 β€” X-windows, version 11. This is the preferred interface. ✨ Magic acts as a client to the X window server and interfaces to all graphics terminals supported by the X server.
    • OGL β€” OpenGL graphics running under X11. This is the preferred interface on systems having hardware-accelerated 3D graphics video cards and drivers. πŸ”₯

Addition information on Magic's X11 driver, including options for .Xdefaults files, may be found in ``Magic Maintainer's Manual #4: Using Magic Under X Windows''. (yes, "Addition" β€” that's what the original says, we don't edit the elders 🫢)

  • XWIND β€” Simply another name for the X11 driver. Just an alias, a little nickname, we love her.

If no device is specified, Magic tries to guess which driver is appropriate (by checking the environment variables and by poking around in /dev). She's nosy like that. πŸ‘€


When Magic starts up it looks for a command file in ${CAD_ROOT}/magic/sys/.magicrc and processes it if it exists. Then Magic looks for a file with the name ``.magicrc'' in the home directory and processes it if it exists. Finally, Magic looks for a .magicrc file in the current directory and reads it as a command file if it exists. The .magicrc file format is described under the source command. If magic is compiled with Tcl/Tk support, then any magic or Tcl/Tk commands may be used inside the startup file. πŸŽ€

The startup file name was changed to .magicrc to avoid conflicts with a common system file named .magic. However, the name .magic will be searched after .magicrc for backward compatibility. (Legacy support, we stan a considerate queen.)


πŸ‘‘ COMMANDS -- GENERAL INFORMATION πŸ‘‘

Magics uses types of commands: Key macros and long commands. (Yes, "Magics". The original said it. We're keeping it. It's giving typo-but-make-it-fashion.)

The first form consists of single-key (or button) abbreviations called ``macros''; macros are invoked by pressing a single key or mouse button. Certain macros are predefined in the systemwide ${CAD_ROOT}/magic/sys/.magicrc file, but you can override them and add your own macros using the macro command (described below under COMMANDS FOR ALL WINDOWS). The special macro . is reserved to mean "execute the last typed long command". ⭐

You can enter long commands in the terminal console at the console prompt, or from the layout window by typing a : or ; key, which are the two other reserved macros meaning "switch keyboard focus to the console window". After typing the : or ; key, type the text of the command, which will be written to the terminal window. Multiple commands may be specified on one line by separating them with semicolons. 🫢

Most commands deal with the window underneath the cursor, so if a command doesn't do what you expect make sure that you are pointing to the correct place on the screen. (Cursor placement is the whole personality of this program, fr.) There are several different kinds of windows in Magic (layout, color, and netlist); each window has a different command set, described in a separate section below.


πŸŽ€ MOUSE BUTTONS FOR LAYOUT WINDOWS πŸŽ€

Magic uses a three button mouse. The buttons are interpreted in a way that depends on the current tool, as indicated by the shape of the cursor (see the tool command). The various tools are described below. The initial tool is box. These interpretations apply only when mouse buttons are pressed in the interior of a layout window. πŸ“

🌈 Box Tool

This is the default tool, and is indicated by a crosshair cursor. It is used to position the box and to paint and erase:

  • left β€” This button is used to move the box by one of its corners. Normally, this button picks up the box by its lower-left corner. To pick the box up by a different corner, click the right button while the left button is down. This switches the pick-up point to the corner nearest the cursor. When the button is released, the box is moved to position the corner at the cursor location. If the box has been set to snap to the window's grid (see the :snap command), then the box corner is left aligned with the grid that the user has chosen for the window with the :grid command, even if that grid is not visible. πŸ’…
  • right β€” Change the size of the box by moving one corner. Normally this button moves the upper-right corner of the box. To move a different corner, click the left button while the right button is down. This switches the corner to the one nearest the cursor. When you release the button, three corners of the box move in order to place the selected corner at the cursor location (the corner opposite the one you picked up remains fixed). Snapping to the window's grid is handled as for the left button.
  • middle (bottom) β€” Used to paint or erase. If the crosshair is over paint, then the area of the box is painted with the layer(s) underneath the crosshair. If the crosshair is over white space, then the area of the box is erased. πŸ–ŒοΈ

πŸ¦‹ Wiring Tool

The wiring tool, indicated by an arrow cursor, is used to provide an efficient interface to the wiring commands:

  • left β€” Same as the long command wire type.
  • right β€” Same as the long command wire leg.
  • middle (bottom) β€” Same as the long command wire switch.

πŸ’œ Netlist Tool

This tool is used to edit netlists interactively. It is indicated by a thick box cursor.

  • left β€” Select the net associated with the terminal nearest the cursor.
  • right β€” Find the terminal nearest the cursor, and toggle it into the current net (if it wasn't already in the current net) or out of the current net (if it was previously in the net).
  • middle (bottom) β€” Find the terminal nearest the cursor, and join its net with the current net.

πŸ“ Rsim Tool

Used when running the IRSIM simulator under Magic. A pointing hand is used as the cursor.

  • left β€” Moves the box just like the box tool.
  • right β€” Moves the box just like the box tool.
  • middle (bottom) β€” Displays the Rsim node values of the selected paint.

πŸ”₯ LONG COMMANDS FOR LAYOUT WINDOWS πŸ”₯

These commands work if you are pointing to the interior of a layout window. Commands are invoked by typing a colon (:) or semi-colon (;), followed by a line containing a command name and zero or more parameters. In addition, macros may be used to invoke commands with single keystrokes. Useful default macros are set in the global .magicrc file (in ${CAD_ROOT}/magic/sys, normally /usr/local/lib/magic/sys). You can list all current macros with the macro command, described under ``LONG COMMANDS FOR ALL WINDOWS''. Unique abbreviations are acceptable for all keywords in commands. πŸ‘‘

The commands are:

  • addpath searchpath β€” Add more directories to the end of Magic's cell search path. See the documentation for the path command for an explanation of the search path.
  • array xsize ysize β€” Make many copies of the selection. There will be xsize instances in the x-direction and ysize instances in the y-direction. Paint and labels are arrayed by copying them. Subcells are not copied, but instead each instance is turned into an array instance with elements numbered from 0 to xsize-1 in the x-direction, and from 0 to ysize-1 in the y-direction. The spacing between elements of the array is determined by the box x- and y-dimensions. πŸ”
  • array xlo ylo xhi yhi β€” Identical to the form of array above, except that the elements of arrayed cells are numbered left-to-right from xlo to xhi and bottom-to-top from ylo to yhi. It is legal for xlo to be greater than xhi, and also for ylo to be greater than yhi. (Yes, you can go backwards. She supports your chaos. πŸ’€)
  • box [args] β€” Used to change the size of the box or to find out its size. There are several sorts of arguments that may be given to this command:
    • (No arguments.) β€” Show the box size and its location in the edit cell, or root cell of its window if the edit cell isn't in that window.
    • direction [distance] β€” Move the box distance units in direction, which may be one of left, right, up, or down. Distance defaults to the width of the box if direction is right or left, and to the height of the box if direction is up or down.
    • width [size]
    • height [size] β€” Set the box to the width or height indicated. If size is not specified the width or height is reported.

okay so for the coordinate-flavored version of that move:

  • x1 y1 x2 y2 β€” moves the box so it lands on those exact coordinates πŸ’… these are in edit cell coordinates if the edit cell is in the window under the cursor, otherwise they're in the root coordinates of the window. x1 and y1 are the coords of the lower left corner of the box, and x2 and y2 are the upper right corner. And bestie, the coordinates must all be integers β€” no decimals, no vibes, integers only ✨

🧚 calma [option] [args] 🧚

This one reads and writes files in Calma GDS II Stream format (version 3.0, which corresponds to GDS II Release 5.1). It's like CIF in that it describes physical mask layers instead of Magic layers β€” and yes, the technology file is the one holding the correspondence between CIF and Calma layers 🫢 The current CIF output style (peep cif ostyle) controls how Calma stream layers get generated from Magic layers.

If you give it no arguments, calma generates a Calma stream file for the layout in the window beneath the cursor, written to file.strm, where file is the name of the root cell πŸ‘‘ This stream file describes the entire cell hierarchy in the window, and the name of the library is the same as the name of the root cell. But option and args can invoke one of several additional operations:

  • calma flatten β€” normally Magic arrays get output using the Calma ARRAY construct, but after a calma flatten they get output as a collection of individual cell uses instead, exactly like what happens when writing CIF πŸ¦‹
  • calma help β€” prints a short synopsis of all the calma command options πŸ’–
  • calma labels β€” outputs labels whenever writing a Calma output file ✨
  • calma lower β€” allows both upper and lower case to be output for label text. This is the default behavior; calma nolower makes lower case get converted to upper case on output 🌸
  • calma noflatten β€” undoes the effect of a prior :calma flatten command, re-enabling the output of Magic arrays using the Calma ARRAY construct πŸ’…
  • calma nolabels β€” don't output labels when writing a Calma output file πŸ™ˆ
  • calma nolower β€” converts lower case to upper case when outputting labels 🌈
  • calma read file β€” reads in file.strm in Calma format and converts it to a collection of Magic cells. The current CIF input style determines how the Calma layers get converted to Magic layers. The new cells are marked for design-rule checking. Calma format does not identify the root of the collection of cells read in, so none of the cells read will appear on the display β€” use load to make them visible πŸ‘€ If the Calma file had been produced by Magic, then the name of the root cell is the same as the library name printed by the :calma read command πŸ’«
  • calma write fileName β€” writes a stream file just as if no arguments had been entered, except the output goes into fileName.strm instead of using the root cell name for the file name πŸŽ€

πŸŽ€ channels πŸŽ€

This command runs just the channel decomposition part of the Magic router, deriving channels for the area under the box πŸ”₯ The channels get displayed as outlined feedback areas over the edit cell. slay.


πŸ’– cif [option] [args] πŸ’–

Reads or writes files in Caltech Intermediate Form (CIF). With no arguments, it generates a CIF file for the window beneath the cursor in file.cif, where file is the name of the root cell. The CIF file describes the entire cell hierarchy in the window πŸ‘‘ Option and args can invoke one of several additional CIF operations:

  • cif arealabels [yes | no] β€” enables/disables the cif area-label extension. If enabled, area labels are written via the 95 cif extension. If disabled, labels are collapsed to points when writing cif and the 94 cif construct is used. Area-labels are disabled by default (many programs don't understand cif area-labels, smh) πŸ’€
  • cif help β€” prints a short synopsis of all of the cif command options ✨
  • cif istyle [style] β€” selects the style to be used for CIF input. If no style argument is provided, Magic prints the names of all CIF input styles defined in the technology file and identifies the current style. If style is provided, it becomes the current style πŸ¦‹
  • cif ostyle [style] β€” selects the style to be used for CIF output. If no style argument is provided, Magic prints the names of all CIF output styles defined in the technology file and identifies the current style. If style is provided, it becomes the current style πŸ’…
  • cif read file β€” reads in file.cif in CIF format and converts it to a collection of Magic cells. The current input style determines how the CIF layers get converted to Magic layers. The new cells are marked for design-rule checking. Any information in the top-level CIF cell is copied into the edit cell πŸ‘€
⚠️ note: this command is not undo-able (it would waste too much space and time to save information for undoing). no take-backs, bestie 😭
  • cif see layer β€” in this command layer must be the CIF name for a layer in the current output style. Magic displays on the screen all the CIF for that layer that falls under the box, using stippled feedback areas. It's a bad idea to look at CIF over a large area, since this command requires the area under the box to be flattened and therefore is slow 🐌
  • cif statistics β€” prints out statistics gathered by the CIF generator as it operates. This is probably not useful to anyone except system maintainers πŸ™ˆ
  • cif write fileName β€” writes out CIF just as if no arguments had been entered, except the CIF goes into fileName.cif instead of using the root cell name for the file name. The current output style controls how CIF layers are generated from Magic layers ✨
  • cif flat fileName β€” writes out CIF as in the cif write command, but flattens the design first (e.g. creates an internal version with the cell hierarchy removed). This is useful if you wish to use the and-not feature of the CIF output styles but are having problems with interactions of overlapping cells 🌸

πŸ¦‹ clockwise [degrees] πŸ¦‹

Rotates the selection by 90, 180 or 270 degrees πŸ’« After the rotation, the lower-left corner of the selection's bounding box will be in the same place as the lower-left corner of the bounding box before the rotation. Degrees defaults to 90. If the box is in the same window as the selection, it gets rotated too. Only material in the edit cell is affected πŸ‘‘


πŸ‘‘ copy [direction [amount]]

πŸ‘‘ copy to x y

If no arguments are given, a copy of the selection is picked up at the point lying underneath the box lower-left corner, and placed so that this point lies at the cursor position 🫢

If direction is given, it must be a Manhattan direction (e.g. north β€” see the DIRECTIONS section below). The copy of the selection is moved in that direction by amount. If the box is in the same window as the selection, it's moved too. Amount defaults to 1.

The second form of the command behaves as though the cursor were pointing to (x, y) in the edit cell; a copy of the selection is picked up by the point beneath the lower-left corner of the box and placed so that this point lies at (x, y) ✨


🌈 corner direction1 direction2 [layers] 🌈

Similar to fill, except it generates L-shaped wires that travel across the box first in direction1 and then in direction2 πŸ”₯ For example, corner north east finds all paint under the bottom edge of the box and extends it up to the top of the box and then across to the right side of the box, generating neat corners at the top of the box πŸ’…

The box should be at least as tall as it is wide for this command to work correctly. Direction1 and direction2 must be Manhattan directions (see the DIRECTIONS section below) and must be orthogonal to each other. If layers is specified, then only those layers are used; otherwise all layers are considered πŸŽ€


πŸ’œ delete πŸ’œ

Deletes all the information in the current selection that is in the edit cell πŸ’€ When cells are deleted, only the selected use(s) of the cell is (are) deleted: other uses of the cell remain intact, and so does the disk file containing the cell. Selected material outside the edit cell is not deleted. iykyk 🫢


⭐ drc option [args] ⭐

This command is used to interact with the design rule checker. Option and args (if needed) invoke a drc command in one of the following ways:

  • drc catchup β€” lets the checker process all the areas that need rechecking. This command will not return until design-rule checking is complete or an interrupt is typed ⌨️ The checker will run even if the background checker has been disabled with drc off πŸ”₯
  • drc check β€” marks the area under the box for rechecking in all cells that intersect the box. The recheck occurs in the background after the command completes. This command isn't normally necessary, since Magic automatically remembers which areas need to be rechecked β€” it should only be needed if the design rules are changed πŸ¦‹
  • drc count β€” prints the number of errors in each cell under the box. Cells with no errors are skipped πŸ™ˆ
  • drc find [nth] β€” drops the box right on top of the nth error area in whichever cell is selected (or the edit cell if nothing's selected), and then spills the tea about that error exactly like drc why would πŸ’…. Don't pass nth (or pass something less than 1) and it just hops to the next error area. Call it over and over and it cycles through every error tile in the cell, no cap. Multiple cells selected? It goes with the upper-leftmost one. Nothing selected at all? Edit cell it is 🫢.
  • drc help β€” prints a lil' synopsis of all the drc command options. Very demure, very helpful ✨.
  • drc off β€” turns the background checker OFF 😴. From this moment on, Magic will not recheck design rules immediately after each command β€” but bestie, it does still record the areas that need rechecking, so you can bring the checker back with drc on.
  • drc on β€” turns the background checker back ON πŸ”₯. It'll check whatever modifications haven't already been checked, and from now on it'll reverify modified areas as they come out of your commands. Important vibe: the checker runs in the background, not synchronously with commands, so it can get temporarily behind if you're making massive changes. She's doing her best, okay 😭.
  • drc printrules [file] β€” prints out the compiled rule set into file, or straight to the text terminal if you don't give a file. For system maintenance only, so like... not your casual Tuesday 🧚.
  • drc rulestats β€” prints summary statistics about the compiled rule set. Primarily meant for writing technology files πŸ‘‘.
  • drc statistics β€” prints the statistics the design-rule checker keeps. For each statistic you get two values: the count since the last time you invoked drc statistics, and the total count for this editing session. Also primarily for system maintenance. Two numbers, zero judgement πŸ’€.
  • drc why β€” rechecks the area underneath the box and prints out the reason for each violation it finds. Heads up: because this causes a recheck, you should normally keep the box around a small area (like an error area). Big box, big oops 🌸.
  • dump cellName [child refPointC] [parent refPointP] β€” copies the contents of cell cellName into the edit cell so that refPointC in the child lands on point refPointP in the edit cell πŸŽ€. Those reference points can be either the name of a label β€” in which case the lower-left corner of the label's box is the reference point β€” or a pair of numbers giving the (x, y) coordinates explicitly. No refPointC? It uses the lower-left corner of the cellName cell. No refPointP? It uses the lower-left corner of the box tool (and yes, the box has to be in a window on the edit cell for that). Once this command finishes, the new information is selected ✨.
  • edit β€” makes the selected cell the edit cell and edits it in context. The edit cell normally shows up in brighter colors than everything else (peep the see command if you wanna change that πŸ‘€). If more than one cell is selected, or the selected cell is an array, the cursor position decides which one becomes the new edit cell. And generally speaking, Magic commands only ever modify the current edit cell. Main character only πŸ’….
  • erase [layers] β€” for the area enclosed by the box, erases all paint in layers. (Layer list syntax lives in the ``LAYERS'' section, iykyk.) Leave layers out and it defaults to *,labels. Wanna know which layer names actually exist? Check your technology manual, or just run the layers command πŸ¦‹.
  • expand [toggle] β€” if you hand it the keyword toggle, every selected cell that's unexpanded gets expanded and every selected cell that's expanded gets unexpanded. So satisfying πŸŽ€. If toggle isn't given, then all the cells underneath the box get expanded recursively until there's nothing but paint under the box. Zero hierarchy, all vibes.
  • extract option [args] β€” extracts a layout, producing one or more hierarchical .ext files that describe the electrical circuit your layout actually implements ⚑. The current extraction style (see extract style below) decides the parameters for parasitic resistance, capacitance, etc. that get used. Run extract with no parameters and it checks timestamps and re-extracts as needed to bring all .ext files up-to-date for the cell in the window beneath the crosshair, plus all cells beneath it. If errors pop up during circuit extraction, Magic shows them with stippled feedback areas over the area of the error, along with a message telling you what kind of error it is πŸ”₯. Option and args work like this:
    • extract all β€” every cell in the window beneath the cursor gets re-extracted, regardless of whether it's changed since the last extraction. No skipping, we do the work πŸ’ͺ.
    • extract cell name β€” extracts only the currently selected cell, putting the output in the file name. If more than one cell is selected, it uses the upper-leftmost one.
    • extract do [ option ]
    • extract no option β€” enable or disable the various options governing how the extractor works. Use :extract do with no arguments to print a list of available options and their current settings πŸ‘‘. When the adjust option is enabled, the extractor computes compensating capacitance and resistance whenever cells overlap or abut; disabled, it skips those adjustments but runs faster πŸƒ. If capacitance is enabled, node capacitances to substrate (perimeter and area) are computed; otherwise all node capacitances are set to zero. Same energy with resistance β€” it governs whether node resistances get computed at all. The coupling option controls whether coupling capacitances are computed; if it's disabled, flat extraction is significantly faster than with coupling capacitance computation enabled. And finally, the length option decides whether pathlengths in the root cell are computed (see extract length below).
    • extract help β€” prints a short synopsis of all the extract command options ✨.
    • extract length [ option args ] β€” gives you several options for controlling which point-to-point path lengths get extracted explicitly. The extractor keeps two internal tables: one of drivers, a.k.a. places where a signal is generated, and one of receivers, a.k.a. places where a signal is sent πŸ“‘. The components of each table are hierarchical label names, defined via the two commands extract length driver name1 [name2 ...] and extract length receiver name1 [name2 ...]. If pathlength extraction is enabled (:extract do length), then when the root cell in an extract command is being extracted, the extractor computes the shortest and longest path between each driver and each receiver on the same electrical net, and outputs it to the .ext file for the root cell. Normally you'd make a file of these Magic commands for the circuit drivers and receivers you care about and use source to read it in before circuit extraction β€” big brain move 🧠. And extract length clear removes all the entries from both the driver and receiver tables. Clean slate πŸ’….
    • extract parents β€” extracts the currently selected cell and all of its parents. All of its parents have to be loaded for this to work correctly, no cap. If more than one cell is selected, it uses the upper-leftmost one.
    • extract showparents β€” like extract parents, but it only prints the cells that would be extracted; it doesn't actually extract them. Just a lil' preview, no commitment πŸ™ˆ.
    • extract style [style] β€” picks the style used for extraction parameters. Give no style argument and Magic prints the names of all extraction parameter styles defined in the technology file and identifies the current one. Give a style and it becomes the current style πŸ‘‘.
    • extract unique [#] β€” for each cell in the window beneath the cursor, checks that no label is attached to more than one node. If the # keyword was not specified, then whenever a label is attached to more than one node, the labels in all but one of the nodes get changed by appending a numeric suffix to make them unique ✨. If the # keyword is specified, only names that end in a #'' are made unique; any other duplicate nodenames that don't end in a !'' are reported by leaving a warning feedback area 🚨. This command exists for converting old designs that were intended for extraction with Mextra, which would automatically append unique suffixes to node names when they appeared more than once. Vintage behavior, vintage drama πŸŽ€.
    • extract warn [ [no] option | [no] all ] β€” the extractor always reports fatal errors. This command controls which types of warnings get reported. Option can be one of the following: dup, to warn about two or more unconnected nodes in the same cell that share a name; fets, to warn about transistors with fewer than the minimum number of terminals; and labels, to warn when nodes aren't labeled in the area of cell overlap πŸ‘€. On top of that, all refers to all warnings. If a warning is preceded by no, it's disabled. To disable all warnings, use extract warn no all''. And to see which warning options are currently in effect, use extract warn''. Vibe check your warnings, bestie πŸ’–.
  • extresist [cell [threshold] ] β€” bestie this is the glow-up postprocessor for your resistance numbers πŸ’… It takes the resistance calculation that the circuit extractor already did and makes it better. Here's the whole ritual, in order:
    1. Extract the design rooted at cell using :extract cell 🫢
    2. Flatten it with ext2sim(1), which hands you the files cell.sim and cell.nodes ✨
    3. Run :extresist cell β€” this spits out a file called cell.res.ext containing the differences between the network described by the .ext files produced the first time around, and a brand-new network that incorporates explicit two-point resistors where appropriate (more on that below πŸ‘€)

Then you may append that file to cell.ext, and run ext2simrun a second time, to produce a new network with explicit resistors. The threshold parameter is the vibe check for which nodes get turned into resistor networks: any node whose total resistance exceeds threshold times the smallest on-resistance of any transistor connected to that node will be approximated as a resistor network. No cap.

  • feedback option [args] β€” this one is your little detective πŸ” It examines feedback information created by several of the Magic commands, so it can report problems or highlight certain things for users. Option and args work like this:
    • feedback add text [style] β€” creates a feedback area manually, right at the location of the box. This exists so other programs, like Crystal, can highlight stuff on a layout 🌈 They can generate a command file made of a feedback clear command plus a sequence of box and feedback add commands. Text gets associated with the feedback (it'll be printed by feedback why and feedback find). Style tells how to display the feedback, and it's one of dotted, medium, outline, pale, and solid β€” and if you don't specify it, style defaults to pale πŸŽ€
    • feedback clear β€” clears ALL existing feedback information off the screen. poof πŸ’¨
    • feedback count β€” prints out a count of how many feedback areas exist right now πŸ”’
    • feedback find [nth] β€” locates a particular feedback area. If nth is specified, the box is moved to the location of the nth feedback area. If nth isn't specified, the box moves to the next sequential feedback area after the last one located with feedback find. Either way, the explanation associated with the feedback area gets printed πŸ“’
    • feedback help β€” prints a short synopsis of all the feedback command options πŸ†˜
    • feedback save file β€” saves information about all existing feedback areas into file. It's stored as a collection of Magic commands, so you can recover it later with the command source file πŸ’Ύ
    • feedback why β€” prints out the explanations associated with all feedback areas underneath the box πŸ‘€
  • fill direction [layers] β€” direction is a Manhattan direction (peep the section DIRECTIONS below for that tea). The paint visible under one edge of the box gets sampled. Everywhere that the edge touches paint, the paint is extended in the given direction to the opposite side of the box ✨ For example, if direction is north, then paint is sampled under the bottom edge of the box and extended to the top edge. If layers is specified, only the given layers are considered; if layers isn't specified, then all layers are considered. queen behavior πŸ‘‘
  • findbox [zoom] β€” centers the view on the box 🎯 If the optional zoom argument is present, it zooms into the area specified by the box. Heads up bestie: this command will complain if the box is not in the window you are pointing to πŸ™ˆ
  • flush [cellname] β€” cell cellname is reloaded from disk. All changes made to the cell since it was last saved are discarded πŸ’€ If cellname isn't given, the edit cell gets flushed. bye bye unsaved work 🫢
  • garoute option [args] β€” with no option or arg, this is basically the route command: it generates routing in the edit cell to make the connections specified in the current netlist (go read the route command for the full lore). BUT here's the difference: garoute is meant for routing types of circuits β€” think gate-arrays β€” whose routing channels can be determined in advance, and which need the ability to river-route across the tops of cells 🌊 Those channels have to be predefined using garoute channel commands before you invoke this. And unlike route, where the box indicates the routing area, garoute ignores the box entirely. The new wires go in the edit cell. The netlist used is the one selected by the route netlist command, or the current netlist being edited in a netlist window if no route netlist command has been given. Options and args do this:
    • garoute channel [type]
    • garoute channel xlo ylo xhi yhi [type] β€” defines a channel πŸ“ If xlo, ylo, xhi, and yhi are provided, they're interpreted as the coordinates of the lower-left and upper-right of the bounding box for the channel, respectively. Otherwise, the coordinates of the box are used. The boundary of each channel is adjusted inward to lie halfway between routing grid lines if it doesn't already sit there β€” and if the channel gets adjusted, a warning message is printed ⚠️ The channel defined is an ordinary routing channel if type isn't specified; those are identical to the ones used by the router of the route command. If type is given, it must be either h or v. The channel created that way is a river-routing channel, inside which only left-to-right routes are possible (h) or top-to-bottom (v). And unlike a normal channel, a river-routing channel may contain terminals in its interior πŸ‘€
    • garoute generate type [file] β€” gives you a primitive form of channel decomposition for regular structures like gate-array or standard-cell layouts ✨ It generates a collection of garoute channel commands, either to the standard output, or to file if the latter is specified. The type parameter must be either h or v. The entire area contained within the box is turned into routing channels. Each cell inside this area has its bounding box computed for purposes of routing by looking only at those layers considered to be "obstacles" to routing (see "Tutorial #7: Netlists and Routing" for the details πŸ“š). The bounding box just computed is then extended all the way to the sides of the area of the box tool β€” vertically if type is h, or horizontally if type is v. This extended area is then marked as belonging to a river-routing channel of type type; adjacent channels of this type get merged into a single channel 🌊 After all cells are processed, the areas not marked as being river-routing channels are output as normal channels.
    • garoute help β€” prints a short synopsis of all the garoute command options πŸ†˜
    • garoute nowarn β€” if a given terminal appears in more than one place inside a cell, the router can leave feedback when it's not possible to route to all the places where the terminal appears. The garoute nowarn command instructs the router to leave feedback only if it's not possible to route to any of the locations of a terminal. (This is the default behavior of garoute router btw 🫢)
    • garoute route [netlist] β€” routes the edit cell. If netlist isn't specified, the netlist used is the same as when garoute is given with no options. If netlist is given, then it's used instead.
    • garoute reset β€” clears all channels defined by garoute channel, in preparation for redefining a whole new set of channels 🧹
    • garoute warn β€” the opposite of garoute nowarn πŸ™ƒ This tells the router to leave feedback if it's not possible to route to all of the places where a terminal appears, when a terminal has more than one location β€” even if not all of those locations are actually selected for routing by the global router. messy but honest ✨

  • getcell cellName [child refPointC] [parent refPointP] β€” this command adds a child cell instance to the edit cell πŸ’– The instance refers to the cell cellName; it's positioned so that refPointC in the child sits at point refPointP in the edit cell. Those reference points can either be the name of a label β€” in which case the lower-left corner of the label's box is used as the reference point β€” or a pair of numbers giving the (x, y) coordinates of a point explicitly πŸ“ If refPointC isn't specified, the lower-left corner of cellName cell is used. If refPointP isn't specified, the lower-left corner of the box tool is used (and the box must be in a window on the edit cell, bestie πŸ‘€). The new subcell is selected. The difference between this command and dump? dump copies the contents of the cell, while getcell just makes a reference to the original cell. Important: cellname must not be the edit cell or one of its ancestors 🚫
  • getnode [alias on | alias off]
and that's where this part ends, bestie β€” the getnode tea continues in the next one πŸ’…βœ¨
  • getnode [abort [str]] β€” okay so getnode is the one that spills the node names (the ones the extractor uses) for every bit of paint you've got selected. πŸ’… If aliasing is turned on, getnode prints all the names it finds for a given node β€” but lowkey it might not print every name that actually exists out there. Turn aliasing off and it just gives you one name. Periodt.

The abort option is how you tell getnode "bestie, don't stress about fully searching nodes that have certain names." Like getnode abort Vdd says: if you find that one of its names is Vdd, stop searching that node, we're done. πŸ™ˆ And getnode abort with no string argument wipes the whole list of names you built up from earlier getnode abort calls with string arguments. You can safely bail on getnode at literally any time by typing the interrupt character, usually ^C. See Tutorial #11: Using IRSIM and RSIM with Magic for the full tea on this command. ✨

  • grid [xSpacing [ySpacing [xOrigin yOrigin]]] and grid off β€” no arguments? a one-unit grid gets toggled on or off in the window underneath your cursor. grid off always turns the grid off, no matter whether it was on or off before β€” it does not care, it does not ask. 😌

Give it numerical arguments and those arguments set the grid spacing and origin for the window under the cursor. In its most general form, grid takes four integer arguments. XOrigin and yOrigin specify an origin for the grid: the horizontal and vertical grid lines will pass through this point. XSpacing and ySpacing determine the number of units between adjacent grid lines. If xOrigin and yOrigin are left out, they default to 0. If ySpacing is also left out, then the xSpacing value gets used for both spacings. πŸ’«

Grid parameters stick around for a window until you explicitly change them with another grid command. And when the grid is displayed, a solid box is drawn to show the origin of the edit cell. πŸŽ€

  • identify instance_id β€” sets the instance identifier of the selected cell to instance_id. 🫢 Instance_id has to be unique among all the instance identifiers in the parent of the selected cell, no exceptions. Initially, Magic keeps identifiers unique for you by giving each cell an initial identifier made of the cell definition name, followed by an underscore, followed by a small integer. iykyk. ✨
  • iroute subcommand [args] β€” this one is an interactive interface to the Magic maze-router. 🌈 Routing happens one connection at a time. Three internal hint layers β€” magnet, fence, and rotate β€” let you guide the routing graphically. Routes get chosen close to magnets (if possible), routing doesn't cross fence boundaries, and rotate areas reverse the preferred routing directions for each layer. The maze-router is out here seeking a lowest-cost path, iconic behavior honestly. 🧚

Parameters specifying costs for horizontal and vertical routing on each layer, cost for jogs and contacts, and cost (per unit area) for distance between a path and magnets all help determine the nature of the routes. Several search parameters let you tune things to get acceptable routes in as short a time as possible. And routing can always be interrupted with ^C. πŸ’… The iroute subcommands are:

  • iroute β€” routes from cursor to inside box. πŸ“
  • iroute contact [type] [parameter] [value1] ... [valuen] β€” an asterisk, *, can be used for type and parameter. This command is for setting and examining parameters related to contacts. πŸ“
  • iroute help [subcommand] β€” summarizes irouter commands. If you give it a subcommand, usage information for that subcommand gets printed. πŸ™‹β€β™€οΈ
  • iroute layers [type] [parameter] [value1] ... [valuen] β€” an asterisk, *, can be used for type and parameter. This command is for setting and examining parameters related to route layers. πŸŽ€
  • iroute route [options] β€” invokes the router. Options are as follows:
-sLayers layers = layers route may start on
-sCursor = start route at cursor (DEFAULT)
-sLabel name = start route at label of given name
-sPoint x y = start route at given coordinates
-dLayers layers = layers route may end on
-dBox = route to box (DEFAULT)
-dLabel name = route to label of given name
-dRect xbot ybot xtop ytop = route to rectangle of given coordinates
-dSelection = route to selection
  • iroute saveParameters <filename> β€” saves all current irouter parameter settings. πŸ’Ύ You can restore the parameters back to these values with the command ``source filename''.
  • iroute search [searchParameter] [value] β€” lets you modify the parameters that control the search. If routing is too slow, try increasing rate. If the router is producing bad results, try reducing rate. It's a good idea to make width at least twice as big as rate. 🫑
  • iroute spacings [route-type] [type] [spacing] ... [typen spacingn] β€” the default minimum spacings between a route-type placed by the router and other types are derived from the drc section of the technology file. You can override those defaults with this command. The special type SUBCELL is used to specify minimum spacing to unexpanded subcells. 🌸
  • iroute verbosity [level] β€” controls how many messages get printed during routing:
    • 0 = errors and warnings only,
    • 1 = brief,
    • 2 = lots of statistics.
  • iroute version β€” prints irouter version information. ⭐
  • iroute wizard [wizardparameter] [value] β€” used to examine and set miscellaneous parameters. Most of these are best left alone by the unadventurous user. 😭 (no cap, leave them alone)
  • label string [pos [layer]] β€” a label with text string is positioned at the box location. Labels may cover points, lines, or areas, and they're associated with specific layers. Normally the box is collapsed to either a point or to a line (that's the move when you're labeling terminals on the edges of cells). Normally also, the area under the box is occupied by a single layer. πŸ¦‹

If no layer argument is specified, then the label gets attached to the layer under the box β€” or to space, if no layer covers the entire area of the box. If layer is specified but that layer doesn't cover the entire area of the box, the label will get moved to another layer or to space. Labels attached to space will be considered by CIF processing programs to be attached to all layers overlapping the area of the label. πŸ’€

Pos is optional, and it specifies where the label text is displayed relative to the box (e.g. ``north''). If pos isn't given, Magic picks a position for you to make sure the label text doesn't stick out past the edge of the cell. thoughtful king behavior. πŸ‘‘

  • layers β€” prints out the names of all the layers defined for the current technology. 🌈
  • load [file] β€” loads the cell hierarchy rooted at file.mag into the window underneath the cursor. If no file is supplied, a brand new unnamed cell gets created. The root cell of the hierarchy is made the edit cell β€” unless there's already an edit cell in a different window. πŸŽ€
  • move [direction [amount]] and move to x y β€” no arguments? The selection gets picked up by the point underneath the lower-left corner of the box and moved so that this point lies at the cursor location. 🫢

If direction is given, it must be a Manhattan direction (e.g. north). The selection is moved in that direction by amount. If the box is in the same window as the selection, it gets moved too. Amount defaults to 1. Selected material that is not in the edit cell is not affected. πŸ’…

The second form of the command is as though the cursor were pointing to (x, y) in the edit cell: the selection is picked up by the point beneath the lower-left corner of the box and moved so that this point lies at (x, y). ✨

  • paint layers β€” the area underneath the box is painted in layers. 🎨
  • path [searchpath] β€” this command tells Magic where to look for cells. Searchpath contains a list of directories separated by colons or spaces (if spaces are used, then searchpath must be surrounded by quotes). When looking for a cell, Magic checks each directory in the path in order until the cell is found. If the cell isn't found anywhere in the path, Magic will look in the system library for it. 🌸

If path is invoked with no arguments, the current search path gets printed. πŸ“œ

  • plot option [args] β€” used to generate hardcopy plots direct from Magic. Options and args are used in the following ways:
    • plot gremlin file [layers] β€” generate a Gremlin-format description of everything under the box, and write that description in file. If layers isn't specified, paint, labels, and unexpanded subcells are all included in the Gremlin file just as they appear on the screen. If layers is specified, then only the indicated layers are output in the Gremlin file. Layers may include the special layers labels and subcell. 🌈

The Gremlin file is scaled to have a total size between 256 and 512 units; you should use the width and/or height Grn commands to make sure the printed version is the size you actually want. Use the mg stipples in Grn. No plot parameters are used in Gremlin plotting. 🫑

  • plot help β€” prints a short synopsis of all the plot command options. πŸ™‹β€β™€οΈ
  • plot parameters [name value] β€” if plot parameters is invoked with no additional arguments, the values for all of the plot parameters are printed. If name and value are provided, then name is the name of a plot parameter and value is a new value for it. Plot parameters control various aspects of plotting, and all of them have ``reasonable'' initial values. Most of the parameters available now are used to control Versatec-style plotting. πŸ–¨οΈ They are:

next up: the Versatec plot parameters ✨

  • cellIdFont β€” The name of the font to use for cell instance ids in Versatec plots. It has to be a file in Vfont format. no cap. πŸ’…
  • cellNameFont β€” The name of the font to use for cell names in Versatec plots. Also has to be a Vfont file. periodt. πŸŽ€
  • color β€” If this is set to true, the :plot versatec command will generate output suitable for a four-color Versatec plotter, using the styles defined in the colorversatec style of the plot section of the technology file. If color is false (the default), then :plot versatec generates normal black-and-white plots. so if you want that rainbow vibe, set it to true 🌈
  • directory β€” The name of the directory in which to create raster files for the Versatec. The raster files have names of the form magicPlotXXXXXX, where XXXXXX is a process-specific identifier. it's giving organized queen πŸ‘‘
  • dotsPerInch β€” Indicates how many dots per inch there are on the Versatec printer. This parameter is used only for computing the scale factor for plotting. Must be an integer greater than zero. so like, don't put 0, bestie. 🚫
  • labelFont β€” The name of the font to use for labels in Versatec plots. This must be a file in Vfont format. labels need to look cute too πŸ’–
  • printer β€” The name of the printer to which to spool Versatec raster files. tell me where to send it πŸ–¨οΈ
  • showcellnames β€” If true (the default) then the name and instance-identifier of each unexpanded subcell is displayed inside its bounding box. If this parameter is false then only the bounding box of the cell is displayed. so true = full name reveal, false = mystery box πŸ“¦
  • spoolCommand β€” The command used to spool Versatec raster files. This must be a text string containing two %s formatting fields. The first %s will be replaced with the printer name, and the second one will be replaced with the name of the raster file. two %s fields, don't forget, or it's gonna be a mess 😭
  • swathHeight β€” How many raster lines of Versatec output to generate in memory at one time. The raster file is generated in swaths in order to keep the memory requirements reasonable. This parameter determines the size of the swaths. It must be an integer greater than zero, and should be a multiple of 16 in order to avoid misalignment of stipple patterns. multiple of 16, bestie, for that alignment slay ✨
  • width β€” The number of pixels across the Versatec printer. Must be an integer greater than 0, and must be an even multiple of 32. even multiple of 32, no cap. πŸ“

plot versatec [size [layers]] β€” Generate a raster file describing all the information underneath the box in a format suitable for printing on Versatec black-and-white or color printers, and spool the file for printing. See the plot parameters above for information about the parameters that are used to control Versatec plotting. Size is used to scale the plot: a scalefactor is chosen so that the area of the box is size inches across on the printed page. Size defaults to the width of the printer. Layers selects which layers (including labels and subcells) to plot; it defaults to everything visible on the screen. it's giving print shop realness πŸ–¨οΈβœ¨


plow direction [layers] plow option [args]

The first form of this command invokes the plowing operation to stretch and/or compact a cell. Direction is a Manhattan direction. Layers is an optional collection of mask layers, which defaults to *. One of the edges of the box is treated as a plow and dragged to the opposite edge of the box (e.g. the left edge is used as the plow when plow right is invoked). All edges on layers that lie in the plow's path are pushed ahead of it, and they push other edges ahead of them to maintain design rules, connectivity, and transistor and contact sizes. Subcells are moved in their entirety without being modified internally. Any mask information overlapping a subcell moved by plowing is also moved by the same amount. Option and args are used in the following ways:

  • plow boundary β€” The box specifies the area that may be modified by plowing. This area is highlighted with a pale stipple outline. Subsequent plows are not allowed to modify any area outside that specified by the box; if they do, the distance the plow moves is reduced by an amount sufficient to insure that no geometry outside the boundary gets affected. stay in your lane, plow 🚧
  • plow help β€” Prints a short synopsis of all the plow command options. when in doubt, ask for help πŸ†˜
  • plow horizon n / plow horizon β€” The first form sets the plowing jog horizon to n units. The second form simply prints the value of the jog horizon. Every time plowing considers introducing a jog in a piece of material, it looks up and down that piece of material for a distance equal to the jog horizon. If it finds an existing jog within this distance, it uses it. Only if no jog is found within the jog horizon does plowing introduce one of its own. A jog horizon of zero means that plowing will always introduce new jogs where needed. A jog horizon of infinity (plow nojogs) means that plowing will not introduce any new jogs of its own. jog horizon is giving "how far to look for existing jogs" energy πŸ”
  • plow jogs β€” Re-enable jog insertion with a horizon of 0. This command is equivalent to plow horizon 0. bring back the jogs, periodt πŸ•Ί
  • plow noboundary β€” Remove any boundary specified with a previous plow boundary command. no more boundaries, we're free πŸ¦‹
  • plow nojogs β€” Sets the jog horizon to infinity. This means that plowing will not introduce any jogs of its own; it will only use existing ones. infinity horizon, only OGs allowed πŸ‘‘
  • plow nostraighten β€” Don't straighten jogs automatically after each plow operation. leave those jogs messy, it's a vibe πŸ™ˆ
  • plow selection [direction [distance]] β€” Like the move or stretch commands, this moves all the material in the selection that belongs to the edit cell. However, any material not in the selection is pushed out of its way, just as though each piece of the selection were plowed individually. If no arguments are given, the selection is picked up by the point underneath the lower-left corner of the box and plowed so that this point lies at the cursor location. The box is moved along with the selection. If direction is given, it must be a Manhattan direction (e.g. north). The selection is moved in that direction by amount. If the box is in the same window as the selection, it is moved too. Amount defaults to 1. If there is selected material that isn't in the edit cell, it is ignored (note that this is different from select and move). If direction isn't given and the cursor isn't exactly left, right, up, or down from the box corner, then Magic first rounds the cursor position off to a position that is one of those (whichever is closest). main character energy for the selection, pushing everyone else out of the way πŸ’…
  • plow straighten β€” Straighten jogs automatically after each plow operation. The effect will be as though the straighten command were invoked after each plow operation, with the same direction, and over the area changed by plowing. auto-straighten, because we love a clean look ✨

resist cell [tolerance] β€” This command is similar to extresist above, but used for extracting resistance networks for individual nodes. Only the node underneath the box is processed. The network for this node is output to the file cell.res.ext. See the description for extresist for an explanation of tolerance. it's giving resistance extraction for one special node πŸ’…


route option [args] β€” This command, with no option or arg, is used to generate routing using the Magic router in the edit cell to make connections specified in the current netlist. The box is used to indicate the routing area: no routing will be placed outside the area of the box. The new wires are placed in the edit cell. Options and args have the following effects:

  • route end [real] β€” Print the value of the channel end constant used by the channel router. If a value is supplied, the channel end constant is set to that value. The channel end constant is a dimensionless multiplier used to compute how far from the end of a channel to begin preparations to make end connections. channel end constant, lowkey important for end connections 🎯
  • route help β€” Print a short synopsis of all the route command options. help is always there 🫢
  • route jog [int] β€” Print the value of the minimum jog length used by the channel router. If a value is supplied, the minimum jog length is set to that value. The channel router makes no vertical jogs shorter than the minimum jog length, measured in router grid units. Higher values for this constant may improve the quality of the routing by removing unnecessary jogs; however, prohibiting short jogs may make some channels unroutable. so like, balance, bestie βš–οΈ
  • route metal β€” flips metal maximization on or off. The way this works: the route command routes the preferred routing layer (aka ``metal'') horizontally and the alternate routing layer vertically. By default, wires on the alternate routing layer then get converted, as much as possible, over to the preferred layer before being painted into the layout. Turning metal maximization on = better routing quality, because the preferred routing layer generally has better electrical characteristics. BUT β€” if you're a designer who wants to hand-route after auto-routing, you might find it easier to just disable metal maximization and deal with a layer-per-direction layout. Your call bestie πŸ’…
  • route netlist [file] β€” prints the name of the current netlist. If you hand it a file name, it's opened if possible and the new netlist is loaded. This one exists mostly as a convenience so you don't have to open the netlist menu before routing. streamlined. iconic. πŸ¦‹
  • route obstacle [real] β€” prints the obstacle constant the channel router is using. Give it a value and it sets the channel router obstacle constant to that. So what is the obstacle constant? It's a dimensionless multiplier used in deciding how far in front of an obstacle the channel router should begin jogging nets out of the way. Bigger values = nets jog out of the way earlier. But heads up ⚠️ if nets jog out of the way too early, routing area is wasted.
  • route origin [x y] β€” prints the x- and y-coordinates of the origin of the routing grid. Default is that the routing grid starts from (0,0). But if you supply an x and y coordinate to the route origin command, the origin can be set to any other value. This is mainly useful when you're routing a chip designed with routing on the same pitch as the router will use, but where the left and bottom edges of the pre-existing routing don't line up with the routing grid lines (for example, the pre-existing routing might have been centered on routing grid lines). The alternative to specifying a different origin for the routing grid would be to translate <em>all</em> the material in the cell to be routed so that the prewiring lined up properly with routing grid lines. so like… pick your struggle 😭
  • route settings β€” prints the values of all router parameters. yes, all of them. πŸ’–
  • route steady [int] β€” prints the value of the channel router's steady net constant. Supply a value and it sets the steady net constant to that value. The steady net constant, measured in router grid units, specifies how far beyond the next terminal the channel router should look for a conflicting terminal before deciding that a net is rising or falling. Larger values mean the net rises and falls less often. noted ✨
  • route tech β€” prints the router technology information. That includes stuff like the names of the preferred and alternate routing layers, their wire widths, the router grid spacing, and the contact size. receipts πŸ“‹
  • route viamin β€” minimizes vias in a (previously) routed netlist. This subcommand removes unnecessary layer changes in all nets in the current netlist to minimize via count. The preferred routing layer, layer1 in the router section of the technology file, is favored by the algorithm. Note: route viamin is an independent routing postpass that can be applied even if the routing was <em>not</em> generated by the route command β€” provided the layers and widths agree with the router section of the technology file. 🫢
  • route vias [int] β€” prints the value of the metal maximization via constant. Supply a value and it sets the via constant to that value. The via constant, measured in router grid units, represents the tradeoff between metal maximization and the via count. In many cases it's possible to convert wiring on the alternate routing layer into routing on the preferred routing layer (``metal'') at the expense of introducing one or two vias. The via constant specifies the amount of converted wiring that makes it worthwhile to add vias to the routing. the math is mathing πŸ”₯

🌸 rsim [options] [filename] 🌸

Runs rsim under Magic. See Tutorial #11: Using IRSIM and RSIM with Magic for more info on what options and files rsim requires. Normally, IRSIM needs a parameter file for the technology and a .sim file describing the circuit.

The rsim command with <em>no</em> options can be used to interact with a previously-started rsim. Type rsim and you'll see the rsim prompt. To get back to magic, type q. easy peasy πŸ“

πŸ‘‘ save [name] πŸ‘‘

Save the edit cell on disk. If the edit cell is currently the ``(UNNAMED)'' cell, name must be specified; in that case the edit cell is renamed to name as well as being saved in the file name.mag. Otherwise, name is optional. If specified, the edit cell is saved in the file name.mag; otherwise, it's saved in the file from which it was originally read. save your work bestie, i'm begging 😭

πŸ¦‹ see option πŸ¦‹

This command controls which layers get displayed in the window under the cursor. It has several forms:

  • see no layers β€” don't display the given layers in the window under the cursor. If labels is given as a layer name, don't display labels in that window either. If errors is given as a layer, no design-rule violations will be displayed (the checker will continue to run, though πŸ‘€). If layers is given as "*", all mask layers will be disabled, but errors and labels will still be shown. See the "LAYERS" section at the end of this manual page for an explanation of layer naming in Magic.
  • see layers β€” reenable display of the given layers. Note that "*" expands to all mask layers, but does <em>not</em> include the label or error layers. See the "LAYERS" section at the end of this manual page for details.
  • see no β€” don't display any mask layers or labels. Only subcell bounding boxes will be displayed.
  • see β€” reenable display of all mask layers, labels, and errors. the glow-up ✨
  • see allSame β€” display all cells the same way. This disables the facility where the edit cell is displayed in bright colors and non-edit cells are in paler colors. After see allSame, all mask information will be displayed in bright colors. main character treatment for everyone πŸ’…
  • see no allSame β€” reenable the facility where non-edit cells are drawn in paler colors.

πŸ’œ select option πŸ’œ

This command selects paint, labels, and subcells before you operate on them with commands like move, copy, and delete. It has several forms:

  • select β€” if the cursor is over empty space, this command is identical to select cell. Otherwise, paint is selected. The first time you invoke it, a chunk of paint is selected: the largest rectangular area of material of the same type visible underneath the cursor. Invoke it again <em>without moving the cursor</em> and the selection extends to include all material of the same type, regardless of shape. Invoke it a third time and the selection extends again to include all material that is visible and electrically connected to the point underneath the cursor. three taps, escalating chaos πŸŽ€
  • select more β€” identical to select except the selection is <em>not</em> first cleared. Result: the newly-selected material gets added to what's already in the selection. stack it up 🫢
  • select less β€” chooses material just like select does, but the material is removed from the selection rather than added to it. Result: the chosen material is deselected.
  • select [more | less] area layers β€” select material by area. If layers isn't specified, then all paint, labels, and unexpanded subcells visible underneath the box are selected. If layers is specified, then only those layers are selected. If more is specified, the new material is added to the current selection rather than replacing it. If less is specified, the new material is removed from the selection (deselected).
  • select [more | less] cell name β€” select a subcell. If name isn't given, this command finds a subcell that's visible underneath the cursor and selects it. Repeat the command without moving the cursor and it'll step through all the subcells under the cursor. If name is given, it's treated as a hierarchical instance identifier starting from the root of the window underneath the cursor. The named cell is selected. If more is specified, the new subcell is added to the current selection instead of replacing it. If less is specified, the new subcell is removed from the selection (deselected). cycling through them like a slideshow πŸ¦‹
  • select clear β€” clear out the selection. This does <em>not</em> affect the layout; it merely deselects everything. no harm, just vibes ✨
  • select help β€” print a short synopsis of the selection commands.
  • select save cell β€” save all the information in the selection as a Magic cell on disk. The selection will be saved in file cell.mag. committing it to the archives πŸ“πŸ’–
  • select and the see command β€” bestie these two are literally in a whole relationship, no cap. When you're selecting individual pieces of material, only the visible layers are even candidates, like they gotta show up to be picked. But when you select an entire area, both visible and non-visible material gets swept up. Why does that matter? Because it means you can move whole regions of material around even if you used see to turn off the display of some of those layers. Slay. πŸ’…
  • sideways β€” flips the selection left-to-right about a vertical axis that runs straight through the center of the selection's area. If the box is chilling in the same window as the selection, it gets flipped too. Selected material that's not in the edit cell? Unaffected. Periodt. ✨
  • simcmd cmd β€” sends the command cmd over to rsim to be executed. For the whole story, go read Tutorial #11: Using IRSIM and RSIM with Magic.
  • snap [on]
  • snap [off] β€” controls whether the box and the point get snapped to the grid that's selected for the windows they appear in (that grid was set by the grid command), or to the standard 1x1 grid. Default vibes: snapping is off, meaning it snaps to a 1x1 grid. If you run snap with no arguments, it just prints whether snapping is enabled or not. Iconic little status check. πŸŽ€
  • startrsim [options] [filename] β€” basically the rsim command's cooler cousin, except it returns you to Magic the second rsim is started. Again, Tutorial #11: Using IRSIM and RSIM with Magic has the details.
  • straighten direction β€” straightens out jogs in wires underneath the box by pulling them in direction. Important: jogs only get straightened if doing so will cause no additional geometry to move. No messy side effects, we don't do that here. πŸ¦‹
  • stretch [direction [amount]] β€” literally move but with simple stretching happening as the selection moves. Here's the tea: every piece of paint in the selection causes the area it's moved through to be erased in that layer. And every piece of paint in the selection that touches unselected material along its back side causes extra material to be painted in, filling the gap left behind by the move. If direction isn't given and the cursor isn't exactly left, right, up, or down from the box corner, then Magic first rounds the cursor position off to whichever of those it's closest to. Rounding, but make it useful. πŸ’–
  • tool [name | info] β€” changes the current tool, which means the cursor shape changes and the mouse buttons suddenly mean different things (main character energy honestly). tool info prints out what the buttons do for whatever tool you're currently holding. tool name switches you to name, where name is one of box, wiring, or netlist. And if you just run tool with no arguments, it picks a new tool in circular sequence β€” so if you keep invoking it, you'll cycle through every available tool. Cute little carousel. 🌈
  • unexpand β€” unexpands all the cells that touch the box but don't completely contain it.
  • upsidedown β€” flips the selection upside down about a horizontal axis running through the center of the selection's area. If the box is in the same window as the selection, it gets flipped too. Selected material that isn't in the edit cell stays exactly as it is. πŸ”₯
  • what β€” prints out info about all the things that are currently selected. The receipts, basically.
  • wire option [args] β€” this is the centerline-wiring-style user interface, and it's giving very specific. option and args specify a particular wiring option, all listed below. Some of these can also be triggered by mouse buttons when the wiring tool is active, iykyk.
    • wire help β€” prints out a synopsis of the various wiring commands.
    • wire horizontal β€” just like wire leg, except the new segment is forced to be horizontal.
    • wire leg β€” paints a horizontal or vertical segment of wire from one side of the box over to the cursor's x- or y-location (respectively). The direction (horizontal or vertical) gets chosen so as to produce the longest possible segment. The segment is painted in the current wiring material and thickness. The new segment gets selected, and the box gets placed at its tip. πŸ’«
    • wire switch [layer width] β€” switches routing layers and places a contact at the box location. The contact type is chosen to connect the old and new routing materials together. The box gets placed at the position of the contact, and the contact gets selected. If layer and width are specified, they're used as the new routing material and width, respectively. If they're not specified, the new material and width are chosen to correspond to the material underneath the cursor. Adaptive. We love to see it. ✨
    • wire type [layer width] β€” picks a material and width for wiring. If layer and width aren't given, they get chosen from the material underneath the cursor, a square chunk of material gets selected to show off the layer and width that were chosen, and the box gets placed over that chunk. If layer and width are given, then this command does not modify the box position. Noted. πŸ“Œ
    • wire vertical β€” just like wire leg, except the new segment is forced to be vertical.
  • writeall [force] β€” steps through all the cells that have been modified in this edit session and gives you a chance to write each one out. If the force option is specified, then ``autowrite'' mode kicks in: all modified cells are automatically written without asking for permission. So like, no take-backs, no prompts, just vibes and writes. 🫢

πŸ’– COMMANDS FOR ALL WINDOWS πŸ’–

okay bestie, these commands are not for layout β€” they're the overall housekeeping functions. They are valid in all windows. no cap. 🫢


✨ closewindow

The window under the cursor gets closed. That area of the screen will now show other windows or the background. bye bestie πŸ’…

✨ echo [-n] str1 str2 ... strN

Prints str1 str2 ... strN in the text window, separated by spaces and followed by a newline. If the -n switch is given, no newline is output after the command. simple as that. 🌸

✨ help [pattern]

Displays a synopsis of commands that apply to the window you're pointing at. If pattern is given, then only command descriptions containing the pattern are printed. pattern may contain * and ? characters, which match a string of non-blank characters or a single non-blank character (respectively). iykyk. πŸ’«

✨ logcommands [file [update]]]

If file is given, all further commands are logged to that file. If no arguments are given, command logging is terminated. If the keyword update is present, commands are output to the file to cause the screen to be updated after each command when the command file is read back in. log it and leave it πŸ“

✨ macro [char [command]]

command is associated with char such that typing char on the keyboard is equivalent to typing : followed by command. If command is omitted, the current macro for char is printed. If char is also omitted, then all current macros are printed. If command contains spaces, tabs, or semicolons then it must be placed in quotes. The semicolon acts as a command separator allowing multiple commands to be combined in a single macro. macro queen πŸ‘‘

✨ openwindow [cell]

Open a new, empty window at the cursor position. Placement, sizing, and methods of manipulation are determined by the conventions of the window system in use. If cell is specified, then that cell is displayed in the new window. Otherwise the area of the box will be displayed in the new window. new window who dis πŸͺŸ

✨ pushbutton button action

Simulates a button push. button should be left, middle, or right. action is one of up, or down. This command is normally invoked only from command scripts produced by the logcommands command. click clack πŸ–±οΈ

✨ quit

Exit Magic and return to the shell. If any cells, colormaps, or netlists have changed since they were last saved on disk, you are given a chance to abort the command and continue in Magic. don't lose your work bestie 😭

✨ redo [n]

Redo the last n commands that were undone using undo (see below). The number of commands to redo defaults to 1 if n is not specified. rewind time, but make it fashion βͺ

✨ redraw

Redraw the graphics screen. refresh queen ✨

✨ scroll direction [amount]

The window under the cursor is moved by amount screenfulls in direction relative to the circuit. If amount is omitted, it defaults to 0.5. scrollin' πŸŒ€

✨ send type command

Send a command to the window client named by type. The result is just as if command had been typed in a window of type type. See specialopen, below, for the allowable types of windows. sending it πŸ“¨

✨ setpoint [x y [windowID]]

Fakes the location of the cursor up until after the next interactive command. Without arguments, just prints out the current point location. This command is normally invoked only from command scripts.

If windowID is given, then the point is assumed to be in that window's screen coordinate system rather than absolute screen coordinates. fake it till you make it πŸ“

✨ sleep n

Causes Magic to go to sleep for n seconds. nap time 😴

✨ source filename

Each line of filename is read and processed as one command. Any line whose last character is backslash is joined to the following line. The commands setpoint, pushbutton, echo, sleep, and updatedisplay are useful in command files, and seldom used elsewhere. script it up πŸ“œ

✨ specialopen [x1 y1 x2 y2] type [args]

Open a window of type type. If the optional x1 y1 x2 y2 coordinates are given, then the new window will have its lower left corner at screen coordinates (x1, y1) and its upper right corner at screen coordinates (x2, y2). The args arguments are interpreted differently depending upon the type of the window. These types are known:

  • layout β€” This type of window is used to edit a VLSI cell. The command takes a single argument which is used as the name of a cell to be loaded. The command
open filename

is a shorthand for the command

specialopen layout filename.
  • color β€” This type of window allows the color map to be edited. See the section COMMANDS FOR COLORMAP EDITING below.
  • netlist β€” This type of window presents a menu that can be used to place labels, and to generate and edit net-lists. See the section COMMANDS FOR NETLIST EDITING below.

special delivery 🎁

✨ underneath

Move the window pointed at so that it lies underneath the rest of the windows. go to the back 🫣

✨ undo [count]

Undoes the last count commands. Almost all commands in Magic are now undo-able. The only holdouts left are cell expansion/unexpansion, and window modifications (change of size, zooming, etc.). If count is unspecified, it defaults to 1. undo it, reverse it ↩️

✨ updatedisplay

Update the display. This command is normally invoked only from command scripts. Scripts that do not contain this command update the screen only at the end of the script. refresh bestie πŸ”„

✨ view

Choose a view for the window underneath the cursor so that everything in the window is visible. see everything, slay πŸ‘€

✨ windscrollbars [on|off]

Set the flag that determines if new windows will have scroll bars. scroll bar vibe check 🎚️

✨ windowpositions [file]

Write out the positions of the windows in a format suitable for the source command. If file is specified, then write it out to that file instead of to the terminal. save the layout πŸͺŸ

✨ zoom [factor]

Zoom the view in the window underneath the cursor by factor. If factor is less than 1, we zoom in; if it is greater than one, we zoom out. zoom zoom πŸ”


πŸŽ€ MOUSE BUTTONS FOR NETLIST WINDOWS πŸŽ€

When the netlist menu is opened using the command special netlist, a menu appears on the screen. The colored areas on the menu can be clicked with various mouse buttons to perform various actions, such as placing labels and editing netlists. For details on how to use the menu, see Magic Tutorial #7: Netlists and Routing. The menu buttons all correspond to commands that could be typed in netlist or layout windows. click around and find out πŸ–±οΈπŸ’–

✨ COMMANDS FOR NETLIST WINDOWS ✨

okay bestie, so these commands? They only work when you're pointing inside the netlist menu. But plot twist: you can also invoke them from another window if you use the send netlist command. And terminal names? They're hierarchical, meaning they're made of zero or more cell use ids separated by slashes, then the label name. Like toplatch/shiftcell_1/in. And when Magic processes those terminal paths, it always starts the search in the edit cell. Periodt.

  • add term1 term2 β€” Add the terminal named term1 to the net containing terminal term2. If term2 isn't in a net yet, make a new net containing just term1 and term2. Slay.
  • cleanup β€” Check the netlist to make sure that for every terminal named in the list there is at least one label in the design. Also check to make sure that every net contains at least two distinct terminals, or one terminal with several labels by the same name. When errors are found, give the user an opportunity to delete offending terminals and nets. This command can also be invoked by clicking the ``Cleanup'' menu button.
  • cull β€” Examine the current netlist and the routing in the edit cell, and remove those nets from the netlist that are already routed. This command is often used after pre-routing nets by hand, so the router won't try to implement them again.
  • dnet name name ... β€” For each name given, delete the net containing that terminal. If no name is given, delete the currently-selected net, just as happens when the ``No Net'' menu button is clicked.
  • dterm name name ... β€” For each name given, delete that terminal from its net.
  • extract β€” Pick a piece of paint in the edit cell that lies under the box. Starting from this, trace out all the electrically-connected material in the edit cell. Where this material touches subcells, find any terminals in the subcells and make a new net containing those terminals. Note: this is a different command from the extract command in layout windows.
  • find pattern [layers] β€” Search the area beneath the box for labels matching pattern, which may contain the regular-expression characters *'' ?'', ['', ]'', and \'' (as matched by `csh(1)`; see the description of the find button in Magic Tutorial #7: Netlists and Routing''). For each label found, leave feedback whose text is the layer on which the label appears, followed by a semicolon, followed by the full hierarchical pathname of the label. The feedback surrounds the area of the label by one unit on all sides. (The reason for the one-unit extension is that feedback rectangles must have positive area, while labels may have zero width or height). If layers are given, only labels attached to those layers are considered.
  • flush [netlist] β€” The netlist named netlist is reloaded from the disk file netlist.net. Any changes made to the netlist since the last time it was written are discarded. If netlist isn't given, the current netlist is flushed.
  • join term1 term2 β€” Join together the nets containing terminals term1 and term2. The result is a single net containing all the terminals from both the old nets.
  • netlist [name] β€” Select a netlist to work on. If name is provided, read name.net (if it hasn't already been read before) and make it the current netlist. If name isn't provided, use the name of the edit cell instead.
  • print [name] β€” Print the names of all the terminals in the net containing name. If name isn't provided, print the terminals in the current net. This command has the same effect as clicking on the ``Print'' menu button.
  • ripup [netlist] β€” This command has two forms. If netlist isn't typed as an argument, then find a piece of paint in the edit cell under the box. Trace out all paint in the edit cell that is electrically connected to the starting piece, and delete all of this paint. If netlist is typed, find all paint in the edit cell that is electrically connected to any of the terminals in the current netlist, and delete all of this paint.
  • savenetlist [file] β€” Save the current netlist on disk. If file is given, write the netlist in file.net. Otherwise, write the netlist back to the place from which it was read.
  • shownet β€” Find a piece of paint in any cell underneath the box. Starting from this paint, trace out all paint in all cells that is electrically connected to the starting piece and highlight this paint on the screen. To make the highlights go away, invoke the command with the box over empty space. This command has the same effect as clicking on the ``Show'' menu button.
  • showterms β€” Find the labels corresponding to each of the terminals in the current netlist, and generate a feedback area over each. This command has the same effect as clicking on the ``Terms'' menu button.
  • trace [name] β€” This command is similar to shownet except that instead of starting from a piece of paint under the box, it starts from each of the terminals in the net containing name (or the current net if no name is given). All connected paint in all cells is highlighted.
  • verify β€” Compare the current netlist against the wiring in the edit cell to make sure that the nets are implemented exactly as specified in the netlist. If there are discrepancies, feedback areas are created to describe them. This command can also be invoked by clicking the ``Verify'' menu button.
  • writeall β€” Scan through all the netlists that have been read during this editing session. If any have been modified, ask the user whether or not to write them out.

πŸ’… MOUSE BUTTONS FOR COLORMAP WINDOWS πŸ’…

Color windows display two sets of colored bars and a swatch of the color being edited. The left set of color bars is labeled Red, Green, and Blue; these correspond to the proportion of red, green, and blue in the color being edited. The right set of bars is labeled Hue, Saturation, and Value; these correspond to the same color but in a space whose axes are hue (spectral color), saturation (spectral purity vs. dilution with white), and value (light vs. dark).

The value of a color is changed by pointing inside the region spanned by one of the color bars and clicking any mouse button. The color bar will change so that it extends to the point selected by the crosshair when the button was pressed. The color can also be changed by clicking a button over one of the ``pumps'' next to a color bar. A left-button click makes a 1% increment or decrement, and a right-button click makes a 5% change.

The color being edited can be changed by pressing the left button over the current color box in the editing window, then moving the mouse and releasing the button over a point on the screen that contains the color to be edited. A color value can be copied from an existing color to the current color by pressing the right mouse button over the current color box, then releasing the button when the cursor is over the color whose value is to be copied into the current color.


🎨 COMMANDS FOR COLORMAP WINDOWS 🎨

These commands work if you are pointing to the interior of a colormap window. The commands are:

  • color [number] β€” Load number as the color being edited in the window. number must be an octal number between 0 and 377; it corresponds to the entry in the color map that is to be edited. If no number is given, this command prints out the value of the color currently being edited.
  • load [techStyle displayStyle monitorType] β€” Load a new color map. If no arguments are specified, the color map for the current technology style (e.g, mos), display style (e.g, 7bit), and monitor type (e.g, std) is re-loaded. Otherwise, the color map is read from the file techStyle.displayStyle.monitorType.cmap in the current directory or in the system library directory.
  • save [techStyle displayStyle monitorType] β€” Save the current color map. If no arguments are specified, save the color map in a file determined by the current technology style, display style, and monitor type as above. Otherwise, save it in the file techStyle.displayStyle.monitorType.cmap in the current directory or in the system library directory.

🧭 DIRECTIONS 🧭

Many of the commands take a direction as an argument. The valid direction names are north, south, east, west, top, bottom, up, down, left, right, northeast, ne, southeast, se, northwest, nw, southwest, sw, and center. In some cases, only Manhattan directions are permitted, which means only north, south, east, west, and their synonyms, are allowed.


🌈 LAYERS 🌈

The mask layers are different for each technology, and are described in the technology manuals. The layers below are defined in all technologies:

  • * β€” All mask layers. Does not include special layers like the label layer and the error layer (see below).
  • $ β€” All layers underneath the cursor.
  • errors β€” Design-rule violations (useful primarily in the see command).
  • labels β€” Label layer.
  • subcell β€” Subcell layer.

Layer masks may be formed by constructing comma-separated lists of individual layer names. The individual layer names may be abbreviated, as long as the abbreviations are unique. For example, to indicate polysilicon and n-diffusion, use poly,ndiff or ndiff,poly. The special character - causes all subsequent layers to be subtracted from the layer mask. For example, *-p means ``all layers but polysilicon''. The special character + reverses the effect of a previous -; all subsequent layers are once again added to the layer mask.


πŸ”— SEE ALSO πŸ”—

ext2sim(1), ext2spice(1), cmap(5), dstyle(5), ext(5), sim(5), glyphs(5), magic(5), displays(5), net(5)

Online documentation can be found at the following URLs: http://opencircuitdesign.com/magic/ http://vlsi.cornell.edu/magic/

The OpenCircuitDesign website contains HTML versions of all the documentation found in the Magic "doc" subdirectory, including tutorials, technology file manual; download, compile and install instructions, and command reference.

πŸ’Ύ FILES πŸ’Ύ

okay bestie, here's the whole squad of files magic messes with, and what each one is for ✨

  • ${CAD_ROOT}/magic/sys/.magicstartup β€” the file that creates your default macros πŸŽ€
  • ~/.magic β€” your own personal startup command file, just for you πŸ’–
  • ${CAD_ROOT}/magic/nmos/* β€” some standard nmos cells πŸ‘‘
  • ${CAD_ROOT}/magic/scmos/* β€” some standard scmos cells 🌸
  • ${CAD_ROOT}/magic/sys/*.cmap β€” colormap files, go read the CMAP(5) man page 🌈
  • ${CAD_ROOT}/magic/sys/*.dstyle β€” display style files, see DSTYLE(5) 🌟
  • ${CAD_ROOT}/magic/sys/*.glyphs β€” cursor and window bitmap files, see GLYPH(5) πŸ–ΌοΈ
  • ${CAD_ROOT}/magic/sys/*.tech β€” technology files, see ``Maintainer's Manual #2: The Technology File'' πŸ“œ
  • ${CAD_ROOT}/displays β€” configuration file for Magic serial-line displays πŸ–₯️

CAD_ROOT variable

so, the tea: if the shell environment variable CAD_ROOT is set, Magic uses that location instead of the installed location (/usr/local/lib, by default). and like, normally you'd change the search path (see below) rather than redirecting the entire CAD_ROOT location. that's the move πŸ’…

Search path

Magic's system and library files β€” think technology files and display-style files β€” normally live in the ${CAD_ROOT}/magic area. but Magic first tries to find them in the user's current directory. this is sooo intentional, it makes it easier for an individual user to override installed system files. the search path is defined by the Magic command path,


πŸ‘‘ AUTHORS πŸ‘‘

Original: Gordon Hamachi, Robert Mayo, John Ousterhout, Walter Scott, George Taylor β€” the founding mothers and fathers of this whole situation, icons only 🫢

Contributors: Michael Arnold (Magic maze-router and Irouter command), Don Stark (new contact scheme, X11 interface, various other things), Mike Chow (Rsim interface). the X11 driver is the work of several people, including Don Stark, Walter Scott, and Doug Pan β€” collab of the century fr fr πŸ”₯

Developers: ongoing development (magic version 6.5 and higher) made possible by Stefanos Sidiropolous, Tim Edwards, Rajit Manohar, Philippe Pouliquen, Michael Godfrey, and others. legends, all of them πŸ’œ

Many other people have contributed to Magic, but it is impossible to list them all here. we appreciate their help! πŸ˜­πŸ’–


πŸ’€ BUGS πŸ’€

okay so if Magic gets stuck for some reason, first try typing Control-C into the terminal window (in the Tcl/Tk version, this is the original terminal, not the Tk console window β€” the way that detail matters 😀). most of Magic's lengthy database searches are interruptible. if that doesn't work? kill the process, no shame 🫑 the Tcl/Tk version automatically creates periodic backups that may be recovered with "magic -r". periodt.

report bugs to magic-dev@csl.cornell.edu. please be specific: tell us exactly what you did to cause the problem, what you expected to happen, and what happened instead. if possible send along small files that we can use to reproduce the bug. a list of known bugs and fixes is also available from the above address. and tell us which version of magic you are running!! πŸ‘€

and that's the whole page bestie, we made it πŸŽ‰πŸ’…βœ¨ this one's from the 4th Berkeley Distribution, and it's the MAGIC(1) page β€” no date on the footer, she's just timeless like that. go forth and lay out some silicon, you absolute main character πŸ¦‹πŸ‘‘πŸ’–

πŸ“¦ where this page comes from