SKILL: Is this the simplest way to extract the x-axis of a waveform?

Discussion in 'Cadence' started by Svenn Are Bjerkem, Nov 12, 2007.

  1. Hi,
    looking at some of the code examples posted here I came up with the
    following code to get the x-axis of a waveform returned as a list. My
    question is just: Is this really the simplest/best way to do this
    task?

    xvec = drGetWaveformXVec( waveform )
    (let (i alist) for(i 0 sub1(drVectorLength(xvec)) alist=tconc(alist
    drGetElem(xvec i))) car(alist))

    it works as expected, that is not the problem, but if there is already
    a dr* or awv* function that I don't know about it would probably be
    better.
     
    Svenn Are Bjerkem, Nov 12, 2007
    #1
  2. Hi Svenn,

    That's pretty similar to my code below (I just have an additional
    option to allow the data to be transposed, and also I'm outputing
    the x and y values):

    /* abWaveToList.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Nov 17, 2003
    Modified
    By

    Convert a waveform to a list

    ***************************************************

    SCCS Info: @(#) abWaveToList.il 11/17/03.15:08:15 1.1

    */

    /************************************************************************
    * *
    * (abWaveToList wave @key transpose) *
    * *
    * Take a waveform object, and return it as a list of xy pairs. Or *
    * if transpose is set, it returns a list of x values followed by a list *
    * of y values. *
    * *
    ************************************************************************/

    (procedure (abWaveToList wave @key transpose)
    (let (xList yList xyList len
    (xVec (drGetWaveformXVec wave))
    (yVec (drGetWaveformYVec wave))
    )
    (setq len (drVectorLength xVec))
    ;-----------------------------------------------------------------
    ; Return value of this if is the list
    ;-----------------------------------------------------------------
    (if transpose
    (progn
    (for i 0 (sub1 len)
    (setq xList (tconc xList (drGetElem xVec i)))
    (setq yList (tconc yList (drGetElem yVec i)))
    )
    (list (car xList) (car yList))
    )
    ; else
    (progn
    (for i 0 (sub1 len)
    (setq xyList (tconc xyList (list (drGetElem xVec i)
    (drGetElem yVec i))))
    )
    (car xyList)
    )
    ) ; if
    ) ; let
    ) ; procedure

    Regards,

    Andrew.
     
    Andrew Beckett, Nov 15, 2007
    #2
  3. *Blush* It very much your code *Blush*

    I just found it extremely strange that there is no dr* API function
    that solves this.
     
    Svenn Are Bjerkem, Nov 15, 2007
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.