• 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 20259
  • 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
  • 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
  • swdesigner
    swdesigner over 13 years ago

    vec = drGetWaveformXVec( IT("/L3/MINUS") )

    then

    drGetElem( vec (drVectorLength( vec)-1) )

    does it. How would one use ymax( xval ( wave) )?

     

    Thanks

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

    Yes, that's effectively the same as using the abLastX function in my previous post - abLastX(IT("/L3/MINUS"))

    You for the ymax(xval(wave)) you'd use ymax(xval(IT("/L3/MINUS"))) - for example.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Abhishek D
    Abhishek D over 11 years ago
    Hi Andrew, I was also searching for the same answer and came across this thread. I would really appreciate if you can explain why that code is a better option for getting the time rather than the small command that can easily be done through Cadence Calc. Please pardon my ignorance in skill language. I am asking this question because I have 100s of GB data for waveform and I have to use the time as a variable in my ocean script. Best Regards Abhishek
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Abhishek D
    Abhishek D over 11 years ago

    Hi Andrew,

                        I have used both the method and facnig this problem.

    load "ResultProcessing.ocn"

    ERROR: Unable to allocate memory for variable transitions block (tran).

    ERROR: Unable to allocate memory for variable transitions block (tran).

    ERROR: Unable to allocate memory for variable transitions block (tran). 

    and then simulations halts.

    Please let me know if you require more information on this.

     

    Best Regards

    Abhishek 

      

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Abhishek D said:
    Hi Andrew, I was also searching for the same answer and came across this thread. I would really appreciate if you can explain why that code is a better option for getting the time rather than the small command that can easily be done through Cadence Calc. Please pardon my ignorance in skill language. I am asking this question because I have 100s of GB data for waveform and I have to use the time as a variable in my ocean script. Best Regards Abhishek

     

    If you use the code that I provided, it will register some new functions in the calculator, so they are just as easy to use as the built-in functions. The ymax() approach is less efficient, because whilst it doesn't have to really generate a new waveform (the xval function simply takes the x-vector of the existing waveform and  creates a new waveform the x and y vectors the same as the original waveform), it still has to search along the entire waveform to find the greatest y value (which is in fact the greatest x value). My code simply looks at the last value, so is more efficient.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Abhishek D said:

    ERROR: Unable to allocate memory for variable transitions block (tran). 

    and then simulations halts.

    Please let me know if you require more information on this.

     

    First of all, you've not followed the Forum Guidelines which ask you not to post on the end of an old thread (especially when this is not really relevant to the original thread). You also didn't give the version you're using. You've also posted the same question at the end of another thread (it tells you not to post in more than one place).

    Put simply, your problem is that you've run out of memory. Most likely you're running a 32-bit version of the software, and this could be addressed (in IC614 onwards) by running viva or virtuoso in 64 bit mode.

    See solution 11715812. If you're running in IC5141, your only options would be to open the database in simvision (iin 64 bit mode) - see solution 11147828, or to run viva from IC615/IC616.

    Kind Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Abhishek D
    Abhishek D over 11 years ago
    Hi Andrew,

    Thanks for the explanation. I got the function in user defined tab and was able to use it. Some how as far as time to produce the result was concerned , I didn't get much benefit. When I was doing PVT simulation then I faced low memory problem which I guess is solved by using 64 bit version of Ocean.

    Thanks
    Abhishek
    • 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