• 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 SKILL
  3. How to find the final time value of a signal?

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 20269
  • 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

How to find the final time value of a signal?

swdesigner
swdesigner over 13 years ago

( I did search the forum and support.cadence.. no luck)

Say my simulation terminates earlier than the input file specifies, I want to analyze the last 10 us of a waveform. 

How can I get tmax, which is the final timepoint?

xmax gives the time value corresponding to the max value that the signal attained.

Thanks

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    You could do this with ymax(xval(waveform)) but a more efficient way (for large waveforms) would be to use the code below:

    /* abFirstLast.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Mar 02, 2009 
    Modified   
    By         
    
    Functions for finding the first and last X and Y points
    in a waveform. To register abFirstX, abFirstY, abLastX, abLastY
    with the calculator (so they show up in the user defined special
    functions), call
    
    abRegFirstLastCalcFunctions()
    
    ***************************************************
    
    SCCS Info: @(#) abFirstLast.il 02/19/14.08:11:54 1.2
    
    */
    
    /***************************************************************
    *                                                              *
    *                       (abFirstY wave)                        *
    *                                                              *
    *          Return the first Y value from the waveform          *
    *                                                              *
    ***************************************************************/
    (defun abFirstY (wave)
      (cond
        ((drIsWaveform wave)
         (drGetElem (drGetWaveformYVec wave) 0)
         )
        ((famIsFamily wave)
         (famMap 'abFirstY wave))
        (t
          (error "abFirstY: can't handle %L\n" wave)
          )
        )
      ) ; defun abFirstY
    
    /***************************************************************
    *                                                              *
    *                       (abFirstX wave)                        *
    *                                                              *
    *          Return the first X value from the waveform          *
    *                                                              *
    ***************************************************************/
    (defun abFirstX (wave)
      (cond
        ((drIsWaveform wave)
         (drGetElem (drGetWaveformXVec wave) 0)
         )
        ((famIsFamily wave)
         (famMap 'abFirstX wave))
        (t
          (error "abFirstX: can't handle %L\n" wave)
          )
        )
      ) ; defun abFirstX
    
    /***************************************************************
    *                                                              *
    *                        (abLastY wave)                        *
    *                                                              *
    *          Return the last Y value from the waveform           *
    *                                                              *
    ***************************************************************/
    (defun abLastY (wave)
      (cond
        ((drIsWaveform wave)
         (let (len vec)
           (setq vec (drGetWaveformYVec wave))
           (setq len (drVectorLength vec))
           (drGetElem vec (sub1 len))
           )
         )
        ((famIsFamily wave)
         (famMap 'abLastY wave))
        (t
          (error "abLastY: can't handle %L\n" wave)
          )
        )
      ) ; defun abLastY
    
    /***************************************************************
    *                                                              *
    *                        (abLastX wave)                        *
    *                                                              *
    *          Return the last X value from the waveform           *
    *                                                              *
    ***************************************************************/
    (defun abLastX (wave)
      (cond
        ((drIsWaveform wave)
         (let (len vec)
           (setq vec (drGetWaveformXVec wave))
           (setq len (drVectorLength vec))
           (drGetElem vec (sub1 len))
           )
         )
        ((famIsFamily wave)
         (famMap 'abLastY wave))
        (t
          (error "abLastX: can't handle %L\n" wave)
          )
        )
      ) ; defun abLastX
    
    /***************************************************************
    *                                                              *
    *                 (abFirstLastGenCB funcName)                  *
    *                                                              *
    *   Macro (and invocations) to build the calculator callback   *
    *                          functions.                          *
    *                                                              *
    ***************************************************************/
    (defmacro abFirstLastGenCB (funcName)
      `(defun ,(concat funcName 'CB) ()
         (calSpecialFunctionInput (quote ,funcName) nil)
         ))
    (abFirstLastGenCB abFirstX)
    (abFirstLastGenCB abFirstY)
    (abFirstLastGenCB abLastX)
    (abFirstLastGenCB abLastY)
    
    /***************************************************************
    *                                                              *
    *                (abRegFirstLastCalcFunctions)                 *
    *                                                              *
    * Register all four first/last functions as special functions  *
    *                     for the calculator.                      *
    *                                                              *
    ***************************************************************/
    (defun abRegFirstLastCalcFunctions ()
      (foreach func '(abFirstX abFirstY abLastX abLastY)
               (calRegisterSpecialFunction
                 (list (get_string func) (concat func 'CB)))
               )
      ) ; defun abRegFirstLastCalcFunctions

     

     

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

    You could do this with ymax(xval(waveform)) but a more efficient way (for large waveforms) would be to use the code below:

    /* abFirstLast.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Mar 02, 2009 
    Modified   
    By         
    
    Functions for finding the first and last X and Y points
    in a waveform. To register abFirstX, abFirstY, abLastX, abLastY
    with the calculator (so they show up in the user defined special
    functions), call
    
    abRegFirstLastCalcFunctions()
    
    ***************************************************
    
    SCCS Info: @(#) abFirstLast.il 02/19/14.08:11:54 1.2
    
    */
    
    /***************************************************************
    *                                                              *
    *                       (abFirstY wave)                        *
    *                                                              *
    *          Return the first Y value from the waveform          *
    *                                                              *
    ***************************************************************/
    (defun abFirstY (wave)
      (cond
        ((drIsWaveform wave)
         (drGetElem (drGetWaveformYVec wave) 0)
         )
        ((famIsFamily wave)
         (famMap 'abFirstY wave))
        (t
          (error "abFirstY: can't handle %L\n" wave)
          )
        )
      ) ; defun abFirstY
    
    /***************************************************************
    *                                                              *
    *                       (abFirstX wave)                        *
    *                                                              *
    *          Return the first X value from the waveform          *
    *                                                              *
    ***************************************************************/
    (defun abFirstX (wave)
      (cond
        ((drIsWaveform wave)
         (drGetElem (drGetWaveformXVec wave) 0)
         )
        ((famIsFamily wave)
         (famMap 'abFirstX wave))
        (t
          (error "abFirstX: can't handle %L\n" wave)
          )
        )
      ) ; defun abFirstX
    
    /***************************************************************
    *                                                              *
    *                        (abLastY wave)                        *
    *                                                              *
    *          Return the last Y value from the waveform           *
    *                                                              *
    ***************************************************************/
    (defun abLastY (wave)
      (cond
        ((drIsWaveform wave)
         (let (len vec)
           (setq vec (drGetWaveformYVec wave))
           (setq len (drVectorLength vec))
           (drGetElem vec (sub1 len))
           )
         )
        ((famIsFamily wave)
         (famMap 'abLastY wave))
        (t
          (error "abLastY: can't handle %L\n" wave)
          )
        )
      ) ; defun abLastY
    
    /***************************************************************
    *                                                              *
    *                        (abLastX wave)                        *
    *                                                              *
    *          Return the last X value from the waveform           *
    *                                                              *
    ***************************************************************/
    (defun abLastX (wave)
      (cond
        ((drIsWaveform wave)
         (let (len vec)
           (setq vec (drGetWaveformXVec wave))
           (setq len (drVectorLength vec))
           (drGetElem vec (sub1 len))
           )
         )
        ((famIsFamily wave)
         (famMap 'abLastY wave))
        (t
          (error "abLastX: can't handle %L\n" wave)
          )
        )
      ) ; defun abLastX
    
    /***************************************************************
    *                                                              *
    *                 (abFirstLastGenCB funcName)                  *
    *                                                              *
    *   Macro (and invocations) to build the calculator callback   *
    *                          functions.                          *
    *                                                              *
    ***************************************************************/
    (defmacro abFirstLastGenCB (funcName)
      `(defun ,(concat funcName 'CB) ()
         (calSpecialFunctionInput (quote ,funcName) nil)
         ))
    (abFirstLastGenCB abFirstX)
    (abFirstLastGenCB abFirstY)
    (abFirstLastGenCB abLastX)
    (abFirstLastGenCB abLastY)
    
    /***************************************************************
    *                                                              *
    *                (abRegFirstLastCalcFunctions)                 *
    *                                                              *
    * Register all four first/last functions as special functions  *
    *                     for the calculator.                      *
    *                                                              *
    ***************************************************************/
    (defun abRegFirstLastCalcFunctions ()
      (foreach func '(abFirstX abFirstY abLastX abLastY)
               (calRegisterSpecialFunction
                 (list (get_string func) (concat func 'CB)))
               )
      ) ; defun abRegFirstLastCalcFunctions

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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