EE 348 Experiment 1

download EE 348 Experiment 1

of 32

Transcript of EE 348 Experiment 1

  • 7/24/2019 EE 348 Experiment 1

    1/32

    Laboratory Experiment 1

    EE348L

    Jonathan Roderick

    Onder Oz

    Tyler Rather

    Revised by !aron "#rry

    University of Southern California. EE348L page1 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    2/32

    Table o$ "ontents

    1 Experiment %1 &'("E &im#lations)( **************************************************************************** 4

    1.1 Introduction..................................................................................................................................... 4

    1.2 First time HSPICE setup on your computer....................................................................................4

    1.2.1 To simulate a circuit........................................................................................................... 4

    1.2.2 To view/read simulation results o a circuit simulation...................................................... !

    1." T#e $etlist%...................................................................................................................................... !

    1.4 Circuit Elements Statements........................................................................................................... &

    1.4.1 Independent Sources.......................................................................................................... '

    1.4.2 (ependant Sources.............................................................................................................11

    1.4." Passive elements................................................................................................................1"

    1.4.4 )ctive elements.................................................................................................................14

    1.! Command Statements.....................................................................................................................1'

    1.!.1 )nalysis type..............................................................................*****..****.1'

    1.!.2 +utput re,uested................................................................... ****..******..1-

    1.& rap#ical Interace Plots............................................................................ ..********..21

    1.' Eample o an input ile ................................................................................................................ 22

    1.0 eerence eadin......................................................................................................................... 2"

    1.- HSPICE 3I(EI$ES E5IE6................................................................................................ 24

    1.-.1 To Simulate a Circuit........................................................................................................ 24

    1.-.2 To plot t#e output o a circuit........................................................................................... 241.-." Some common wave view options....................................................................................24

    1.-.4 Some common user pro7lems wit# SPICE....................................................................... 24

    1.-.! (e7uin******************************..2!

    1.18 a7 eercises..................................................................................................................................2&

    1.11 eneral eport Format uidelines................................................................................................"1

    University of Southern California. EE348L page2 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    3/32

    Table of Figures

    Figure 1-1:An independent voltage and current source.. ................... 6

    Figure 1-2:A transient plot of a sine wave produced by a SIN source... ................................ 9

    Figure 1-3:A transient plot of a pulsed wave produced by a PULS source....................................... !"

    Figure 1-4:A transient plot of a piecewise linear plot produced by a P#L source..... !"

    Figure 1-5:A sc$e%atic representation of r&c&l passive ele%ents.................................................... !'

    Figure 1-6:A sc$e%atic representation of a diode............................................................................... !(

    Figure 1-7:A sc$e%atic representation of a )*+................................... !,

    Figure 1-8:A sc$e%atic representation of a -S/+........................................................... !6

    Figure 1-9:A sc$e%atic representation of t$e sa%ple 0SPI1 input file............................................. 22

    Figure 1-10:A transient plot of t$e input and output nodes fro% t$e sa%ple 0SPI1 input file........... 22

    Figure 1-11:A circuit sc$e%atic for lab e3ercise !............................................................................. 26

    Figure 1-12:A reular '41 op9amp. ................................................................................................... 24

    Figure 1-13:An e5uivalent circuit for Figure 1-12to be used in 0SPI1. .... 24

    Figure 1-14:A circuit sc$e%atic for lab e3ercise 2................................................................................. 29

    Figure 1-15:A circuit sc$e%atic for lab e3ercises '(........................................................................... '"

    1 Experiment %1 &'("E &im#lations 'art (

    University of Southern California. EE348L page3 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    4/32

    1*1 (ntrod#ctionT#is eperiment is desined to amiliari:e t#e student wit# SPICE. SPICE simulations will 7e needed or

    prela7s and pro;ects contained in t#is la7 manual. Spice is an acronym or Simulation Proram wit#

    Interated Circuit Emp#asis. SPICE is a computer aided desin es one truly

    successul. T#ere are many dierent variations o SPICE t#at are produced 7y companies. Two o suc#

    versions are TSPICE

  • 7/24/2019 EE 348 Experiment 1

    5/32

    "= ead circuit.out to see i t#ere are any errors or warnins. ou must i t#e errors w#ile warnins

    may 7e inored dependin on severity. T#is can 7e done wit# t#e more command

  • 7/24/2019 EE 348 Experiment 1

    6/32

    statement are or t#e node num7ers t#at t#e terminals are connected to. T#e last part o t#e statement

    contains t#e p#ysical model o t#e element. I certain device p#ysical c#aracteristics are let 7lan>? t#en

    SPICE #as a set o deault values t#at it will automatically use. Even t#ou# SPICE #as some deault

    values or a limited num7er o device c#aracteristics? some parameters cannot 7e let 7lan>. Ta7le 1.1

    contains a list o some 7asic elements and t#e letter t#at is used to identiy t#em%

    T#ese elements all into t#ree dierent cateories. Sinal Sources? Passive Elements? and )ctive

    Elements.

    1*4*1 (ndependent &o#rces

    T#ree independent sources can 7e used in SPICE simulations. ) (C source? a re,uency9sweepin )Csource? and time varyin T)$ source can all 7e modeled wit# standard SPICE sinal sources. Eac#

    source can eit#er supply current or voltae. (ierent types o sources are used or dierent types o

    analysis. Ta7le 1.2 lists t#e dierent element statements or independent sources and t#e analysis type t#at

    is typically used wit# eac#.

    University of Southern California. EE348L page6 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    7/32

    Eac# element statement #as an array o c#aracters t#at represent dierent c#aracteristics o t#e source.

    T#e c#aracters are separated 7y a space so t#at t#e compiler >nows t#at t#e user is done descri7in one

    aspect and startin anot#er. In t#e element statements? t#e irst letter depicts i t#e source delivers voltae

    or current wit# a 5 or I? respectively. T#e irst letter is ollowed 7y t#e name o t#at source. Eac# source#as to #ave a dierent name and t#ey can 7e up to seven c#aracters lon. $et? t#e n and n9 denote t#e

    node num7er o t#e positive and neative terminal? respectively. ou will assin num7ers

    #as a manitude and

    SPICE will assume a :ero deree p#ase s#it.

    University of Southern California. EE348L page Lab 1

  • 7/24/2019 EE 348 Experiment 1

    8/32

    &(2 TR!25

    eneric statement%

    5namen n9 SI$

  • 7/24/2019 EE 348 Experiment 1

    9/32

    Eample%

    5188 2! 18 P6

  • 7/24/2019 EE 348 Experiment 1

    10/32

    University of Southern California. EE348L page1" Lab 1

  • 7/24/2019 EE 348 Experiment 1

    11/32

    1*4*- ependant &o#rces(ependent sources will 7e covered in more detail in t#e second la7. T#ey are introduced in t#is part.

    I you #ave a voltae dependent source t#ere are our nodes in t#e command. I you #ave a current

    dependent source t#ere are two nodes and a voltae source in t#e command. T#e irst two nodes o any

    dependent source? n and n9? represent t#e node num7ers or t#e positive and neative ports o t#e output.

  • 7/24/2019 EE 348 Experiment 1

    12/32

    Eample%

    Fmirror vDirrorP vDirrorD vDirrorControl 2

    In t#e eample? t#e CCCS is named @mirrorA. Its output current lows $romnode vDirrorP tonode

    vDirrorD

  • 7/24/2019 EE 348 Experiment 1

    13/32

    1*4*3 'assive elementsPassive element statements are very similar to (C sources. T#e irst letter indicates t#e passive element

    t#at is 7ein used. T#e letters or a standard resistor? capacitor and inductor are listed in ta7le 1.1. )

    sc#ematic diaram o eac# is s#own 7elow. T#e sc#ematic diarams accompanied 7y a eneric statement?

    an eample statement and a 7rie eplanation.

    Resistor

    eneric%

    namen n9 value

    Eample%

    1 ! 8 18>

    T#e eample depicts a resistor named @1A? w#ic# is connected 7etween nodes ! and 8 +#ms.

    "apacitor

    eneric%

    Cnamen n9 valueNICMinitial conditionO

    Eample%

    Cload !8 8 18u NICM8.!5O

    T#is eample is a capacitor named @loadA connected at nodes !8 and 8 !8 8 1

    T#is is an eample o an inductor named @eed7ac>A. It is connected 7etween nodes !8 and 8

  • 7/24/2019 EE 348 Experiment 1

    14/32

    1*4*4 !ctive elementsou will 7e usin t#ese elements in la7s later in t#e semester. T#ey are introduced #ere.

    T#e t#ree 7asic active elements needed or t#is class are t#e diode? GT and t#e D+SFET. T#e element

    statements or active devices are really similar to passive. T#e undamental dierence is t#at t#e GT and

    D+SFET are t#ree and our terminal devices? respectively. T#e p#ysical c#aracteristics can also 7e a little

    more complicated. +t#er t#an t#at? active elements ollow t#e same 7asic element statement ormat. T#e

    irst letter identiies t#e device type? t#e net t#ree statements are or t#e node num7ers

  • 7/24/2019 EE 348 Experiment 1

    15/32

    :JT

    T#e GT element statement is very similar to t#e diode. T#e main dierence is t#at it #as t#ree terminals

    instead o two. +t#er t#an t#at? t#e structure o t#e statement is very similar. )n eample o a $P$ is

    done 7elow.

    eneric%

    QnameC G E model-name

  • 7/24/2019 EE 348 Experiment 1

    16/32

    ;O&.ET

    T#e element statement structure or t#e D+SFET is 7asically t#e same as t#e GT? 7ut wit# one more

    terminal. )n eample is iven and eplained 7elow.

    eneric%

    Dname( S G &odel-nameMvalue6Mvalue

    are connected to nodes 1!? 8

  • 7/24/2019 EE 348 Experiment 1

    17/32

    o D+SFET is identiied in t#e @.modelA statement. In t#is eample t#e D+SFET is a $D+S? 7ut

    replacin t#e @$D+SA part in t#e statement wit# @PD+SA will c#ane t#e type o D+SFET rom $D+S

    to PD+S. ) ta7le o ot#er typical D+SFET c#aracteristics and t#eir deault values are listed in ta7le 1.'.

    1*< "ommand &tatements+nce you #ave entered all t#e element statements in t#e input ile? you #ave to enter t#e command

    statements. T#ese command statements tell SPICE eactly #ow you want to simulate t#e circuit and

    present t#e data. )s opposed to element statements? all command statements 7ein wit# a period.

    1* wit# certain types o analysis. T#ere are our 7asic types o analysis to c#oose rom% (C operatin

    point? (C sweep? )C re,uency response? and transient response

  • 7/24/2019 EE 348 Experiment 1

    18/32

    In t#e eample t#e @.(CA analysis command instructs t#e source named @powerA in t#e circuit to start at

    85 and increase its values 7y increments o 8.15 until it reac#es a value o !5? t#en it stops.

    !" $re=#ency response

    eneric%.)C type num/er-of-points frequency-start frequency-stop

    T#e @.)CA command does not need t#e name o t#e source. )n )C source is t#e only source t#at allows

    or t#is type o analysis? so HSPICE will implement t#is analysis to t#e )C source in t#e circuit

    automatically. Followin t#e @.)CA command are statements t#at indicates t#e way points are ta>en and

    t#e num7er o points ta>en? respectively. Finally? t#e startin and endin re,uencies are listed. T#ere are

    t#ree dierent types o )C re,uency responses. T#e dierence deals wit# #ow t#e points are ta>en. ou

    can speciy t#e ollowin types% (EC es 188 points per

    decade. T#e analysis starts at 2>H: and ends at 1DH:. T#e ot#er two statements ollow t#e same ormat.

    Transient response

    eneric%

    .T)$step-time stop-time

    T#e @.T)$A analysis is preormed w#en t#e response o t#e circuit wit# time is desired. For eample? a

    transient response re,uest would 7e used i you wanted to see t#e time it ta>es a capacitor to c#are or

    disc#are. "a#tion .or correct data collection+ make s#re that the smallest step time in the

    transient command is e=#al to or smaller then the $astest chan,e in yo#r si,nal* >o# m#st also make

    s#re that the transient time complements the so#rce+ or yo# 0ill not be able to see the sim#lated

    res#lts*

    Eample%

    .T)$ 18n 18m

    T#is eample simulates t#e circuit or 18ms and ta>es data points every 18ns.

    Trans$er .#nction

    eneric%

    .TF 5

  • 7/24/2019 EE 348 Experiment 1

    19/32

    T#e .TF analysis is useul or indin Rsmall sinal ain and input/output impedances. T#is will ma>e

    more sense later in t#e semester.

    Eample%

    .TF 5

  • 7/24/2019 EE 348 Experiment 1

    20/32

    Some eamples are done 7elow.

    'robe

    eneric%

    .Pro7e output

    Eample%

    .Pro7e ac ain M par

  • 7/24/2019 EE 348 Experiment 1

    21/32

    )ter you #ave entered all t#e elements? analysis? and output re,uest you must end t#e input ile wit# an

    @.E$(A statement. Da>e sure to press return ater you #ave typed your .E$( statement. $ot doin t#is

    sometimes #ans up SPICE.

    1*@ raphical (nter$ace 'lots)ain? HSPICE plots are very crude and not t#e most presenta7le. T#ere are tools t#at you can use to plot

    t#e data once you #ave collected it. ou can use t#e @.PI$TA statement? t#en copy and paste t#e output

    data into ecel or an e,uivalent and plot it t#at way. T#ere are also rap#ical interace prorams desinedto plot t#e data stored in you output ile automatically. +ne suc# proram is @6ave5iew )naly:erA. I

    you want to use 6ave5iew )naly:er you must include t#e statement @.opt postA ri#t 7eore your element

    statements. T#is will save all node voltaes 7y deault e to plot element currents or varia7les? t#en you will

    need to use t#e @.P+GEA statement. To open 6ave5iew )naly:er ater a simulation use t#e ollowin

    command%

    #nixprompt% wv &

    T#e ampersand allows you to continue to use t#e uni mac#ine and ma>e c#anes to your .sp ile and re9

    simulate w#ile 6ave5iew )naly:er remains open. Ge sure to reload t#e waveorm in 6ave5iew

    )naly:er i you do so.

    +nce you #ave 6ave5iew )naly:er open? you will need to add t#e simulation data to 7e plotted. ou

    will open t#ree dierent ile types dependin on w#ic# type o analysis you ran. I you ran a .(C? you

    will open circuit.sw8. I you ran a .)C? you will open circuit.ac8. I you ran a .T)$? you will open

    circuit.tr8. +nce t#e ile is loaded? dou7le clic> on t#e ile name in t#e R+utput 5iew su79window and

    t#en clic> on Rtoplevel. Gelow? t#ere will 7e listed all t#e availa7le plots

  • 7/24/2019 EE 348 Experiment 1

    22/32

    1*A Example o$ an inp#t $ileBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

    Eample input ile T#is must 7e t#e irst line o t#e ile

    .opt post

    5s 2 8 SI$ < 85 15 18>=

    1 2 1 18>

    (1 1 8 diode

    .D+(E diode (

  • 7/24/2019 EE 348 Experiment 1

    23/32

    T#is la7 is no way intended to 7e a SPICE manual. T#is introduction only covers t#e 7asics t#at a student

    will need to run SPICE. +t#er pu7lis#ed material? suc# as t#e ones in t#e reerence readin? on SPICE

    s#ould 7e consulted or a 7etter understandin.

    1*8 Re$erence Readin,1. ordon 6. o7erts and )del S. Sedra. SPICE. Second edition. $ew or>% +ord Press?

    1--'.

    2. Darc E. Herniter. Sc#ematic Capture wit# DicroSim Pspice. T#ird edition. 3pper Saddle

    iver? $ew ersey% Prentice Hall? 1--0.

    ". HSPICE user manual. #ttp%//;catsc.com/media/ee"40/a7s/ee"40B288194B#spice.pd

    4.TSPICE I5 user manual. http#$$%&ats&.&o'$'e(ia$ee348$C)*an(Labs$L+spi&e,-ef.p(f

    5. /S/,CE user 'anual. http#$$%&ats&.&o'$'e(ia$ee348$C)*an(Labs$/Spi&eef.p(f

    1*C /&'("E 6(EL(2E& RE9(E7

    University of Southern California. EE348L page23 Lab 1

    http://jcatsc.com/media/ee348/Labs/ee348_2001-4_hspice.pdfhttp://jcatsc.com/media/ee348/CADandLabs/LTspiceIVRef.pdfhttp://jcatsc.com/media/ee348/CADandLabs/PSpiceRef.pdfhttp://jcatsc.com/media/ee348/CADandLabs/LTspiceIVRef.pdfhttp://jcatsc.com/media/ee348/CADandLabs/PSpiceRef.pdfhttp://jcatsc.com/media/ee348/Labs/ee348_2001-4_hspice.pdf
  • 7/24/2019 EE 348 Experiment 1

    24/32

    1*C*1 To &im#late a "irc#it1= 6rite a netlist usin a tet editor suc# as emacs and save it as a .sp ile on t#e 6aveview

    ta7. For R6aveview Gac>round select R6#ite.

    "= To eport t#e wave view as a postscript? o to FilePrint. $ear t#e 7ottom in t#e RPostScript

    +utput File c#ec> t#e 7o mar>ed RPrint To File. In t#e R+utput Pat# tet 7o name your ile

    ilename.ps in t#e pat# you wis#. Clic> RPrint.4= To convert rom .ps to .pd? you will need to run t#e distill command

  • 7/24/2019 EE 348 Experiment 1

    25/32

    '= 3sin t#e wron units. For eample? user types @1DA to speciy 1e&? w#ic# SPICE interprets as

    1e9" e sure t#at t#e synta o SPICE commands in t#e netlist is correct.4= Da>e sure t#at t#e circuit represented in t#e netlist is w#at you want.

    != Da>e sure t#at t#e SPICE netlist

  • 7/24/2019 EE 348 Experiment 1

    26/32

    Exercise 15

    ). Calculate ? 4M1.!>? !M1>? &M18>? 'M2.2>? 0M288?

    51M"."5? 52M!5.

    1= S#ow #and calculations.

    G. 5eriy your results wit# HSPICE.

    1= Print out node voltaes rom t#e output ile. Compare t#em to t#e #and calculations.

    Exercise -5

    Fiure 1.12 is a reular '41 op9amp. )n op9amp can 7e modeled in SPICE 7y usin t#e e,uivalent

    circuitry ound in Fiure 1.1".

    University of Southern California. EE348L page26 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    27/32

    ). Consider t#e circuit o Fiure 1.14.

    University of Southern California. EE348L page2 Lab 1

  • 7/24/2019 EE 348 Experiment 1

    28/32

    1= Find t#e transer unction ? 2M1>? M188>? 5ccM-5? 95eeM9-5? ind%

    1= T#e ideal ain o t#e circuit

  • 7/24/2019 EE 348 Experiment 1

    29/32

    "= I outVV? 2M1>? M188>? 5ccM-5? 95eeM9-5? ind%

    1= 2. ets call t#is seen.

    2= 5o/5: i outMseen"= 5o/5: i outMseen/188.

    . 5eriy your results in part F. 3se t#e same HSPICE simulation stimulus as in part C wit#

    )oM188)i. (o not oret to add t#e /9 rails

  • 7/24/2019 EE 348 Experiment 1

    30/32

    1= "8ms

    2= "88ms

    "= ."ms

    G= (o t#e results dier w#en usin t#ree dierent simulation timesW 6#y is it important to ma>e an

    educated decision w#en c#oosin a simulation time or your simulationW

    C= T#e time constant o a irst order system reers to t#e time it ta>es t#e system to reac# wit#in 1/e

    o its inal value w#en t#e input is a step es or t#e output to reac# &"Y o its inal value. e

    t#e 9ais loarit#mic in your plots.

    1= et 1M1> and C1M188p. Sweep rom 18H:918>H:

    2= et 1M188> and C1M188n. Sweep rom 18H:918H:"= 6#y did 7ot# o t#ese sweeps ail to s#ow a valid .)C sweepW

    University of Southern California. EE348L page3" Lab 1

  • 7/24/2019 EE 348 Experiment 1

    31/32

    4= et 1M188 and ClM1p. Sweep rom 18H:M18H:. 6#at is t#e pro7lem wit# t#is

    sweepW

    G= +ne can see t#at c#oosin t#e correct re,uency rane optimi:es t#e results. +ne common error

    ee"40 students ma>e is su7mittin poor plots. )n oriinal sweep rom R(C to dayli#t can 7e a

    ood way to et an idea o w#at re,uency rane is appropriate to sweep #owever? t#is oriinalplot s#ould not 7e su7mitted. Find t#e 9"d7 re,uency o t#e circuit in Fiure 1.1! rom part )?

    num7er 1.

  • 7/24/2019 EE 348 Experiment 1

    32/32

    Eplain w#at t#e la7 is a7out. (escri7e t#e circuits 7ein 7uilt in terms o structure and purpose.

    )lso tal> a7out w#at is 7ein investiated.

    For Eac# Eercise

    2. Procedure

    Step 7y step tal> a7out w#at was done and s#ow diarams o t#e circuits.". (ata

    Present data ta>en durin t#e la7. It s#ould 7e orani:ed and easy to read.

    4. Questions

    )nswer all t#e ,uestions in t#e la7.

    !. (iscussion

    (iscuss t#e results you o7tained. 6#at siniicance is t#ere in t#e resultsW How do t#ey #elp

    your investiationW Eplain t#e meanin t#e num7ers alone arent ood enou#.

    &. Conclusion

    6rap up t#e report 7y ivin some comments on t#e la7. (o t#e results clearly aree wit# w#at

    t#e la7 was tryin to teac#W (id you #ave any pro7lemsW SuestionsW

    '. )ttac#ments

    )ttac# all #and calculations and SPICE plots necessary.

    IF ) )G ELECISE )S[S +3 T+ C+DP)E +3 ES3TS 6ITH +3 PE9)G?

    I$C3(E +3 PE9)G ES3T I$ +3 )G EP+T SIDP ST)TI$ THE )E THE

    S)DE IS $+T ++( E$+3H

    $+TE% ou are turnin in la7 reports t#at are to 7e raded. I you want ood mar>s? 7e sure to ma>e t#e

    reports as neat and aest#etically appealin as possi7le. I you reer to an attac#ed plot? include t#e pae

    num7er. I you reer to a #and calculation? 7e sure to #i#li#t w#at you are reerrin to on t#e paecontainin t#e #and calculation. However? includin e,uations? plots? iures? etc. in t#e 7ody o your

    report is ood practice. Ge sure to include plot titles. Ge sure to include ais titles and units. a7 reports

    are to 7e typed. H)$(6ITTE$ EP+TS 6I $+T GE )CCEPTE(. )G EP+TS )E (3E

    )T THE GEI$$I$ +F THE $ELT )G. THE 6I $+T GE )CCEPTE( IF THE )E

    D+E TH)$ 1! DI$3TES )TE