Vous êtes sur la page 1sur 18

S-EDIT

Creating an Inverter Using S-Edit To launch S-Edit in one of the LAB PCs, go to Start > Electrical > Tanner EDA > Tanner Tools v14.0 > S-Edit v14.0 32-bit. Now we will create an inverter schematic and symbol. Start with creating a new design by going to File > New > New Design. Specify the folder you want to create your design in and the name of your design. Suppose you name it inverter. It will show up in the Libraries navigator on the left.

On public machines, the Libraries might not immediately be loaded. To add library to your design, download the Tanner Libraries folder here (password: ENGN160). Now, click on Add button on the Libraries window in S-EDIT, or go to File > Open > Add Library and browse the download folder to point to Libraries\All\All.tanner file.. After loading the library, several sub-libraries will show up in the Libraries window, such as IO_Pads and Devices. Once the library is loaded you will see the following libraries loaded in the Libraries window:

Creating the schematic To load a schematic cell, go to Cell > New View You will see the following screen:

Cliick OK. A new cell view will open up. A CMOS inverter needs an NMOS, a PMOS, Vdd, Gnd and I/O pads. On the left in the Libraries window, click on the Devices library , its symbol objects will be listed in the window below. Find the NMOS from the list. Choose your device, and click on Instance, or simply drag and drop it to the design area. Do the same for PMOS, Vdd and Gnd symbols. Before you drop the instance, a window may show up like the one on the left below. After you drop the instance, a second window (like the one on the right) will show up on the right side of the screen.

Here you could initiate the properties of the instance, such as its Length and Width. Or after placing the instance, you can always single-click on it and edit its properties in the Properties navigator on the right. Lets say we set the length and width of NMOS devices to be 2u and 22u, and the length and width of PMOS devices to be 2u and 11u, respectively. You might have to move your parts around to make the schematic look the way you want it. When you click on a particular part on the schematic, the function of the THREE-BUTTON MOUSE is shown somewhere on the toolbar like this:

So to Move a part around the schematic, select the part with either LEFT or RIGHT mouse button and use the MIDDLE button to move. Alternatively, you can click on the part, hold down ALT key and drag the part to somewhere else on the screen. To Zoom In and Out, either use the View menu or the mouse Scroll wheel or use the + sign to zoom in and sign to zoom out. Once we have the main parts in place, it is time to add I/O pins and wire the parts together. Select and place an Input Pad and an Output pad on the schematic and give the pads a unique name.

Now using the wiring tool make appropriate connections. After clicking on the wiring tool, a SINGLE MOUSE CLICK starts the wiring. If you want to end wiring at a particular location, DOUBLE CLICK. Your completed inverter schematic should look like this. is the input pin/pad and is the output pin/pad.

So we have made the connections. Now it is time to go change the length and width of the MOS devices as per the specifications. Inverter Symbol To create a symbol, first create a View create a new cell with a new symbol view, or create a new symbol view of an existing cell using Cell > New View. Give the symbol a View name, and select the interface it is to be associated with. Then, using the polygon and drawing tools , draw the usual symbol for an inverter. Add the input and output ports. Make sure to give the ports the same name that you used in the schematic i.e. in and out. Now using lines (not wires) connect the ports to the inverter symbol. You should have something that looks like:

The creation of the symbol might be helpful when you do hierarchical design. CREATING SPICE NETLIST FROM THE SCHEMATIC Go to File > Export > Export Spice. Specify the Ouput filename. Check Exclude .end in Options (Without the .end, the generated SPICE file can be included in other SPICE files.) Say Export. The SPICE file is saved in the same directory as the schematic. The file contains the following information:

This generated SPICE file is NOT complete. This is just a description of the circuit structure that you drew in the schematic. In order to simulate the inverter, we still need to add some MOS models, simulation type (DC, transient, AC, Monte Carlo etc.) and give an Input Stimulus. A more detailed description of the SPICE file and what else you need to add is provided here. Last Updated: Kumud Nepal 2/6/2011

