An Introduction to IC Design Under Linux
As everyone knows, computers are composed of two main elements, hardware and software. There are many well-known, powerful tools for developing software under Linux. What's not so well-known is that there are also tools available for developing hardware. This article introduces some of the freely-available tools you can use to create integrated circuits (ICs). These tools include: Magic, an IC layout editor; SPICE, an analog circuit simulator and Sigview, a graphical signal viewer. When these programs are used in concert, Linux becomes a platform that can be used to create real-world, working chips.
We'll start by by briefly describing the layout and simulation that are the basis of IC design. Next, we'll cover where and how to get the tools. Then we'll go into more detail about what a chip layout represents. We'll also touch on Magic's technology file, and finish by presenting a complete design example to tie everything together.
In a nutshell, Magic is a graphical tool that a circuit designer uses to specify how an IC should be constructed. This specification is created by drawing rectangles which represent wires and transistors—the building blocks of most ICs. The rectangles are drawn in various colors and fill patterns which represent the layers used to manufacture the chip. (The “layer” concept is explained in more detail below.) The final drawing is usually referred to as the layout of the chip.
Don't be fooled—there's much more to designing an IC than simply making rectangles; otherwise, most any drawing program could do the job. IC design requires further assistance from the software. To that end, Magic is equipped with tools that make IC design easier. For example, it enforces design rules which guarantee that the circuit, as drawn, can be manufactured correctly, and it can extract a list of circuit components and how they're connected (a netlist) from a layout.
These capabilities help provide a basic introduction to Magic and how it's used to do real-world designs. In particular, we'll develop a simple digital circuit—an inverter, which is a ubiquitous building block for complex digital chips.
Magic is used to draw the rectangles in a layout, but how do we know that the circuit corresponding to these rectangles performs as desired? Simulation is a way to verify that the design you've drawn is actually the design you want—it's very much like using a debugger on a piece of software that you're developing. Why bother with simulation? Why not just draw it, build it, and see if it works? Simulation is necessary, because fabricating a chip is costly in a variety of ways. The manufacturing process itself is very expensive, so you want to minimize the number of times you must re-manufacture a defective design. It is also time-consuming, so you want to avoid missing a market window as a result of too many re-manufacturing cycles. Because of these costs, time invested in verifying a design through simulation pays back tremendous dividends.
One tool used to simulate circuit performance is SPICE (Simulation Program with Integrated Circuit Emphasis). Developed at the University of California at Berkeley in the mid-1970's, SPICE and its derivatives, notably PSpice from MicroSim Corporation and HSPICE from Meta-Software, are the most widely-used examples of analog circuit simulators. Using detailed models of the individual circuit components, these programs provide an accurate picture of the device's operation and can analyze many different aspects of a circuit's behavior. Later, we'll look at one aspect that is particularly useful in digital circuit design.
Magic has a WWW page (maintained by Bob Mayo of DEC's Western Research Laboratory) from which you can get source code and browse other relevant information. Point your favorite Web browser to http://www.research.digital.com/wrl/projects/magic/magic.html and follow the “Getting the program and manuals” link. Version 6.5 should be available and out of beta by the time you read this article.
Magic is installed in either the home directory of the user “cad” or the directory pointed to by the environment variable $CAD_HOME. You must either create a “cad” user and make its file space world-readable (assuming you want everyone to be able to run the tools), or designate a directory for the tools and set $CAD_HOME to point to it. We assume you'll choose the second method and refer to the directory specified by $CAD_HOME as the root of the directory tree in which the tools are installed.
After setting $CAD_HOME, untar magic-6.5.tar. Go to the magic-6.5 directory and enter make config. Choose options 1 (X11), 4 (Linux), 5 (Intel based systems, assuming you're on an Intel). Next is a list of optional modules. Leaving them out trades functionality for smaller executable size and compile time. For now, just accept all the optional modules. You can always recompile later if you find you don't use one feature or another. Then, following the instructions on the screen, do a make force to compile everything. After this compile finishes successfully, make install installs everything in the correct location. Don't skip this last step, because Magic depends on having all its support files in the right place.