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 toscmos. (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:snapcommand), then the box corner is left aligned with the grid that the user has chosen for the window with the:gridcommand, 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 commandwire type.rightβ Same as the long commandwire leg.middle(bottom) β Same as the long commandwire 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 thepathcommand 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 from0toxsize-1in the x-direction, and from0toysize-1in 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 ofarrayabove, 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 ofleft,right,up, ordown. Distance defaults to the width of the box if direction isrightorleft, and to the height of the box if direction isupordown.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.x1andy1are the coords of the lower left corner of the box, andx2andy2are 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 CalmaARRAYconstruct, but after acalma flattenthey 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 thecalmacommand 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 nolowermakes lower case get converted to upper case on output πΈcalma noflattenβ undoes the effect of a prior:calma flattencommand, re-enabling the output of Magic arrays using the CalmaARRAYconstruct π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 infile.strmin 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 β useloadto 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 readcommand π«calma write fileNameβ writes a stream file just as if no arguments had been entered, except the output goes intofileName.strminstead 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 the95cif extension. If disabled, labels are collapsed to points when writing cif and the94cif 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 thecifcommand 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 infile.cifin 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 intofileName.cifinstead 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 thecif writecommand, 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 withdrc 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 likedrc whywould π . Don't passnth(or pass something less than1) 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 thedrccommand 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 withdrc 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 intofile, or straight to the text terminal if you don't give afile. 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 invokeddrc 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 cellcellNameinto the edit cell so thatrefPointCin the child lands on pointrefPointPin 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. NorefPointC? It uses the lower-left corner of thecellNamecell. NorefPointP? 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 theseecommand 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 inlayers. (Layer list syntax lives in the ``LAYERS'' section, iykyk.) Leavelayersout and it defaults to*,labels. Wanna know which layer names actually exist? Check your technology manual, or just run thelayerscommand π¦.expand [toggle]β if you hand it the keywordtoggle, every selected cell that's unexpanded gets expanded and every selected cell that's expanded gets unexpanded. So satisfying π. Iftoggleisn'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.extfiles that describe the electrical circuit your layout actually implements β‘. The current extraction style (seeextract stylebelow) decides the parameters for parasitic resistance, capacitance, etc. that get used. Runextractwith no parameters and it checks timestamps and re-extracts as needed to bring all.extfiles 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 π₯.Optionandargswork 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 filename. 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 dowith no arguments to print a list of available options and their current settings π. When theadjustoption is enabled, the extractor computes compensating capacitance and resistance whenever cells overlap or abut; disabled, it skips those adjustments but runs faster π. Ifcapacitanceis enabled, node capacitances to substrate (perimeter and area) are computed; otherwise all node capacitances are set to zero. Same energy withresistanceβ it governs whether node resistances get computed at all. Thecouplingoption controls whether coupling capacitances are computed; if it's disabled, flat extraction is significantly faster than with coupling capacitance computation enabled. And finally, thelengthoption decides whether pathlengths in the root cell are computed (seeextract lengthbelow).extract helpβ prints a short synopsis of all theextractcommand 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 commandsextract length driver name1 [name2 ...]andextract length receiver name1 [name2 ...]. If pathlength extraction is enabled (:extract do length), then when the root cell in anextractcommand 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.extfile for the root cell. Normally you'd make a file of these Magic commands for the circuit drivers and receivers you care about and usesourceto read it in before circuit extraction β big brain move π§ . Andextract length clearremoves 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β likeextract 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 nostyleargument and Magic prints the names of all extraction parameter styles defined in the technology file and identifies the current one. Give astyleand 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.Optioncan 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; andlabels, to warn when nodes aren't labeled in the area of cell overlap π. On top of that,allrefers to all warnings. If a warning is preceded byno, it's disabled. To disable all warnings, useextract warn no all''. And to see which warning options are currently in effect, useextract 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:- Extract the design rooted at cell using
:extract cellπ«Ά - Flatten it with
ext2sim(1), which hands you the filescell.simandcell.nodes⨠- Run
:extresist cellβ this spits out a file calledcell.res.extcontaining the differences between the network described by the.extfiles produced the first time around, and a brand-new network that incorporates explicit two-point resistors where appropriate (more on that below π)
- Extract the design rooted at cell using
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 afeedback clearcommand plus a sequence ofboxandfeedback addcommands. Text gets associated with the feedback (it'll be printed byfeedback whyandfeedback find). Style tells how to display the feedback, and it's one ofdotted,medium,outline,pale, andsolidβ and if you don't specify it, style defaults topaleπ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 withfeedback find. Either way, the explanation associated with the feedback area gets printed π’feedback helpβ prints a short synopsis of all thefeedbackcommand 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 commandsource 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 isnorth, 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 theroutecommand: it generates routing in the edit cell to make the connections specified in the current netlist (go read theroutecommand for the full lore). BUT here's the difference:garouteis 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 usinggaroute channelcommands before you invoke this. And unlikeroute, where the box indicates the routing area,garouteignores the box entirely. The new wires go in the edit cell. The netlist used is the one selected by theroute netlistcommand, or the current netlist being edited in a netlist window if noroute netlistcommand 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 theroutecommand. If type is given, it must be eitherhorv. 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 ofgaroute channelcommands, either to the standard output, or to file if the latter is specified. The type parameter must be eitherhorv. 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 ish, or horizontally if type isv. 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 thegaroutecommand 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. Thegaroute nowarncommand 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 ofgaroute routerbtw π«Ά)garoute route [netlist]β routes the edit cell. If netlist isn't specified, the netlist used is the same as whengarouteis given with no options. If netlist is given, then it's used instead.garoute resetβ clears all channels defined bygaroute channel, in preparation for redefining a whole new set of channels π§Ήgaroute warnβ the opposite ofgaroute 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 anddump?dumpcopies the contents of the cell, whilegetcelljust 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]]]andgrid offβ no arguments? a one-unit grid gets toggled on or off in the window underneath your cursor.grid offalways 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 toinstance_id. π«ΆInstance_idhas 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, androtateβ 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 increasingrate. If the router is producing bad results, try reducingrate. It's a good idea to makewidthat least twice as big asrate. π«‘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 thedrcsection of the technology file. You can override those defaults with this command. The special typeSUBCELLis 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 atfile.maginto 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]]andmove 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 layerslabelsandsubcell. π
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]β ifplot parametersis 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 totrue, the:plot versateccommand will generate output suitable for a four-color Versatec plotter, using the styles defined in thecolorversatecstyle of the plot section of the technology file. Ifcolorisfalse(the default), then:plot versatecgenerates 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 formmagicPlotXXXXXX, whereXXXXXXis 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β Iftrue(the default) then the name and instance-identifier of each unexpanded subcell is displayed inside its bounding box. If this parameter isfalsethen 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%sformatting fields. The first%swill be replaced with the printer name, and the second one will be replaced with the name of the raster file. two%sfields, 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 tonunits. 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 toplow horizon 0. bring back the jogs, periodt πΊplow noboundaryβ Remove any boundary specified with a previousplow boundarycommand. 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 themoveorstretchcommands, 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 fromselectandmove). 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 thestraightencommand 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 theroutecommand 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: theroutecommand 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 theroute origincommand, 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,layer1in the router section of the technology file, is favored by the algorithm. Note:route viaminis an independent routing postpass that can be applied even if the routing was <em>not</em> generated by theroutecommand β 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. Iflabelsis given as a layer name, don't display labels in that window either. Iferrorsis 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. Aftersee 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 toselect 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 toselectexcept 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 likeselectdoes, 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. Ifmoreis specified, the new material is added to the current selection rather than replacing it. Iflessis 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. Ifmoreis specified, the new subcell is added to the current selection instead of replacing it. Iflessis 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 filecell.mag. committing it to the archives ππ
selectand theseecommand β 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 usedseeto 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 commandcmdover torsimto 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 thegridcommand), or to the standard1x1grid. Default vibes: snapping is off, meaning it snaps to a1x1grid. If you runsnapwith no arguments, it just prints whether snapping is enabled or not. Iconic little status check. πstartrsim [options] [filename]β basically thersimcommand'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 indirection. 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]]β literallymovebut 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. Ifdirectionisn'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 infoprints out what the buttons do for whatever tool you're currently holding.tool nameswitches you toname, wherenameis one ofbox,wiring, ornetlist. And if you just runtoolwith 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.optionandargsspecify 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 likewire 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. Iflayerandwidthare 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. Iflayerandwidtharen'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. Iflayerandwidthare given, then this command does not modify the box position. Noted. πwire verticalβ just likewire 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 theforceoption 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 namedterm1to the net containing terminalterm2. Ifterm2isn't in a net yet, make a new net containing justterm1andterm2. 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 eachnamegiven, delete the net containing that terminal. If nonameis given, delete the currently-selected net, just as happens when the ``No Net'' menu button is clicked.dterm name name ...β For eachnamegiven, 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 theextractcommand in layout windows.find pattern [layers]β Search the area beneath the box for labels matchingpattern, which may contain the regular-expression characters*''?'',['',]'', and\'' (as matched by `csh(1)`; see the description of the find button inMagic 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). Iflayersare given, only labels attached to those layers are considered.flush [netlist]β The netlist namednetlistis reloaded from the disk filenetlist.net. Any changes made to the netlist since the last time it was written are discarded. Ifnetlistisn't given, the current netlist is flushed.join term1 term2β Join together the nets containing terminalsterm1andterm2. The result is a single net containing all the terminals from both the old nets.netlist [name]β Select a netlist to work on. Ifnameis provided, readname.net(if it hasn't already been read before) and make it the current netlist. Ifnameisn't provided, use the name of the edit cell instead.print [name]β Print the names of all the terminals in the net containingname. Ifnameisn'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. Ifnetlistisn'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. Ifnetlistis 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. Iffileis given, write the netlist infile.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 toshownetexcept that instead of starting from a piece of paint under the box, it starts from each of the terminals in the net containingname(or the current net if nonameis 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]β Loadnumberas the color being edited in the window.numbermust be an octal number between 0 and 377; it corresponds to the entry in the color map that is to be edited. If nonumberis 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 filetechStyle.displayStyle.monitorType.cmapin 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 filetechStyle.displayStyle.monitorType.cmapin 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 theseecommand).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 theCMAP(5)man page π${CAD_ROOT}/magic/sys/*.dstyleβ display style files, seeDSTYLE(5)π${CAD_ROOT}/magic/sys/*.glyphsβ cursor and window bitmap files, seeGLYPH(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
- debian bookworm: magic 8.3.105+ds.1-1.1 Β· BSD-style
- fedora 43: magic 8.3.552-1.fc43 Β· HPND-UC-export-US AND TCL AND HPND
- fedora 43: magic 8.3.651-1.fc43 Β· HPND-UC-export-US AND TCL AND HPND
- fedora 44: magic 8.3.623-1.fc44 Β· HPND-UC-export-US AND TCL AND HPND
- fedora 44: magic 8.3.684-1.fc44
- fedora 44: magic 8.3.685-1.fc44 Β· HPND-UC-export-US AND TCL AND HPND
- nixos 26.05: magic-vlsi 8.3.629
- nixpkgs unstable: magic-vlsi 8.3.689
- ubuntu jammy: magic 8.3.105+ds.1-1.1 Β· BSD-style
- ubuntu noble: magic 8.3.105+ds.1-1.1 Β· BSD-style
- ubuntu resolute: magic 8.3.105+ds.1-1.1 Β· BSD-style
- ubuntu stonking: magic 8.3.105+ds.1-1.1 Β· BSD-style
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms