• 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. Calculator: How to avoid interpolation when using spectrumMeasurement...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 127
  • Views 9771
  • 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

Calculator: How to avoid interpolation when using spectrumMeasurement()?

jorgeluislagos
jorgeluislagos over 3 years ago

Hi! Is it possible to avoid somehow the interpolation done by spectrumMeasurement()?

Context: I would like to apply spectrumMeasurement() to waveforms produced by abCrossTwoWaves(). However, the strobbing signal used in abCrossTwoWaves() is jittery, thus the resulting waveform x-values are not equally-spaced. Moreover, the "starting" time of the initial crossing is not known beforehand (and might even change across sweeps). As a result, using spectrumMeasurement() on such an output inevitable results in interpolation, which renders the results erroneous.

All the above issues would disappear if the output of abCrossTwoWaves() could be somehow "sampled and held" before passing it to spectrumMeasurement(), but I don't know how to achieve this using just calculator functions / Skill.

Of course, I could also detect the crossings and hold the signals using "testbench circuitry", but the number of signals I need to do this on is so large that such approach becomes very cumbersome.

Is there a way to overcome this?

Thanks in advance,
Jorge.

  • Cancel
Parents
  • ShawnLogan
    ShawnLogan over 3 years ago

    Dear Jorge,

    jorgeluislagos said:
    Context: I would like to apply spectrumMeasurement() to waveforms produced by abCrossTwoWaves(). However, the strobbing signal used in abCrossTwoWaves() is jittery, thus the resulting waveform x-values are not equally-spaced. Moreover, the "starting" time of the initial crossing is not known beforehand (and might even change across sweeps).

    I must apologize for my initial comments as I am not familiar with the specifics of your design and application! 

    However, I am concerned that your objective may lead to an incorrect result. Specifically, it sounds as if you are trying to force the crossing points of two waveforms to be a fixed constant in order that the crossings always occur some time Tcross apart. Is this a valid assumption? It is far more common (and expected) that some variation is expected in their subsequent crossing events due to circuit noise (both random and deterministic). Hence, if you "force" the crossing times to be invariant with time, your spectrum will not reflect the actual spectrum.

    There are ways to analyze this situation that I can think of that I would consider in lieu of the methodology you are proposing - but once again - not knowing additional information on your application or circuit I may be totally missing your overall objective!!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • dontpanic
    dontpanic over 3 years ago in reply to ShawnLogan

    Thanks for your reply, Shawn. I'm not fully sure I understand it, though!
    As you correctly assume (and as mentioned in my original post), the actual crossings indeed occur at random instants and are not equally spaced. The reason why I want to somehow "hold" programmatically these values at the crossings is that spectrumMeasurement() will otherwise interpolate them before calculating the spectrum (since it assumes/requires equally-spaced samples), which results in corrupted spectrums/measurements. Thus, if I were able to hold the values at the crossings (somehow through a function) before passing them to spectrumMeasurement(), then the interpolation done by the latter would be inconsequential, and I could get valid spectrums/measurements. At least that's my reasoning on this Slight smile
    KR, Jorge.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to dontpanic

    Hi Jorge,

    I just wrote this function which I think will do what you want. It allows you to hold each point in a waveform until the next one - so you should be able to use it on the output of abCrossTwoWaves.

    /* abHoldPoints.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 12, 2022 
    Modified   
    By         
    
    Calculator function to convert a waveform with a set of points 
    to be sample-and-held (of sorts). What this means is that if
    you plot the input waveform, it would have a line between 
    successive points; the output of the function will hold the
    value at one point, and then switch instantaneously to the
    new value at the next point - you'll see this as a staircase
    waveform.
    
    The code includes the calculator function template, so can be
    added to the calculator using the "fx" button in the function
    panel in the calculator, or the + button in the expression builder.
    
    ***************************************************
    
    SCCS Info: @(#) abHoldPoints.il 05/12/22.13:44:50 1.2
    
    */
    
    /***************************************************************
    *                                                              *
    *                     (abHoldPoints wave)                      *
    *                                                              *
    *    Take a waveform and hold each value to the next point,    *
    *         generating a sample-and-held like waveform.          *
    *                                                              *
    ***************************************************************/
    
    (defun abHoldPoints (wave)
      (cond
        ((drIsWaveform wave)
         (let (xVec yVec newXVec newYVec newWave len hold x)
           (setq xVec (drGetWaveformXVec wave))
           (setq yVec (drGetWaveformYVec wave))
           (setq len (drVectorLength xVec))
           (setq newXVec (drCreateVec (drType xVec) (times len 2)))
           (setq newYVec (drCreateVec (drType yVec) (times len 2)))
           (for ind 0 (sub1 len)
                (setq x (drGetElem xVec ind))
                ;------------------------------------------------------------
                ; Note, this will create a zero-time step. Probably fine
                ; in most cases unless you're trying to take the 
                ; derivative!
                ;------------------------------------------------------------
                (when hold
                  (drAddElem newXVec x)
                  (drAddElem newYVec hold))
                (setq hold (drGetElem yVec ind))
                (drAddElem newXVec x)
                (drAddElem newYVec hold))
           (putpropq newXVec (getq xVec name) name)
           (putpropq newYVec (getq yVec name) name)
           (putpropq newXVec (getq xVec units) units)
           (putpropq newYVec (getq yVec units) units)
           (setq newWave (drCreateWaveform newXVec newYVec))
           (famSetExpr newWave `(abHoldPoints ,(famGetExpr wave)))
           newWave
           ))
        ((famIsFamily wave)
         (famMap 'abHoldPoints wave))
        (t
          (error "abHoldPoints: can't handle %L\n" wave))
        )
      )
    
    
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
     '(nil
      function abHoldPoints
      name abHoldPoints
      description "Hold each point in waveform to create sample-hold type waveform" 
      category ("Custom Functions")
      analysis (nil
          general (nil
            args (wave )
              signals (nil
                    wave (nil
                          prompt "Waveform"
                          tooltip "Waveform"
                          )
               )
              params(nil
              )
            inputrange t
          )
      )
      outputs(result)
     )
    )
    

    Here's a waveform showing how it works (on a simple sampled sine wave):

    Let me know if this works for you!

    Regards,

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to dontpanic

    Hi Jorge,

    I just wrote this function which I think will do what you want. It allows you to hold each point in a waveform until the next one - so you should be able to use it on the output of abCrossTwoWaves.

    /* abHoldPoints.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       May 12, 2022 
    Modified   
    By         
    
    Calculator function to convert a waveform with a set of points 
    to be sample-and-held (of sorts). What this means is that if
    you plot the input waveform, it would have a line between 
    successive points; the output of the function will hold the
    value at one point, and then switch instantaneously to the
    new value at the next point - you'll see this as a staircase
    waveform.
    
    The code includes the calculator function template, so can be
    added to the calculator using the "fx" button in the function
    panel in the calculator, or the + button in the expression builder.
    
    ***************************************************
    
    SCCS Info: @(#) abHoldPoints.il 05/12/22.13:44:50 1.2
    
    */
    
    /***************************************************************
    *                                                              *
    *                     (abHoldPoints wave)                      *
    *                                                              *
    *    Take a waveform and hold each value to the next point,    *
    *         generating a sample-and-held like waveform.          *
    *                                                              *
    ***************************************************************/
    
    (defun abHoldPoints (wave)
      (cond
        ((drIsWaveform wave)
         (let (xVec yVec newXVec newYVec newWave len hold x)
           (setq xVec (drGetWaveformXVec wave))
           (setq yVec (drGetWaveformYVec wave))
           (setq len (drVectorLength xVec))
           (setq newXVec (drCreateVec (drType xVec) (times len 2)))
           (setq newYVec (drCreateVec (drType yVec) (times len 2)))
           (for ind 0 (sub1 len)
                (setq x (drGetElem xVec ind))
                ;------------------------------------------------------------
                ; Note, this will create a zero-time step. Probably fine
                ; in most cases unless you're trying to take the 
                ; derivative!
                ;------------------------------------------------------------
                (when hold
                  (drAddElem newXVec x)
                  (drAddElem newYVec hold))
                (setq hold (drGetElem yVec ind))
                (drAddElem newXVec x)
                (drAddElem newYVec hold))
           (putpropq newXVec (getq xVec name) name)
           (putpropq newYVec (getq yVec name) name)
           (putpropq newXVec (getq xVec units) units)
           (putpropq newYVec (getq yVec units) units)
           (setq newWave (drCreateWaveform newXVec newYVec))
           (famSetExpr newWave `(abHoldPoints ,(famGetExpr wave)))
           newWave
           ))
        ((famIsFamily wave)
         (famMap 'abHoldPoints wave))
        (t
          (error "abHoldPoints: can't handle %L\n" wave))
        )
      )
    
    
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
     '(nil
      function abHoldPoints
      name abHoldPoints
      description "Hold each point in waveform to create sample-hold type waveform" 
      category ("Custom Functions")
      analysis (nil
          general (nil
            args (wave )
              signals (nil
                    wave (nil
                          prompt "Waveform"
                          tooltip "Waveform"
                          )
               )
              params(nil
              )
            inputrange t
          )
      )
      outputs(result)
     )
    )
    

    Here's a waveform showing how it works (on a simple sampled sine wave):

    Let me know if this works for you!

    Regards,

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
  • jorgeluislagos
    jorgeluislagos over 3 years ago in reply to Andrew Beckett

    Hi Andrew, sorry for my late reply; thanks a million for the custom function, it totally solves the problem!

    Cheers,

    Jorge.

    • 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