An Introduction to IC Design Under Linux
Before beginning a simulation, first create a SPICE file and add transistor models and SPICE commands to it. Next, simulate the inverter to verify that it was laid out correctly.
First, translate the inverter.ext file into something that SPICE can understand. The ext2spice program by Stefanos Sidiropolous that comes with the Magic distribution performs this translation. Simply enter:
ext2spice -f spice3 inverter.ext
We specify “spice3” format output, because earlier SPICE versions can't handle text strings for labels.
We now have a file that SPICE can understand, but it's incomplete in an important way. For SPICE to simulate a device correctly, it needs a model, a mathematical description of the device's behavior. In particular, we now need models for the two transistors (n-type and p-type) that we've used in our design.
SPICE has a variety of built-in transistor models specified in terms of sets of parameters. These parameters vary according to the fabrication process used, so it's up to the user to specify the correct parameters for the process being used. Fortunately, you don't have to figure these out yourselves—you can get them from MOSIS at ftp://ftp.mosis.edu/pub/mosis/vendors/orbit-scna20. This FTP site contains a whole slew of data from past runs; we chose a typical one from the “Level 2 Parameters” section. One minor detail—note that you need to change the “CMOSN” and “CMOSP” to match ext2spice's output, “NFET” and “PFET”.
After pasting in the transistor models, the inverter.spice file should look like Listing 1.
We've drawn the inverter and extracted a netlist. Now we need to simulate the chip to make sure it'll perform as expected when the chip is fabricated. A simulator such as SPICE can do many different types of circuit analysis. We will demonstrate two that are very useful for the digital circuit designer.
It might seem curious to use an analog circuit simulator for a digital circuit. We think of digital circuits as being in one of two states, 0 or 1, while analog circuits can take any of a continuous range of values. What's important to realize is that a digital circuit is actually a special kind of analog circuit. At the circuit level, a signal is either a voltage or current, and these are really analog quantities. The conventional 0 and 1 representations of a bit are simply abstractions of two particular voltage values; the actual values depend on the process in which the chip is fabricated. With CMOS in particular, you can generally ignore the currents and deal only with the voltages, due to the FET's mode of operation. For example, in the particular process for which we extracted our inverter, a 1 corresponds to 5 Volts (5V). In other processes, it might correspond to 3.3V or 2.5V. Happily enough, a 0 generally means 0V. As we all know, digital circuits don't switch instantaneously between their two values. It takes time to change voltages, and this delay is one of the things that makes your CPU run at 100MHz instead of 133MHz.
The upshot is that SPICE simulates analog behavior, but as digital circuit designers, we will interpret the circuit's output as digital bits rather than the analog voltages they actually are.
Simulators specialized for digital circuits do not provide the level of detail, that is, accuracy, that SPICE does, but they are orders of magnitude faster. IRSIM, which is available through the Magic WWW home page (see Resources at the end of the article) is an example of such a simulator.
Suppose we apply the test vector 101 to the inverter over a period of 75 nanoseconds (1 ns = 10-9 seconds). How will the output change over this time interval? To answer this question, SPICE can do a transient analysis. In a transient analysis, you define the input signal(s) and tell SPICE to simulate the circuit for a certain amount of time from the circuit's point-of-view, not real time. A transient analysis provides timing information, for example, how long the output takes to switch from 1 to 0. This analysis is also useful for verifying the circuit's functionality; you simply apply the test vector and check the output for correctness.
Let's apply the vector 101 to our inverter. Add the following lines to the end of the inverter.spice file:
Vpwr Vdd Gnd 5 Vgnd Gnd 0 0 Vinput in Gnd 0 PULSE( 0V 5V 0ns 2.5ns 2.5ns 25ns 50ns ) .TRAN 0.1ns 75ns .end
Let's go over this specification line-by-line. Line 1 defines a 5V voltage source between Vdd and Gnd; this is the power supply. Line 2 is necessary because of a SPICE artifact of always referring to ground as 0. We simply tie Gnd and 0 together (electrically speaking) by using a 0V voltage source, i.e., a short-circuit. Line 3 defines a voltage source between “in” and ground; this is the inverter's input. Looking at the parameters in parentheses, we have a voltage source whose initial voltage is 0V and “pulsed” voltage is 5V, and it starts after a 0ns delay. It has a rise time (i.e., the time required to switch from 0 to 1) of 2.5ns, and a fall time (i.e., the time required to switch from 1 to 0) also of 2.5ns. The width of each pulse is 25ns, and it repeats after 50ns have elapsed. Line 4 means that we want to do a transient analysis with a resolution of 0.1ns that lasts for 75ns. Line 5 ends the circuit file. Save the file, then run the simulation by typing:
spice3 -r inverter.out < inverter.spiceNow, let's view the results by typing:
sigview inverter.outWe're interested only in the top two signals, “out” and “in”, as shown in Figure 6.
Figure 6. SPICE Inverter Output
From the digital point-of-view we see that the inverter correctly produces a 010 pattern; from the analog point-of-view we see that the output's rise time is about 0.91ns and its fall time is about 0.89ns.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Dart: a New Web Programming Experience
- Developer Poll
- May 2013 Issue of Linux Journal: Raspberry Pi
- What's the tweeting protocol?
- Reply to comment | Linux Journal
4 hours 21 min ago - Reply to comment | Linux Journal
5 hours 8 min ago - Web Hosting IQ
6 hours 42 min ago - Thanks for taking the time to
8 hours 19 min ago - Linux is good
10 hours 16 min ago - Reply to comment | Linux Journal
10 hours 34 min ago - Web Hosting IQ
11 hours 4 min ago - Web Hosting IQ
11 hours 4 min ago - Web Hosting IQ
11 hours 5 min ago - Reply to comment | Linux Journal
14 hours 6 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
Simulation support for Gnucap / ngspice
Sir,
It was a wonderful tutorial. It was really helpful. I want to know if there are any ways to simulate the layout design using gnucap. Thank in advance.