Sunteți pe pagina 1din 29

Tutorial:Analog Artist with HSPICE for the CDK

http://www.eda.ncsu.edu/wiki/Tutorial:Contents
This tutorial will introduce you to the Cadence Environment: specifically Composer, Analog Artist and the Results Browser. It will also show you how to use the simulator HSPICE in stand-alone mode to make certain parts of your design exploration easier. ECE 546Students: This tutorial is designed to introduce you to the tools we will use in class. Proficient use of Cadence and Hspice will allow you to complete the projects and homework quickly, and will make the class more fun. Practice is really the only way to achieve such proficiency. There are probably an infinite number of tricks and shortcuts to make the design process easier, or at least enough to fill a small book. No tricks or short-cuts are covered in this tutorial and it will be up to you learn more about the tool and how you can use it better for your needs. Lastly, the screen-shots in this tutorial may vary slightly from what you will see. Refer to the text next to the screen-shot for up-to-date information. Note also that some screen-shots have been shrunk to make the page more readable. In this case, please click on the image to view its wiki-page, and click on the image again to download the full-size image.

Start the Cadence Design Framework


1. Type add cadence at the command prompt. This will add the tool to your search path. 2. Make directory called something like Artist. Change to this directory. 3. Start the Cadence Design Framework by typing icfb & at the command prompt.
% % % % add cadence_cdk add cadence2005 mkdir Artist cd Artist

% icfb &

The screen below illustrates the output after the add command. Note, however, that you should see the Cadence 2004 version.

The first window that appears is called the CIW (Command Interpreter Window).

Another window that appears is the Library Manager. This window allows you to browse the available libraries and create your own.

Create the myInverter Schematic


In the Library Manager, create new library called ArtistTutorial. Select File->New>Library. This will open new dialog window, in which you need to enter the name of your library, library path, and "Attach to existing tech library" (TSMC 0.20u should be

selected rather than the older technology pictured below). You can leave the "Path" field blank, or set it to ".". the library will be created in your working directory. After you fill this all out, the window should look something like this:

You should see the library "ArtistTutorial" appear in the Library Manager.

Next, select the library you just created in the Library Manager and select File->New>Cell View.... We will create a schematic view of an inverter cell. Simply type in "myInverter" under cell-name and "schematic" under view. Click OK or hit "Enter". Note that the "Tool" is automatically set to "Composer-Schematic", the schematic editor.

Alternatively, you can select the "Composer-Schematic" tool, instead of typing out the view name. This will automatically set the view name to "schematic".

After you hit "OK", the blank Composer screen will appear. The image below shows the final schematic that we will make in this tutorial.

To generate a schematic like this, you will need to go through the following steps: From the Schematic Window, choose Add->instance. The Component Browser, will then pop up.

In the Library field, select NCSU_Analog_Parts. We will place the following instances in the Schematic Window from the NCSU_Analog_Parts library as instructed below:
N_Transistor: P_Transistor : Supply_Nets : R_L_C : nmos pmos vdd , gnd cap

Voltage_Sources : vdc,vpulse

Note: pay special attention to the parameters specified in vdc, vpulse, and cap. These parameters are very important in simulation.

Place pmos instance


In Component Browser, select P_Transistors and then pmos. Place it in the Schematic Window

Place nmos instance


In Component Browser, select N_Transistors and then nmos. Place it in the Schematic Window.

Place gnd instance


In Component Browser, select Supply_Nets and then gnd. Place it in the Schematic Window.

Place vdd instance


In Component Browser, select Supply_Nets and then vdd Place it in the Schematic Window.

Place IN pin

From the Schematic Window menu, select Add -> Pin... In the Pin Name field , enter IN In the Direction field, select input Place it in the Schematic Window

Place OUT pin


From the Schematic Window menu, select Add -> Pin... In the Pin Name field , enter OUT In the Direction field, select output Place it in the Schematic Window

Place vdc instance


In the Component Browser, select Voltage Sources and then vdc In the DC voltage field, enter 1.8 V (not 5 V as pictured below) Place it in the Schematic Window

Place vpulse instance


In the Component Browser, select Voltage_Sources and then vpulse Enter the following values in the form:
0V 1.8 V 100p s 100p s 1n s

Voltage 1: Volrage 2: Rise Time: Fall Time: Period:

Delay Time: 0 s

Pulse Width: 400p s

Place it in the Schematic Window

Place cap instance


In Component Browser, select R_L_C and then cap

In the Capacitance field, enter OutCap F. (This Design Variable will be used in Artist.)

Place it in the Schematic Window

Place wires

In the Schematic Window menu, select Add -> Wire (narrow) Place the wire to connect all the instances Select Design -> Check and Save.

Look at the CIW. You should see a message that says:


Schematic check completed with no errors. "ArtistTutorial myInverter schematic" saved

If you do have some errors or warnings the CIW will give a short explanation of what those errors are. Errors will also be marked on the schematic with a yellow or white box. Errors must be fixed for your circuit to simulate properly. When you find a warning it is up to you to decide if you should fix it or not. The most common warnings

occur when there is a floating node or when there are wires that cross but are not connected. Just be sure that you know what effect each of these warning will have on your circuit when you simulate. Your schematic should look like the one shown below. Note that your transistors will have the model tsmc20N and tsmc20P, the widths will be 300n, and the lengths will be 200n.

If you would like to learn more about the schematic editor, you can work through chapters 1-5 of the Composer Tutorial that comes with the Cadence documentation. Start the documentation browser by typing
cdsdoc &

at the command prompt, make sure that IC5.0.332 is selected in the Active Library pull-down box at the top, and then select Virtuoso Composer->Virtuoso Schematic Composer Tutorial in the browser window that appears. This should start an HTML browser that displays the table of contents for the tutorial. You may also find the Virtuoso Schematic Composer User Guide very helpful to describe some of the further commands available in the schematic editor. If you find that you cannot view the figures correctly in the web browser, you can click the View/Print PDF link at the top of the page to launch a PDF viewer for the tutorial. This documentation browser offers many more links for you to learn about the Cadence Design Framework.

Simulate the Schematic with HSPICE within Analog Artist


Set up the Simulation Environment
You are now prepared to simulate your circuit. From the Schematic Window menu, select Tools -> Analog Environment A window will pop-up. This window is the Analog Artist Simulation Window.

Choose a Simulator

From the Analog Artist menu, select Setup -> Simulator/Directory/Host. Enter the fields as shown below. Choose hspiceS as your simulator. Your simulation will run in the specified Project Directory. You may choose any valid pathname and filename that you like.

Choose Analysis
We will do Transient Analysis on the circuit that we just produced. From the Analog Artist menu, select Analyses -> Choose... Fill out the form with the following values (not pictured): o From: 0 o To: 2n o By: 10p

Add a Variable
From the Analog Artist menu, select Variables -> Edit The Editing Design Variables form will appear. Fill out the form as shown below, and then click Add to send this Variable to the Table of Design Variables. (Recall that we entered the OutCap Design Variable in the Capacitor component while editing the schematic in the previous section.)

Setup Output
When using Transient Analysis, the transient voltage will be saved automatically. We can save the current through capacitor C0 in the schematic by doing the following: From the Analog Artist menu, select Outputs -> To be Saved -> Select On Schematic In the Schematic Window, click on the lower terminal (not the wire) of capacitor C0. After you click on the terminal, the Analog Artist Window should look like this:

Run Simulation

From the Analog Artist menu, select Simulation -> Run, Look at the echoing information in the CIW window. If the simulation succeeds, the window will display ...successful.

If the simulation is unsuccessful, then one of the error messages should provide a clue as to what went wrong. Remember that you can move elements around in your schematic by clicking and dragging them. You can delete them by selecting them and pressing the delete key. You modify the properties of the elements by selecting them and pressing the q key. If you would like to learn more about the Analog Design Environment, select Analog Design Environment->Cadence Analog Design Environment User Guide in the cdsdoc browser window.

View Waveforms
From the Analog Artist menu, select Results -> Direct Plot -> Transient Signal The Waveform Window will then pop up In the Schematic Window, Click on the IN wire and then Click on the OUT wire Press ESC on your keyboard The two curves (IN and OUT) will then be displayed in this window:

Press the Switch Axis Mode icon (circled in Red) on the left side of the Waveform Window The waveforms will then be displayed separately as shown below:

If you would like to learn more about the Waveform Viewer, select Analog Design Environment->Waveform User Guide in the cdsdoc browser window.