Simulating your Inverter with SmartSpice


Now that you have a S-Edit generated Spice File, it is time to look at how to make it complete for simulation. Download and copy to your folder the 180nm.lib technology that you will be using for the MOS models. The SPICE Netlist generated from S-Edit contains the following information and is saved as inverter.sp * SPICE netlist written by S-Edit Win32 9.10 * Written on Jan 29, 2004 at 09:49:04 * Main circuit: inv M1 Out In Gnd Gnd NMOS L=2u W=22u AD=66p PD=24u AS=66p PS=24u M2 Out In Vdd Vdd PMOS L=2u W=11u AD=66p PD=24u AS=66p PS=24u * End of main circuit: inv This generated SPICE file contains the basic description of the circuit structure. Now we will add the section that specifies the model library, the power supply, other simulation specific parameters, the type of analysis and the input stimulus. Lets look at our inverter_main.sp file that contains everything that we need to do an analysis of our inverter. *Main inverter file .param Supply=1.8 .include '180nm.lib' .options post * Define power supply .global Vdd Gnd Vdd Vdd Gnd 'Supply' *Set Transient Analysis .tran 10ns 500ns *** CIRCUIT NETLIST *** * .include <name_of_extracted_spice_file> .include 'inverter.sp' *** INPUT STIMULS *** * add any input vector here vin1 In Gnd pulse(0 Supply 10n 1n 1n 50n 100n) * if you want to see the VTC for the inverter add a DC analysis .DC vin1 0 Supply 0.1 .END

The lines shown in BLUE do not need to be edited as you move from one design to the other. The first red line containing the transient analysis definition might change. You might change the timestep, the total time of

simulation or you might have to do a completely different analysis (eg. DC analysis instead of TRANSIENT). The second red line containing the .include 'inverter.sp' will change based on what your Tanner generated spice file is called. In this example the description of the inverter was extracted to inverter.sp. Hence the name of the include file. The third line containing the Input Stimulus might change based on what your input port is labeled. The green line shows how to use a DC analysis to generate a VTC for the inverter. Comment out the Green line if you are not running any DC analysis. This should get you started with SPICE. A more detailed description of a SPICE DECK is given here Important: Remember to have the 180nm.lib, inverter.sp and the inverter_main.sp files in the same directory. If you have them in a different folder, make sure to specify the full-path of the files in your .include statement. Now that you have prepared your complete Spice file, start SMARTSPICE.

Start a project with sourcing the input files. Click on the source button , or simply drag a deck from the Explorer Window and drops it over the SMARTSPICE Window. To reload your source after a modification press the quick button that says Reload the current input deck. SmartSpice will open and parse your input file. You shouldn't see any errors. Go to the Analysis -> Run menu option. An information box will appear while the simulation is running. The file can also be run by pressing Ctrl-R.

If you want to see what the output plots look like. Click the vectors button . A dialog will appear listing different plots and vectors that are available. Click on the tran1 plot. Scroll down the vector list until you see the input and output voltages. Highlight them and click Plot. You can highlight multiple items by holding down the Ctrl key and clicking on your selection. If you change your Spice input file after you run a simulation, then reload and run it again, you'll see many different vectors available, named tran1, tran2, tran3, etc... Be sure to unselect your old plots before clicking the plot button, unless you want to see the old plots and your new one on the same graph. Example : Generating all possible input combinations for a two input gate. If you are simulating a two-input gate, you want to make sure that the gate works for all four possible input combinations (00, 01, 10 and 11). Lets say that your two inputs are labeled A and B. Using: v1 A Gnd pulse(0 Supply 250n 1n 1n 250n 500n) v2 B Gnd pulse(0 Supply 500n 1n 1n 500n 1000n) as the two input pulse should simulate all four combinations in one single run.

If you want to find out what exactly the pulse statement does, check here Last Updated: Kumud Nepal 02/06/2011

