Docsity

Circuit Simulation - Lab Assignment 2 | ECE 1192, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
Fall 2006 ECE1192/2192
Lab Assignment #2
Copyright©2005 by Gayatri Mehta and Ivan Kourtev
Copyright©2006 by Steven P. Levitan
University of Pittsburgh
Department of Electrical and Computer Engineering
September 8, 2006 (Friday, Week 2)
1 Circuit Simulation
Circuit simulation is one of the fundamental steps in the design methodology of VLSI circuits. The
operation characteristics of the designed product are predicted in a cost and time efficient manner using
simulation. In the current assignment, circuit simulation is used to illustrate basic concepts of digital circuits
and to check for hand-written SPICE models.
1.1 Setting up your account
In this lab, you will be using software provided by a company called Synopsys. HSPICE will be used to
simulate the circuit designs, and CosmosScope will be used to view the output from the HSPICE
simulations.
Before you get started on this assignment, you need to ensure that your account is properly set up to
run the software needed to complete this lab. To verify that HSPICE and CosmosScope are properly set up,
issue the following commands:
>which hspice
/CAD/synopsys/V-2004.03-SP1/bin/hspice
>which cscope
/CAD/synopsys/cosmos-scope_vV-2004.06/ai_bin/cscope
If you have any problems and you are sure that you properly have your account setup, inform your TA
immediately.
2 Introduction to SPICE
SPICE is the most commonly used analog circuit simulator today and is enormously important for the
electronics industry. SPICE is a general purpose analog simulator which contains models for most circuit
elements and can handle complex nonlinear circuits.
2.1 Circuit elements
In SPICE syntax, all elements within a circuit are labeled as components. The wires, for instance, are
labeled as nets, and the connectivity of the circuit is defined via these nets. The standard SPICE syntax
requires the definition of an element (labeled by a letter such as R for a resistor, C for a capacitor etc.), the
nets its terminals are connected to and the value for the element. The SPICE syntax for component
definitions looks as follows:
C0 gnd net1 10f
1
pf3
pf4
pf5

Partial preview of the text

Download Circuit Simulation - Lab Assignment 2 | ECE 1192 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Fall 2006 ECE1192/

Lab Assignment

Copyright©2005 by Gayatri Mehta and Ivan Kourtev Copyright©2006 by Steven P. Levitan

University of Pittsburgh

Department of Electrical and Computer Engineering

September 8, 2006 (Friday, Week 2)

1 Circuit Simulation

Circuit simulation is one of the fundamental steps in the design methodology of VLSI circuits. The operation characteristics of the designed product are predicted in a cost and time efficient manner using simulation. In the current assignment, circuit simulation is used to illustrate basic concepts of digital circuits and to check for hand-written SPICE models.

1.1 Setting up your account

In this lab, you will be using software provided by a company called Synopsys. HSPICE will be used to simulate the circuit designs, and CosmosScope will be used to view the output from the HSPICE simulations. Before you get started on this assignment, you need to ensure that your account is properly set up to run the software needed to complete this lab. To verify that HSPICE and CosmosScope are properly set up, issue the following commands:

which hspice /CAD/synopsys/V-2004.03-SP1/bin/hspice

which cscope /CAD/synopsys/cosmos-scope_vV-2004.06/ai_bin/cscope

If you have any problems and you are sure that you properly have your account setup, inform your TA immediately.

2 Introduction to SPICE

SPICE is the most commonly used analog circuit simulator today and is enormously important for the electronics industry. SPICE is a general purpose analog simulator which contains models for most circuit elements and can handle complex nonlinear circuits.

2.1 Circuit elements

In SPICE syntax, all elements within a circuit are labeled as components. The wires, for instance, are labeled as nets, and the connectivity of the circuit is defined via these nets. The standard SPICE syntax requires the definition of an element (labeled by a letter such as R for a resistor, C for a capacitor etc.), the nets its terminals are connected to and the value for the element. The SPICE syntax for component definitions looks as follows:

C0 gnd net1 10f

R0 net2 net3 1k V3 net4 net5 DC 3.3V V0 net6 net7 pulse 0 vddp 0n 200p 200p 3n 6n

The first line is a capacitor, named C0, between gnd and net1. Its value is specified to be 10fF. The second line is a 1K resistor, called R0, connected between net2 and net3. The third line is a 3.3V DC voltage source named V3, between net4 and net5. The fourth line is another voltage source, connected between net6 and net7. The voltage source produces pulses of 0 V and vddp (e.g. 5V). The time values listed are respectively delay, rise_time, fall_time, pulse_width and period.

The format for a MOSFET is:

  1. Name (must begin with M)
  2. Node numbers in the following order : Drain Gate Source Base
  3. MOSFET model name
  4. W and L are the width and length of the gate (in meters) [Ό is micron]

For example,

M_0 output input vdd vdd p W=2u L=1u M_1 output input gnd gnd n W=1u L=1u

Note that the first letter of each line in the above examples specifies the element type. Most popular elements, used in this course are:

V Voltage C Capacitance R resistance M MOSFET Q BJT

2.2 Voltage input waveforms

There are some commands to insert input waveforms in the circuit, as well. ‘PWL’ and ‘PULSE’ are two input waveforms frequently used in transient analysis. The format for a piece-wise linear (PWL) waveform is:

PWL time0 value0 time1 value ...

where value0 is the value at time0, value1 is the value at time1 and so on. An example could be:

