• 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. Custom IC Design
  3. Getting more data after MC run directly in the Results table...

Stats

  • Replies 18
  • Subscribers 133
  • Views 12388
  • Members are here 0

Getting more data after MC run directly in the Results table?

StephanWeber
StephanWeber 3 months ago

Hi,

the ViVA calculator has some nice statistical functions, like average, stddev, skewness, kurtosis, and building more like Cpk or Jarque-Bera JB is not so difficult. But I struggle to get this not only in the calculator but really as output, e.g. to define a spec! E.g. we want Cpk>1.67 or  e.g. JB<3 for check for Gaussian data.

What works so far is this: 

I switch to Detailed table mode, select an output like Rsense or VoutDC, do a "plot across points", then I go to Viva and make "Send to Calculator", then I get an expression like swapSweep(Rsense "Design Points" "nom"), next I simply set x=swapSweep(Rsense "Design Points" "nom"). So it is no easy to get the mean and stddev and then to plot the Gaussian PDF of that fit.

However, I struggle to make that not only manually every time after the MC run but as output expression which would give a much higher automation. E.g. I want to see:

- The PDF plot for a fit for each MC analysis and my key outputs (I run MC vs VT corners)

- Also look for 5-sigma values

- Check if data is Gaussian, e.g. do also other fits like lognormal fit of JB is too large

- Or check at which corner the 5-sigma value is worst, etc.

This way I also do not need to plot Histograms etc. manually after each run.
His anybody done this before?

e.g. stddev(Rsense ?overall t) (with sweeps selected) works but skewness(Rsense ?overall t) (works in CIW!!) is changed to (skewness Rsense ?overall t)
same issue for kurtosis.

Are these Cadence-functions not registered in ADE?

