Home > Community > Forums > Custom IC SKILL > How to find the final time value of a signal?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to find the final time value of a signal? 

Last post Thu, Jan 2 2014 2:19 AM by Abhishek D. 8 replies.
Started by swdesigner 03 Aug 2012 10:31 AM. Topic has 8 replies and 3373 views
Page 1 of 1 (9 items)
Sort Posts:
  • Fri, Aug 3 2012 10:31 AM

    How to find the final time value of a signal? Reply

    ( 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

    • Post Points: 20
  • Mon, Aug 6 2012 1:48 AM

    Re: How to find the final time value of a signal? Reply

    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

     

     

    • Post Points: 20
  • Wed, Aug 8 2012 4:58 PM

    Re: How to find the final time value of a signal? Reply

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

    then

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

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

     

    Thanks

    • Post Points: 20
  • Wed, Aug 8 2012 10:14 PM

    Re: How to find the final time value of a signal? Reply

    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.

    • Post Points: 20
  • Wed, Jan 1 2014 9:31 AM

    • Abhishek D
    • Not Ranked
    • Joined on Fri, Oct 26 2012
    • Bangalore, Karnataka
    • Posts 14
    • Points 220
    Re: How to find the final time value of a signal? Reply
    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
    • Post Points: 20
  • Wed, Jan 1 2014 10:15 PM

    • Abhishek D
    • Not Ranked
    • Joined on Fri, Oct 26 2012
    • Bangalore, Karnataka
    • Posts 14
    • Points 220
    Re: How to find the final time value of a signal? Reply

    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 

      

    • Post Points: 20
  • Thu, Jan 2 2014 2:10 AM

    Re: How to find the final time value of a signal? Reply

    Abhishek D:
    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.

    • Post Points: 20
  • Thu, Jan 2 2014 2:15 AM

    Re: How to find the final time value of a signal? Reply

    Abhishek D:

    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.

     

    • Post Points: 5
  • Thu, Jan 2 2014 2:19 AM

    • Abhishek D
    • Not Ranked
    • Joined on Fri, Oct 26 2012
    • Bangalore, Karnataka
    • Posts 14
    • Points 220
    Re: How to find the final time value of a signal? Reply
    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
    • Post Points: 5
Page 1 of 1 (9 items)
Sort Posts:
Started by swdesigner at 03 Aug 2012 10:31 AM. Topic has 8 replies.