The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 6th, 2024, 5:40am
Pages: 1
Send Topic Print
Analog Artist Waveform data structures? (Read 4778 times)
David Sobel
New Member
*
Offline



Posts: 6
Univ of California--Berkeley
Analog Artist Waveform data structures?
Mar 09th, 2006, 5:08pm
 
Hi,

I have a number of questions, all of which can probably be answered by someone telling me the nature of the data structure that Artist uses for its waveforms. In short, if I knew the data structure and a good set of data access functions, there are a lot of things that would be FAR EASIER to do. The Artist Skill language reference lists a few relevant data access functions (i.e. drGetWaveformXvec, drCreateVec, etc), but they are a very limited, very klugdey set of data access functions. If someone can answer the following questions, and/or point me to a more exhaustive reference, I would really appreciate it!

Here are some sample issues I have:

1. If I type
      plot(VT("/net9")
as expected I get a plot of net9 with the waveform caption  VT("/net9") .  But if I type:  
         foo = VT("/net9")
         plot(foo)

I get the same plot with the same caption. Therefore the data structure contained in foo MUST contain a field with the string VT("/net9") , right? However, I have no idea how to access that data field or to modify it. (It seems as if the documentation explains how to get the X and Y vectors from a waveform data structure, but nothing else.)

2. I have similar issues with the data structures used for vectors. They are different than the list data structure, so there are very few data access/manipulation functions for this structure. For instance, I'm trying to right a function to calculate the SFDR of a waveform. In order to do this, I take a transient waveform and do the FFT of it. It's easy to get the magnitude of the peak tone in the fft (using the ymax function), but far harder to get the magnitude of the biggest spurious tone. I've managed to solve this issue by writing some really inelegant skill code, but if I understood how the data structure for drvec 's were structured (and manipulated/accessed), these tasks would be far easier.

These are examples of what I'm up against. Any info you have on the drwave and drvec data structures would be much appreciated!!

Thanks,
David
Back to top
 
 
View Profile dasobel   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: Analog Artist Waveform data structures?
Reply #1 - Mar 30th, 2006, 5:12am
 
David,

Apologies again (after your PM) for how long its taken me to get to this - just been a bit busy with family rather than having time to look at the Designer's Guide site, but pretty much caught up again now...

Waveforms and vectors are specific objects in SKILL. Waveforms consist of an X and a Y vector, which are accessed like arrays, but using a particular function (drGetElem). There's also drSetElem() to update them. Some examples:

Code:
a=VT("/o1")
drwave:178577432

a~>??
(xScale linear)

a~>xScale
linear

yvec=drGetWaveformYVec(a)
drvec:178569240

yvec~>??
(expression
    VT("/o1") units "V"
)

yvec~>expression
VT("/o1")

yvec~>units
"V"

xvec=drGetWaveformXVec(a)
drvec:178569248

xvec~>??
(units "s" name "time")

drVectorLength(yvec)
343

drType(yvec)
double

drGetElem(yvec 0)
5.0

drGetElem(yvec 123)
1.286023

drGetElem(xvec 0)
0.0

drGetElem(xvec 123)
6.233276e-09
 



As you can see from this, the expression is stored as a list on the y vector (a resonable place for it to be). Of course, it gets a bit more complicated with family curves, but the famMap function is usually what you'd use to iterate over those.

Here's some example code which traverses a waveform, and does a modulo operation - it reads the source waveform, and builds a new waveform object from it. It also manipulates some of the properties on the waveform/vectors too. It's written in LISP syntax (tends to be my preference), but I think the meaning should be clear enough. You can always pp() it to convert it into C-like syntax if LISP syntax defeats you!

Code:
/* abModulo.il

Author     A.D.Beckett
Group	Custom IC (UK), Cadence Design Systems Ltd.
Language   SKILL
Date	 Jul 06, 2005
Modified   Nov 23, 2005
By	   A.D.Beckett

Example use:

plot(abModulo(phaseDegUnwrapped(v("/Pif" ?result "pss_fd"))))

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

SCCS Info: @(#) abModulo.il 11/23/05.18:05:09 1.2

*/

/***************************************************************
*										  *
*	    (abModulo waveform @optional (modulo 360))	    *
*										  *
*	 Take a waveform and return a modulus - strictly	  *
*     positive. Useful for wrapping phase waveforms to be	*
*		   between (say) 0 and 360 degrees.		   *
*										  *
***************************************************************/

(procedure (abModulo waveform @optional (modulo 360))
  (cond
   ;---------------------------------------------------------------------
   ; Handle ordinary waveform
   ;---------------------------------------------------------------------
   ((drIsWaveform waveform)
    (let (oldyvec newyvec len newwave yval)
	 (setq oldyvec (drGetWaveformYVec waveform))
	 (setq len (drVectorLength oldyvec))
	 (setq newyvec (drCreateVec 'double len))
	 ;---------------------------------------------------------------
	 ; Iterate over the points, computing the modulus of each point
	 ;---------------------------------------------------------------
	 (for point 0 (sub1 len)
		(setq yval (drGetElem oldyvec point))
		(setq yval
		    (difference yval
				(times
				 (fix (quotient yval modulo))
				 modulo)))
		(drSetElem newyvec point yval)
		)
	 ;---------------------------------------------------------------
	 ; Set the expression so the name of the waveform is correct
	 ;---------------------------------------------------------------
	 (putpropq newyvec
		   (list 'abModulo (getq oldyvec expression) modulo) expression)
	 (setq newwave
		 (drCreateWaveform
		(drGetWaveformXVec waveform)
		newyvec
		))
	 ;---------------------------------------------------------------
	 ; Inherit the plot style and scale
	 ;---------------------------------------------------------------
	 (putpropq newwave (getq waveform plotStyle) plotStyle)
	 (putpropq newwave (getq waveform plotStyle) xScale)
	 newwave
	 )
    )
   ;---------------------------------------------------------------------
   ; Family waveforms should be handled OK
   ;---------------------------------------------------------------------
   ((famIsFamily waveform)
    (famMap 'abModulo waveform modulo)
    ) ; family
   ;---------------------------------------------------------------------
   ; And straight numbers
   ;---------------------------------------------------------------------
   ((numberp waveform)
    (difference waveform
		(times
		 (fix (quotient waveform modulo))
		 modulo)))
   (t
    (error "abModulo - can't handle %L\n" waveform)
    )
   )
  )
 



Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.