• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. RF Design
  3. Working with DC sweeps and OP

Stats

  • Locked Locked
  • Replies 14
  • Subscribers 66
  • Views 35195
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Working with DC sweeps and OP

MicheleA
MicheleA over 13 years ago

Hi all,

I know it's not appealing to write one's first post in an RF focused group talking about DC but please bare with me :)

I am interested in plotting some MOS DC parameters like gm, gmoverid, Cgg, gds as they vary across VGS and VDS.

Keeping VDS fixed for the moment, I would expect to be able to DC sweep VGS and get a curve of - say - gm Vs. VGS. This is not the case. I actually get only one point, which is the point corresponding to the "static" value of VGS, in the design variables list.

Of course I could set up an equation in the Calculator for the derivative of Id but I think that "somewhere" the tool should calculate those parameters for me...And also because for some trickier parameters like Cgg the whole process would be more complicated.

The alternative to that is to run a parametric analysis, but this is way less effective timewise.

 Does anybody know of a way of overcoming this?

Thank you in advance,

 Michele

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Michele,

    The way to do this is to create an ASCII file called "save.scs" and in that put:

      save M1:gm

    or

      save M1:oppoint

    or

      save *:gm sigtype=dev

    or

      save *:oppoint sigtype=dev

    (see "spectre -h save" for more details - particularly on wildcarding).

    Then reference this file using Setup->Model Libraries in ADE. What this is doing is telling it to additionally save the operating point data (or specifically gm) for a single transistor or set of transistors. Normally this doesn't happen for DC sweeps, just DC operating points - in order to prevent a huge amount of data being produced that most of the time you don't need. 

    Having done this, you should be able to access the resulting operating point data from the DC sweep from the results browser, and then you'll get a plot of it versus your sweep. Similarly if you did a transient you could plot the gm versus time using this approach.

    Hope that's clear,

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MicheleA
    MicheleA over 13 years ago

    Hi Andrew,

    thanks for your reply. I think you were pretty clear and I should have implemented everything, but it isn't working yet.

    To recap, I have a very simple schematic with a transistor and two dc sources: I created an ASCII file named "save.scs" containing one single line of text:

    save M1:oppoint     [I tried save M1:gm and didn't work either]

    In the libraries setup, I added a path to this file [this is different from where the other libraries reside]

    ran the DC sweep

    plotted OP("/M1", "gm") from the Calc

    ==> I get the buffer evaluated to a number

    In order to select gm, I select the "op" choice in the Calc, then select an instance in the schematic view, and choose the parameter gm from the drop down list.

    In the input.scs  file, I do see the include directive for "save.scs" so I don't really know what could be wrong.

    I would have added some screenshots inline in the post, but I couldn't find my way through. I have attached a zip with 3 screenshots showing the testbench, the simulation windows, and the (incredibly complex) save.scs file :)

     Thanks for helping!

     Michele

    P.S. in te netlist the last line says:

    saveOptions options save=al currents=all subcktprobelvl=2

    is it conflicting with something?

    tb_MOS.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Michele,

    The key is that you're using the OP() function, whereas I said to use the results browser. The OP function will retrieve the DC operating point data, not the results from the DC sweep. 

    If you do that, and send the signal from the results browser to the calculator, you'll get something like this:

    getData("M1:gm" ?result 'dc)

    And this should plot the gm versus the swept variable for the dc analysis. You could also just type the getData() expression into the calculator.

    There is an enhancement request (for some time) requesting an easy way to set up these save statements and access the results from the UI, but it's not been implemented yet.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MicheleA
    MicheleA over 13 years ago

    Thanks a lot Andrew!

    It works just perfectly. I could swear I also looked in the results browser but of course if gm is here now, it must have been there last time as well :)

    I have a second part for this question however :-D

    Now, to retrieve the behavior Vs. two variables, I have to do a parametric sweep (I suppose): DC sweep VGS, par sweep VDS. This means that my gm will become a bidimensional function...A surface in a three dimensional space. I don't think that the Visualization Tool  is equipped for plotting surfaces but actually what I need is plotting contours (slices of my surface).

    If there is a way of doing it in Cadence, I would be glad to learn it. If not, I guess I could export the data in tabular form.

    Can you point me to the place in the manuals where this topic is explained? I would also try to do it automatically, like more or less what you made me do for "save.scs"...Maybe include some "print.scs"?

    Thank you very much for your help,

     Michele

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Michele,

    There's no contour capability, although you can take a slice across the data using the value() function - so maybe that is sufficient. For example, if the inner sweep is VGS and outer sweep VDS, a slice of the inner sweep would be:

    value(getData("M1:gm" ?result 'dc) 0.5)

    or if you want to do it for the outer sweep (the value function works by default on the inner sweep), you could do:

    value(getData("M1:gm" ?result 'dc) 'VDS 0.6)  ; where 'VGS is the name of the swept variable

    Maybe that's what you want? 

    Otherwise you can save the data to a table - which version of Virtuoso are you using? (Help->About in the CIW)

    Potentially there's a print statement in spectre, but I'm not sure that's really the right solution. You could add this in your save.scs :

      print M1:gm, name=dc to="stuff%T.out"

    I made the filename have %T so that it has a timestamp in there for each point in the parametric sweep - but this is a bit clunky. The print statement in spectre is primarily there for compatibility with other SPICE simulators, and is rarely used with spectre syntax (spectre -h print for more details; for example, it must have a comma at the end of all the outputs, which is a little strange).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MicheleA
    MicheleA over 13 years ago

    Hi Andrew,

     unfortunately the value() function doesn't provide what I am looking for. The term "slicing" is probably not 100% correct (poor English I suppose :))

    What I am aiming at is something along these lines: you now have your gm assuming a certain value across all combinations (VGS, VDS) in your simulated points.

    The question I'd like to answer (in pictorial form) is: what are the (VGS,VDS) couples that give me a value of - say - 10 for my gm? The answer could be: none, one single point, many points...etc

    I found in the result browser an "export" option which is giving you the data in csv format. It is maybe not efficient in the long run but is certainly viable for the moment.

    I can already plot my values in excel and can certainly do a better job in Matlab.

    Regards,

    Michele

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Michele,

    So if the two independent axes (VGS and VDS) are "x" and "y", you want a slice which is in the z axis - i.e. the dependent axis - thus giving you a true contour map (at least for a single value).

    There's not really an capability to do that - there's the xval function if there's a single crossing, but if there are multiple regions that won't help you. 

    So right now you're probably best doing this in Matlab, say. You could use the spectre toolbox for Matlab (covered in the MMSIM documentation, and in app notes in the <MMSIMinstDir>/tools/spectre/examples directory hierarchy).

    I just used this simple example:

    // example of sweeping id curves
    model nch mos1 type=n vto=1 kp=16u gamma=1.3 lambda=0.01 \
           phi=0.7 pb=0.80 mj=0.5 mjsw=0.3 cgbo=200p cgso=350p cgdo=350p \
           cj=300u cjsw=500p ld=0.1u tox=80n \
           af=1 kf=3.1e-24


    m1 (drain gate 0 0) nch w=20u l=0.8u
    vgs (gate 0) vsource dc=2.5
    vds (drain 0) vsource dc=1

    voff (off 0) vsource dc=20m
    vcvs (gate2 off gate 0) vcvs gain=1
    rload (gate2 0) resistor r=10k

    save m1:ids m1:gm rload:1

    sweepvgs sweep dev=vgs param=dc start=0 stop=2 step=20m {
        dc dc dev=vds start=0 stop=5 step=20m
    }

    And ran (from command line) "spectre idcurvesw.scs" which produced idcurvesw.raw (the PSF results).

    Then I did this in Matlab:

    gm=cds_srr('./idcurvesw.raw','sweepvgs_dc-sweep','m1:gm');
    contour(getfield(gm,'vgs:dc'),gm.dc,gm.S);

    (could use mesh instead of contour to see a graph). Similarly could look at m1:ids:

    id=cds_srr('idcurvesw.raw','sweepvgs_dc-sweep','m1:ids')
    mesh(getfield(id,'vgs:dc'),id.dc,id.A)

    So this means you then don't have to load it and then export it to CSV to read back into Matlab; it can directly read the PSF results into Matlab.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MicheleA
    MicheleA over 13 years ago

    Thanks again Andrew.

    Now I only have to make the toolbox work in the environment...Wich won't be difficult with the help of my super-duper CAD guys ;)

    Talking about Matlab, the association is with co-simulation (rhyme unintended), and then, with system level simulations. After reading your reply to another post in this forum where you mentioned the "spectreRF_workshop", I looked into it and found an high-level model of a Tx subsystem, but found not much information on the general subject of system level simulation.

    Questions:

    - how would you rate Cadence' suite "user-friendliness" to perform (and quickly setup) system-level simulations? (architecture assesment, chain analysis and the like)? In other words: how many blocks, simulation types, evaluation tools are available and easy to configure for this type of task? I would really like - if possible - to stay in Cadence for all IC related work, also for the "big picture" stages of the design.

    - based on your answer, can you suggest me which resources to read/study to learn sys level simulations in Cadence?

     Thanks (that must be the eighth time I write it today),

     Michele

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Michele,

    There are two parts to the Matlab interfaces. There's one which is an interface to Simulink - available with spectre and AMS Designer - which allow co-simulation with Simulink; and a toolbox to allow Matlab to read spectre/Ultrasim/AMS simulation results directly into Matlab for further processing. 

    It is possible to do system simulations in the Cadence IC tools, but I wouldn't say that there is a particularly rich library compared with other more dedicated system simulation tools such as Simulink. That's one of the reasons for offering a co-simulation capability with Simulink. There are a fair number of blocks for certain types of systems - primarily for RF systems - so the Spectre RF documentation (User Guide and Theory) in the MMSIM documentation are a good place to look. You can also do system simulation using AMS Designer - provided that you have Verilog/Verilog AMS/VHDL/VHDL AMS/SystemVerilog models to do so (there are some libraries included in the software).

    I'd say your best bet is to contact Cadence (either via customer support, or via your account manager) so we can discuss in more detail your requirements.

    Best Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MicheleA
    MicheleA over 13 years ago

    Andrew,

    thank you so much for helping. I got the RF library installed by the (allmighty) CAD support here, and the matlab import functions work perfectly for my purpose. I'll later explore the system capabilities of the library and certainly come to the support if questions arise.

    I do have another question, but it is a slightly different matter so I'll open a new post (after checking for the topic in the Forum).

    Kind Regards,

     Michele

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
>

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information