graph from skill

Discussion in 'Cadence' started by Suresh Jeevanandam, Sep 15, 2006.

  1. Hi all,
    What is the easiest way to create a graph from inside Skill.

    eg.
    declare(a[100])
    pi = asin(1.0)*2.0
    for(i 0 99 a = sin(2*pi*i/99))

    Now how to plot 'a' ?

    regards,
    Suresh
     
    Suresh Jeevanandam, Sep 15, 2006
    #1


  2. Suresh,

    A couple of ways this can be done.

    1. Use awvPlotList() - given two lists
    2. Use the following code (or something similar) to build a waveform object.
    With your example, it would be:

    defMathConstants('math)
    a=abMakeWaveform(lambda((x) sin(2*math.PI*x/99.0)) linRg(0 99 1))
    plot(a)

    Regards,

    Andrew.


    /* abMakeWaveform.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Jul 14, 1999
    Modified Feb 26, 2002
    By A.D.Beckett

    A simple function to throw together waveforms for
    test purposes. Usage:

    abMakeWaveform('cos linRg(1 100 1)) => o_waveObj

    Returns a waveform with x axis 1 to 100, in 1 steps, with y
    axis the value of the x.

    A more complex example:

    abMakeWaveform(lambda((x) x*sin(x)) linRg(-40 40 0.1))

    Can be plotted in OCEAN using plot(var).

    Also supports the first argument being a list of y values:

    abMakeWaveform('(5 6 7) '(1 2 3))

    Note the lists must be equal length.

    An optional third argument which is the data type may be supplied,
    e.g. 'double (default) 'single etc.

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

    SCCS Info: @(#) abMakeWaveform.il 02/26/02.21:54:16 1.3

    */

    /***************************************************************
    * *
    * The generic function takes a function object, or the name of *
    * a function (a symbol) and calls that function for *
    * each of the x values. This would be nice if it could be *
    * done as a method, but the problem is that you can only *
    * have a method specialised on user defined functions, not *
    * binary functions. *
    * *
    ***************************************************************/

    (defgeneric abMakeWaveform (func xvalues @optional (dataType 'double))
    (let (xVec yVec wave)
    (setq wave (drCreateEmptyWaveform))
    (setq xVec (drCreateVec dataType xvalues))
    (setq yVec (drCreateVec dataType (mapcar func xvalues)))
    (drPutWaveformXVec wave xVec)
    (drPutWaveformYVec wave yVec)
    wave
    ))

    /****************************************************************
    * *
    * A method is defined to allow the first argument to be a list, *
    * and do something different there. *
    * *
    ****************************************************************/

    (defmethod abMakeWaveform ((yvalues list) xvalues @optional (dataType 'double))
    (let (xVec yVec wave)
    (when
    (and (listp xvalues) (equal (length xvalues) (length yvalues)))
    (setq wave (drCreateEmptyWaveform))
    (setq xVec (drCreateVec dataType xvalues))
    (setq yVec (drCreateVec dataType yvalues))
    (drPutWaveformXVec wave xVec)
    (drPutWaveformYVec wave yVec)
    wave
    )
    ))
     
    Andrew Beckett, Sep 19, 2006
    #2
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.