Magic VLSI Layout Tool Version 7.2 *

Table of Contents

Magic 7.2 Download
Compiling and Installing Magic 7.2
GNU Autoconf Compilation "configure" Hints
Compilation "make config" Hints
Magic 7.2 Command-Line Syntax
Debugging Runtime Errors under Tcl
Version 7.2 Disclaimers
Version 7.2 Screenshot
Description of Version 7.2 Revisions
Features Specific to Magic Version 7.2
Features Specific to the Tcl Interpreter-Based Version
Using IRSIM with Tk/Tcl-based Magic
Things To Do
Bug Fixes

BETA Code: Magic version 7.2 Download

I have been working hard on the next-generation "magic" product. While it is in no condition to be called stable, it is a working product and so I am releasing it as BETA code. This is an upgrade from the previous designation as ALPHA code, as several chips have been successfully designed and manufactured using version 7.2. For differences between the 7.1 CVS source version available from Cornell and the 7.2 development version posted here, please see the following sections.

The new development version is 7.3, with the introduction of a complete overhaul of the way magic deals with contacts, allowing arbitrary stacked contacts. Currently this is in a ALPHA state. Information on this version can be found at the Magic 7.3 page.

Revision 36 was reposted on 4/21/03, as I fixed a bug in the extract section which was producing incorrect length and width values for any transistors extracted with technology files not using the new "device" keyword (which is basically all of them except for the default one that comes with the source). The revision number is not updated because I have Revision 37 still on my laptop at home, but did not have the chance to transfer it to my web host yet. However, the fix is critical for correct circuit extraction; otherwise, area and perimeter values are interpreted as length and width on read-in, producing poor results (to say the least).

Revision 37 introduces autoconf to magic. Inevitably, this will produce a whole new round of porting problems for Solaris, Cygwin, OS X, etc. However, once the essential bugs are ironed out, it should result in fewer porting problems overall. For the moment, both configure and make config methods are retained.

Revision 49 changes the "varargs" method to "stdarg" (one of the items in "TODO"). This became urgent when the latest version of gcc claimed not to support the varargs method for variable arguments any more. HOWEVER, the stdarg method is different on different operating systems. The GNU autoconf system checks for this. The original "make config" script does not. In "make config", the correct setting is made for Linux. However, until some bug reports come back, I'm not certain which systems this will or will not compile on.

Revision 55 incorporates a port to the 64-bit Linux platform. Correct operation has been confirmed on an AMD Opteron machine running RedHat GinGin64 (2.4.20 kernel), loading a design with a half-million standard-cell gates and a half-million nets.

Download here:

File Revision Size Date
magic-7.2.70.tgz 70 (4.1MB) May 13, 2004
magic-7.2.68.tgz 68 (4.1MB) April 29, 2004
magic-7.2.54.tgz 54 (4.0MB) October 27, 2003
magic-7.2.45.tgz 45 (4.0MB) August 4, 2003
magic-7.2.26.tgz 26 (3.8MB) February 24, 2003
irsim-9.7.0.tgz 0 (523KB) November 13, 2004
irsim-9.6.11.tgz 11 (461KB) December 3, 2003
irsim-9.6.4.tgz 4 (764KB) February 19, 2003
netgen-1.2.6.tgz 6 (444KB) September 30, 2003
netgen-1.1.tgz 2 (417KB) January 13, 2003

Compiling and Installing Magic Version 7.2

See file README.Tcl in the source distribution for complete instructions on compiling the Tcl/Tk-based version of magic. For the impatient, the general rule is:
% ./configure
% make
% make install
There is an interactive configure script which goes through all of the option settings. Support for the interactive script is deprecated; use the GNU autoconf script. However, at this time, it still works:
% make config
% make
% make install
Note that Magic version 7.2 compiled with Tcl makes use of the optional Tcl/Tk package "BLT". Magic will run fine without it (it detects its absence and works around it), but if you don't have it, you'll miss the "cell manager" widget with the hierarchical cell view. BLT can be downloaded from SourceForge at the following location: BLT Toolkit Project on SourceForge.

Installing irsim version 9.6:
IRSIM 9.6 is beta code. Compiled normally (i.e., without the Tcl interface), it should compile and run like the long-standing standard version 9.5. However, the "make" process has been substantially cleaned up, and making for various systems should be much simpler. The "make" process is now identical to that for magic. Start with "make config" and then follow the instructions. The Tcl version of Irsim compiles and runs, except that the "analyzer" graphic display is a work in progress. The Tcl version takes advantage of both the ability to script the simulation procedure, as well as having a better interface to magic.

IRSIM 9.6 has not yet been converted to GNU autoconf compilation. This feature should be coming soon.

% make config
% make tcl
% make install-tcl
Note that the "user subcircuit" system has not been ported to the Tcl/Tk platform. My intention is to replace or augment the C-code based subcircuit system with a Tcl script-based version.

IRSIM revision history: Version 9.6
  1. December 2, 2002
    Original release of IRSIM version 9.6 with TCL.
  2. December 9, 2002
    Fixes error with revision 1 in which compilation will fail if the "user subcircuit" option is selected. Also fixes a problem with the print output to the tkcon console, which was sending garbage for arguments in error messages.
  3. December 24, 2002
    Fixes a few problems with the standard (non-Tcl) compile (thanks to Mike Godfrey for the fixes).
  4. February 19, 2003
    Corrects problems with refreshing the "analyzer" window by threading the graphics interface. This also speeds up the graphics initialization. This fix is not relevant to the Tcl version.
  5. March 12, 2003
    Updates the "make config" process to match that for Magic-7.2 revision 29. As per the notices posted above, the fixes may actually break the compile for some systems.
  6. March 24, 2003
  7. April 9, 2003
    This version was never officially released.
  8. March 31, 2003
  9. September 23, 2003
    Attempt to update varargs. This was a no-go, and superceded by revision 10.
  10. September 26, 2003
    Updates the deprecated "varargs" variable argument method, allowing compilation with gcc version 3, and overloads the Tcl "clock" command such that input command files (especially pre-version-9.6 ones) can be run without substituting "irsim::clock" for "clock".
  11. December 3, 2003
    Additional updates, especially to remove text after all #endifs to stop the compiler from complaining.
    Also, corrected an error with the non-TCL-based version compile involving routine lprintf().