Bye Stephan

  • Cancel
  • Sign in to reply
  • Andrew Beckett
    Andrew Beckett 3 months ago

    Stephan,

    You should just need to set the evalType column for the measurement to be "sweeps". Then it will make the measurement across the sweep (i.e. the Monte Carlo sweep), rather than the default eval type which is "point" - that's only evaluated per individual Monte Carlo point and so cannot compute results across the whole set of mc iterations.

    If you've built your post-processing functions properly, they should work across the sweep data too. 

    Personally I've not created the functions you're asking for in SKILL (I have for many others, of course), but I have used the ADE MATLAB integration to do the same thing... see this video: Using the Enhanced Virtuoso ADE Product Suite and MATLAB Integration: A Practical Guide (Video [cc])

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • StephanWeber
    StephanWeber 3 months ago in reply to Andrew Beckett

    Thanks Andrew for quick reply. I use meesurements across sweeps. 

    The key problem is that here ADE does not support all skill function, but only a few, like average, stddev, but not yet skewness and kurtosis.
    Whenever you enter e.g. kurtosis(..) it will immediately changed to (kurtosis ..).

    Getting the statistical functions is quite easy, all we need is the normal distribution pdf (~exp x^2), plus cdf and inverse cdf.

    I already made them all in Skill. Only the application is currently restricted, which is a pity. Want to avoid Matlab, prefer skill. 

    Here is the code for 2 such new functions. Doing the same for other distributions is easy too (e.g. for lognormal fits, etc.)

    procedure(phiNorm(x)
      let( (invSqrt2Pi)
        invSqrt2Pi = 0.3989422804014327 ; 1/sqrt(2*pi)
        invSqrt2Pi * exp(-(x*x)/2.0)
      )
    )

    procedure(cdfNorm(x)
      let( (sign z tz a1 a2 a3 a4 a5 phi tpoly cdf)
        a1 = 0.319381530
        a2 = -0.356563782
        a3 =  1.781477937
        a4 = -1.821255978
        a5 =  1.330274429

        sign = 1.0
        z    = x
        when(z < 0.0
          sign = -1.0
          z = -z
        )

        tz  = 1.0 / (1.0 + 0.2316419 * z)
        phi = phiNorm(z)

        tpoly = a1*tz + a2*tz*tz + a3*tz*tz*tz + a4*tz*tz*tz*tz + a5*tz*tz*tz*tz*tz
        cdf   = 1.0 - phi * tpoly

        if(sign < 0.0 then
          1.0 - cdf
        else
          cdf
        )
      )
    )

    Also making a plot of the Gaussfit works fine (but not from ADE, but from CIW):

    ; PdfNormal(mu sigma @optional nPoints)
    ;   - Build a normal pdf waveform from given mean and sigma
    ;   - x-range = [mu - 5s, mu + 5s]
    ;   - nPoints samples (default 200)
    ; Usage:
    ;   wNorm = PdfNormal(0.0 1.0)
    ;   plot(wNorm)


    procedure(PdfNormal(mu sigma @optional (nPoints 200))
      let( (startX endX dx sig2 normConst i xList yList xVal yVal)

        when(sigma <= 0.0
          return(nil)
        )

        when(nPoints < 2
          nPoints = 2
        )

        startX = mu - 5.0 * sigma
        endX   = mu + 5.0 * sigma
        when(endX <= startX
          return(nil)
        )

        dx       = (endX - startX) / (nPoints - 1)
        sig2     = sigma * sigma
        normConst = 1.0 / (sqrt(2.0 * 3.14159265358979) * sigma)

        xList = nil
        yList = nil

        for( i 0 nPoints-1
          xVal = startX + i * dx
          yVal = normConst * exp( -0.5 * ((xVal - mu)*(xVal - mu) / sig2) )
          xList = cons(xVal xList)
          yList = cons(yVal yList)
        )

        xList = reverse(xList)
        yList = reverse(yList)

        abMakeWaveform(yList xList)
      )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 3 months ago in reply to StephanWeber
    StephanWeber said:

    The key problem is that here ADE does not support all skill function, but only a few, like average, stddev, but not yet skewness and kurtosis.
    Whenever you enter e.g. kurtosis(..) it will immediately changed to (kurtosis ..).

    That's not true. ADE absolutely supports all SKILL functions, provided that they return scalar values or waveforms, and that they handled value coming in which are either scalars, waveforms or families. kurtosis and skewness are absolutely supported in ADE. Just because it changes to show parenthesis before the function doesn't mean they are not supported (I didn't see that behaviour - I was trying with IC25.1 ISR4 - and the results are correctly computed).

    I don't know how you are calling the functions above in ADE, but I suspect it's because they are not handling the arguments being potentially passed in as a waveform/family. You might need to use the standard pattern of a cond() function which does drIsWaveform, famIsFamily, famMap and so on around your code - as seen in many of my functions.

    I don't have the time today to try out your code and adapt it, but you could contact customer support to have one of the team investigate.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann 3 months ago in reply to Andrew Beckett
    Andrew Beckett said:
    You might need to use the standard pattern of a cond() function which does drIsWaveform, famIsFamily, famMap and so on around your code - as seen in many of my functions.

    ... and as explained e.g. at https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O0V000007MkO7UAK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • StephanWeber
    StephanWeber 3 months ago

    Hi Frank and Andrew,

    I followed Franks link and see something about famIsFamily(), this sounds very close to what I need, but I believe there is not only one hurdle.

    1. It is indeed interesting to pick the whole MC data, e.g. vs mc and vs corner, and then extract e.g. stddev vs mc for each corner.I

    2. I wonder what is easier calculating mean, stddev, etc. as separate output vs sweeps and then e.g. plot the fitted pdf by taking the 2 params

    3. OR I just take the whole data, calculate parameters internally, and return the fitted waveform (or even create multiple outputs)
    2. looks simpler and would also allow to directly sets specs. 

    However, using Virtuoso Studio 23.1-64b ISR15.37 already something simpler failed:

    I can calculate average and stddev vs sweeps, and get the correct MC mean and stddev, but it does not work for skewness() and for kurtosis(). I miss also the median as function.

     stddev(Rsense ?overall t) with sweeps is fine

     skewness(Rsense ?overall t) with sweeps is automatically modified by ADE immediately to  (skewness Rsense ?overall t) and is not working

    However, from CIW skewness(x) works, if I made x=expression got by sent to in Calculator.

    One further tricky part is this:

    Rsense is also an output expression, like value(mag((VF("/VRECT") - VF("/VMID"))) 1)

    And skewness(value(mag((VF("/VRECT") - VF("/VMID"))) 1)) WORKS in ADE.   => I believe this is what works on your side Andrew??

    So at the moment my conclusion is that in the version I use, skewness does not work on ADE outputs, but it works in CIW, Calculator and on signals.

    Any feedback of course highly appreciated, because manually with Send to Calculator and in it I can do already now all I need, like also overlaying a lognormal fits, shifted lognormal fit, etc.

    Bye Stephan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 3 months ago in reply to StephanWeber

    The point about making your code handle families and waveforms is just that it can handle any scenario. If it's supplied with the data across corners then it should work. Sometimes you might have the value across corners but just for a single corner (so it's still a waveform). Ensuring functions handle any kind of input data ensures they work in all scenarios. It doesn't force you to process the entire MC dataset in one go, but you can if you want.

    StephanWeber said:

     skewness(Rsense ?overall t) with sweeps is automatically modified by ADE immediately to  (skewness Rsense ?overall t) and is not working

    I tried this in IC23.1 ISR17 and IC25.1 ISR4 and in those versions, the ?overall t is not added. It works fine (?overall t is not supported by these functions - I can only guess it was a mistake that was corrected - I don't have time to test with the same subversion as you).

    In my example I had skewness(Voffset) where Voffset was the name of the output I wanted to find the skewness of. I didn't need to repeat the expression.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • StephanWeber
    StephanWeber 3 months ago in reply to Andrew Beckett

    GREAT, deleting  ?overall t makes all work! Thanks a lot, Andrew.

    So I can extract e.g. the MC count, the mean, stddev, skew and kurtosis, also a plot of pdf is possible. Will go on to make more in the next week.

    BUT one thing is strange:

    If I manually enter stddev() I get a correction with ?overall t added!

    That is the reason why I thought also skewness and kurtosis need that  ?overall t, but the opposite is true.

    Here are my exported outputs (all work nicely):
    ACS_FCS_DFT,Rsense,expr,value(mag((VF("/VRECT") - VF("/VMID"))) 1),point,t,,,Ohms,range 17.5m 28m,AC Rsense
    ACS_FCS_DFT,x,expr,Rsense,sweeps,t,,,Ohms,,
    ACS_FCS_DFT,x1,expr,value(mag((VF("/VRECT") - VF("/VMID"))) 1),sweeps,t,,,Ohms,,
    ACS_FCS_DFT,avgRsense,expr,average(Rsense ?overall t),sweeps,t,,,Ohms,,
    ACS_FCS_DFT,stddevRsense,expr,stddev(Rsense ?overall t),sweeps,t,,,Ohms,,
    ACS_FCS_DFT,skewRsense,expr,skewness(Rsense),sweeps,t,,,,,
    ACS_FCS_DFT,kRsense,expr,kurtosis(Rsense),sweeps,t,,,,,
    ACS_FCS_DFT,pdfN,expr,PdfNormal(0 1),sweeps,t,,,,,
    ACS_FCS_DFT,skewRsenseFull,expr,skewness(value(mag((VF("/VRECT") - VF("/VMID"))) 1)),sweeps,t,,,,,
    ACS_FCS_DFT,N,expr,sampleSize(Rsense),sweeps,t,,,,,

    For me it looks stddev is slightly differently implemented than e.g. skewness.

    Bye Stephan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 3 months ago in reply to StephanWeber
    StephanWeber said:

    BUT one thing is strange:

    If I manually enter stddev() I get a correction with ?overall t added!

    This is just because average and stddev existed for a long time before ADE XL/Explorer/Assembler and then had to be extended to support measure across sweeps/corners etc. It was hard to do that in a compatible way and so the ?overall t keyword was added to enable that. kurtosis and skewness are more recent additions and they were (I believe) designed from day one to cope with the result structures that ADE presents. I've not checked this, but I think that's what's going on.

    So it's history/legacy behaviour that is the likely reason.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • StephanWeber
    StephanWeber 3 months ago in reply to Andrew Beckett

    Again, many thanks, Andrew. I implemented now also a shifted lognormal fit, so I have to test a lot now.

    One thing could help: 

    Instead of calculating each value in a dedicated function, then using e.g. mean, stddev, skewness, etc. for the 3-parameter fit, it might be easier to put all that in one bigger function, and return multiple things as a list. 

    Also it might help to not define each output explicitly as ADE output, but doing the output creation also inside a skill script.

    So overall it could look like this:

    I have a dedicated ADE output like "Rsense" (plus many others, like Vout, accuracy, f3dB)

    We pass Rsense (complete waveform vs MC & corners) to a script.

    This script has a big function which calculates e.g. mean, stddev, skew, kurtosis, + model fit & yield in sigma from that fit, etc.
    And it creates new outputs (with specs) for ADE.

    I wonder is using the Run Plan + post-script the best way to go?
    Best would be to pass just a list of outputs (not all, but the most important ones e.g. all ADE point outputs with active spec) to the script. 

    Bye Stephan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Andrew Beckett
    Andrew Beckett 3 months ago in reply to StephanWeber

    Stephan,

    That doesn't really fit into the ADE use model. You can have an OCEAN script measurement which returns multiple outputs (it announces at the beginning of the script what those outputs will be, and then outputs the individual results throughout the script), but there's not a mechanism for a normal measurement function to add multiple rows in the table (I think this would be confusing). We could have a Swiss Army knife type function which can return multiple different things, and an argument determines which it use (e..g like the spectrumMeasurement function).

    Anyway, the right thing to do here is to contact customer support if you want an enhancement.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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.

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

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