• 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. Plotting the DC sweep but clipped

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 125
  • Views 13963
  • 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

Plotting the DC sweep but clipped

Pyroblast
Pyroblast over 9 years ago

Hi guys,

I want to clip a portion of the hysteresis sweep. Is that possible? I tried to use the clip function but I didn't get any result. I wounder if the clip function can be used with DC values on the x-axis.

Best regards.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    The clip function only works with monotonic x vectors - which is not the case here. I wrote a function a while ago to filter (rather than clip) based on the y-values; I just extended it to work with x-values as well:

    /* abFilterByValue.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Feb 02, 2015 
    Modified   Sep 01, 2016 
    By         A.D.Beckett
    
    Filter outliers from a waveform (by value). Useful for histogram
    plotting. For example:
    
    abFilterByValue((statGetWaveform "Current_C3_0" nil ?resDbFile 
        axlGetHistoryResults(axlGetCurrentHistory(_vivaGetSessionName())) ?testName "AC" ?filtPointsList "") 
        8.29m 8.295m
    )
    
    Added support in 1.2 for filtering based on the x-value as a means to "clip"
    signals with non-monotonic x-axes such as those from the dc hysteresis analysis 
    in spectre
    
    ***************************************************
    
    SCCS Info: @(#) abFilterByValue.il 09/01/16.10:35:59 1.2
    
    */
    
    /**********************************************************************
    *                                                                     *
    *                   (abFilterByValue wave min max)                    *
    *                                                                     *
    * Filter a waveform by value. If any points are outside the range min *
    *         to max, they are omitted from the output waveform.          *
    *                                                                     *
    **********************************************************************/
    
    (defun abFilterByValue (wave min max @optional filterX)
      (cond
        ((drIsWaveform wave)
         (let (xVec yVec newXVec newYVec xval yval val len newWave)
           (setq xVec (drGetWaveformXVec wave))
           (setq yVec (drGetWaveformYVec wave))
           (setq len (drVectorLength xVec))
           (setq newXVec (drCreateVec (drType xVec) len))
           (setq newYVec (drCreateVec (drType yVec) len))
           (for i 0 (sub1 len)
                (setq xval (drGetElem xVec i))
                (setq yval (drGetElem yVec i))
                (setq val (if filterX xval yval))
                (when (and
                        (or (null max) (leqp val max))
                        (or (null min) (geqp val min)))
                  (drAddElem newXVec xval)
                  (drAddElem newYVec yval)
                  )
                )
           ;-----------------------------------------------------------------
           ; Set the units, name and expression attributes
           ;-----------------------------------------------------------------
           (putpropq newXVec (getq xVec units) units)
           (putpropq newXVec (getq xVec name) name)
           (putpropq newYVec (getq yVec units) units)
           (putpropq newYVec (getq yVec name) name)
           (setq newWave (drCreateWaveform newXVec newYVec))
           (famSetExpr newWave `(abFilterByValue ,(famGetExpr wave) ,min ,max))
           newWave
           )
         )
        ((famIsFamily wave)
         (famMap 'abFilterByValue wave min max filterX)
         )
        (t
          (error "abFilterByValue: cannot handle %L\n" wave)
          )
        )
      )
    

    The idea is that you can then do:

    abFilterByValue(yourWaveform minX maxX t)

    The t tells it to filter based on x rather than y values. Note that it filters rather than clips (so no interpolation at the ends - it simply omits any points outside the range).

    Regards,

    Andrew.

    • 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