Home > Community > Forums > Custom IC SKILL > Creating a Waveform from a Vector or a List

## Email

Recipients email * (separate multiple addresses with commas)

Message *

 Send yourself a copy

## Subscribe

Intro copy of the newsletter section here, some intro copy of the newsletter. Instruction of how to subscribe to this newsletter.

First Name *

Last Name *

Email *

Company / Institution *

 Send Yourself A Copy

# Creating a Waveform from a Vector or a List

Last post Wed, Aug 19 2009 12:52 AM by Orcun Kilic. 3 replies.
 Started by Orcun Kilic 13 Aug 2009 02:52 AM. Topic has 3 replies and 2486 views
• #### Thu, Aug 13 2009 2:52 AM

Creating a Waveform from a Vector or a List
 I would really appreciate it, if someone could tell me how to turn a List or a Vector into a Waveform. I couldnt find anything about it in user references. Thanks! Orcun
• Post Points: 35
• #### Sat, Aug 15 2009 11:36 PM

Re: Creating a Waveform from a Vector or a List
 You can use something like the following SKILL code to do this: ```/* abMakeWaveform.il Author A.D.Beckett Group Custom IC (UK), Cadence Design Systems Ltd. Language SKILL Date Jul 14, 1999 Modified Dec 10, 2007 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. Finally a fourth argument may be given if the x-axis wants to be a different type. For example for bar graphs: abMakeWaveform('(1 -2 4) '("NOM" "SLOW" "FAST") 'double 'string) *************************************************** SCCS Info: @(#) abMakeWaveform.il 12/10/07.13:48:06 1.4 */ /******************************************************************************* * DISCLAIMER: The following code is provided for Cadence customers to use at * * their own risk. The code may require modification to satisfy the * * requirements of any user. The code and any modifications to the code may * * not be compatible with current or future versions of Cadence products. * * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING WITHOUT * * LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES OF MERCHANTABILITY * * OR FITNESS FOR A PARTICULAR USE. * *******************************************************************************/ /*************************************************************** * * * 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 (yDataType 'double) xDataType) (let (xVec yVec wave) (setq wave (drCreateEmptyWaveform)) (unless xDataType (setq xDataType yDataType)) (setq xVec (drCreateVec xDataType xvalues)) (setq yVec (drCreateVec yDataType (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 (yDataType 'double) xDataType) (let (xVec yVec wave) (when (and (listp xvalues) (equal (length xvalues) (length yvalues))) (setq wave (drCreateEmptyWaveform)) (unless xDataType (setq xDataType yDataType)) (setq xVec (drCreateVec xDataType xvalues)) (setq yVec (drCreateVec yDataType yvalues)) (drPutWaveformXVec wave xVec) (drPutWaveformYVec wave yVec) wave ) )) ``` Regards,Andrew.
• Post Points: 20
• #### Tue, Aug 18 2009 6:56 PM

• gilberts
• Joined on Tue, Jun 23 2009
• Posts 9
• Points 105
Re: Creating a Waveform from a Vector or a List
 Have you tried "awvPlotList" or "artListToWaveform""awvPlotList"1. assign variables for list and waveform window xlist = list(0 1 2 3 4 5 6 7 8 9 10) ;points for x-axisylist = list(0 1 2 3 4 5 4 3 2 1 0) ;points for y-axiswin = newWindow()2. plot your list with "awvPlotList"awvPlotList( win list( ylist ) xlist ) "artListToWaveform" 1. assign variables for list and waveform window xylist = '( (0 0) (1 1) (2 2) (3 3) (4 2) (5 1) (6 0) ) ;points for xy-axiswin = newWindow()2. convert List to Waveformwave=artListToWaveform( xylist ) 3. plot awvPlotWaveform( win list( wave ) ?expr list("xylist") ) I hope this would help.Best regards,Gilbert
• Post Points: 5
• #### Wed, Aug 19 2009 12:52 AM

Re: Creating a Waveform from a Vector or a List
 Thanks a lot for the help, it works now. I wish searching cadence help documents was easier regards
• Post Points: 5