How to add a little SPICE to your circuit design For this class we will use SILVACO's SmartSpice, an industry standard circuit simulator. This tutorial will give you a basic idea on how to write spice files from scratch or how to edit spice netlists generated by Tanner. Before we get started make sure you download 0.18u Technology file from here. Here is an example spice deck for the following circuit.

* Spice Netlist for an Inverter * This spice deck creates a simple inverter with an output load * cap, runs a transient analysis and measures the propagation delay *********************************************************************** * Set supply and library *********************************************************************** .temp 50 * Set operating temp .param Supply=1.8 .include '180nm.lib' * the 0.18micron MOS model library .options post * this will allow you to view the result *********************************************************************** * Define power supply *********************************************************************** .global Vdd Gnd Vdd Vdd Gnd 'Supply' *********************************************************************** * Define Subcircuits *********************************************************************** .subckt inv In Out m1 Out In Gnd Gnd nfet l=0.18u w=0.5u m2 Out In Vdd Vdd pfet l=0.18u w=1.0u .ends *********************************************************************** * Top level simulation netlist ***********************************************************************

x1 In Out inv c1 Out Gnd 10f *********************************************************************** * Stimulus *********************************************************************** Vin In Gnd pulse(0 'Supply' 5n 0.5n 0.5n 25n 50n) * Run a transient analysis .tran .01ns 12ns *********************************************************************** * Measurements *********************************************************************** * measure delay of the inverter .measure prop_delay + TRIG v(In) VAL='Supply/2' RISE=1 + TARG v(Out) VAL='Supply/2' FALL=1 *********************************************************************** * End of Deck *********************************************************************** .end Looks scary? Dont panic... Here are some common things you see in the above spice deck

The FIRST LINE of the deck is always interpreted as the 'Title'. It is generally helpful to put the name of the circuit as the title for quick reference. Any line that begins with a * is a COMMENT and will be ignored by the SPICE tool. In SMARTSPICE if you want to block comment use #COM and #ENDCOM. eg.: #COM This is a comment line1 THis is a comment line2 #ENDCOM

.temp statement specifies the simulation temperature in Celsius. If you remove this line, SPICE will use a default room temperature of 27C. .param statement specifies a constant definition. Once you define a parameter, you can use the name you specified instead of the actual value. See how 'Supply' is used in the above SPICE deck. .include statement allows you to "include" other files in your deck. Here the .include statement is adding the NMOS and PMOS model definitions for the 0.18u technology. The next thing you see in the deck is the definition of 'Vdd' and 'Gnd' values.

All the items that I have discussed so far can be directly copied to any SPICE deck that you wish to write. The .temp value might need a change depending on the temperature you wish to simulate.