Use Calculator
In Artist Window, go to Tools -> Calculator. The Calculator Window will then pop up, as shown below:

In Calculator Window, go to Options -> Set Algebraic We are going to use the calculator to plot both the current through the capacitor and the absolute value of the capacitor current. In Waveform Window, select Window -> Reset to clear the input and output plots from the window. In the Calculator Window, click on the it button (3rd column of buttons on the top). In the Schematic Window, click on the lower terminal of the capacitor. Returning to the Calculator Window, the text area at the top should like this:

In the Calculator Window, press the plot button to plot this waveform in the Waveform Window. In the Waveform Window, press the Add Subwindow button (bottom button on left). In the Calculator Window, press the clear button (4th Column, top) to erase the text area, press the abs button (last column, top), and press the it button. In the

Schematic Window, click on the lower terminal of the capacitor. Returning to the Calculator Window, the text area at the top should like this:

In the Calculator Window, press the plot button to plot this waveform in the Waveform Window. Your Waveform Window should now look like this:

Use Results Browser


In Artist Window menu, select Tools -> Result Browser In the pop-up window that appears, click OK

The Results Browser Window will then be displayed

In Results Browser Window, click netlist/ and then click hspiceFinal A text window will then show the hspice netlist file for your circuit.

Simulate the Schematic with HSPICE in standalone mode


Sometimes its easier to do certain kinds of analysis manually in HSPCE than it is to figure out which Cadence menu option will give you the desired result. To run HSPICE manually, follow the following procedure.

Generate the HSPICE Netlist


First, follow the steps described in the last section:

From the Schematic Window menu, select Tools -> Analog Environment From the Analog Artist menu, select Setup -> Simulator/Directory/Host. Choose hspiceS as your simulator.

Next, generate the netlist with the following commands: From the Analog Artist menu, select Simulation -> Netlist -> Create Final. This will cause a window to open that displays the text of your netlist.

In the netlist text window, choose File -> Save As. Enter the name "inv.sp". The path is relative to the directory where you started Cadence.

Open up the file in your favorite text editor (a popular one is nedit). It should look something like the following:
* * * * # FILE NAME: /AFS/UNITY.NCSU.EDU/USERS/W/WDAVIS/CADENCE/SIMULATION/ MYINVERTER/HSPICES/SCHEMATIC/NETLIST/MYINVERTER.C.RAW NETLIST OUTPUT FOR HSPICES. GENERATED ON AUG 18 12:37:57 2005

* GLOBAL NET DEFINITIONS .GLOBAL VDD! * FILE NAME: ARTISTTUTORIAL_MYINVERTER_SCHEMATIC.S. * SUBCIRCUIT FOR CELL: MYINVERTER. * GENERATED FOR: HSPICES. * GENERATED ON AUG 18 12:37:57 2005. M1 OUT IN 0 0 TSMC20N L=200E-9 W=300E-9 AD=150E-15 AS=150E-15 PD=1.6E-6 +PS=1.6E-6 M=1 C0 OUT 0 +1.00000000E-14 M=1.0 V1 IN 0 PULSE 0.0 1.8 0.0 100E-12 100E-12 400E-12 1E-9 V0 VDD! 0 1.8 M0 OUT IN VDD! VDD! TSMC20P L=200E-9 W=300E-9 AD=150E-15 AS=150E-15 +PD=1.6E-6 PS=1.6E-6 M=1 .lib "$CDK_DIR/models/hspice/public/publicModel/tsmc20P" PMOS .lib "$CDK_DIR/models/hspice/public/publicModel/tsmc20N" NMOS

* INCLUDE FILES

* END OF NETLIST .PROBE TRAN + I(C0) .TRAN 1.00000E-11 2.00000E-09 START= .TEMP 25.0000 .OP .save .OPTION INGOLD=2 ARTIST=2 PSF=2 + PROBE=0

0.

.END

This file looks a lot more complicated than it should be. The act of using the Analog Environment to create the netlist placed many comments in the file that make it look more cluttered. There are several important things to note about this netlist: 1. Hspice code will always interpret the first line of the file as a comment. Make sure that the first line of your code IS a comment, because if the first line is part of the code for your circuit, it will not be read correctly. 2. Note the ".END" statement at the end of the file. Your file will not finish execution if you do not have this .END statement at the end of the code. The analysis lines (.TRAN and .PROBE TRAN) will not show up if you did not do the Choose Analysis and Setup Output steps described in the last section.
3.