Vin 3 0 PWL 0n 0V 0.4n 5V 14.6n 5V 15n 0V

The format for the PULSE command is:

PULSE (initial_value pulse_value delay rise_time fall_time pulse_width period)

2.5 Simulation

In order to run simulations on the netlist file, specify the durations of the simulation and/or the initial and incrementing values for the input voltages. Basically two types of simulations will be used:

  1. DC Sweep: The .DC statement allows you to increment (sweep) an independent source over a certain range with a specified step value. The format of using this statement is as follows:

.DC source_name Vstart Vstop Vincrement

The DC sweep command can be nested and is often used to plot transistor characteristics. The format for the nested DC Sweep is:

.DC source_name1 Vstart1 Vstop1 Vincrement1 source_name2 Vstart Vstop2 Vincrement

  1. Transient Analysis: The .TRAN statement specifies the time interval over which the transient analysis takes place and the time increment. The format of this command is:

.TRAN tstep tstop <tstart >

where tstep is the time increment, tstop is the final time, tstart is the starting time (if omitted, tstart is assumed to be zero), tmax is the maximum step size. tstart and tmax are optional. For example :

.TRAN 0.01N 20N

2.6 SPICE code

The SPICE file should contain the technology parameters, in order to produce a good prototype of the circuit and produce realistic simulation results. This is done by including a technology file stored in a path, or by directly trying to write the parameters. Most of the manufacturers release their process technology parameters for use in simulation and circuit realization. Now look at the following source:

  • FILE: invert.sp .include ‘/classes/ece1192/fall06/CLASS/ami_C5N.mod’

VDD vdd 0 DC 5

  • My code starts here .tran 0.01n 100n M0 out in gnd gnd n W=2u L=1u M1 out in vdd vdd p W=4u L=1u C1 gnd out 15f R1 gnd out 1K VA in gnd PWL 0n 0V 0.2n 5V 14.6n 5V 15n 0V .END

The lines starting with ‘’ are just comments and not a part of the code. The line starting with .include command includes the path for the technology file. This technology, which is also being used in layout drawing, is called `AMI_C5N' technology. ‘5’ indicates that twice the minimum length for a gate of a transistor is 0.5um (2lmin = 0.5um). To write a full-custom SPICE code, create a regular text file with ‘.sp’ extension, and copy the lines specifying the technology and settings to a new text file (from the beginning to the comment line: ‘My code starts here’). Then, in this new text file, append your SPICE code, where you implement your circuit and include simulation commands. Note: The presented file includes unnecessary comment lines. You do not need to include this in your .sp files. However, The first line of every SPICE file MUST be a comment. You might want to create one such file as a template file and make copies of it every time you need to write different SPICE files.

2.7 Additional information

To generate the netlist file, Cadence or MMI tools (VLSI design packages) can be used. The circuit is designed in these schematics/layout editing tools by using the built-in commands of the tools to create a netlist. The simulations are run and resulting waveforms are observed for circuit functionality. For this assignment, the SPICE files will be written from scratch (using any text editor), as one of the objectives of this assignment is to practice writing full-custom SPICE codes to represent circuits. NOTE: SPICE code requires all nodes of a circuit to be connected (to a net). No floating nodes are allowed.

2.8 Running HSPICE

To run HSpice on any SPICE input file, type “hspice .sp” at UNIX command prompt. Remember SPICE files must be named with “.sp” extension. Follow the output on your screen. Watch out for any warnings or errors that occured during simulation. Several files are created by HSPICE: .ic0: text file containing circuit initial conditions .st0: text file containing a summary of the simulation .tr0: Binary file containing transient analysis waveforms .sw0: Binary file containing dc sweep analysis waveforms

To learn more about HSPICE refer to the online manuals and the related documentation on the world wide web.

2.9 Quick introduction to CosmosScope

After simulating the SPICE code, the output waveforms can be viewed using CosmosScope. To use CosmosScope, type “cscope &” at the UNIX command prompt.

  • Click on File > Open > Plotfiles and choose your “.tr0” file that contains the transient analysis.
  • A signal manager window and the plot file window will open up.
  • Choose which variables you want to plot (voltage, current). For example, you want to plot v(in), double click v(in) in the plot window.
  • The waveform editor has rulers and zoom menus to ease measurement.
  • You can also view waveforms for the DC sweep analysis. For this, click on File > Open > Plotfiles and choose your “.sw0” file that contains the DC sweep analysis.
  • CosmosScope has a help manual which can be invoked from within the program.
  1. Using the same inverter in the previous task, perform a DC sweep on the input voltage. You must remove the lines starting with .MODEL for this part and include the following line.

.include ‘/classes/ece1192/fall06/CLASS/ami_C5N.mod’.

This will set the proper technology parameters for your transistors.

  • Perform the DC sweep on the input from 0 to 5 volts using a 0.05 increment and plot the Voltage Transfer Curve (input and output voltages) for the inverter.
  1. Now create a subcircuit of an inverter and use it to build a 7-stage ring oscillator. Measure the delay of the ring oscillator and then compute the delay of a single-inverter.
  2. Print outs of all source code (.sp files) used for each part and all waveforms generated (plots) , all measurements , and computations are due by next Friday, September 15, 2006.

Hint for Problem 4: A ring oscillator is a device composed of an odd number of inverters whose output oscillates between two voltage levels, representing true and false. The inverters are attached in a chain and the output of the last inverter is fed back into the first inverter. The schematic for a 7- stage ring oscillator is shown below: