Mast Language Reference Man

download Mast Language Reference Man

of 172

Transcript of Mast Language Reference Man

  • 8/9/2019 Mast Language Reference Man

    1/172

    Comments?

    E-mail your comments about Synopsys

    documentation to [email protected]

    MAST Language

    Reference Manual

    Release 2003.06, June 2003

  • 8/9/2019 Mast Language Reference Man

    2/172

    ii

    Copyright Notice and Proprietary InformationCopyright2003 Synopsys, Inc. All rights reserved. This software and documentation contain confidential and proprietaryinformation that isthepropertyofSynopsys,Inc.Thesoftwareanddocumentationarefurnishedundera licenseagreementand maybe used or copied only in accordance with the terms of the license agreement. No part of the software and documentation may bereproduced,transmitted,ortranslated, inanyformor byanymeans,electronic,mechanical,manual,optical,or otherwise,withoutpriorwritten permission of Synopsys, Inc., or as expressly provided by the license agreement.

    Right to Copy Documentation

    ThelicenseagreementwithSynopsyspermitslicenseeto make copiesof thedocumentation for itsinternal useonly. Eachcopy shall include all copyrights, trademarks, service marks, and proprietary rights notices, if any. Licensee must assignsequential numbers to all copies. These copies shall contain the following legend on the cover page:

    This document is duplicated with the permission of Synopsys, Inc., for the exclusive use of__________________________________________ and its employees. This is copy number __________.

    Destination Control StatementAll technical data contained in this publication is subject to the export control laws of the United States of America.Disclosure to nationals of other countries contrary to United States law is prohibited. It is the readers responsibility todetermine the applicable regulations and to comply with them.

    Disclaimer

    SYNOPSYS, INC., AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITHREGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OFMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

    Registered Trademarks, Trademarks, and Service Marksof Synopsys, Inc.

    Registered Trademarks ()Synopsys, AMPS, Arcadia, C Level Design, C2HDL, C2V, C2VHDL, Cadabra, Calaveras Algorithm, CATS, CoCentric,COSSAP, CSim, DelayMill, Design Compiler, DesignPower, DesignWare, Device Model Builder, EPIC, Formality,HSPICE, Hypermodel, I, InSpecs, iN-Phase, in-Sync, LEDA, MAST, Meta,Meta-Software, ModelAccess, ModelExpress,ModelTools, PathBlazer, PathMill, Photolynx, Physical Compiler, PowerArc, PowerMill, PrimeTime, RailMill, Raphael,RapidScript, Saber, SiVL, SmartLogic, SNUG, SolvNet, Stream Driven Simulator, Superlog, System Compiler, Testify,TetraMAX, TimeMill, TMA, Vera, and Virtual Stepper are registered trademarks of Synopsys, Inc.

    Trademarks ()abraCAD, abraMAP, Active Parasitics, AFGen, Apollo, Apollo II, Apollo-DPII, Apollo-GA, ApolloGAII, Astro, Astro-Rail,Astro-Xtalk, Aurora, AvanTestchip, AvanWaves, BCView, Behavioral Compiler, BOA, BRT, Cedar, ChipPlanner, CircuitAnalysis, Columbia, Columbia-CE, Comet 3D, Cosmos, CosmosEnterprise, CosmosLE, CosmosScope, CosmosSE,Cyclelink, Davinci, DC Expert, DC Expert Plus, DC Professional, DC Ultra, DC Ultra Plus, Design Advisor, DesignAnalyzer, DesignerHDL, DesignTime, DFM-Workbench, DFT Compiler, Direct RTL, Direct Silicon Access, DW8051,DWPCI, Dynamic-Macromodeling, Dynamic Model Switcher, ECL Compiler, ECO Compiler, EDAnavigator, Encore,Encore PQ, Evaccess, ExpressModel, Floorplan Manager, Formal Model Checker, FormalVera, FoundryModel, FPGACompiler II, FPGAExpress, Frame Compiler, Frameway, Galaxy, Gatran, HDL Advisor, HDL Compiler, Hercules,Hercules-Explorer, Hercules-II, Hierarchical Optimization Technology, High Performance Option, HotPlace, HSPICE-Link, iN-Tandem, Integrator, Interactive Waveform Viewer, iQBus, Jupiter, Jupiter-DP, JupiterXT, JupiterXT-ASIC,JVXtreme,Liberty, Libra-Passport,Library Compiler, Libra-Visa,LRC, Mars,Mars-Rail,Mars-Xtalk, Medici, Metacapture,Metacircuit,Metamanager,Metamixsim, Milkyway, ModelSource, ModuleCompiler, MS-3200, MS-3400, NanoSim,Nova

    Product Family, Nova-ExploreRTL, Nova-Trans, Nova-VeriLint, Nova-VHDLlint, OpenVera, Optimum Silicon, Orion_ec,ParasiticView, Passport, Planet,Planet-PL,Planet-RTL,Polaris, Polaris-CBS,Polaris-MT, PowerCompiler, PowerCODE,PowerGate, ProFPGA, Progen, Prospector, Proteus OPC, Protocol Compiler, PSMGen, Raphael-NES, RoadRunner,RTLAnalyzer, Saturn,ScanBand,SchematicCompiler, Scirocco,Scirocco-i, Shadow Debugger, SiliconBlueprint,SiliconEarly Access, SinglePass-SoC, Smart Extraction, SmartLicense, SmartModel Library, Softwire, Source-Level Design,Star, Star-DC, Star-MS, Star-MTB, Star-Power, Star-Rail, Star-RC, Star-RCXT, Star-Sim, Star-Sim XT, Star-Time, Star-XP, SWIFT, Taurus, Taurus-Device, Taurus-Layout, Taurus-Lithography, Taurus-OPC, Taurus-Process, Taurus-Topography, Taurus-Visual, Taurus-Workbench, The Power in Semiconductors, TimeSlice, TimeTracker, TimingAnnotator, TopoPlace, TopoRoute, Trace-On-Demand, True-Hspice, TSUPREM-4, TymeWare, VCS, VCS Express,VCSi, Venus, Verification Portal, VFormal, VHDL Compiler, VHDL System Simulator, VirSim, and VMC are trademarksof Synopsys, Inc.

  • 8/9/2019 Mast Language Reference Man

    3/172

    ii i

    Service Marks (SM)DesignSphere, MAP-in, SVP Caf, and TAP-in are service marks of Synopsys, Inc.

    SystemC is a trademarkof the Open SystemC Initiativeand is used under license.AMBA is a trademarkof ARM Limited.ARMis a registered trademarkof ARMLimited.All otherproduct orcompany namesmay betrademarks oftheirrespectiveowners.

    Printed in the U.S.A.

  • 8/9/2019 Mast Language Reference Man

    4/172

    iv

  • 8/9/2019 Mast Language Reference Man

    5/172

    M AST L anguage Reference M anu al (J un e 2003) v

    Copyright 1985-2003 Synopsys, I nc.

    MAST Language Reference Manual

    Cha pter 1. Overview .....................................................................................1-1

    File for C lan gua ge declar a tions included.......................................1-3

    A compound st a tement in a templat e ca nnot ha ve an empty body1-3

    A foreign routine in a template th a t does not r eturn a va lue can causeerrors .................................................................................................1-3

    You cannot use a n enumera ted ty pe para meter (enum) as an externalva ria ble in a templa t e ......................................................................1-3

    Cha pter 2. MAST Sy nt a x Rules ...................................................................2-1

    Cha pter 3. Declara t ions and Da ta Structures ............................................ 3-1

    Cha pter 4. Expressions .................................................................................4-1

    Cha pter 5. Int rinsic Functions a nd Va lues ................................................. 5-1

    Cha pter 6. S ta tements ..................................................................................6-1

    Cha pter 7. Templates ...................................................................................7-1

    Cha pter 8. Foreign Fu nctions ......................................................................8-1

    Cha pter 9. MAST Functions ........................................................................ 9-1

    Index ......................................................................................................... In dex-1

  • 8/9/2019 Mast Language Reference Man

    6/172

    MAST L anguage Refer ence M anu al

    vi M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

  • 8/9/2019 Mast Language Reference Man

    7/172

    M AST L anguage Reference M anu al (J un e 2003) 1-1

    Copyright 1985-2003 Synopsys, I nc.

    chapter1

    Overview

    Introduction

    This ma nua l describes th e MAST modeling la ngua ge. This la ngua ge lets y oucr ea t e a m od el of a n y a n a log s ys tem or elem en t t h a t ca n be d efi n ed in t er ms of

    nonlinear lumped a lgebraic or differentia l equa tions. Some extensions a re

    a lso provided by th e use of ideal dela y a nd scheduling.

    After completing a model, you ca n use it a s input t o the Sa ber simula tor. Youca n a l so u se t h e M AS T l a n gu a ge t o cr ea t e d ig it a l m od els t h a t t a k e on d is cr et eva lues a t discrete t imes. With t he MAST lan gua ge and th e Sa ber simulator,you ca n m odel an d simula te most physica l syst ems: electronic, mecha nica l,

    optica l, hydr a ulic, etc. (or an y combina tion of them).

    The MAST la ngua ge is a uniq ue concept in simula tor input th e sam ela ngua ge describes models of elements, of subsys tems, a nd of full systems. As ys t em m od el ca n be a s s im ple a s a n et lis t t h a t d es cr ibes t h e in t er con n ect ion sof existing s yst em components (using pre-defi ned models from a MAST

    libra ry) or a s complex as t he full syst em description (using no pre-defi nedmodels).

    At m inimum, the S a ber simula tor requires (for each syst em to be simulat ed)a n input fi le conta ining a n etlist tha t completely describes the system in t heMAST la ngua ge.

    NOTE

    Th e simul ator al so accept s files conta i ni ng SPICEin put , after th ey have been conver ted t o MAST formatwi th thespitosconver si on u ti l i ty. However, the Sabersim ul ator is in her ent ly compati ble wi th th e M ASTlanguage, so using M AST models prov ides both greatermodel i ng flexi bi l i ty an d better sim u l at i on speed.

  • 8/9/2019 Mast Language Reference Man

    8/172

  • 8/9/2019 Mast Language Reference Man

    9/172

  • 8/9/2019 Mast Language Reference Man

    10/172

    Chapter 1: Overview

    1-4 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Templates and Hierarchy

    A complete MAST description of a n element, s ubsyst em, or entire sy stem isconta ined in a fi le a nd is ca lled a t empla te.

    The MAST lan guage supports designs, w hich m eans tha t templates cancont a in references to oth er templa tes. If one templa te (sa y t emplat e A)

    con t a in s a r ef er en ce t o a n ot h er (t em pla t e B ), t h is in dica t es t h a t , in t h e m od el,the syst em represent ed by templat e B is a subsystem of tha t represented bytemplate A. You ca n crea te a t emplat e tha t defi nes a subsyst em, and t henrefer t o it in t he syst em template w herever t he subsystem is used. When yout a k e f ull a d v a n ta g e of h ier a r ch ica l m od elin g, t h e m os t n a t u ra l s t ru ct u re of t h e

    model is th e structur e of the syst em it models.

    A reference in one templa te to a nother templat e is a netlist entr y. U singnetlist entries to defi ne a syst em hiera rchica lly ca n signifi ca ntly increase the

    speed of simulat ion.

    The MAST la ngua ge pla ces no restrictions on th e depth of th e templat eh iera rchy. Moreover, any level may cont a in any number of references to lowerlevels, and ca lled templa tes can be defi ned either insid e or outside of the

    ca lling templat e.

    B eca use we supply substa ntia l librar ies of sta nda rd component a nd elementtempla tes, you ca n usua lly simplify your model-w ritin g effort by in cludingreferences, w henever possible, to these templa tes. In m a ny ca ses, you candefi ne an entire system using only netlist entries th a t call libra ry templat es.Such a sy stem is ca lled a netlist .

    A netlist entr y is equiva lent to th e full defi nition of the referenced template.For example, a net l is t reference to a predefi ned res is tor t empla te i s equ iva len tto a full defi nit ion of tha t r esistor. Moreover, th e netlist r eference wouldspecify th e value of the resistor (in ohms), a nd t ha t value w ould be passed tothe r esistor templat e.

    If a templa te consist s only of a full model description inst ead of referencing

    oth er templat es, it is ca lled fl a t . Fla t descriptions ha ve two disadva nta ges:

    In most cases, s imula t ion requires more t ime.

    I f t h er e a r e m ult iple occu rr en ces of a s ubs ys tem , it s d escr ipt ion m us t bew rit ten in full for ea ch occurr ence, reducing simula tion effi ciency an dincrea sing th e size of th e input fi le.

    Naming the Template File

  • 8/9/2019 Mast Language Reference Man

    11/172

    Templ ate Or gani zati on

    M AST L anguage Reference M anu al (J un e 2003) 1-5

    Copyright 1985-2003 Synopsys, Inc.

    You ca n use your syst ems editor to crea te a templa te fi le in t he MAST

    lan gua ge. Give it a na me of this form:

    templatename.sin

    wheretemplatename

    is t h e n a m e of y ou r t em pla t e, w h ich ca n m od el a s ys tem ,subsys tem, or component . The number of cha rac ter s a l lowed in templatenamedepends upon your opera t ing system. The .sin ex tens ion is requ ired for use byth e Sa ber simula tor. The templatenamemust sta rt w ith a lett er. The othercha ra cters in t he na me ma y be lett ers, numbers, or und erscores. If you ha vea n input fi le previously creat ed in the SP IC E forma t, you ca n convert it t oSa ber forma t w ith th e Spice-to-MAST Tra nsla tion t ool nspitos. For adescription of the n spitos tool, refer t o nspitos in th e SaberBook Onl in e H elpSystem.

    The top-level templa te in a hiera rchica l syst em model conta ins othertemplates or references to them, a nd is not referred to by other t emplat es.

    When invoking the Sa ber s imula t or, you ca l l the top-level templa te direct ly, asfollow s, wh ere brackets ([ ]) denote optiona l items:

    saber [opt ions] templ atename[.sin]

    Template Organization

    This section presents an overview of template organization.

    Templa tes have a genera l form consis t ing of severa l di fferent sect ions . You usesome or a ll of t he possible sections depending on th e requirement s of yourmodel a nd w hether y ou include previously defi ned t empla tes in your model.

    Wit h in y ou r t em pla t e, a t a n y poin t , y ou ca n s pecif y ot h er fi l es, t h e con t en t s of

    w hich a re read int o the templa te. Included fi les a re ca lled include fi les.I n clu de fi l es ca n con t a in pa r t , or ev en a l l, of a t em pla t e. Th e pos sible t em pla t esections a re as follow s:

    Unit definitions

    Connection point definitions

    Template header

    Header declarations

    {

    Local declarations

    Parameters section

    Netlist section

    When statements

    Values section

  • 8/9/2019 Mast Language Reference Man

    12/172

    Chapter 1: Overview

    1-6 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Control section

    Equations section

    }

    In genera l, the more complicat ed th e model, the more templat e sections you

    w ill probably use.

    In a h iera rchica l syst em model, the top-level templa te models the wh oles ys t em a n d ca n con t a in t em pla t es t h a t d efi n e t h e s ubs ys t em a n d com pon en t s.Templa tes wi th in the top level t empla te can ei ther be expl ici t ly defi ned wi th in

    t h e t em pla t e fi l e, or ca n be d efi n e d in s epa r a t e fi l es a n d in clu ded by r efer en ce.

    The top level templat e must not conta in a templat e header, th e headerdecla ra tions section, or the bra ces ({ }) surr ounding t he body of thetemplate. When you invoke the Sa ber simulator to a na lyze a sy stem model,you use the na me of th e fi le conta ining th e top level templat e in the S a berinvoca tion line.

    When wr iting templates, you should bear in mind t w o importa nt r ules th a t

    a ffect t he positions of relat ed items.

    1. You m us t a l wa y s d efi n e s om et h in g befor e y ou u se it . For exa m ple, if t h etemplat e uses a va riable, tha t va riable must be declared prior to itsfi rs t occur rence. The exception is th e use of implicitly decla redpins

    a nd s ome forw a rd r eferences to component svars. S imvars a ndintrinsic functions are also implicitly declared.

    2. Wh er e y ou d efi n e s om et h in g d et er m in es w h et h er it is d efi n e d loca l ly orgloba lly. In pa rt icula r, if you include or defi ne a templa te before a

    templat e header, it is a ccessible by a ll templa tes below th a t one in thetempla te hiera rchy. This is genera lly tru e for other decla ra tions.H owever, if you defi ne it a fter t he hea der decla ra tions section (forexam ple, in th e local decla ra tions section) then it is visible only in t he

    local scope. Loca l scope means th a t the pa rticular defi nition isa cces sible on ly t o t h a t t em pla t e a n d pos sib ly t o it s d es cen d a n ts. (O t hertemplat es ca n include or defi ne th e sam e thing independently.)

    As lon g a s y ou com ply w it h t h es e r ules, t em pla t e s ect ion s d o n ot h a ve t o be ina part icular order.

    Unit and Connection Point Definitions

    The~ unit defi nition specifi es the units for certa in va riables such a s th roughva riables, across va riables,vars,refs,states, andvals. Unit definit ionsset t he id en tifi er used t o in dica t e t he un it s of a n um ber t ha t w ill r esult fr om acalculation.

  • 8/9/2019 Mast Language Reference Man

    13/172

    Templ ate Or gani zati on

    M AST L anguage Reference M anu al (J un e 2003) 1-7

    Copyright 1985-2003 Synopsys, Inc.

    The connect ion point defi nit ion specifies the connect ion point s a templa te can

    use. If they a re pin-type, it implies t he na mes of the th rough an d a crossva riables, tw o importa nt va riables associat ed with a ll pins.

    The connection point d efi nit ion is importa nt beca use it tells th e Sa bersimulat or w hich va riable to solve for a nd w hich must be equa l to zero at a

    connection point. I n a ddition, it a llow s th e simulator to ma ke sure tha t onlycompa tible components a re conn ected.

    B eca use the connection point defi nition uses units, it must follow the un it

    defi nition in th e templat e.

    St a nda rd unit a nd connection point defi nitions appea r inunits.sin, w hichis included in the fi le header.sin. If you invoke th e Saber simulat or w ith t he-laoption, header.sinis aut omat ica lly loa ded. If you wish, you may cha ngeunits.sina nd r e-compile it u sing t hesaber -poption.

    Header

    The header for a t emplat e fi le defi nes the na me of the templat e, the na mes ofits connection points, a nd the n a mes of the templates a rguments used in anetlist entry. You must include the header in a ny t empla te th a t y ou w ill ca llfrom a nother templat e; tha t is, a ny t emplat e except a top level template.

    The hea der includes the na me of th e templat e, th e na mes of the connectionpoints, an d a ny a rguments a ssociat ed with it . Whenever you defi ne a

    pa r t icu la r elem en t by r efer rin g t o it in t er ms of t h e t em pla t e t h a t d efi n es it (anetlist sta tement), the form a nd content of the header sta tement defi nes theform of th e netlist sta tement.

    Declarations

    There are tw o sections tha t cont a in declara tions: hea der declara tions an dlocal decla ra tions. All na mes (identifi ers) must be defi ned before th ey ca n be

    used. These defi nitions ar e ca lled declara tions. Keyw ords (names t ha t a rerequired pa rt of MAST sta tements) a re defi ned by the langua ge and requiren o f ur t her d ecla r a t i on . A d ecla r a t ion t ells t h e s ys t em t h e t y pe t o be a s socia t edw ith t he na me, th us defin ing how it is to be used. Some declar a tions ca n a lsoinclude the assignment of an initial va lue.

    The purpose of head er decla ra tions is to defi ne to the syst em th e na mes used

    in t he head er. The loca l declara tions defi ne th e na mes used in t he rest of thetemplateit cont a ins declara tions for a ll ident ifi ers used inside th e templa te.

    Th e n a m e of t h e t em pla t e d oes n ot r eq uir e a s epa r a t e d ecla r a t ion ; in fa ct , t h eheader it self is th e declara tion of th e template na me. The other na mes use inthe header (names of connection points and arguments) must be declared inthe hea der declara tions.

  • 8/9/2019 Mast Language Reference Man

    14/172

    Chapter 1: Overview

    1-8 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Declara tions of connection points must defi ne th eir t ype (pin,ref,var, orstate). Declara tions of a rguments defi ne the ty pe of each argum ent.Argum ent ty pes fall int o one of thr ee ca tegories: simple, composite, or a rra ysof sim ple/composi t e.

    U ndersta nding declar a tions is a key to understa nding how to use the MAST

    lan gua ge and is explained in more deta il in th e cha pter on Decla ra tions andDa ta S t ructures .

  • 8/9/2019 Mast Language Reference Man

    15/172

    Templ ate Or gani zati on

    M AST L anguage Reference M anu al (J un e 2003) 1-9

    Copyright 1985-2003 Synopsys, Inc.

    The Parameters Section

    The P a ra meters section is used to ma nipula te par a meters. You can use it t oa dd error checking to templa tes by t esting th e input va lues of argument s forva lidity a nd to model sta tistical distributions for Monte Ca rlo a na lyses.

    Pa ra meters an d ar guments a re similar. They ca n ha ve the sa me types ofdeclara tions, but par a meters ar e declared loca lly in a t emplat e, wh ilea rguments a re declared in th e hea der declara tions section and their va lues

    ca n be passed into a t emplat e by using a netlist st a tement. H ow ever, onlya r g um en t s a n d in it ia l iz ed pa r a m et er s ca n be ch a n ged by t h ealter commandin the Sa ber simulat or. Only para meters may be cha nged in the Pa ra meterssection.

    The sta tements in t he Pa ra meters section are evalua ted a s follow s:

    O nce ju st a f t er t h e in pu t fi l e is r ea d

    E a ch t im e t he S a beraltercomma nd is used (ca using a tempora rya lterat ion of a t emplate a rgument)

    For each run of a Monte C a r lo s imula t ion

    Pa ra meters may depend only upon other para meters, a rguments a ndconstants.

    Assignment st a tements, expressions, an d conditional st a tements (if-else)a re allowed in th is section. Mat hema tical expressions a nd int rinsic functions

    a re allowed in t his section w ith t he exception ofd_by_dt(x)(th e deriva tivefunction) and thedelayfunction. Calls to foreign subroutines are allowed.

    The Netlist Section

    The Netlist section consists of one ore more netlist sta tement s th a t ca ll oth ert em pla t es. Th es e s t a t em en t s d efi n e elem en t s of t h e s ys t em t h a t a r e in st a n cesof the t emplat e(s) being called. The Netlist section is r equired only in

    templates t ha t ma ke reference to other t emplat es; in fact , it is a nimplementa tion of anoth er level of hiera rchy.

    The form of a netlist st a tement is a s follow s:

    templatename.refdes connect ion_pt_l i s t [= argument_assignments]

    The templatenameis t h e n a me of t h e t em pla t e y ou a r e ca llin g, a s id en t ifi e d inits header.

    The refdesis th e reference designat or, a unique na me for t ha t element of thesystem.

  • 8/9/2019 Mast Language Reference Man

    16/172

  • 8/9/2019 Mast Language Reference Man

    17/172

    Templ ate Or gani zati on

    M AST L anguage Reference M anu al (J un e 2003) 1-11

    Copyright 1985-2003 Synopsys, Inc.

    Conditiona l stat ements a re allow ed in this section, a s well a s mat hema tical

    expressions a nd in tr insic functions, except for t hed_by_dt,delaya ndrandom()intrinsic functions. Foreign subroutines are also allowed.

    Control Section

    The Cont rol section decla res specifi c informa tion to th e simulat or tha t doesnot fi t in oth er sections of th e templat eit is not req uired in a ll models. Theinforma tion th a t th e Control section provides is specifi c to the sy stem being

    analyzed.

    The Cont rol section can cont a in th e follow ing ty pes of sta tement s:

    Condi t iona l s t a t ements tha t can col lapse two nodes into a s ing le node,thereby speeding up the s imula t ion . However, once nodes a re coll apsedduring a s imula t ion , you cannot undo i t w i thou t exi t ing and re-enter ingth e Saber simulat or.

    S ta tements tha t declare groupings of nonl inear va lues for the purposeof piecew ise linear evalua tion, defin ing t he independent va riables foreach group

    S ta tements tha t declare the sample points for each independentva ria ble used in t he piece-w ise linea r set

    S ta tements tha t declare Newton s teps for the specified independentvariables

    S ta tements tha t descr ibe smal l-s igna l noise sources

    Ea ch of these sta tements is described in th e Templatessection.

    Equations Section

    The Equa t ions sect ion descr ibes the ana log cha rac ter is t ics a t the termina ls oft h e elem en t t h e t em pla t e is d efi n i n g. I n ef fect , t h is s ect ion d efi n e s t h e effect ofthe element on t he rest of the system.

    St a tements in th e Eq ua tions section indicate the relationship of the ana log

    cha rac ter is t ics of specia l va r iab les to va r iab les in the res t of the system. Thesesta tements use t he special opera tors+=(is a dded t o) a nd-=(is subtr a ctedfrom) to indicate t his relat ionship. Mat hema tical expressions a nd int rinsic

    functions a re a llow ed in th is section. The int rinsic functionsd_by_dta nddelaya re allowed a s w ell, but ma y not be nested. Therandom()function isnot a llow ed.

  • 8/9/2019 Mast Language Reference Man

    18/172

    Chapter 1: Overview

    1-12 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Miscellaneous

    Include Files

    There are t w o way s to bring the cont ents of oth er fi les into a templat e. One

    wa y is with the net l ist sta tement , w hich refers to a t emplate a nd defin es theconnections of its t erminals t o nodes of th e system. The other wa y is w ith th einclude sta tement, w hich ha s th e follow ing form:

  • 8/9/2019 Mast Language Reference Man

    19/172

    Miscellaneous

    M AST L anguage Reference M anu al (J un e 2003) 1-13

    Copyright 1985-2003 Synopsys, Inc.

    Template Variables

    Several different t ypes of var iables ca n be used in a template. Ea ch t ype hasits ow n fun ction a nd us es. The ty pes of va ria bles are listed below.

    U ndersta nding th e concepts behind t hese var iables is essentia l for a nyt hingbut th e most rudimenta ry t emplate usa ge.

    S yst em va ria bles- th rough va riables- a cross va ria bles- vars- refs

    S im ula t or va r ia bles

    P a ra met ers

    Arguments

    Va lues (vals)

    states

    Th e t a sk of a s im ula t or is t o d es cr ibe t h e beh a vior of a m a t hem a t ica l m od el ofa physica l system. For t he Sa ber simula tor, the model is a system ofsimulta neous (linea r or nonlinear ) a lgebraic an d ordinar y differentia l

    equa tions, or both .

    Th e pu rpos e of t h e M AS T l a n gu a ge is t o s pecify t h e m od el of t h e s ys tem t o besimula ted. The lan gua ge must be a ble to do th e follow ing:

    1. Allow arguments to be passed into templat es.

    2. Specify how t he templa te is connected to the rest of the system. Morespecifi ca l ly, th i s means specifying the interact ions of element s in termsof the equat ions tha t a rise from physica l law s when entit ies are

    con n ect ed (a t n od es ) t o for m a s ys t em . I n elect r ica l s ys t em s, t h es e la w sa r e K ir ch off s cu rr en t a n d v olt a g e la w s (K C L a n d K VL ). Th es e t w o la w sma y be sta ted, respectively, a s th e sum of the currents leaving a nodeis zero and th e sum of volta ge drops a cross elements in a ny loop iszero.

    3. Specify the equa t ions th at describe the a na log behavior of the system.For example, the equations describing the analog behavior of a resistora rev=i*ra nd th ose for a ca pacitor a rei=c*dv/dt, wh ere, in bothcases,va ndiar e the volta ge across an d the current t hrough theelement, respectively.

  • 8/9/2019 Mast Language Reference Man

    20/172

    Chapter 1: Overview

    1-14 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    4. Specify the discrete behavior of the syst em. You can use When

    sta tements t o tell the simula tor how t o schedule discrete events a ndtime steps.

    5. Allow fl exibility in specifying system beha vior.

    6. K eep t h e s im ula t ion a s fa s t a s poss ible by s epa r a t in g v a ria bles in t o t h efollowing:

    a . Those tha t must be evalua ted cont inuously

    b. Those that must be evalua ted on a n event-driven basis

    c. Those tha t can be eva luat ed only a s needed or for post-processing

    d. Those tha t have to be evaluat ed only once for each simulat ion

    To fulfi ll th ese var ious fun ctions, t he MAST la ngua ge offers t hese differentty pes of va ria bles, each of wh ich is d escribed in t he follow ing section.

    System Variables

    Syst em var iables are t he va riables for w hich t he simulat or solves. Theyinclude across variables,vars, an drefs. You cann ot a ssign va lues t o these

    va riables in a t empla te. Only the simulat or ca n a ssign their values.

    To genera l ize KC L and KVL so they apply to both elect r ica l and non-elect r ica lsystems, tw o associat ed qua nt it ies must be defi ned for each connection point:the throughand the acrossva riables. The rule for t hrough va riables is a sfollows:

    The sum of all t hrough va ria bles lea ving a node is zero.The rule for across va ria bles is as follow s:

    The sum of all a cross va ria ble differences ar ound a ny closed pat h iszero.

    Across and through variables for various technologies are as follows:

    Through Across

    Electrical current volt a ge

    Rotational t orque a ngula r velocit y

    Mechanical force posit ion

    Fluid fl ow ra te pressure

    Thermal pow er tempera t ure

  • 8/9/2019 Mast Language Reference Man

    21/172

    Miscellaneous

    M AST L anguage Reference M anu al (J un e 2003) 1-15

    Copyright 1985-2003 Synopsys, Inc.

    Modified Nodal Analysis

    The supplied t empla tes usua lly use a m odifi ed nodal a na lysis technique. Innodal a na lysis , through varia bles are added to a nd subtra cted from t hesystem m a trix directly, an d t hen th e simulator solves for a cross varia bles.Therefore, through var iab les a re dependent va r iab les and across va r iab les a re

    independent va riables. In ma ny cases, how ever, nodal a na lysis must bemodifi ed . For example, modifi ca t ion is requ ired where ac ross va r iab les a re not

    f un ct ion s of t h rou gh v a r ia b les, s uch a s in a n id ea l v olt a g e s ou rce, in w h ich t h ecurrent is w ha tever it needs to be to give th e defi ned volta ge. In such a ca set h e t h r ou gh v a r ia b le, cu rr en t , is a n in d epen d en t v a r ia b le, w h ich is h a n d led b ya dding a n equa tion to th e system of equa tions.

    In general, most through varia bles ar e dependent va ria bles an d all a crossvariables are independent variables. These variables are declared implicitly

    through the pin decla r a t ions. For example, when you defi ne a connect ion pointx t o be elect r ica l , t he s imula tor au toma t ica l ly crea tes an independent va r iab le

    of the formv(x)a nd th e dependent va riablei(x).

    An independent t hrough var iable, such a s the current th rough a voltagesource, must be decla red a s avarin t he loca l declara tions section. It must bea ssocia ted wit h a n equa tion in the Equa tions section of the form:

    var: expression= expression

    Avaris not decla red in t he formi(x)(for example, as a current a t a pin),beca u se t h a t for m w ou ld d en ot e a d epen den t va r ia b le. You ca n a ls o u se avarfor situa tions tha t a rise less frequently. In cases w here you need to ta ke

    multiple derivat ives a nd delays (which cann ot be nested), you can declare avar.

    You ca n a lso defi ne avara s a n independent varia ble tha t can be passeda nother template, in wh ich it is declar ed aref.

    In general, the dependent var iable in a t emplat e is the through varia bledefi ned in rela tion to a conn ection point . The independent va ria bles in a

    template a re a cross varia bles defi ned in relat ion t o a connection point,varstha t a re associated w ith a n a ddit iona l equa t ion in the E qua t ions sect ion, andoccasionally asrefs.

    Dependent t hrough va riables an d independent a cross va ria bles a re declaredimplicitly by thepindeclar a tions. They a re associat ed with equat ions in t heEq ua tions section using the following forma ts:

    through(pin) += expression

    through(pin) -= expression

    through(pin1->pin2) += expression

  • 8/9/2019 Mast Language Reference Man

    22/172

    Chapter 1: Overview

    1-16 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    The formthrough(p in1->pin2) -= expressionis a lso possible, but is lessreada ble a nd is not r ecommended.

    Avarmust be declar ed in the loca l declar a tions section a nd m ust bea s socia t ed w it h a n eq ua t ion in t h e E q ua t ion s s ect ion , w h er e t h e eq ua t ion h a sthe formvar: expression = expression. A ref must be ident ifi ed , a long

    w i t h ot h er con n ect ion poin t s, in t h e t em pla t e h ea d er, a n d m us t be d ecla r ed inth e header declara tion section. For exam ples, refer t o th e Templatessection.

    Simulator Variables

    Simula tor var iables (simvar s) a re varia bles used by the simulat ion. They a renot directly pa rt of th e system of equa tions tha t d escribe the model, but ma ybe used in va rious w ay s th roughout t he template. They a re used mostfrequently in conditiona l sta tements (if-else). Simva rs include th efollowing:

    The simulat or a ssigns va lues to most simva rs a ccording t o its own rules andrequirements. Exceptions a renext_timea ndstep_size, which give

    informa tion to the simula tor. A templa te need not provide values t o th esesimvar s. However, if a template does provide a va lue, th e simulator uses th eva lue to infl uence its choice of th e next t ime step or time-step size in t hesimulation.

    The simulat or a utomat ica lly declar es simvar s, so you n eed n ot declar e them.However, if you declare a var iable with t he same na me as a simvar (not

    recommen ded), then y our decla ra tion overrides t he a utoma tic one, so youcan not use that varia ble as a simvar.

    You ca n use simva rs in When st a tements a nd in th e Va lues section, an d incer t a in ci rcumstances , in the Equa t ions sect ion . The s t a t i st i ca l s imvar can be

    used in the Pa ra meters section an d in th e Netlist section.

    Arguments

    Ar gu men t s a r e n a m ed in t h e t em pla t e h ea d er, a n d v a lu es for t h em a r e pa s sedinto a t empla te via a netlist entry. You declare each a rgument in the hea derdecla ra tions sectioneither a s one of th e thr ee simple types, a s one of th reecomposite ty pes, or a s a n a rra y of simple a nd/or composite ty pes.

    dc_domain freq next_time time_domain

    dc_done freq_domain statistical time_init

    dc_init freq_mag step_size time_step_done

    dc_start freq_phase time tr_done

    tr_start

  • 8/9/2019 Mast Language Reference Man

    23/172

    Miscellaneous

    M AST L anguage Reference M anu al (J un e 2003) 1-17

    Copyright 1985-2003 Synopsys, Inc.

    Arguments ca n receive their values in tw o way s:

    1. B eing ini t ia l ized in the declara t ion

    2. Ha ving values passed in through the ar gument l ist in a net l ist entry

    A va lue passed in through a net l is t en t ry supersedes any ini t ia l ized va lue. You

    ca n ch a n ge t h e v a lu e of a n a r gu men t d ur in g a s im ula t ion r un u sin g t h ealtercommand of the simulator.

    Parameters

    P a r a m et er s a r e v a ria b les u sed in expr es sion s t h a t a s sig n v a lu es t o ot h er t y pes

    of va riables. Pa ra meters ca n be declar ed to be a ny of thr ee simple or t hreecomposite types, or a rra ys or combina tions th ereof. Pa ra meters a nda r g um en t s h a ve t h e s a m e t y pes of d ecla r a t i on s. You d ecla r e pa r a m et er s in t h elocal decla ra tions section.

    A para meter can receive its va lue in t w o wa ys. You can either initialize it inthe declara tion or you ca n a ssign it a va lue in the Pa ra meters section, by

    eith er an a ssignment st a tement or a foreign subroutine call. You can cha ngethis initia l value while runn ing the Sa ber simulat or, using th ealter

    command.

    Within t he Pa ra meters section, only para meters ca n a ppear on the left ha ndside of an a ssignment st a tement, or be returned from a foreign subroutineca l l. You ca n u se pa r a m et er s t o in it ia l iz e s t a t es. P a r a m et er s ca n be u sed in a l l

    oth er sections in t he body of a templat e: the Pa ra meters section, Netlistsection, When st a tement s, the Va lues section, th e Contr ol section, an d th eEq ua tions section.

    Vals

    Vals are var iables tha t hold tempora ry informa tion during simulat ion, an dw hich can supply informa tion not otherwise a va ilable during post-simulat ion

    processing.

    Vals ca n r eceiv e t h eir v a lu es on ly in t h e Va l ues s ect ion of t h e t em pla t e: eit h erin an a ssignment sta tement (with t hevalon the left-ha nd s ide of th estatement) or as the return value of a foreign subroutine call. You mustdeclarevals in t he local declara tions a rea of th e template. You can use them

    in t he Va lues section, the E qua tions section, an d in When st a tements.

  • 8/9/2019 Mast Language Reference Man

    24/172

    Chapter 1: Overview

    1-18 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    States

    States a re varia bles tha t hold informa tion pertinent t o discrete t imesimulation.Stateva riables ma y be digita l (discrete in va lues a nd d iscretein t ime), or event-driven a na log (cont inuous in va lues an d discrete in tim e).

    States can receive their va lues in tw o way s:

    1. U se astatea s a connection point in the hea der of a templat e, thenpass t he value in from a netlist .

    2. Assign t hestate a va lue in a Wh en st a tem en t, w her e t he st a te ca n be

    th e left-ha nd t erm of an a ssignment sta tement, can be used in var iousscheduling sta tements, or can ha ve its va lue return ed by foreignsubroutine calls.

    I f astate is pa s sed in a s a con nect ion poin t , it m us t be d ecla r ed in t h e h ea d erdeclaration section; otherwise, it must be declared in the local declaration

    section. You can usestates in When sta tements a nd in th e Va lues a ndEq ua tions sections.

  • 8/9/2019 Mast Language Reference Man

    25/172

    M AST L anguage Reference M anu al (J un e 2003) 2-1

    Copyright 1985-2003 Synopsys, I nc.

    chapter2

    MAST Syntax Rules

    The genera l synt a x rules an d reserved w ords for t he MAST modelinglanguage are divided into the following topics:

    Ident ifiers and Str ings

    White Spa ce Usa ge

    Netlist St a t ementComments

    Line Cont inua tion

    Section K eywords

    Expressing R eal Num bers

    MAST Keyw ords

    MAST - Non-Reserv ed K eyw ords

    Identifiers and Strings

    Identifi ers a re na mes for va ria bles, templa tes, nodes, etc. There ar e tw o validforms for ident ifi ers. One must sta rt w ith a n a lpha betic cha ra cter or an

    und erscore (_), followed by a lpha betic cha ra cters, digits, or und erscores. Theother form must sta r t w ith the@cha ra cter a nd be follow ed by a stringcon st a n t . Th er e is n o lim it on t h e n um ber of ch a r a ct er s in a n id en t ifi e r, a n d a l lcha ra cters a re signifi cant . B eca use the MAST lan guage is n ot ca se-sensitive,the follow ing w ords all refer t o the sam e ident ifi er:name,NAME,NaMe.

    Ident ifi er s for connect ion point pins names can be unsigned integers, but onlyin netlist entr ies, and nowhere else in the templat e.

    S t r ing cons t an t s cons is t of zero or more charac ter s, w i thou t any double quotesor newlines, enclosed in double quotes. Em pty st rings ca n be specifi ed as"".

  • 8/9/2019 Mast Language Reference Man

    26/172

    Chapter 2: MAST Syntax Rules

    2-2 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    St ring consta nt s ca nnot span more th a n one line, alth ough you ca n use

    conca tena tion a s follow s:

    There a re no escape sequences (such as the C language backsla sh) ava i lab le ins t rin g con st a n t s. B y u sin g a for eig n s ubr ou t in e, y ou m a y en t er a d ou ble q u ot eor a new line into a st ring (refer t o Messa ges on page 5-10).

    White Space Usage

    B lan ks, ta bs, and comments (described la ter) are considered wh ite space,a nd a re ignored except t o separa te w ords w hen no oth er punctua tion isr eq u ir ed . F or exa m ple, bla n ks (s pa ces ) a ct a s s epa r a t or s in a lis t of n od es on atempla te reference.

    Netlist Statement

    A netlist st a tement (or t emplat e reference) is a netlist entr y in the n etlist

    s ect ion of a t em pla t e t h a t ca l ls (r ef er s t o) a n ot h er t em pla t e. I t con sis t s of t h en a m e of t h e t em pla t e, f ollow ed by a per iod , follow ed by a r ef er en ce d es ig na t oras follows:

    templatename.r efd es connecti on_poin ts [= argument_assignments]

    The templatename.refdesis considered a complete unit, so no blanks a re

    a llow ed wit hin it . The reference designat or (refdes) may consist of a lpha beticcha ra cters, digits, and underscores, w ith no requirement th a t t he fir stcha ra cter be a lphabetic.

    The connection_pointscon sis ts of t h e n a mes of t h e n od es t o w h ich t h e m od elsconnection points a re joined. Ent ries in this list must be separa ted by w hitespace. The node nam es must either be in the sa me order an d qua ntit y a s theconn ection point s specifi ed in th e ca lled templat e, or they m ust be specifi edwith reference to the actual connection point names, in the form:

    connection_point_name:node_name

    "This is a long string. Because it might not"//

    "fit on one line, it is put together using"//

    "concatenation."

  • 8/9/2019 Mast Language Reference Man

    27/172

    I denti fiers and Str in gs

    M AST L anguage Reference M anu al (J un e 2003) 2-3

    Copyright 1985-2003 Synopsys, I nc.

    For exa mple, if th e diode (w ith th e reference designa tordx) is conn ect ed t o

    nodes na mednode1a ndnode2, you can specify it eith er a s:

    d.dx node1 node2

    or as eith er of th e follow ing:

    d.dx p:node1 n:node2

    d.dx n:node2 p:node1

    Also, node nam es ca nnot ha ve a number a s the fi rst cha ra cter unless allremaining characters are numbers:

    Correct: 5,v16,vcc94b,6431

    Incorrect: 5v,+5V,15v1

    Non-a lpha num eric cha ra cters (such as + or -) a re not allowed.

    The argument_assignmentsar e required only for templates th a t ha veuninitia lized ar guments. Forma ts for this a rgument list depend on th e datastructure of the ar guments. Multiple entries in a n a rgument list must besepa ra ted by comma s.

    Comments

    The MAST la ngua ge ignores blank lin es a nd comment s. A comm ent m ustbeg in w it h a pou nd s ig n (#) a n d is r ecogn iz ed a s r un nin g t o t h e en d of t h e lin e.

    A comment ca n st a rt a nyw here within a line, wh ich is useful for tempora rilyremoving a line or pa rt of a line.

    Line Continuation

    Norma lly, a car riage return termina tes a line. A backsla sh (\) a t t he end of aline with no comment indica tes continua tion of th e line a nd is ca lled acontinua tion cha ra cter. It h a s no meaning in a n input fi le except t o indicate

    continua tion, and if it is th e last non-comment cha ra cter on a line, it isdiscarded.

    I n a d dit ion , ea ch of t h e follow in g in dica t es t h a t t h e lin e is t o be con t in ued if itis in cont ext (part of th e line) a nd it is th e last non-comment cha ra cter on t he

    line:

    + - * /

    & | < >

    ( { [ ~

    , . : =

  • 8/9/2019 Mast Language Reference Man

    28/172

    Chapter 2: MAST Syntax Rules

    2-4 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    The s emicolon (;) is a llow ed as a n explicit line termin a tor, but it is not

    r eq u ir ed . Ty pica l ly a s em icolon is u sed t o a l low m or e t h a n on e s t a t em en t on as ing le l ine. One use for the semicolon is in da t a s t ructure defi nit ions, followinga lis t of v a ria bles, t o a llow t h e clos in g br a ce (} ) t o be on t he sa me lin e ra t hertha n t he follow ing line.

    The line pa rser does not count th e pa rent heses in a line, an d so ca nn otdetermine whether a closing grouping symbol (),},]) is the fi na l one in a

    sta tement . Therefore, in t he a bsence of th e line continua tion char a cter, aclosing symbol indica tes t he end of a line.

    Section Keywords

    The lef t b race ( { ) t h a t follow s a sect ion key w or d m us t a lw a y s be on t h e s a meline, right a fter t he keyword. These keyw ords a recontrol_section,equations,parameters, andvalues. The left bra ce must a lso directly

    followwhen.

    Expressing Real Numbers

    All r ea l n um ber s ca n be expr es sed eit h er in t h e u su a l s cien t ifi c n ot a t ion , w i t hth e lett ers e or d expressing pow ers of 10, or w ith t he follow ing suffi xes:

    You ca n express a number a s a const a nt immediately follow ed by a na ppropria te a bbreviat ion (do not include units).

    No a lphanum eric cha ra cter ca n a ppear immediat ely a fter a suffi x; a spa ce orpunctua tion is required.

    Note tha tmmea ns 10 , a ndmea ndmegmea n 10 .

    a a t t o 10

    f femto 10

    p pico 10

    n na no 10

    u (or mu) micro 10

    m milli 10

    k kilo 10

    meg (or me) mega 10

    g giga 10

    t t era 10

    -18

    -15

    -12

    -9

    -6

    -3

    3

    6

    9

    12

    -3 6

  • 8/9/2019 Mast Language Reference Man

    29/172

    MAST - Non-Reser ved K eywords

    M AST L anguage Reference M anu al (J un e 2003) 2-5

    Copyright 1985-2003 Synopsys, I nc.

    For example, the following are equivalent:

    x=3p x=3d-12 x=3e-12

    The follow ing a re illega l specifi cat ions for nu mbers:

    x = 3 p

    (space not a llow ed betw een n umber an d a bbreviat ion)

    x = 1mA

    (units not a llow ed)

    MAST Keywords

    The follow ing keyw ords a re reserved in the MAST la ngua ge an d cann ot beused a s varia ble names in a template :

    *Section keywords that must be followed by a left brace,{, on the same line.

    MAST - Non-Reserved Keywords

    Th e f ollow i ng g rou ps of key w or ds a r e n ot r es er ved a n d ca n be u sed a s v a r ia b lena mes, a lthough it is good practice to treat th em as if th ey were reserved:

    Control Section Words

    Simula tor Va riables

    Int rinsic Functions

    P redefi ned Numbers in hea der.sin File

    component cont rol_sect ion* element else

    enum equa t ions* ext erna l foreign

    group if inf number

    pa ra meters* pin ref ret urn

    simva r st a t e st a t es st r ing

    st ruc templa te undef union

    unit va l va lues va r

  • 8/9/2019 Mast Language Reference Man

    30/172

  • 8/9/2019 Mast Language Reference Man

    31/172

    MAST - Non-Reser ved K eywords

    M AST L anguage Reference M anu al (J un e 2003) 2-7

    Copyright 1985-2003 Synopsys, I nc.

    Predefined Numbers in header.sin File

    The following are predefined numbers in theheader.sinfi le:

    Number Definition Description

    temp = 27 Temperat ure va lue

    mos_scale = 1.0 Sca le factor for mosfet physica l dimensions(used bym.sina ndspm.sin)

    mos_scalm = 1.0 P rocess sca le factor for mosfet phys ica ldimensions (used bym.sinonly)

    r_tol = 0 Resistor va lue tolera nce(f or exa m ple, a v a lu e of 0.05 in d ica t es a 5%tolerance resistor)

    c_tol = 0 Ca pacitor va lue tolera nce(f or exa m ple, a v a lu e of 0.05 in d ica t es a 5%tolerance capacitor)

    l_tol = 0 Ind uctor va lue toleran ce(f or exa m ple, a v a lu e of 0.1 in d ica t es a 10%tolerance inductor)

    r_pdmax = undef Maximum power dissipation for resistor

    (for exa mple, 1/4 W resis tors)

    c_vmax = undef Forw a rd volta ge rat ing for capacitors

    c_vrmax = c_vmax Reverse volta ge ra ting for capa citors(different fromc_vmaxfor electrolytics)

    include_stress = 1 Allows remova l of stress an a lysis innetlisted templat es. Default va lue = 1 w ill

    run str ess.

    use_2g6 = 0 Allows invoca t ion of SP ICE 2G.6 compat ibleMOS m odels throughm.sina ndspm.sin

    acc_fac = 1 Accuracy factor

    G lobal va lues for hyd ra ulics library

    rho = 1k G lobal va lue of r ho (kg/m**3)

    mu = 14.3m G loba l va lue of mu (N-s/m**2)

    bulk = 689.5meg G lobal v a lue of bulk m odulus (N/m**2)

  • 8/9/2019 Mast Language Reference Man

    32/172

    Chapter 2: MAST Syntax Rules

    2-8 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Loga rith ms a re expressed in MAST a s follow s:

    base e = ln

    base 10 = log

    This differs from how other progra mmin g la ngua ges (such a s FOR TRAN,RATFOR , an d C ) express logarit hm s:

    base e = log

    base 10 = log10

    patm = -101325 G lobal v a lue of pat m (N/m**2)

    pcav = -95k G lobal va lue of pca v (N/m**2)

    valid_pres = inf Stress ra t ing pa ram eter

    Number Definition Description

  • 8/9/2019 Mast Language Reference Man

    33/172

  • 8/9/2019 Mast Language Reference Man

    34/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-2 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    decla r a t ion causes an impl ici t decla r a t ion of the associa t ed through and

    a cross va ria bles. You must declarevars andrefs a nd specify th eirunits.

    Val d eclar ati onsdecla re va ria bles and s pecify th eir unit t ypes. Thesimulat or a ssigns va lues t ovals only wh en needed, which is notnecessarily a t each time or frequency step.

    Vals ca n a ct a s in t er m ed ia t e v a r ia b les t h a t r eceiv e v a lu es in t h e Va l uessection and t hen a re used to ca rry t hose va lues into equa tions in theEq uat ions sect ion or a wh en sta t ement .

    Any expression of any ty pe ma y be assign ed to aval. Theextractcomma nd uses thedfilea nd t he informa tion in th e Va lues section to

    a ssign va lues tovals.

    Stat e decla r ati onsidentify va ria bles to be used to model discrete timesimulat ion a nd specify their units. Sta tes ca n be initia lized a nd can bea ssigned values in wh en sta t ements a nd in the va lues an d equat ionssections of the templa te.

    Simu la t i on var iab le(simvar) declarationsa r e opt ion a l. You d o n ot h a v eto declare simva rs beca use their defi nition is part of the simula tor.Simva rs ar e pre-defi ned varia bles tha t pass informa tion from the

    simulator to the template or from the template to the simulator. Youma y use only t he na mes pre-defi ned in the MAST lan guage a s th ena mes of simvars.

    Exter nal declar ati onsident ify pa ra meters, a rguments, and pinsbrought fr om a high er level to a low er level templat e.

    For eign declar ati onsident i fy foreign funct ions and foreign sta tes . Therea re tw o kinds of foreign functions: those th a t r eturn a single numbera nd t hose not restricted to return ing a single number. Foreign st a tes

    a re used for mixed-simula tor a pplicat ions.

    Group declar at ionsa r e a w a y t o g rou p v a r ia b les t og et h er for ext r a ct iona nd for other purposes.

    Templ ate decla r ati onsdescribe a templa te. This t erm refers to th eentire templat e forma t.

    I mpl ic i t declar at ionsa re those tha t occur a s a product of oth erdefi nitions an d declar a tions, a nd d o not r equire explicit declara tion.Va riables tha t a re declar ed implicit ly include th rough a nd a crossva ria bles (decla red implicitly by pin defi nit ions), simvar s, connection

  • 8/9/2019 Mast Language Reference Man

    35/172

    M AST L anguage Reference M anu al (J un e 2003) 3-3

    Copyright 1985-2003 Synopsys, I nc.

    point a ss ignment s used in net l is t s t a t ement s, externa l t empla tes , node

    na mes, and net na mes.

    Va riable na mes fall into tw o ca tegories: units a nd pins, and a ll oth erv a ria bles. I n a t em pla t e, t h e n a mes of pin s a n d u nit s m us t a ll be d iffer en t , bu tt h ey n eed n ot be d if fer en t fr om ot h er v a r ia b le n a m es. For exa m ple, t h er e m a yexist both a unitvand a var iab lev.

    The follow ing sections describe th e va ria ble types in more deta il.

    Unit and Pin Definitions

    Th e M AS T l a n g ua g e let s y ou d efi n e u nit s for u se in d es cr ibin g s ys t em s. U n i ts

    appear in:

    Defini t ions of pin-type connect ion points

    D ecla ra t ions ofvar,ref,state, andvalconnection points

    U nit defi nitions must precede a ny declara tions tha t use th em.

    Sta nda rd unit and pin defi nit ions are in the fileunits.sin. This fi le isincluded in t he fi leheader.sin. Norma lly, th is fi le is included aut oma ticallyby use of pre-loa ded templat es, so if you w ish t o use the sta nda rd defi nitions,you do not need to a dd unit a nd pin defi nitions to your templat e.

    NOTE

    I f you ent er t he saber command w it h no cont r adi ctory

    opti ons, it defau lt s to th e -la opti on. Thi s l oads th esaber load file analogy.sld at the top level of a system.Th is i s a pre-compi led file made f rom analogy.sin usingth e -p opti on. The stand ar d an al ogy.sl d file conta i nsheader.si n, whi ch i ncl ud es un i ts.si n. The spi ce.sl d fileal so conta i ns header.si n.

    To d efi n e n ew u nit s or pin s, or t o ch a n ge d efi n i t ion s, t h er e a r e s ev er a l opt ion s.

    C ha ngeunits.sinand runsaber -pt o pre-compile it for in clusionwith the-laoption.

    C ha ngeunits.sina nd includeheader.sina t t he top level of th esystem h iera rchy, an d do not use th e-laoption. (The fi le ca n beincluded by writ ing

  • 8/9/2019 Mast Language Reference Man

    36/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-4 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Write new defi nit ions of units and/or pins in the template before they

    a re used in declara tions. P ins a nd unit s cannot be redefi ned, so youcannot change pin a nd unit defi nitions in th is wa y.

    You may place unit a nd pin defi nitions above the header, in th e headerdecla ra tions section, or in the local decla ra tions section. Rega rdless of w hereyou pla ce th em, they a re global to th e entire system description.

    Unit Definitions

    U n i t d efi n i t ion s ca n t a k e on e of t w o for ms a n a l og or d ig it a l . Th e a n a l og for mof aunitdefi nition is as follows:

    unit { "symbol", "un i t", "definition" } identifier

    where identifieris t he n a me bein g d efi n ed , a n d t he t hr ee st rin gs give t he un ita bbreviat ion, t he full unit na me, an d t he unit description, respectively.

    Examples ofunitdeclar a tions are:

    unit {"V","Volt","Voltage"} v

    unit {"A","Ampere","Current"} i

    unit {"rpm","Revolutions/minute","Angular velocity"} w

    unit {"kg.m","kilogram meter","Torque"} t

    Logic st a tes use th e follow ing formunitdefinition:

    unit state {MASTname,"Bool ean val ue","pr in tmap","plotmap",MASTname,"Boolean val ue","pr in tmap","plotmap"}name= MASTname

    There must be as ma ny lines in th e unit defi nition as th ere a re sta tes in the

    unit sta te. Tw o discrete logic fa milies ar e provided, logic_4a nd logic_3. Thelogic_4 unit defi nit ion describes four-st a t e logic (0, 1, X, Z); th erefore, it ha sfour lines. The logic_3 unit defi nit ion (0, 1, Z) ha s t hr ee lines. By conven t ion,t he n am e of t he un it islogic_number, w h er e numberr efer s t o t h e n um ber oflogic st a tes.

    Ea ch line ha s four entries tha t provide all th e informa tion needed for one of

    the sta tes.

    The fi rst entr y in the defin ition is the MASTnamea ssigned to the sta te. Thisis the na me used in the MAST lan gua ge for t he va lue of th e sta te. Forexam ple, one of t he MASTnamesfor th e logic_4 fam ily isl4_0, w hichcor res pon d s t o t h e log ic s t a t e of 0. Astate va r iab le decla red as a log ic_4 typeca n be a ssigned to bel4_0.

  • 8/9/2019 Mast Language Reference Man

    37/172

  • 8/9/2019 Mast Language Reference Man

    38/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-6 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Pin Definitions

    P in-ty pe conn ection point s need to be defi ned in term s of th e units t hey w illuse.

    NOTE

    I t is gener al ly u nn ecessar y to i nser t th i s secti on in atemplat e, because stand ar d pin defini t i ons ar e specifiedin th e un i ts.si n fil e. Thi s file is aut omati cal ly i ncludedwhen you load t he Saber simul ator.

    The tw o general forms of a pin d efin ition a re:

    pin identifieracross un i t1through un i t2pin identifierthrough un i t1across un i t2

    In th is example, identifieris t he n a me of t he pin t ype bein g d efi n ed , a n d un i t1a nd un i t2a r e t he t hr ough a n d a cr oss un it t ypes t ha t a r e t o be a ssocia t ed w it htha t pin t ype. Exa mples of pin ty pes cont a ined inunits.sinare :

    pin electrical through i across v

    pin rotational through w across t

    Once you ha ve defi ned t hese pins (for exa mple, inunits.sin), you can usethe defi nition to declare t he types of pins in a templat e.

    Across var i ablesa re those whose va lues a re equa lized w hen tw o or more pinsa re tied together a t a node (a s, for exam ple, volta ge in electr ica l syst ems).Across varia bles follow a genera lized K VL la w : the sum of across va riables

    around a closed loop is zero.

    Thr ough var iabl esa re th ose (like current in electrical sys tems) wh ose va luesfollow a genera lized KC L law : the sum of through var iables flowing out of anode is zero.

    Connection Point Declarations

    Na ming a var iable and specifying its type is ca lled a declaration. There a refour kinds of connection points t ha t you ca n decla re in a templat e:

    pin-t ype

    st a t e

    va r

    ref

  • 8/9/2019 Mast Language Reference Man

    39/172

    M AST L anguage Reference M anu al (J un e 2003) 3-7

    Copyright 1985-2003 Synopsys, I nc.

    P ins a re an a log connection points t ha t use th rough an d a cross varia bles (for

    elect r ica l cir cu it s, t h es e a r e u sed t o f or m K C L a n d K VL eq u a t ion s). Wh en y ouspecify them in t he template hea der an d declare th em in the hea derdecla ra tions section, pins a re ava ilable for externa l connection. When y oudeclare them in the local declarations section, pins can be internal nodes.

    A pin decla ra tion identifi es the ty pe of node to w hich a pin ma y be connected.The genera l forma t of pin decla ra tions is th e follow ing:

    pintypei d[, id ... ]

    wh ere the pintypeis a word already specified in a pin defi nit ion, a nd th e i dsa re the na mes of th e pins being declared.

    An exam ple of a pin decla ra tion is th e follow ing:

    electrical c,b,e,s

    This decla res th a t t he four pinsc,b,e, andsa reelectricalpin-t ypeconnection points. An automatic side effect of this declaration is that the

    simulat or implicit ly ma kes ava ilablev(c),v(b),v(e), andv(s)(w ithrespect to g round) as ac ross system var iab les ; i t makesi(c),i(b),i(e), a ndi(s)as th rough system va ria bles.

    Although it is recommended th a t pins be declared, t hey do not ha ve to bedeclared if you use them in a n etlist sta tement w ithin th e same templa te.

    P in n a mes ca n be in teger s a s lon g a s t hey a r e used on ly in a n et list . I f y ou usenon-integer pin n a mes, you can t hen use them in other places with in th e

    template. This implicit declar a tion is va lid only a fter t he netlist st a tementoccurring w ithin the t emplat e. This mea ns, for exam ple, tha t the pin na mes

    could be used in a Va lues section follow ing t he netlist s ta tement , but not in aWhen statement preceding the netlist statement. The following exampleshows a va lid use of th e implicit declara tion:

    template templatename a b

    {

    val v v

    templatename2.1 a b = 1k

    values

    {

    v = v(a)-v(b)

    }

    ...

    }

    Parameter and Argument Declarations

    Pa ram eters a re template va riables tha t a re used to assign va lues to otherty pes of va ria bles. They a re decla red in t he local declara tions sections. The

  • 8/9/2019 Mast Language Reference Man

    40/172

  • 8/9/2019 Mast Language Reference Man

    41/172

    M AST L anguage Reference M anu al (J un e 2003) 3-9

    Copyright 1985-2003 Synopsys, I nc.

    st r ing

    These pa ra meters use an equa ls sign (= ) to assign one a ppropria te va lue to

    tha t part icular va riable.

    NOTE

    I f a simple par ameter is used as an ar gument, i t m ustbe in it ial ized (eit her in th e templat e or in a netl ist)otherwi se, a netl ist er r or wi l l r esul t.

    I f a sim pl e par ameter i s used as a l ocal par ameter, th eSaber simu l a tor w i l l au toma t i ca l l y i n i t i al i ze i t t o undef(un less otherw ise in i ti al i zed i n t he templ ate).

    Numbers

    A para meter declared a s a number ty pe requires a numeric (integer or rea l)v a lu e. Th e S a ber sim ula t or u ses on ly r ea l n um ber s, s o t h er e is n o s yn t a x t h a td is t inguishes between rea l numbers and integers. The form of the decla r a t ionis :

    number i d [[ =in i t i a l_value] , id [=i ni t i al_value]... ]

    wh ere the i ds are the argument or para meter na mes, and t he in i t ia l_valuesa re (optiona l) num bers or expressions s pecifying init ia l va lues. Suchexpressions must consist of consta nts, pa ra meters t ha t ha ve been previouslyinitialized, or templat e argument s.

    For exam ple, th e follow ing decla res severa l number declara tions on one line:

    number vcc=5, dc_input, rload=10k, cload

    Here,vcc,dc_input,rload, andcloadar e declared a s number typeparameter s. In addit ion ,vcc a ndrload h a v e been a s sig ned in it ia l v a lu es of 5

    a nd 10k, respectively. If th ese w ere argu ment s,dc_inputa ndcloadw ouldneed to be specifi ed in a netlist entr y.

    If th ese va riables were ar guments, they could be assigned values in a n etlistentry one of tw o wa ys:

    1. Following th e equa ls sign, just l ist the values in the order thea rguments a re listed in the head er, separa ted by comma s

    (...= 5, 2.7, 10k, 47n)

  • 8/9/2019 Mast Language Reference Man

    42/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-10 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    2. List the names of the a rguments a nd assign their values in an y order

    (...= cload=47n, vcc=5, dc_input=2.7, rload=10k)

    For cla r it y, y ou m a y a l w a y s w i sh t o s pecif y t h e a r g um en t n a m es, r eg a r dles s oforder. Arguments w ithout initia l values assigned in t he templa te must bespecified by the netlist entry.

    templatename.r efdes connecti on_poin ts= 5,2.7,10k,47n

    templatename.r efdes connecti on_poin ts= dc_input=2.7, cload=47n

    If th ese numbers ar e pa ra meters, you ca n a ssign them values in thePa ra meters section of th e templa te. Any simple pa ra meters ca n be used aft erthey a re declared in t he templat e by referring t o them by na me (e.g.,vcc,dc_input,rload,cload).

    Enumerated Types

    A para meter declared a s an enumera ted type (enum) ma y h old only one of a

    r es t rict ed s et of n a m es. Th is s et of n a m es m us t be s pecifi e d w i t hin br a ces{ }

    when declaring theenumpara meter.

    The form of th e decla ra tion is:

    enum {eval ue [, eval ue...]} i d [ [=in i t i a l_value] , id [=i ni t i al_value]... ]

    wh ere the i ds ar e the arguments or pa ra meters being declared, an d theevalues, w h ich a r e n a m es, a r e t h e v a lu es t h ey m a y con t a in . Th e evaluenames,once declared, a re mean ingful in th e template, an d no other va riables orevaluesm a y h a ve t he sa m e n a me. Th e in i t ia l_valuesa re t he evaluesassignedtoi ds as initia l values.

    An exa mple of a nenumdeclara tion is:

    enum {_n,_p} bjt_type = _n

    which declaresbjt_typeto be an a rgument or par ameter tha t can a ssumeva lues of only_nor_p. In t his example,bjt_typeha s been assigned a n

    initial va lue of_n. You can use enumerat ed types in a ssignments a nd incompa risons; you ca n a lso pas s th em to foreign routines.

    I f t his w er e t he d ecla r a tion of a n a r gum en t, y ou could a ssign it a va lue fr om an et lis t en t ry by a s sig nin g on e of t h e en um er a t ed va lu es t objt_type. (Again,t h e a r gu men t n a m e is n eces sa r y on ly if t h e a r gu men t s a r e t a ken ou t of or der.)

    B eca use the declar a tion in the templat e specifi es an init ial va lue, it is notn ecessa r y t o specify it in t he a r gum en t list of a n et list en tr y if y ou w a n t t o usetha t va lue:

    templatename.r efdes connecti on_poin ts= bjt_type=_n

    If th e declara tion is for a para meter, you ca n a ssign it a va lue in the

    Pa ra meters section or use th e initial va lue by not a ssigning a value. You ca n

  • 8/9/2019 Mast Language Reference Man

    43/172

  • 8/9/2019 Mast Language Reference Man

    44/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-12 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    These parameter t ypes a l low you to group mult iple pa rameter s (either s imple

    or composite) togeth er, providing convenience an d fl exibility w hen w orkingw ith la rge numbers of pa ra meters.

    Structures

    A structure is a pa ra meter tha t declares a n ordered list of other par a meters.The most genera l form of structu re decla ra tion is a s follow s:

    struc [structurename]{declaration

    declaration

    ...

    } i d [=in i t i a l_value] [,i d [=i ni t i al_value]... ]

    Note tha t t he structure i dcomes a fter t he closing bra ce.

    Aside from th e keyw ordstruc, the st ructur e decla ra tion consist s of fourma jor components: t he st ructure na me (structurename), th e decla ra tions ofpara meters w ithin the structure, the i ds of the para meters being declared a s

    insta nces of the st ructure, and, optionally, th eir init ial va lues.Follow ing is a n exam ple of a structure declara tion:

    struc fred {

    enum {_n,_p} type

    number is,beta,cj

    } bjt

    st ruct ure I t is oft en convenient t o w ork w it h ma ny rela ted va ria bles

    a s a unit . An exam ple of such a gr ouping is th e modela rgum ent of a semicondu ctor device such a s a bipolarjunct ion t r ans is tor, which is decla red as a s t ructure. Thisstructure in t urn, declares several dozen r ela ted simplepara meters tha t can a ll be ca lled by the na me of thestructure,model.

    union I t ma y be necessa ry for a single a rgument or pa ra met erto hold different types of informa tion a t different t imes,on e t ype a t a t im e. An exa m ple of t his kin d of gr oupin g isthe tra nsient (tran) a rgum ent of the volta ge sourcetempla te, wh ich is decla red a s a union. This un ion, in

    turn , declares both st ructures and enumera tedpara meters, only one of wh ich can be active a t a t ime.Th a t is, a s sig nin g a va lu e t o on e m em ber of t h e u nion in anetlist entry overrides a ll the oth er members of tha tunion.

  • 8/9/2019 Mast Language Reference Man

    45/172

    M AST L anguage Reference M anu al (J un e 2003) 3-13

    Copyright 1985-2003 Synopsys, I nc.

    This example declares a single argument or pa ra meter na medbjt. This

    va riable is a st ructure of the ty pe w hose na me isfred. It conta ins foursubordinate parameters (type,is,beta, andcj). The pa ra metertypeis anenumerat ed type, whileis,beta, andcja re numbers.

    U sing th is declar a tion, it is now possible to refer directly to the st ructure

    name (fred) a s a shortha nd w ay of declar ing a ddit iona l structure argumentsor parameters:

    struc fred m1,m2

    wherem1a ndm2ar e declared a s structures, th e same asbjt.

    It is not necessary to declar e a st ructure nam e (such a sfred). The followingsingle declara tion a ccomplishes th e sa me purpose a s t he a bove tw o:

    struc {

    enum {_n,_p} type

    number is,beta,cj

    } bjt,m1,m2

    On t he other ha nd, it is possible to sepa ra te completely th e declar a tion of th estructure na me from th e declara tions of the argument s or para meters tha tha ve tha t st ructure, as follow s:

    struc fred {

    enum {_n,_p} type

    number is,beta,cj

    }

    struc fred bjt,m1,m2

    You ca n refer to argum ent st ructures from netlist ent ries by assigning va luesto the par a meters w ithin t he structure. These are enclosed wit hinparent heses w hen a ssigned values from a netlist entry. The na mes of thepara meters wit hin t he structure need to be specifi ed only w hen th ey are notgiven in order (a lthough for ease in read ing netlist entries, you may w a nt to

    specify them):

    templatename.r efdes connecti on_poin ts=bjt=(type=_p,is=1a,beta=100,cj=10p)

    If th e para meters of a str ucture ar e not a ssigned initia l values, but th e

    structure itself is assigned a va lue of()in t he netlist entry, all of itspara meters are given the valueundefw hen simulated.

    If th e structure is a para meter, the value assignment in the Pa ra meterssection is simila r.

    You can a ssign initial values to th e pa ra meters with in the structure in twoplaces: wit hin a structure declara tion or follow ing th e para meter na me. The

    next exa mple declar es a str ucture w ith t hree number para meters:a,b,c.

  • 8/9/2019 Mast Language Reference Man

    46/172

  • 8/9/2019 Mast Language Reference Man

    47/172

    M AST L anguage Reference M anu al (J un e 2003) 3-15

    Copyright 1985-2003 Synopsys, I nc.

    union source {

    number dc

    struc {

    number mag

    number phase

    } ac

    } input1=(dc=5), input2=(ac=())

    The decla ra tion decla res a sin gle union t ype, na medsource, and t w o unioni ds:input1,input2. The decla r a t ion ofsource consis t s of two opt ions :dc (anumber type para meter) a ndac(a structure type para meter w ith tw onumeric fi elds,maga ndphase). From this, you ca n see tha t t here is nestingcapa bilityone of the members of the union grouping is a str ucture (ac)w hich also consists of a grouping.

    You can create the same effect with the following declarations (the names of

    the unions an d th eir declar a tions ca n a lso be specifi ed as sh ow n):

    union source {

    number dc

    struc {

    number mag

    number phase

    } ac

    }

    union source input1=(dc=5), input2=(ac=())

    Init ializing unions is similar to initia lizing st ructures. The difference is th a t

    you must a lso specify t he na me of the choice to be in effect. In th e aboveexample,input1is init ia lized to th e choice ofdcw ith a numeric value of 5.Input2is init ia lized to the choiceac, using init ia l values defi ned within t heacst ructure. Sincemaga ndphasew ere not assigned initia l values there,input2inheritsmag=undefa ndphase=undef.

    To reference a un ion a rgum ent fr om a netlist entr y, you need to include,

    w ithin pa rentheses, the na me of the choice to be activat ed and its a ssignedvalues.

    templatename.r efdes connecti on_poin ts=input1=(ac=(mag=1,phase=0))

    To reference a un ion from inside a t emplat e, you must fi rst determin e thedecla ra tion th a t t he union activa tes. To do this, use th e int rinsic functionunion_type, w hich is described in I ntr in sic Functions and Valu es. Afterusing th is function, you can a ccess the st ructures using th e symbol->

    (str ucture reference) a s follow s:

    input1->dcinput2->ac->maginput2->ac->phase

  • 8/9/2019 Mast Language Reference Man

    48/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-16 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Wh en a u nion pa r a m et er is pa s sed t o a f or eig n r ou t in e, a n in d ica t i on of w h ich

    choice i s a ss igned is ava i lab le to the foreign rou t ine. The det a i ls of the pass ingconvent ions a re shown in For eign Functions.

    Arrays

    J ust a s it is useful to creat e composite type para meters to group together

    many parameter s of possibly d issimi la r t ypes , i t a l so des ir ab le to keep severa lid en t ica l t y pes t oget h er a n d t o r efer t o t h em by a sin gle n a m e. You ca n d o t h isw it h a n a r ra y. You ca n d ecla r e a n a r ra y t o be of fi x ed s ize (like a s tr uct ur e), orof unbounded size (unlike a st ructur e).

    On ly a r gu men t s, pa r a m et er s, a n d s ta t es (of a fi x ed s ize) m a y be d ecla r ed t o bea rra ys. Use the follow ing synta x to declare a simple a rra y:

    type i d [subscripts]

    where typeis on e ofnumber,enum,string, orstate id , a n d i dis t he n am e ofthe va riable being declared a n a rra y, and t he subscriptsact as identifyingn um ber s t h a t d is tin gu is h a m on g t h e m em ber s of t h e a r ra y. Mor e t h a n on e s et

    of subscripts indicat es a mu lti-dimensiona l ar ra y. The subscripts th emselvesa re a comma -separ a ted list of simple subscripts, wit h ea ch simple subscriptgiving an optiona l low er bound a nd a n upper bound:

    [lower:upper, lower:upper, ...]

    The low er bound on a ny of the individua l subscripts m a y be omitt ed, an d if itis, it defa ults t o 1. The synt a x would th en be:

    [upper, upper,...]

    In a ddition, the upper bound of the fi rst simple subscript ma y be specifi ed asan as ter isk (*), ind ica t ing a va r iab le-leng th a r r ay whose leng th is determineda t ru n-time:

    [*,lower:upper,...]

    It is not possible to have a rra ys in w hich t he second a nd h igher subscriptsha ve var iable lengths.

    Some examples of a rra y declara tions ar e the following:

    number tc[2]

    number samples[*,0:1]

    number x[0:50,5,-1:+1]

    In the examples above,tcis a one-dimensiona l a rra y of 2 numbers;samples

    is a tw o-dimensiona l ar ra y, of w hich t he fi rst dimension is not declar ed untilrun t ime, and t he second dimension sta r ts a t 0 a nd ends a t 1;xis a th ree

  • 8/9/2019 Mast Language Reference Man

    49/172

    M AST L anguage Reference M anu al (J un e 2003) 3-17

    Copyright 1985-2003 Synopsys, I nc.

    dimensiona l ar ra y w hich ha s a fi rst dimension of 0 to 50, a second dimension

    of 1 to 5, an d a th ird d imension of -1 to 1.

    These a r r ays can be in it i a lized by including the appropr ia t e number of commasepa ra ted entries betw een squa re brackets.

    number tc[2]=[0,1]number y[0:2,2,-1:1]=[1,2,3,4,5,6,7,8,9,10,11,12]

    If you wa nt t o a ssign values to a rra ys, you must use squa re bra ckets.

    The elements of multidimensiona l ar ra ys a re stored w ith t he last subscriptva rying fi rst (by row). This convention is th e same as t ha t in P a sca l, but t heopposite of th a t used in FORTRAN. The only t ime you need t o know th is isw hen passing t he ar ra ys to a foreign routine. The Cha pter on ForeignFunct ionsdescribes th e deta ils of passing va riable length a rra ys t o foreignroutines.

    Arrays of Composite Types

    Arra ys of composite or nest ed composite type par a meters ca n be decla red byputt ing the square bra ckets a f ter the i dof th e para meter. For exam ple, th efollowing d eclare a structure conta ining tw o number par a meters(breakpoint,increment) a s an element of arra yssvbea ndsvbc:

    struc{

    number breakpoint, increment

    } svbe[*],svbc[*]

    or

    struc sa_points{

    number breakpoint, increment

    }

    struc sa_points svbe[*],svbc[*]

    In both these examples,svbea ndsvbcar e one-dimensiona l arra ys w ith th e

    number of structures they conta in determined at run t ime. Ea ch member(structure) w ithin th ese a rra ys ha s tw o numbers:breakpointa ndincrement.

    You ca n initia lize the a rra ys by setting ea ch st ructure equa l to pa renthesized

    sets of two numbers, separa ted by comma s a nd enclosed in squa re brackets.The following example declaressvbeto be a va riable-sized a rra y of

    structures.

    struc{

    number breakpoint, increment

    } svbe[*]=[(-1k,10),(-10,.1),(0,.1),(10,10),(1k,0)]

  • 8/9/2019 Mast Language Reference Man

    50/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-18 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    Init ially, its size is set t o five by the fi ve pairs of numbers enclosed in th e

    s qu a re br a cket s. B eca u se t h e fi e ld n a m es a r e n ot n a m ed in t h e n um ber pa i rs,t h e s im ula t or con sid er s t h e n um ber s in ea ch pa ir t o be in t h e s a me or der a s inthe str ucture declar a tionbreakpointfi r st ,incrementsecond. Specifyingvalues for th ese arra ys a s a rguments or a s para meters requires the sa mesynt a x as the initializer.

    Nested Composite Types

    Th e m em ber s of s tr uct ur es a n d u nion s m a y be a n y of t h e pa r a m et er t y pes. I na ddition, they ma y be declared a s fi xed- or va ria ble-length a rra ys.

    An exa m ple of t h is is t h e follow i ng d ecla r a t i on of a s ou rce, s im ila r t o a v olt a g es ou rce. N ot e t h a t t h e u nion a n d s t ru ct u re i ds (tran a ndsource, respectively)

    come a fter t heir closing bra ces.struc {

    number dc

    union {

    struc {number off,ampl,freq,ph;} sin

    number pwl[*]

    } tran

    struc {number mag,phase;} ac

    } \

    source

    This example declaressourcea s a structure with three members

    (presumab ly to be used wi th three dif ferent ana lyses):dc (a number),tran (aunion, mean ing a choice of tw o va lues or w a veforms ), an dac(a st ructur e).Within thetranunion, tw o possibilities exist: th e structur esin, and theva riable-length a rra y,pwl.

    I f you wa ntedsourceto be a n a rra y of length 3, you could achieve th is byreplacing th e last line of th e structure declara tion a bove bysource[3].

    This example i llust ra tes tw o syntax fea t ures not yet discussedthe semicolon(;) a nd the ba ckslash (\ ). The syn ta x requirements of a structure include the

    need for a n end-of-line just before th e closing bra ce. H owever, for rea da bilityyou ca n keep the bra ce on t he sa me line as t he last declara tion if you use thesemicolon, a s a bove. The ba ckslash is a cont inua tion chara cter, mea ning t ha tthe next line is to be trea ted a s a continua tion of the line with t he backsla sh.

    This is simply t o enh a nce rea da bility.

    The four syn ta x exa mples below a ssign va lues t osource. This synt a x willw ork when d ecla ring init ia l values for source in t he nested composite type

  • 8/9/2019 Mast Language Reference Man

    51/172

  • 8/9/2019 Mast Language Reference Man

    52/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-20 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    where templatenameis the na me of the template from which the argum entdefi nit ion is to be borrow ed, argumentnameis the nam e of an argumentwithin templatename, and the i ds ar e the names of the argum ents orpara meters being declared t o be of the sa me type as argumentname.Assuming tha t th ere is a templat e with the na me q, and i t has a n a rgumentw it h t he n am emodel, y ou ca n d ecla r e v a r ia b les n a m edm1 a ndm2 t o b e of t hesa me type with the following d eclara tion:

    q..model m1=(), m2=()

    With t his declara tion, the tw o va riablesm1a ndm2can be used whenever th emodela rgument of theqtemplat e is required. In part icular, if th emodel

    argument ofqis a la rge structure, thenm1a ndm2a re also large structures,with the sam e subordinate para meter na mes and an y exist ing defa ult values.

    B eca use it is possible for t emplat e defi nit ions t o be nested, it is a lso possiblef or a r g def s t o r ef er t o a r g um en t s in t h e n es t ed t em pla t es. Th e g en er a l for m isas follows:

    template1..template2..template3..argumentname

    with as m an y templat e names as a re needed to rea ch th e required a rgument .For exa m ple, t h er e m a y be a t em pla t enand, t h a t u ses it s pr iva t e d efi n it ion ofa M OS t r a n sis t or ca l ledmos. You cou ld d ecla r e a n a r gu men t t o be of t h e s a metype as t hemodelargument withinmos, as follow s:

    nand..mos..model m1

    Argdefs are initialized to the same para meter na mes and initia l values a s inthe defi ning argument . I t is as i f the i dwere listed aft er the structure a sfollows:

    data_structure {

    declarations

    } id=()

    You can supply a dditional initializa tion informat ion w ith th e same synta xused to initialize other i ds of the da ta structure. In th e example usingq..model, assume th a t one of the member para meters isbf. The following

    statement initializesbfto a value different from the default :

    q..model m1=(bf=80)

    Arrays of argdefs

    If an a rgument or para meter is defi ned as an a rray of argdefs, and thea r gu men t u sed in t h e d ecla r a t ion is it self a n a r ra y, t h e r es ult in g v a ria b le w illbe a n a rra y w ith th e subscripts in the argument s appended to the subscripts

    used on the a rgdef decla r a t ion . This i s bes t expla ined by an example. C ons idera templat elowlevel, wit h t he follow ing declar a tion for one of its a rguments:

    number lowarg[5]

  • 8/9/2019 Mast Language Reference Man

    53/172

  • 8/9/2019 Mast Language Reference Man

    54/172

    Chapter 3: Declar ati ons and D ata Str uctur es

    3-22 M AST L anguage Reference M anu al (J un e 2003)

    Copyright 1985-2003 Synopsys, I nc.

    struc {number vo,va,f,td,phase;}sin

    } tran

    tran->sin->phase

    Similar ly, you ca n use the sa me opera tor w ith a n a rra y. An a rra y reference

    ha s t he following genera l form:

    var iab le[expression,expression,...]

    w here ea ch expressionmust, w hen evalua ted, be a n umber (real numbers a reconverted to integers by truncation).

    An exam ple of a n a rra y reference is shown below :

    struc {

    number work[32]

    } m1[*]

    m1[i]->work[32]

    where arra yworkis a member of ar ra ym1[i](a n a rray of arra ys), andm1[i]->work[32]represents one of its element s.

    Structure Overlay

    St ructure overlay decla ra tions let you assign th e values of a compositepa rameter to another compos it e pa rameter, and then change va lues of specific

    members. The general syn ta x for t his a ssignment is:

    left_hand_value=structurename

  • 8/9/2019 Mast Language Reference Man

    55/172

    Declar ati on Oper ators

    M AST L anguage Reference M anu al (J un e 2003) 3-23

    Copyright 1985-2003 Synopsys, I nc.

    You could then cha nge t heisa ndrbva lues formodel2by using thestructure_overlaywi thmodel1:

    #in parameters section

    model1=(is=1e-14,bf=100)

    model2=model1is=1e-15

    model1->rb=10with:

    model1=model2

  • 8/9/2019 Mast Language Reference Man

    56/172

  • 8/9/2019 Mast Language Reference Man

    57/172

    Declar ati on Oper ators

    M AST L anguage Reference M anu al (J un e 2003) 3-25

    Copyright 1985-2003 Synopsys, I nc.

    freq_phaseis set t o 1 during frequency domain a na lyses tha t

    comput e the pha se of complex numbers. It is set t o 0 otherw ise.

    statisticalis set t o 1 when Mont e Ca rlo a nd other sta tisticala na lyses are being performed. It is set to 0 otherw ise. It ca n be usedonly in the Pa ra meters section and in t he netlist .

    timeis set (continua lly updated) to the simulat ion t ime at w hich t hetempla te is being eva lua ted. Time progresses only du ring t ime domaina na lyses. Time is set to 0 in frequency a nd D C d oma in a na lyses in t heValues and Equations sections for analog-only simulation.For

    templa tes providing mixed-mode simula tion (i.e., cont a ining Whensta tements), th e value of t ime is dependent on th e DC Algorithmoutlined in The DC Algorithm on page 9-11.

    time_domainis set t o 1 during a ny t ra nsient a na lysis. It is set to 0otherwise.

    time_initis set t o 1 a t the sta r t of t ransient a na lysis . I t is set t o 0otherwise. I t is not r eset wh en resta r t ing a t ra nsient an alysis from aprevious one. It is used primarily in When statements.

    tr_startis set to 1 a t t he sta r t of any tra nsient a na lysis , includingone resta rted from a previous tra nsient a na lysis. It is set t o 0

    otherwise. It is used prima rily in when sta tements.

    tr_doneis set to 1 a t th e end of a ny t ra nsient a na lysis. It is usedprimarily in When sta tements.

    time_step_doneis set to 1 a t t he end of each time step in t ra nsienta na lysis. It is used primar ily in When sta tements.

    Category 2

    next_timecan be set by th e template to a future t ime tha t t hesimulat or must reach exa ctly. If th e templa te ha s no scheduling

    requirement s, it should leavenext_timeundefi ned. A ty pica l use ofth is simvar is in piecewise linear sources, where it t ells th e simulatorw hen t he next t urning point occurs in the defi nition of source, or an y

    other t ime-dependent t empla te w here an abrupt cha nge occurs.Another use is to ensure tha t t he simulator uses a pa rticula r t ime.More informa t ion abou t usingnext_time i s prov ided in the subsect ion

    tit led Scheduling Ana log Wa veform Sa mpling Times.

    step_sizecan be s