Installing netgen version 1.2:
I am in the process of updating and migrating Massimo Sivilotti's netlist-processing program "netgen" to Tcl/Tk. This program can read and write numerous netlist formats, though its main feature of interest is the netlist comparator, which I intend to integrate into magic as an interactive LVS system.

The "make" process is now the same as that designed for both magic and IRSIM, making this start to look like a real suite of VLSI tools! Note that this has only been compiled under Linux, so other platforms may encounter problems and it may be necessary to hand-edit compile-time definitions in the "defs.mak" file. Version 1.1 revision 2 is left in the download file for anyone who finds that the newest "make config" script changes break the compile process.

Netgen revision history: Version 1.1
  1. December 14, 2002
    This is a first draft. Only a few things have been changed in this release other than the Tcl/Tk port. There is now support for capacitors, resistors, bipolars, poly-poly capacitors and resistors built with the pseudo-poly layer in magic, in the SPICE, sim, and ext format read routines. The Tcl version has a completely revamped command set, better matching the general practices of Tcl command syntax (mainly meaning commands are full words rather than single letters). In addition, the command sets for "netgen" and "netcmp" have been combined.
  2. January 13, 2003
    Massive speedup of several critical and badly-written functions; reduced from O(N^2) to O(N). The "compare" command is now virtually instantaneous. Commands "nodes" and "elements" now give more relevant information regarding specific points in the network. "sim" format retains position in the element names (for FET and FET-like elements) for convenient traceback to a layout or schematic.
Netgen revision history: Version 1.2
  1. March 12, 2003
    Fixes the the "make config" process for Tcl/Tk compile. Also, finished implementing the Tcl "log" command for log file output, and added the script-level "lvs" command to replace the original standalone program "netcomp".
  2. March 24, 2003
    Corrections to TCL command interface.
  3. March 26, 2003
    This version was never officially released.
  4. March 31, 2003
    Changes for interoperability with magic and IRSIM.
  5. April 3, 2003
    Changes to save position information in element names for transistors read from .sim files.
  6. September 22, 2003
    Added the capability to handle "M=" syntax in SPICE files for declaring multiple transistors with equal size and connections.
  7. September 30, 2003
    Fixed an unfortunate problem with the "lvs" script command in which it implies that circuits which pass the low-level connectivity comparison match correctly. In fact, these circuits may have errors. The fix checks this condition, performs the high-level resolution of automorphisms, and reports a final pass/fail condition.
Using netgen:
The most common use of "netgen" is to make use of its network comparison feature to compare a layout generated from magic with "extract" and "exttosim" ("ext2sim" in the non-Tcl version) commands against a layout generated from a schematic (e.g., xcircuit). The command sequence in netgen to compare these two netlists is: Arguments circuit1 and circuit2 are filenames. They do not need to have the ".sim" extension but do need to contain any directory path components (relative to the current working directory).

For circuits which do not match, it will be necessary to run the command "verify" to look at the list of illegal elements and nodes.

Note that the "verify" command produces copious output. Generally, it is preferable to use the "log" command to dump this output to a file. The command "verify only" produces just one line stating whether or not the circuits match. The output can be terminated at any time with a Control-C interrupt into either the terminal or console windows.

Starting with version 1.2, there is a script-level command which performs the sequence of commands above. This command is:

Arguments circuit1 and circuit2 are exactly as described above. logfile is the file to dump all output, and defaults to "comp.out" if not specified. Note that certain useful information, such as the initial report on the two files, and the final "yea or nay" result, is duplicated both to the log file and to the console (or terminal) window.

GNU Autoconf Compilation: Hints for "configure"

The "make config" script is being phased out in favor of GNU Autoconf. As usual for Autoconf compilation, compile-time options can be queried by doing "configure --help". At this time, the Autoconf script is in the subdirectory scripts, requiring descending to that directory to do the configure step and ascending back to the top-level source directory to run make. Options mostly mirror the "make config" options. The major options are:
All of the optional modules in magic can be enabled or disabled by individual switches on the command line. Generally speaking, these should be left alone. Some systems may run into trouble with either the TCL interpreter or OpenGL if they are installed in unusual places. The autoconf script goes to great lengths to find them, but in case of failure, the location of files may be specified explicitly by passing an argument to autoconf. For even more obscure options which may effect compilation on peculiar systems, refer to the text dump from "configure --help".

A Note on Tcl/Tk: Compilation under Tcl/Tk is probably both the most common option and the most problematic. A number of standard OS distributions do not come with all the bits and pieces necessary to compile a Tcl/Tk extension. If this is the case, then you will see this when you do configure when it says:

checking for no.
Assuming that you really, really want the Tcl version of magic (and in my opinion, you really, really do), your best bet is to download, compile, and install new versions of Tcl and Tk. This is pretty straightforward. Get the latest version from the Tcl/Tk Developers Exchange (click on the download link up near the top). One important thing to know when compiling your own: The executables for "tclsh" and "wish" will be installed as "tclsh8.4" and "wish8.4" (or whatever is the current version number). "wish" is critical, because magic uses it. You will need to rename or remove any existing executable for wish, and then either rename "wish8.4" to "wish" or else create a symbolic link "ln -s wish8.4 wish" (preferred).

For example, I have a RedHat system which came with Tcl/Tk 8.0 installed in /usr/bin/. Compiled from source, Tcl/Tk 8.4 installed by default in /usr/local/bin/. I changed "/usr/bin/wish" to "/usr/bin/wish8.0" and changed "/usr/local/bin/wish8.4" to "/usr/local/bin/wish" (hmm, did I just say "preferred"?).

Compilation: Hints for "make config"

Some of the configuration options may be obscure or require an explanation. In a nutshell, here are the options encountered in "make config" and what they mean. Note that not all of these options will necessarily be presented, depending on prior choices.

Magic version 7.2 Usage

Basic usage:

magic [-noc[onsole]] [-w[rapper]] [-d devType] [-T technology] [file]


(Tcl version only) Uses the calling terminal for terminal-based command-line input. Otherwise, a Tk console window is used.
(Tcl version only) Magic layout windows use the GUI wrapper, including cell and technology manager windows, layer toolbar, and file menu.
-d devType

