• 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. Unwrap a waveform

Stats

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

Unwrap a waveform

debaabed
debaabed over 5 years ago

Hi All

In Viva, is there a function available to unwrap a waveform by defining its wrap-over value. For eg: please see the below plot. I want to generate lower plot from the upper plot. There are phaseDegunwrap and phaseRadunwrap, they don't serve this purpose. 

I would be grateful if I can get few pointers towards solving this.

  • Cancel
Parents
  • ShawnLogan
    ShawnLogan over 5 years ago

    Dear debaabed,

    debaabed said:
    In Viva, is there a function available to unwrap a waveform by defining its wrap-over value. For eg: please see the below plot. There are phaseDegunwrap and phaseRadunwrap, they don't serve this purpose. 

    I am a little confused about which plot you are trying to create - the upper plot from the lower plot or the lower plot from the upper plot? From your description of your question, "to unwrap a waveform by defining its wrap-over value", I think you want to create the upper plot from the lower plot (i.e., unwrap a waveform with some modulus). 

     If so, you essentially are applying a modulus function to a waveform. There is a SKILL function that Cadence has provided for this purpose. It is described in the article at URL:

    support.cadence.com/.../ArticleAttachmentPortal

    Does this help at all debaabed?

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • debaabed
    debaabed over 5 years ago in reply to ShawnLogan

    Hi Shawn

    I should have been more clear. I want to generate lower plot from the upper plot such that it removes the discontinuities and result in a continuous function.  

    Thanks and Regards

    Debasish

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 5 years ago in reply to debaabed

    Hi Debasish,

    debaabed said:
    I want to generate lower plot from the upper plot such that it removes the discontinuities and result in a continuous function.

    I now understand. Thank you for clarifying your question! Hence, the function I pointed you to is not what you want. Sorry.

    Other than functions like "phaseDegUnwrapped()" or its radian equivalent, I am not familiar with a specific function that will accomplish exactly what you want. However, an ocean script that works something like the following might be an approach.

    1. For a waveform y that is limited to some value YLIMIT and periodic with multiple values of YLIMIT, create a new waveform y_prime = y + DELTA where DELTA is  some constant less than YLIMIT that causes y_prime to cross YLIMIT multiple times

    2. Use the cross() function to find the crossing numbers of function y_prime of YLIMIT (use the cycle and time  options of cross()).

    3. For all times of the crossing points of y_prime that are returned, create your desired waveform y_desired as the sum of y and the crossing number*YLIMIT at each crossing time.

    4. Plot the waveform y_desired and compare to the plot of y.

    I am sure this algorithm can be implemented in SKILL if you prefer.

    Hope this provides you some help even though it is not a defined function.

    Shawn

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to ShawnLogan

    There isn't any public function that does this, as far as I know. Whilst there is a private function used within phaseDegUnwrapped and phaseRadUnwrapped, it's not general purpose (only works for complex data).

    What is generating this modulo-pi data? I'd like to understand where it's coming from so that I can make a suitable recommendation as to how this could be written.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • debaabed
    debaabed over 5 years ago in reply to Andrew Beckett

    Hi Andrew

    Let me explain the problem. I need to extract the parameters for a transmission line. I have the transmission line electromagnetic model extraction from Integrand software. To extract the RLGC data, I am following one of the methods which uses open circuit and short circuit impedance. Please see the reference 

    S-parameter-based IC interconnect transmission line characterization, IEEE Transactions on Components, Hybrids and Manufacturing Technology, Vol. 15, Issue:4, Aug 1992

    While calculating the gamma (propagation constant) for the transmission line, its imaginary part has these modulo-pi data. But to use them to calculate the RLGC data, unwrapped gamma is needed.

    The equations are described below. The below code is from ADS.

    I hope I have conveyed my issue. Please let me know.

    Thanks

    DB

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to debaabed

    OK, understood. Hopefully this does what you want? (you can add to the calculator using the fx button in the function panel or in the expression builder) if using IC617/IC618:

    Regards,

    Andrew

    /* abUnwrap.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Apr 06, 2020 
    Modified   
    By         
    
    Provides calculator function to unwrap with arbitrary modulus. Looks
    for sudden large point-point steps in the value.
    
    Usage:
    
    abUnwrap(phase(VF("/sig")) 180.0)
    
    Can also be added to calculator by using the fx button in the function
    panel or expression builder in Explorer/Assembler, as the code
    contains the UI template too.
    
    ***************************************************
    
    SCCS Info: @(#) abUnwrap.il 04/06/20.11:10:48 1.1
    
    */
    
    ; test data
    ; wv=abMakeWaveform(lambda((x) modf(x 1.2u)*1e6) linRg(0 10u 0.09u))
    ; wv=abMakeWaveform(lambda((x) modf(-x 1.2u)*1e6) linRg(0 10u 0.09u))
    
    /*******************************************************************
    *                                                                  *
    *     (abUnwrap wave modulus @optional (maxRelativeDelta 0.5))     *
    *                                                                  *
    * Unwraps a waveform (note, this must be non-complex data) with an *
    *   arbitrary modulus. Unwraps any sudden steps of greater than    *
    *                     maxRelativeDelta*modulus                     *
    *                                                                  *
    *******************************************************************/
    
    (defun abUnwrap (wave modulus @optional (maxRelativeDelta 0.5))
      (cond
        ((drIsWaveform wave)
         (let (xVec yVec newYVec len (correction 0.0) y prevY delta 
                    maxAbsoluteDelta)
           (setq maxAbsoluteDelta (times modulus maxRelativeDelta))
           (setq xVec (drGetWaveformXVec wave))
           (setq yVec (drGetWaveformYVec wave))
           (setq len (drVectorLength xVec))
           (setq newYVec (drCreateVec (drType yVec) len))
           ;-----------------------------------------------------------------
           ; If any successive delta is greater than 50% of the modulus (in a single
           ; step by default) then compute a cumulative correction to keep adding
           ; to the output waveform
           ;-----------------------------------------------------------------
           (for i 0 (sub1 len)
                (setq y (drGetElem yVec i))
                (when prevY
                  (setq delta (difference y prevY))
                  (when (geqp (abs delta) maxAbsoluteDelta)
                    (setq correction 
                          (plus correction (if (plusp delta) (minus modulus) modulus)))
                    )
                  )
                (drSetElem newYVec i (plus y correction))
                (setq prevY y)
                )
           (putpropq newYVec (getq yVec units) units)
           (putpropq newYVec (getq yVec name) name)
           (drCreateWaveform xVec newYVec)
           )
         )
        ((famIsFamily wave)
         (famMap 'abUnwrap wave modulus maxRelativeDelta)
         )
        (t
          (error "abUnwrap: can't handle %L\n" wave)
          )
        )
      )
    
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
     '(nil
      function abUnwrap
      name abUnwrap
      description "Unwrap with arbitrary modulus"
      category ("Custom Functions")
      analysis (nil
          general (nil
            args (wave modulus maxRelativeDelta )
              signals (nil
                    wave (nil
                          prompt "Waveform"
                          tooltip "Waveform"
                          )
               )
              params(nil
                     modulus (nil
                           prompt "Modulus"
                           tooltip "Modulus"
                           guiRowHint 1
                           type float
                           default 180
                           required t
                     )
                     maxRelativeDelta (nil
                           prompt "Max Relative Delta"
                           tooltip "Maximum proportion of modulus which triggers unwrapping"
                           guiRowHint 1
                           type float
                           default 0.5
                           required nil
                     )
              )
            inputrange t
          )
      )
      outputs(result)
     )
    )
    

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

    OK, understood. Hopefully this does what you want? (you can add to the calculator using the fx button in the function panel or in the expression builder) if using IC617/IC618:

    Regards,

    Andrew

    /* abUnwrap.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Apr 06, 2020 
    Modified   
    By         
    
    Provides calculator function to unwrap with arbitrary modulus. Looks
    for sudden large point-point steps in the value.
    
    Usage:
    
    abUnwrap(phase(VF("/sig")) 180.0)
    
    Can also be added to calculator by using the fx button in the function
    panel or expression builder in Explorer/Assembler, as the code
    contains the UI template too.
    
    ***************************************************
    
    SCCS Info: @(#) abUnwrap.il 04/06/20.11:10:48 1.1
    
    */
    
    ; test data
    ; wv=abMakeWaveform(lambda((x) modf(x 1.2u)*1e6) linRg(0 10u 0.09u))
    ; wv=abMakeWaveform(lambda((x) modf(-x 1.2u)*1e6) linRg(0 10u 0.09u))
    
    /*******************************************************************
    *                                                                  *
    *     (abUnwrap wave modulus @optional (maxRelativeDelta 0.5))     *
    *                                                                  *
    * Unwraps a waveform (note, this must be non-complex data) with an *
    *   arbitrary modulus. Unwraps any sudden steps of greater than    *
    *                     maxRelativeDelta*modulus                     *
    *                                                                  *
    *******************************************************************/
    
    (defun abUnwrap (wave modulus @optional (maxRelativeDelta 0.5))
      (cond
        ((drIsWaveform wave)
         (let (xVec yVec newYVec len (correction 0.0) y prevY delta 
                    maxAbsoluteDelta)
           (setq maxAbsoluteDelta (times modulus maxRelativeDelta))
           (setq xVec (drGetWaveformXVec wave))
           (setq yVec (drGetWaveformYVec wave))
           (setq len (drVectorLength xVec))
           (setq newYVec (drCreateVec (drType yVec) len))
           ;-----------------------------------------------------------------
           ; If any successive delta is greater than 50% of the modulus (in a single
           ; step by default) then compute a cumulative correction to keep adding
           ; to the output waveform
           ;-----------------------------------------------------------------
           (for i 0 (sub1 len)
                (setq y (drGetElem yVec i))
                (when prevY
                  (setq delta (difference y prevY))
                  (when (geqp (abs delta) maxAbsoluteDelta)
                    (setq correction 
                          (plus correction (if (plusp delta) (minus modulus) modulus)))
                    )
                  )
                (drSetElem newYVec i (plus y correction))
                (setq prevY y)
                )
           (putpropq newYVec (getq yVec units) units)
           (putpropq newYVec (getq yVec name) name)
           (drCreateWaveform xVec newYVec)
           )
         )
        ((famIsFamily wave)
         (famMap 'abUnwrap wave modulus maxRelativeDelta)
         )
        (t
          (error "abUnwrap: can't handle %L\n" wave)
          )
        )
      )
    
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ocnmRegGUIBuilder(
     '(nil
      function abUnwrap
      name abUnwrap
      description "Unwrap with arbitrary modulus"
      category ("Custom Functions")
      analysis (nil
          general (nil
            args (wave modulus maxRelativeDelta )
              signals (nil
                    wave (nil
                          prompt "Waveform"
                          tooltip "Waveform"
                          )
               )
              params(nil
                     modulus (nil
                           prompt "Modulus"
                           tooltip "Modulus"
                           guiRowHint 1
                           type float
                           default 180
                           required t
                     )
                     maxRelativeDelta (nil
                           prompt "Max Relative Delta"
                           tooltip "Maximum proportion of modulus which triggers unwrapping"
                           guiRowHint 1
                           type float
                           default 0.5
                           required nil
                     )
              )
            inputrange t
          )
      )
      outputs(result)
     )
    )
    

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

    Hi Andrew,

    Thanks for the immense help! I really appreciate the fast response.

    I tried this function and it does exactly what I needed.

    Thanks and Regards

    DB

    • 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