The SUBCIRCUIT definition was not really necessary for this 'simple' design. However, once you get into more complicated designs, you might find this helpful. Basically, a .subckt definition just defines a module that you will be using later on for the real netlist. The general format is: .subckt <name_of_module> <Input_1> <Input_2> ...<Input_n> <Output> Remember to end the sub-cricut defintion with a .ends statement Now comes the main part: Top Level Simulation Netlist. This is the part where you describe the actual physical connection for the circuit shown above. The simulation netlist that you will use for this class will generally have one of the following circuit elements: X - sub-circuit elements, C-capacitance, RResistance, M-mosfets. The general format is: X<number> <Input1> <Input2> ... <Inputn> <Output> C<number> <Node1> <Node2> <Capacitance_value> R<number> <Noe1> <Node2> <Resistance_value> M<number> <Drain> <Gate> <Source> <Bulk> <Width> <Length> [optional AD, PD, AS, PS] The next section is where you would describe the input pattern for simulation. For digital simulations, you will either use the pulse or the pwl (piecewise linear).I recommend pulse statement over pwl. The format of the pulse statement is: voltname node1 node2 Pulse(start_volt end_volt initial_delay rise_time fall_time pulse_width period So the pulse statement in the deck above: Vin In Gnd pulse(0 'Supply' 5n 0.5n 0.5n 25n 50n) specifies a pulse at node In, starting at 0v, stayingat 0v for 5ns, then rising to 1.8v with a rise time of 0.5ns, staying high for 25ns and falling to 0v with a fall time of 0.5ns and repeating every 50ns. So far, we have described the circuit netlist and setup all the input voltages. Next step is to specify what kind of simulation we will be doing. For this course, you will either do a DC analysis or a Transient analysis. For a DC analysis the format is: .DC src1 vstart vstop vincrease (src2 start2 stop2 increase2) For the transient analysis, the format is: .tran timestep timestop You could add a .END statement here and end the deck. Sometimes you might want to make some measurements without having to go through a tedious method of deducing certain values from a plot. In the above example, I show a way to measure the propagation delay from Input to Output for the inverter. Similarly, you can measure numerous parameters, eg. Power, Voltage at certain times etc. In the above example, the propagation delay is measured when the input voltage rises to 50% of Vdd and the output node falls to 50% of Vdd. Notice the + sign in the measure statement above. Here the + sign does not indicate "addition", it simply means that the .measure statement was supposd to be one single line but due to some reason (space constraint in the line) had to be written on multiple lines. If you start a stament with a +, SPICE will consider it as a continuation of the previous line. Just as an example this is how you would measure the average power of the inverter: .measure average_power AVG power FROM=10n TO 50n

Now that you have successfully understood and created a spice netlist, open SmartSpice, load the netlist, hit RUN and enjoy. This is all you have to do to add a little SPICE to your circuits. Last Updated: Kumud Nepal 02/06/2011

Creating an I-V characteristic curve of a PMOS

Copy the following SPICE deck to your folder. Make sure you have downloaded the 180nm.lib library file into the same folder. *I-V curve PMOS .param Supply=1.8 .include '180nm.lib' .options post * Define power supply .global Vdd Gnd Vdd Vdd Gnd 'Supply' *** CIRCUIT NETLIST *** *** mpmos1 drain gate source bulk L= length W= width m1 ds gs Vdd Vdd PMOS L=10u W=20u *** DEFINE VOLTAGE CONNECTIONS *** ********************************** * you need to change some connections around for NMOS * VoltageName Node+ Node- VoltageValue vds Vdd ds 'Supply' vgs Vdd gs 'Supply' **************************************** *** INPUT STIMULS *** *increase Vds from 0 to 1.8v with step of 0.1 increase vgs from 0 to 1.8v with step of 0.5 .DC vds 0 1.8 0.1 vgs 0 1.8 0.5 .probe dc i1(m1) *This is here so that you can plot the current easily in SmartSpice .END

Open Smart Spice and load the spice deck. You might get a warning that might read something like Warning on line: 12 : m1 ds gs Vdd Vdd PMOS L=10u W=20u. Run the spice deck. Plot i1(m1) vs vds by clicking and choosing i1(m1) from the list.

Another way to plot the voltage or current at a node is to just type: plot i1(m1) on the command line of SmartSpice.

This will invoke SmartView and produce the following plot for the PMOS:

This should give you an idea of what to do for an NMOS.

Last Updated: Kumud Nepal 02/06/2011

SmartSpice Plots

After the analysis is complete, click on

from the toolbar to launch the vectors window.

Click on the voltage name that you want to print. Click Plot.

When its plotted in SmartView, click

on the left, which will start a new plot space.

In SmartSpice again, click on the second voltage name. Click Plot. Repeat this, until you have all the inputs and outputs plotted. This will result in all the inputs and output voltages on the same plot as subplots.

Easy for you to visualize and simulate. Easy for me to grade If you have plotted two signals in one plot and want to split them up, right click on the plot and select Split All/Selected. It will then give you a stacked view.

By default your background will be black. You can change this to a white background by going to Edit > Preferences > Colors and selecting a white background with black axes. Last Updated: Kumud Nepal 02/06/2011

Vous aimerez peut-être aussi