4. The lines that begin with ".lib ..." define the transistor models that will be used in the simulation. Note that the models path above uses the environment variable $CDS_DIR, which is defined when you type "add cadence_cdk". We will make a couple of changes to this file to perform a DC simulation. 1. Add the POST option to the ".OPTION" statement. This will ensure that all output variables are saved. This can lead to large files that exceed your disk-quota later in the semester, but it makes things easier for small circuits. (NOTE: Be sure to put the POST option at the end of the list. Putting it at the beginning gives an "unknown file error" when opening the output in the waveform viewer, for some unknown reason.) 2. Remove the ".PROBE TRAN" and "+ I(CO)" lines, if they exist. These are the lines that would normally create the simulation output, which is no longer necessary due to the option above. Note that the "+" character at the beginning of a line denotes a line continuation. 3. Add a line that reads ".DC V1 lin 100 0 1.8". This will create a DC analysis that sweeps voltage source V1 linearly from 0V to 1.8V with 100 points. 4. Only one sweep is allowed, so we need to remove the .TRAN line, if it exists.

5. Edit the "V1" line so that it reads simply "V1 IN 0". The rest is unnecessary for a DC analysis. 6. Remove the "C0" line. The capacitor is meaningless in a DC simulation.

Running an Hspice simulation


In the same directory as your "inv.sp" file you must add Hspice to your environment, then run the simulation. Type the following in a new terminal window:
% add hspice % add cadence_cdk % hspice inv.sp >! inv.lis

This will cause some output text to be sent back to the inv.lis file. In the event that you have an error with your simulation you will need to read through that output to find out what the error is. If your simulation ran without errors then your output should say:
>info: ***** hspice job concluded real 10.5 user 3.9 sys 1.0

If your simulation had errors it will look like this:


>error ***** hspice job aborted real 2.3 user 0.1 sys 0.1

For more information on how to use HSPICE, see the HSPICE Tips on the course web-page, or see the HSPICE Simulation and Analysis User Guide, which can be found at /afs/bp.ncsu.edu/dist/hspice200403/docs/hspice_sim_analysis.pdf or can be accessed on-line at http://manuals.eos.ncsu.edu/hspice200303/index.html.

Viewing your waveform


Once your simulation runs without errors, we can view the waveform that was generated. Hspice doesnt have any built-in waveform viewer, so we will have to use the Awaves software package for that. In the same directory as your "inv.sp" file, start the Awaves program.

% awaves &

1.

Within awaves, open the "inv.sp" design with Design -> Open.

This should cause the Open Design window to appear. You should see a list of all the Hspice files in your directory listed in that window. 2. Double click on the "inv.sp" name. This should cause the results browser window to open. The results browser window will list the results of each of the simulations that you ran on a given Hspice file. For example if you did a frequency sweep analysis as well, it would be listed in this window. 3. Click on the line "DC: *file name: /afs/..." That should display the names of each of the nodes of your circuit in the "curves" section of the Results Browser window. Your Results Browser window should look similar to this: Double clicking on any of the nodes listed in the "curves" section of the window will cause the waveform in the time domain to be displayed in the main Awaves window. 4. Double click on the node "out". Now go back to the Awaves window. You should see the voltage transfer characteristic displayed as shown below.

From here, you can select Measure->Point to get a cursor that sweeps along the curve. Click where you want to place the cursor, and youll get a pop-up box on the graph that shows the X & Y values as well as the derivative . You may need to try this several times until you get the slope as close as possible to -1. You can delete the

extra measures by selecting the cursor and choosing Measure->Delete Measure or simply Measure->Delete All Measures. ECE 546Students: The technique above is especially helpful when finding VIL and VIH for Homework #1. To print out the waveform, choose Tools->Print. I generally set Print To: File and select PS as the format. Click Print to get a dialog box to edit the file-name. If you want to view the file without printing it, then type the following at the UNIX command prompt:
% add acrobat % distill filename % acroread filename

For more information on how to use AWAVES, see the AvanWaves User Guide, which can be found at
/afs/bp.ncsu.edu/dist/hspice200403/docs/avanwaves.pdf

S-ar putea să vă placă și