(all versions) Select the graphics interface at runtime. Specifying an invalid devType will result in a list of known types. The possible values of devType are determined at compile time, but the usual ones are NULL (no graphics), X11, and OpenGL. X11 is the usual default.
-T technology
(all versions) Select the appropriate technology (.tech27) file. At present (this is on the to-do list), magic cannot change technology after startup. So the technology file corresponding to the layout to be loaded must be supplied to the command line at startup. The default technology is scmos, which is included with the magic source distribution. The complete list of available technology files depends on what has been installed on the system (see the technology file page for details).
(all versions) Load the layout (.mag) file file into the layout window on startup.
Complete usage information:

magic [-noc[onsole]] [-w[rapper]] [-nowindow] [-d devType] [-T technology] [-m monType] [-D] [file]
where the additional options not covered above are:

(Tcl version only) Run without displaying an initial layout window. This is used mainly for GUI wrapper scripts which like to generate and handle their own windows.
-m monType
(obscure) monType names a monitor type. This is used in the search for the colomap file name, which is designated <tech>.<planes>.<mon>.cmap1. The default is "std" (corresponding to colormap file "mos.7bit.std.cmap1". The only other monitor type for which colormaps exist in the distribution is "mraster". This provides a way for users to override the system color assignments.
(all versions) Run in Debug mode.
Obsolete usage information:

magic [-g gPort] [-i tabletPort] [-F objFile saveFile] ...
where the additional options not covered above are:

-g gPort
(largely obsolete) gPort names a device to use for the display. This was generally used in the past with dual-monitor systems, especially Sun systems in which the layout display might go to /dev/fb.
-i tabletPort
(largely obsolete) tabletPort names a device to use for graphics input. This has not been tested with modern graphics tablet devices. It is ignored by the X11 and OpenGL display interfaces.
-F objFile saveFile
(largely obsolete) Create an executable file of the current magic process, a core image snapshot taken after all initialization. objFile is the name of the original executable, and the image will be saved in saveFile. This only works on VAXen and SUNs running an old SunOS (using a.out executables).

Debugging Runtime Errors under Tcl

The Tcl version, especially using the console, can make debugging runtime errors difficult, especially if the error appears in the console and then the console is destroyed along with the interpreter as magic exits suddenly. Also, the convoluted way magic starts up under the interpreter means that some reported errors may not actually point to the correct origin of the error.

The methods described below progress from easiest to most difficult, but each can be useful depending on how and when the program bites the dust.

gdb "attach" method

The easiest method to debug magic is to use the "attach" function in gdb, which can be specified on the command line as:
gdb program ppid
If only one process using the Tk wish graphical shell is running, the following Linux shell command (which can be copied into a shell script, for convenience) will attach and run gdb on the magic process:
gdb program `ps -C wish --no-headers -o "%p"`
Although this is supposed to work according to the manual page for gdb, I find that gdb doesn't recognize any symbols unless I do:
ps -C wish --no-headers -o "%p"
gdb wish
attach process_id
using the result of the first command for process_id in the gdb attach command. On machines that don't recognize the "-C" switch to ps, use whatever variant that will show you the process ID of the "wish" executable.

Note that once gdb is running, the program may be interrupted at any point with a control-C key sequence in the terminal running gdb, to check variables, calling sequences, set breakpoints, etc. The gdb command "continue" resumes the program after attaching the debugger to the process. If you want the magic developers to investigate a segmentation fault, run the program under the debugger using the above method, and try to repeat the minimum number of steps leading to the crash. After the crash condition has caused the process to drop back to the debugger prompt, run the command "where" to get a stack trace of the subroutine call stack. Email this information to the developers, along with any other relevant information.

If the program fails during or after loading the technology file, but does not crash, it is still possible to use this method by attaching gdb, setting a breakpoint, then running

tech load tech_name
from the magic command line. The tech load command clears out most of the allocated memory structures used by magic and regenerates them from scratch as the technology file is loaded back in.

If the program crashes too fast to attach gdb to the running process, then one of the methods below may be necessary.

"noconsole" method

Errors which disappear along with the console can be viewed by running magic without the console:
magic -noconsole
To debug more pernicious runtime errors, it may be necessary to do a partially manual startup of magic. For non-fatal errors (i.e., an exit with an error but not a segmentation violation or bus error), do the following:
source /usr/local/lib/magic/tcl/magic.tcl
Note that with this kind of manual startup, it is not possible (or at least, it's not easy) to use the "tkcon" console window.

standalone method

Sometimes it may be necessary to pass arguments to magic. An example follows:
set argc 4
set argv {-d OGL -T scmos}
source /usr/local/lib/magic/tcl/magic.tcl

manual object load method

Under some circumstances, it may be necessary to manually load the magic shared object file to figure out what went wrong. This is a good thing to do if, for instance, magic reports that it can't find the "" file:
load /usr/local/lib/magic/tcl/
For fatal errors (crashes), do the following:
gdb wish
source /usr/local/lib/magic/tcl/magic.tcl
Various combinations of the above tactics may be necessary to get the program to run in the right mode for reproducing the runtime error. Note that all of the examples above assume that magic has been installed in the default directory /usr/local, and proper substitutions should be made if required by a non-default location of the installation.

Magic version 7.2 Caveat end-user!

This version IS listed in the section above as "BETA" code, and as such, no guarantee is made to its stability. BETA code should not be presumed to generate a perfect result, though, and all final output should be checked against a separate layout tool. Given the expense of fabrication, even DISTRIBUTION code should not be inherently trusted without at least an eyeball check by an experienced layout designer. Magic 6.5.1 is DISTRIBUTION. Magic 7.1 and Magic 7.2 are BETA. Magic 7.3 is ALPHA.

More designations: Magic 7.1 "NONMANHATTAN" option is BETA. Magic 7.1 "FILE LOCKING" option is correct in the 7.1 CVS source code and later versions, but there is no need to compile with it unless you expect more than one person at a time to be working on a layout. It may be considered BETA. New magic techfiles from ISI (MOSIS) have their own designations and are currently described as BETA. Old magic techfiles "scmos.tech27" and its ilk are DISTRIBUTION for most purposes such as small digital circuits (college class projects and such) but are getting outdated.

Note: When checking magic output for errors, remember to always check the CIF or GDS result, as an improper technology file can introduce new errors into a layout which are not checked by either the magic extraction or the DRC rule-based checker. Because errors may also exist in the DRC section of a techfile, a layout ideally should be checked against a professional-grade DRC checker such as CALIBRE.

The purpose of the recent Magic development effort is, eventually, to be able to call Magic a "professional-grade" tool. Any help in this effort is greatly appreciated.

Screenshot of Magic version 7.2

Shows off a number of features of the Tcl version, including the cell manager window, the tech manager window, the toolbar, the console command-line entry window, and popup dialog boxes. Also shows off the version 7.1+ features of the OpenGL display and the non-Manhattan geometry extension.

Revision information on Magic version 7.2:

  1. Original (prior to adding revision information); last updated August 29, 2002. Changed the "make" method from "make wrapper" and "make install-wrapper" to "make tcl" and "make install-tcl" both to reflect the fact that SWIG is no longer used, and to make it more syntactically compatible with "tclspice".
  2. Fixed conflicting routines in "exttospice" and "exttosim"; "exttosim" can be run without crashing the program. Extraction output now redirects to the console output, not the terminal output.
  3. More "exttospice" and "exttosim" fixes: Both programs now free memory like they're supposed to. In addition, both commands can be run from inside a window and automatically operate on the root cell of the layout in that window.
  4. Extensions to the "magic wrapper" GUI ("magic -w"):
    There is now a toolbar on the right-hand side of the layout window, showing all of the layers known to the tech file. Each one is a button. Clicking mouse button 1 paints that layer into the box in the layout. Clicking mouse button 3 hides the layer, and clicking mouse button 2 restores visibility of the layer. The name of the layer appears in the title bar of the layout. Also, the box coordinates are shown in the title bar. For people who use magic in 8-bit PseudoColor mode, the console window is repainted in magic colormap colors, so there is no more color switching between the layout and the console.
  5. Important repairs to the CIF reading/writing and internal grid rescaling code---affects the ability of magic to read CIF/GDS in a different lambda scale from the scale at which it was written. Also, non-Manhattan geometry has finally been incorporated into the extresis code.
  6. Minor revisions thanks to Conrad Ziesler implementing the grid scaling code in the wiring and router sections, and a fix to some segmentation-faulting behavior, also in the router section. Fixed up behavior of the wrapper in all modes, including OpenGL and overlay planes. Unfortunately, it's my X server that fails on some of these mode combinations, not the magic code. The XFree86 server operates as intended, although it does not implement overlay planes.
  7. Added a menubar to the wrapper GUI. This includes file read/write functions, and a "cell hierarchy manager" that provides a tree-based view of cell definitions. New code changes allow magic to operate in a slave interpreter (specifically, as a slave interpreter in the TkCon console version). Changed magic command names to avoid conflicts with Tcl/Tk commands. Replaced the "list", "listall", "listtop", "parent", and "children" commands with an extended and more general method using two (new) commands "cellname" and "instance" (these are required by the cell hierarchy manager widget).
  8. Finished the basic GUI, including a working "cell manager" and "tech manager". Added general method for callbacks "magic::tag " which replaces the previous method for handling captions and scrollbars, and allows syncronizing the GUI with command-line commands. Added new magic command "techinfo" to return several variables related to the loaded tech file. Added option "childinst" to the "cellname" command, which enables reporting the child instances of top-level cells, which are otherwise unavailable due to the fact that top-level instances are always named "Topmost cell in the window" and cannot be selected or searched by name. Added options "list" and "listall" to the three commands "cif istyle", "cif ostyle", and "extract style", so that the current style and available styles can be queried from the command line and returned as a Tcl result. Added "label", "subcell", and "error" layers to the toolbar. Added keystroke commands to the toolbar: "p" for "paint" and "e" for "erase". Switched mouse button functions so that button 1 = "see", button 2 = "paint", and button 3 = "see no" (hide layer). This matches the button 2 function in the tool bar to the function in the layout window, and works better for 2-button mice.
  9. Added command "element" for annotations on the magic layout window. Presently, this is somewhat primitive. Commands are:
    • element add rect name style llx lly urx ury
    • element add line name style x1 y1 x2 y2
    • element add text name style x y text
    • element delete name
    The name is a unique name given to each element so it can be registered and searched in a hash table. The style is the name of a magic style which must match the name from the .dstyle5 file (it can also be the number of the style, 0 through 255).
    Also: Extended keystroke commands on the toolbar with: "s" for "select more area layer" and "S" for "select less area layer".
    Also: Changed the "make" process so "make clean" descends into all modules, not just the ones selected by "make config".
  10. November 18, 2002
    Quick fixes on the tag mechanism (magic commands called from a command tag should not increment the sequence of command numbers, or else the "select" mechanism doesn't work right), and corrected the #ifdef statements in the proto.magic file so that interactive macros "p" and "l" (paint and label, respectively) are defined under the Tcl version.
  11. November 19, 2002
    Quick patch to revision 10, which crashes on any call to "select" with more than two arguments.
  12. November 25, 2002
    Completed the (initial version of the) tag mechanism, mainly with the option "element configure" which allows element positions to be changed, text to be altered, and styles to be added or removed.
    Also: Added line antialiasing to the OpenGL version.
    Also: Changed the outline rendering to do true outlines of layers rather than outline each tile. This allows, for example, nonmanhattan pads to be drawn without highlighting the entire internal tile structure.
    Also: Changed the "techinfo" command (see above) to "tech info" and added a "tech load" command for real-time loading of the technology. This can be used to develop and reload debugged/extended versions of the same tech file, or to load an entirely new technology. This is still under development, is inherently dangerous, and can crash the whole program.
  13. December 2, 2002
    Completed the "tech load" command so that it does not complain or crash the program, although existing layout may be invalidated if the number of planes changes.
    Also: Extended the "image create layer" method under Tk with the ability to drop entire layouts into Tk images. The syntax is "image create layer -name -width -height ", where "window_name" is the Tk path of an existing layout window. The existing window will be deleted when the image is instantiated.
  14. December 9, 2002
    Completed a reasonable first draft of the interactive IRSIM simulator under magic. This corresponds to IRSIM 9.6 Revision 1. Both programs must be compiled and installed for this method to work properly.
  15. December 11, 2002
    Added Mac OS X support (thanks to Michael Doster). Changed the "layers" command to "tech layers", with "tech layers *" vs. "tech layers" differentiating between the version which returns a Tcl list of all canonical names and the one that prints all names and aliases, respectively. Started a skeleton program for the techfile builder wizard, added a minimal-size techfile ("minimum.tech27"), and debugged the operation of magic under the minimum techfile.
  16. December 12, 2002
    Correction to scmos/Makefile which deletes "minimum.tech27" in rev. 15 and thus halts the make install process.
  17. December 16, 2002
    Minor corrections for OS X support when not compiling with Tcl/Tk support (again, thanks to Michael Doster).
  18. December 17, 2002
    Changed the tech initialization routine to use memcpy() and memset(). This takes a couple seconds off of startup when magic is compiled without optimization (which is the default for magic 7.2, as long as it remains in alpha status).
  19. December 23, 2002
    Finally changed the way tech styles are handled so that magic can take more than 64 layout styles, and is not dependent on the ordinal numbering in the styles file. Styles may be called out by name as well as number in the "styles" section of the technology file. Modified the OpenGL dstyle file to take advantage of the new system.
    Also: Removed a lot of old cruft from the distribution, including AED and X10 graphics packages, the "mpack" command, magic's built-in malloc() routine, and the VAX-only executable image "freeze" and "thaw".
    Also: Did a test with the "plow" section in which the feature is modularized under Tcl, is not loaded on startup, but auto-loads the first time the feature is requested (by executing the "plow" or "straighten" command). The plan is to extend the modularization to the "plot" and "route" sections.
  20. January 6, 2003
    Fixes to the extresis geometry extraction and subcircuit boundary handling. Fixed modularization for the "plow" option and extended modularization to the "plot" and "route" options.
  21. January 7, 2003
    Due to an error, revision 21 was exactly the same as revision 20.
  22. January 8, 2003
    Quick fix to the install process, which was missing the glyph files in the graphics subdirectory. Thanks to Tim Chuang for reporting this error.
  23. January 20, 2003
    Added a window console option, although the implementation is only partial.
  24. Feburary 10, 2003
    Rewrote the graphics routines to find display depth during display initialization. This corrects an error left around since the display style file format was changed. As a result, it is no longer necessary to declare the display depth in the display style file. This is fortunate, since which style file is read depends on the display depth! I have tested Tcl and non-Tcl versions in X11 and OpenGL at display depths of 8, 16, and 24, and everything appears to work correctly. Also, fixed the colormap repainting of the Tk console in 8-bit pseudocolor mode, which was broken since I switched to a master/slave interpreter configuration with the console.
  25. February 19, 2003
    Reincorporated the 3D graphics from the 3D version into the main distribution as a "specialopen" type window. The interface remains somewhat crude, but the command "specialopen wind3d" will bring up an OpenGL 3D window, and various keys manipulate the view: the top keyboard row (numeric keys '1' through '0', minus ('-'), and equal('=')) manipulate the viewing' angle. Keys 'Z' and 'z' zoom out and in, respectively. Keys '>' and '<' change the relative z-axis (height) scaling. Arrow keys reposition the view (albeit relative to the original, top-down view).
  26. February 24, 2003
    Extraction changes: Tech file now takes keywords "device " which takes the place of the "fet" keyword (although that is kept for backward compatibility). Device names are: "mosfet", "bjt", "capacitor", "resistor", and "subcircuit". In particular, the non-FET devices output relevant information to the .ext file, including total capacitance for type "capacitor" and total resistance for type "resistor". "device mosfet" differs from "fet" in that values for gate length and width are written to the .ext file instead of area and perimeter. While the current code keeps the simplistic relationship between area and perimeter and length and width, technically this change allows a more sophisticated extraction implementation which would correctly handle non-standard devices such as annular FETs.
    Enhancements to 3D graphics: Key "C" will toggle between magic layout and CIF layout views.
    Layout window client command "cursor" added which returns the instantaneous value of the pointer in magic coordinates.
  27. February 26, 2003
    Minor bug fixes to non-Tcl compilation; "config" script changes for Solaris support, and "config" script support for Tcl/Tk in non-standard directories, especially for Mac OS X support.
  28. March 4, 2003
    Repaired all the problems with Mac OS X support for the Tcl/Tk-based version, and a couple of other glitches associated with "make config" in Revision 27.
    Also: Removed all format version numbers from magic's system files: .dstyle6 becomes .dstyle, .cmap1 becomes .cmap, and .tech27 becomes .tech. Each of these files except cmap (which has only ever had one format) takes a keyword "version" with the version number, internally. Future versions of magic should read the format version inside the file and adjust the read routine to match the format. Current format ".tech27" is tried as alternative name if a ".tech" file cannot be found, because there are so many ".tech27" files in existance which do not belong to the magic distribution.
  29. March 10, 2003
    Major changes to the "make config" file for support of Tcl/Tk in non-standard directories; hopefully this version is compatible with Cygwin, Solaris, and Mac OS X, although a lot of configurations are untested and it may take some feedback before everything is working reasonably well. Part of the make process changes includes having the linker export only required symbols (procedure names and global variables) to avoid conflicts with other dynamically-loaded object files.
    Also: Commands "exttospice" and "exttosim" have been changed so that they are recognized by magic as built-in commands (that is, they have an entry in the command table and show up in the "help" list).
  30. March 12, 2003
    Removed "plow" from the list of module choices (or any choices) because the plow section of the tech file is used by the "stretch" command. Lack of the plow module changes magic's behavior, so it should always be installed.
    Also: Reinstated the "-namespace-flat" and "-suppress undefined" switches for Mac OS X, because the use of the version script apparently makes it necessary.
  31. March 23, 2003
    Finally implemented an apparently-correct procedure for handling overloaded commands. Commands "array", "load", "flush", and "label" have been reverted back to their original forms. "clockwise" can be used as "clock" without generating an error. "grid" remains renamed to "gridspace".
    Also: Attempted a fix to user-input function TxGetLinePfix(), but so far this is still broken (it works from the command line, but not internally).
    Also: Fixed the "goto" command so that it works on internally-named nodes (it was never updated when the way internal node names are generated was changed).
  32. March 26, 2003
    Fixed some errors in the new "device *" extraction method (old "fet" record was not backwardly compatible as it was supposed to be, and the "device bjt" order of arguments was incorrect).
    Also: Added a method to subcircuit extraction in which labels can be suffixed with "#n", where "n" is the order in which the port should be written to the subcircuit record in the SPICE output. This allows ports to be specified to match a pre-existing SPICE subcircuit, rather than forcing the user to make the subcircuit match the SPICE output from Magic.
    Also: Fixed a string allocation error in the Tk/TOGL graphics routines which would cause occasional fatal crashes.
    Also: Fixed some errors in the CIF/GDS read routine to prevent arithmetic overflow. This repairs some, but not all, cases.
    Also: Fixed the previous fix for the Mac OS X compile. Thanks to John Geisz for helping with the Mac OS X compile and install problems.
  33. March 31, 2003
    Extensions to the "box" and "array" commands. Both commands now take numerous options. Do "box help" and "array help" for a complete list of options.
    Also: Reinstated the original "grid" command (instead of the rewritten "gridspace" command). Also: Wrote in a lot of application interoperability code (scripted). Other applications are invoked on the Tcl command line as they would from the shell command-line. For instance, invoking IRSIM is now done by typing "irsim" at the Tcl prompt, not "startirsim". All applications accept their usual command-line arguments.
    Also: More changes for Mac OS X compile and compatibility. Possible problems have been seen with recent OS X revisions which have apparently enabled 8-bit overlays, but may have different values for reserved portions of the colormap. A temporary fix is to set the shell environment variable "MAGIC_COLOR" to "24bit" to force 24-bit mode, or to set "X_COLORMAP_BASE" and "X_COLORMAP_RESERVED" appropriately, probably to 0 and 2, respectively (this is a guess).
  34. April 7, 2003
    Extension to transistor extraction to include support for annular transistors.
    Also: Important fix to the non-Manhattan paint function. The bug apparently only affected CIF/GDS file reads (layers with non-Manhattan geometry would occasionally get painted with the wrong magic layer type). Also for CIF/GDS reads, added an internal grid subdivision limit so that the internal grid doesn't get subdivided so much that integer overflows occur on large coordinates.
    Also: Added backslash-r and backslash-b (linefeed and backspace) handling to TkCon for compatibility with tclspice output.
  35. April 15, 2003
    Important fix to two outstanding problems: 1) The CIF "bloat-or" function for writing CIF output now handles non-Manhattan geometry, enabling output for non-Manhattan transistor geometries (such as annular devices in submicron technologies); 2) The "widespacing" DRC rule has been implemented in a robust way (the previous version was a bit of a kludge and didn't catch all errors). It remains to be determined how this implementation differs from Dracula or other DRC checker implementations. The DRC rule syntax is
    widespacing layers1 width layers2 spacing adjacency why
    following the syntax of the "spacing" rule except for the addition of "width", specifying the width of material in layers1 which triggers the additional spacing rule.
    Also: Added cell deletion and cell renaming in the form of "cellname" subcommands in the following syntax:
    cellname delete cellname
    cellname rename cellname newname
    These functions currently do not support the file locking feature; that is, it is possible to screw up a shared layout database by using them. File locking support will be patched in in the near future.
    Also: Fixed a bug preventing compilation of the non-Tcl version in revision 34.
    Also: Partially implemented autoconf by attaching the OS and hardware auto-detect script "config.guess", and removing the user selection thereof from magic's config script.
  36. April 16, 2003
    Fixes a bad mistake in revision 35 which effectively disables "exttospice" and "exttosim", if they're compiled as modules (the default), and causes Magic to hang. Also fixes a bug found by James Adkins in which loading cells created by the "flatten" command will crash the program.
  37. April 28, 2003
    Introduced a real working autoconf, though probably will take some time to debug operating systems other than Linux.
    Also: Revamped the "subcircuit" method, which deprecates the "subcircuit" boundary layer in favor of using the new port command to turn labels into ports. port help returns information on the correct syntax.
  38. May 5, 2003
    Incorporates a LEF output module for defining characteristics of a circuit relevant to standard-cell place-and-route. The port command has been extended to include use and class designations. A new command property has been added to assign key-value string pairs to a cell, which can be saved and reloaded along with the layout. A new command lef has been added to generate LEF-format output for a cell. Each of these commands implements a help option for more information.
  39. May 19, 2003
    Enhanced, corrected, and expanded three-dimensional viewing under Tcl/Tk + OpenGL with the "specialopen wind3d" command. Fixes to the LEF module after testing on 3rd-party tools. GNU "autoconf" compilation tested on Linux and Solaris. Fix to extract section for a long-standing error (exists in v.7.1) which miscalculates perimeters of ndiffusion.
  40. June 11, 2003
    Fix to annular and nonstandard transistor extraction. Fix to Solaris autoconf make script.
  41. June 20, 2003
    Fixed the scrollbars in the Tk GUI. Extended the syntax of command "scroll" to include scrolling by layout units. Added capability of the wind3d "specialopen" window to be generated as a Tk path, and added the "magic::render" command to the Tk GUI with a (trivial) GUI wrapper as a proof-of-concept. Added "target window" option to the cell manager. Changed GUI so that the toolbar is not shown by default, but is chosed from the (new) "Options" menu. Removed "Cell" and "Tech" menu buttons and moved them under the "Options" menu as checkbuttons. Fixed an error in which the scrollbars in the non-Tcl version did not recognize mouse input. The fix substantially cleans up the "WindSend" routine.
  42. July 10, 2003
    Changed some CPP processing to M4. Changed extract extension for "device resistor" to include the SPICE type "semiconductor resistor". The semiconductor resistor syntax is used unless the name argument is "None", in which case the simple resistor is used. Changed the keyboard behavior so that shift-keypad keys are not interpreted as ASCII numbers.
  43. July 16, 2003
    Fixed "magic/" so that exttospice and exttosim work again; other bug fixes related to the modularization of the command tables. Added a preliminary "cif warn" option; esp. with "cif warn align", the layout can be checked for contacts on half-lambda spacing. Fixed feedback rendering so that it does not attempt to draw out-of-bounds entries. Fixes and updates to the gnu autoconf interface.
  44. July 24, 2003
    Changes to the Tk graphics to replace X11 calls by Tk calls whereever possible. Added automatic grid scaling for GDS file reads, and added some useful options to CIF and GDS reads, including limiting and redirecting error and warning messages.
  45. August 4, 2003
    More fixes stemming from the modularization of the command tables. Also: Added configuration changes necessary for compiling an RPM package from the Magic source (enhancements courtesy of Erwin Prin).
  46. August 8, 2003
    Reformed the electrical connectivity search function to be a one-pass, recursive function, avoiding redundant tile checks and speeding up the process. Added the ability to search connectivity across ports, for ports having the same index. This search function modification has not yet been copied to the "extresis" and "sim" functions.
  47. August 14, 2003
    Fixed a bug in the new electrical connectivity search function, and extended the improved search function to "extresis" and "sim" (e.g., "getnode") functions. Also: Added files pertaining to the creation of an RPM package for Magic, courtesy of Erwin Prinz. These have been placed in a new subdirectory scripts/rpm.
  48. September 5, 2003
    Fixes/enhancements to the file locking code, courtesy of Mike Godfrey.
  49. September 12, 2003
    Switched from the "varargs" method for variable argument subroutine calls to "stdarg", in response to GNU gcc no longer supporting the former.
  50. September 22, 2003
    Changes to handling of standard cells during extract and exttospice. Also: Fix to capacitance value output from the "device capacitor" extraction method.
  51. September 26, 2003
    Added a LEF file reader to Magic ("lef read file"). Fixed the connectivity algorithm which searches across ports with the same index (which is critical for handling pins with multiple, unconnected ports read from a LEF file).
  52. September 30, 2003
    Corrected a serious CIF/GDS output problem: Contacts may not be centered if the contact size or spacing is an odd number of centimicrons, because half-centimicron values get rounded, and may cause the output geometry to be off-grid. It may also cause overlapping contacts in subcells to produce contact cuts at different positions.
  53. October 3, 2003
    Added a DEF file reader to Magic ("def read file"). Changed the behavior of the "cellmanager" widget in the Tcl wrapper so that it remains nonexistant until called from the Options menu. This prevents magic from hanging while the cell manager processes thousands of cells if a large design is loaded in.
    Note that the LEF and DEF syntaxes have been only partially implemented. In particular, wire widths on routing layers are ignored and a default wire width of 3 is used. Layer names in the LEF and DEF files must have entries in the technology file; that is, they must be included as aliases for magic layer names. Eventually, this should migrate to a new section for the technology file.
  54. October 27, 2003
    A number of fixes, including the graphics handling of layer perimeter outlines, a fix to the "cif limit" syntax parsing, an important fix to CIF read-in for files that define the geometry in sub-centimicron units, and an error reported by Wai Yung in which compilation fails if nonmanhattan extensions are disabled. The LEF and DEF readers have been substantially fixed and enhanced.
  55. November 2, 2003
    Changes made for compilation on an AMD Opteron (using RedHat GinGin64). Operation appears to be correct. Compilation produces numerous warnings, but no errors.
  56. November 12, 2003
    Minor fixes to LEF and DEF read-in routines; cap on wiring contact types removed.
  57. November 16, 2003
    Major changes to LEF and DEF input method for better handling of large (greater than 1GB) files.
  58. November 25, 2003
    Major changes to the techfile format. Format number incremented to 29. Format 29 adds the asterisk (*) notation for any layer to indicate the union of that layer and all contact layers which have that layer as a residue. Use of this notation SIGNIFICANTLY decreases the size and complexity of the technology file, as well as increasing readability. Also, added several extra types for DRC checking. These are all essentially duplicating the functionality of the "edge4way" rule, but make the DRC section of the technology file easier to read. New DRC checking types are "surround", "overhang", and "rect_only".
  59. November 28, 2003
    Includes a fix to the IRSIM handling routine, which was doing I/O incorrectly for SYSV-style select() calls. Thanks to Mike Marcel for pointing out this error. Also, the CIF parsing of the "*" notation (see above) required restricting to the plane of the layer.
  60. December 1, 2003
    Colormap and style file changes to add colors and styles for metal layers 9 and 10 and corresponding vias. Also, changed label handling in the LEF file reader for speedup reading files with many labels (i.e., complicated port geometries).
  61. December 23, 2003
    Additions to the LEF/DEF reading for handling LAYER, VIA, and VIARULE statements. Also, changed the DRC parsing for the "edge4way" rule to determine the plane of "OKtypes", so that the optional 9th argument is not necessary.
  62. December 30, 2003
    Fixed a problem with DRC rule edge4way rule parsing stemming from revision 58. Also, corrected the non-autoconf compile (thanks to Jake Hill for reporting this problem). Finally, fixed the text input method for Tcl-based magic when used under the "tkcon" console. Now text entry works correctly with functions such as the netlist window's label input method.
  63. March 11, 2004
    Lifted the requirement that the Tcl version be compiled with "make tcl" and installed with "make install-tcl". "make" and "make install" now suffice for both the Tcl and non-Tcl versions.
  64. March 19, 2004
    Major changes!
    Make changes: Autoconf compile now assumes options "with-tcl" and "with-opengl" are YES by default, checks for the header and library files for each, and disables them with a warning if something goes wrong.
    Also: Corrections and extensions to the follwoing command-line functions: goto, findlabel, getnode, and the window command update. getnode now allows global nodename (labels ending with "!") to be disabled. The node alias reporting is fixed, and confusion over labels completely surrounded by a layer is fixed. The search routine SimTreeSrTiles has been overhauled for efficiency, with poor code excised. findlabel now has a "-glob" option to return a list of nodes matching a csh-style pattern with wildcard characters (this was already in Magic but only available under the Scheme interpreter). goto now has a "-nocomplain" option to prevent printing an error message if the node cannot be found (e.g., if it's a global node name). update command now has options "suspend" and "resume" to prevent and resume graphics refresh. This is useful when generating scripts to execute multiple commands.
    Also: Added a new command search with syntax "search layers proc" which executes a low-level tile search for all tiles matching the layer list layers. For each tile found, it executes the TCL procedure proc, passing it a list of the tile lower-left and upper-right coordinates, and the tile type.
    Also: Created a "pin list" GUI tool. This tool searches out all the pads in a design and generates a pinout list. The tool can be used to aid in renaming all the pads.
    Also: Rearranged the source directory structure so that all TCL scripts go into the subdirectory "tcltk".
  65. March 31, 2004
    Modified the tech file parser to handle DOS-style carriage-return/linefeeds.
    Also: Modified the "squares-grid" cifoutput function to avoid writing contact cuts with less than the specified border. Added an optional y-grid value to the "squares-grid" function. This allows the generation of interleaved rows or columns of contacts, such as required for pad generation in some processes.
    Also: Fixed an error in the DBResidueMask(), which caused the new "*" notation for the technology file format to produce incorrect lists of layer types. Also: Extended the cmdParseCoord() routine to handle coordinates on the user grid (specified by the "grid" command). Previously, "snap grid" only worked for mouse motion. It now works correctly for all commands (and, consequently, all key macros), e.g., move, stretch, etc.
  66. April 9, 2004
    Modified the makefile process for compatibility with Cygwin, and moved tclmagic.c to the tcltk directory as the easy way to avoid an error in trying to compile a library file for the module.
  67. April 12, 2004
    Modified the exttospice (ext2spice) routine to output a .subckt ... .ends record around the netlist output of top-level circuits containing ports. This action can be subverted in the TCL version with the command "exttospice subcircuit top off". Values are "off", "on", and "auto", with the default being "auto".
  68. April 29, 2004
    Extraction of overlap and sidewall capacitance was modified to force it to subtract the substrate capacitance computed for overlapping types belonging to the same electrical node. Also, as magic does not appear to compute overlap between plane images of a contact, only one contact image can declare an area capacitance to substrate. This is NOT all worked out properly.
  69. May 7, 2004
    Corrected a number of errors in the search functions when the database contains non-Manhattan tiles. In particular, some searches would go into an infinite loop (interruptable, but still annoying).
  70. May 13, 2004
    Corrected search routines over non-Manhattan geometry in the routines used by "getnode" and "extresis". These instances were missed in the Revision 69 fix.

Generic features of Magic version 7.2:

Tcl/Tk-specific features of Magic version 7.2:

Using IRSIM With Tcl/Tk-Based Magic:

(See a screenshot of IRSIM 9.6 running under magic 7.2 with Tcl/Tk. The layout is the standard magic tutorial tut11a.mag and the setup was made with a slightly modified IRSIM command file tut11a.cmd, executed using the Tcl command source).

The IRSIM digital switch simulator was a casualty of the switch to the Tcl/Tk interpreter, until Magic 7.2 revision 14.

The focus of the Tcl/Tk version of Magic is to take advantage of the interpreter's ability to load packages on the fly. The result is that disparate programs can run at the same time. Any program can call routines in any other program, although this is normally done via evaluation of interpreter commands.

To facilitate having other programs pass information back to magic for display, a new magic command "element" was added. This general-purpose method lets other programs print text, lines, and boxes on top of the magic layout.

To make use of IRSIM under Tcl/Tk-based Magic, it is necessary to have IRSIM version 9.6 Revision 1 or newer. IRSIM must be compiled with option "Tcl interpreter" and option "Tcl/Tk graphics". The "make" system on IRSIM has been changed to match that for "Magic". Values for "CAD_HOME" (requested at the beginning of the "make config" script) should be the same for both programs (nominally, "/usr/local").

IRSIM works in the following manner. IRSIM is, like magic, exttosim, and exttospice, compiled as a Tcl package, namely as a shared-object library (.so) file. There is a standalone script "irsim" which is normally in $CAD_HOME/bin. Invoked from the script, IRSIM runs under Tcl by itself, and can simulate from any ".sim" file, but cannot interact with magic layout. However, there is also a command "irsim" in magic. Invoked as "irsim", IRSIM loads as an additional package in the Tcl interpreter which launched magic. Able to dectect the "magic" package in Tcl, IRSIM then adds a group of commands designed for interaction between magic and IRSIM. The "irsim" procedure is smart enough to go looking for a ".sim" file matching the magic layout in the window, and generate one automatically if it doesn't exist. Because the IRSIM and magic packages share space in the Tcl interpreter, commands for both are available at any time from the command line. There is no switching between modes to access the simulator. The only caveat is that some IRSIM commands conflict with magic or built-in Tcl/Tk commands. These commands require a prefix "irsim::". For example, "clock" is a command used by Tcl to time the execution of procedures. To get the "clock" command in IRSIM, it is necessary to use "irsim::clock". Several IRSIM commands conflict with Tcl syntax, and so have been renamed. These are indicated below.

The IRSIM/Magic procedures defined when running IRSIM under Magic are as follows:

Results of "watchnode" and "watchtime" on the magic layout.
Entirely new IRSIM commands and procedures defined regardless of whether or not IRSIM is run under magic are as follows:

The new Analyzer graph window under Tcl/Tk IRSIM.
IRSIM defines a callback function which returns values for all watched nodes and vectors on every update. This function is invoked as an extension of the IRSIM "display" command as follows:
display tclproc procedure_name
The Tcl procedure procedure_name must be defined as a procedure taking exactly three arguments:
proc procedure_name { name value tval } {
... (procedure body) ...
IRSIM will call procedure_name once for each variable needing a display update, and fill the values for name, value, and tval. Argument name is the name of the variable (node or vector) to be updated. Argument value is the value of the variable (one character for nodes, or a character string for vectors). Argument tval is the time of the update. In order to facilitate the batch processing of all nodes and vectors which are updated at the same time value, procedure_name will be called once more after all variables have been updated, with the syntax
procedure_name time t tval
The procedure procedure_name should check for the condition "${value}" == "t" to differentiate this call from calls on node and vector names.

IRSIM commands which have been renamed to accomodate standard Tcl syntax are as follows:

IRSIM commands which have been extended:

assert node
Short form. Without an assertion, returns the value of node node. This can be used directly in conjunction with magic to query the simulation value of nodes without adding them to the watch or display lists. To return the value of a layout node, select paint and do:
assert [getnode]
Currently (magic 7.2 rev. 61, IRSIM 9.6 rev. 10), there is no way to remove or reload a file being simulated by IRSIM. Fixing this is a high-priority item. Also, the ability to view bit vectors in the IRSIM "analyzer" window is incompatible with the use of the "Blt" package for graph displays, and will remain so until I create an analyzer package for use with Tk. I will not use the existing analyzer graphics, as they are horrid.

Revision 5 corrects the function calling in Tcl such that it checks for the minimum/maximum number of arguments before passing the arguments to the irsim command handler. Previously, passing the wrong number of arguments to a command could potentially crash the program.

To-Do List for Magic version 7.2+:

Fixes from version 7.1.5:


Last updated: September 13, 2013 at 10:10am