The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:35pm
Pages: 1
Send Topic Print
wave name in Cadence SKILL function (Read 218 times)
makelo
Community Member
***
Offline



Posts: 34
Hillsboro, OR
wave name in Cadence SKILL function
Dec 30th, 2009, 12:46pm
 
I have a SKILL function that extracts a portion of the Cadence ADE Waveform Data to write to a text file.  My trouble is that for parametric data, several of the 'drXXX' waveform access functions don't work, even though they do work for non-parametric data.

I need help breaking the parametric wave into single arrays that allow me to find:
1. the swept wave name (Vgs),
2. swept wave length
3. resultant wave name (Id).
It would be great to be able to use 'drType' and 'drVectorLength'

I call my example function with:
  log_waves(Id "Id")

Here is the function
Code:
procedure( log_waves(wave filename)
  let((p xwve ywve file1)
    file1 = strcat(getShellEnvVar("TBDIR") "/wave/" filename)
    if(isFileName(file1) then
	  println(strcat(file1 " -> rewritten"))
    else
	  println(strcat(file1 " -> created"))
    )
    p = outfile(file1 "w")

    ;--------info about wave--------
    fprintf(p strcat("File " file1 "\n"))
    fprintf(p strcat("Wave Name = " filename "\n"))
    fprintf(p strcat("Is parametric data = " drIsParamWave(wave) "\n"))
    fprintf(p strcat("XType = "   drGetWaveformXType(wave) "\n"))
    fprintf(p strcat("YType = "   drGetWaveformXType(wave) "\n"))
    fprintf(p strcat("Param Name = "   famGetSweepName(wave) "\n"))

    ;--------info about xwve--------
    xwve = drGetWaveformYVec(wave)
    ;fprintf(p strcat("XType = "   drGetWaveformXType(xwve) "\n"))
    ;fprintf(p strcat("YType = "   drGetWaveformYType(xwve) "\n"))
    ;fprintf(p strcat("Length= "   drVectorLength(xwve) "\n"))
    fprintf(p strcat("Type  = "   drType(xwve) "\n"))

    ;--------info about ywve--------
    ywve = drGetWaveformYVec(wave)
    ;fprintf(p strcat("XType = "   drGetWaveformXType(ywve) "\n"))
    ;fprintf(p strcat("YType = "   drGetWaveformYType(ywve) "\n"))
    ;fprintf(p strcat("Length= "   drVectorLength(ywve) "\n"))
    fprintf(p strcat("Type  = "   drType(ywve) "\n"))

    close(p)
  )
) 



with results:

Code:
File
/home/projectpath/testbench/wave/Id
Wave Name = Id
Is parametric data = t
XType = double
YType = double
Param Name = W
Type  = waveform
Type  = waveform
 



The example data is from a parametric dc-dc sweep of "Vgs", with a parameter sweep of "W" and readout "Id".

The Param Name can be found with famGetSweepName() but I am not sure how to get the sweep names "Vgs" and "Id".  I tried extracting the x and y data with drGetWaveformXType() but that did not work and I commented those line out.  There must be a way to break the columns of data into individual waves, right??



References:
1. Virtuoso Analog Design Environment SKILL Language Reference

2 wave stucture basics: http://www.designers-guide.org/Forum/YaBB.pl?num=1141952888
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

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

Posts: 1742
Bracknell, UK
Re: wave name in Cadence SKILL function
Reply #1 - Jan 3rd, 2010, 1:06am
 
If the inner sweep was done as a dc sweep, the name of the inner sweep may not be kept as such - for example, if I do:

Code:
sweepvgs sweep dev=vgs param=dc start=0 stop=2 step=200m {
  dcAnalysis dc dev=vds start=0 stop=5 step=20m
}
 



Then the inner sweep name is "dc" in my case. Without seeing your data, it's a little hard to be sure exactly what you'll get. sweepNames() should tell you all the names of the axes.

The usual way of handling data that may or may not be parametric is to us the famIsFamily() function and then famMap() - as in the example I posted in one of the references you mentioned.

Alternatively, the structure is quite simple. If it's family data, then the x-axis is a vector with each element being the value of that point in the sweep, whereas the y-axis is a vector with each element being the waveform for that point in the sweep. BTW, your code has a typo - you print the YType, but are using the XType function to retrieve it - that said, it would still say double...

So, if you did this:

x=drGetWaveformXVec(wave)
y=drGetWaveformYVec(wave)
len=drVectorLength(x)
for(i 0 len-1
 printf("First wave is at x value %g\n" drGetElem(x i)
 subWave=drGetElem(y i)
 printf("Sub wave x-axis name is %L\n" drGetWaveformXVec(subWave)~>name)
 printf("Sub wave y-axis expression is %L\n" drGetWaveformYVec(subWave)~>expression)
 plot(subWave)
)

Hopefully that gives you enough hints to decompose the waveform the way you want?

Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
pancho_hideboo
Senior Fellow
******
Offline



Posts: 1424
Real Homeless
Re: wave name in Cadence SKILL function
Reply #2 - Jan 4th, 2010, 6:34am
 
Back to top
 
 
View Profile WWW Top+Secret Top+Secret   IP Logged
makelo
Community Member
***
Offline



Posts: 34
Hillsboro, OR
Re: wave name in Cadence SKILL function
Reply #3 - Feb 3rd, 2010, 10:21am
 
Thank you all for the SKILL advice.  I have refined the skill function so that it now works to display the necessary header information and then uses OcnPrint to print the wave data from either single simulations or parametric simulations.

Here is my updated SKILL code:
Code:
procedure( log_waves(wave filename)
  let((p)
    file1 = strcat(getShellEnvVar("TBDIR") "/wave/" filename)
    p = outfile(file1 "w")

    ;--------info about wave--------
    fprintf(p "---------------------------------------------------------------\n")
    fprintf(p "-		Cadence ADE Waveform Output			    -\n")
    fprintf(p "-		generated by skill code 'logwaves'		   -\n")
    fprintf(p "---------------------------------------------------------------\n")
    fprintf(p strcat("Waveform Name   = " filename "\n"))
    isparam = drIsParamWave(wave)
    ;fprintf(p strcat("Is parametric data = " isparam "\n"))

    if( isparam == t then
	swpname = sweepNames(wave)
	outerName=car(sweepNames(wave))
	fprintf(p strcat("OuterSweep Name = "   outerName "\n"))
	foreach(outerVal sweepValues(wave)
	  inner=value(wave outerName outerVal)
	  innerName=car(sweepNames(inner))
	)
	fprintf(p strcat("InnerSweep Name = "   innerName "\n"))
	fprintf(p "Num Columns %s = %d \n" outerName length(sweepValues(wave)) )
    else
	swpname = sweepNames(wave)
	outerName=car(sweepNames(wave))
	fprintf(p strcat("OuterSweep Name = "   outerName "\n"))
	fprintf(p strcat("InnerSweep Name = none \n"))
	fprintf(p "Num Columns %s = 1 \n" outerName )
    )
    ;fprintf(p strcat("File location = " file1 "\n")); old
    fprintf(p strcat("Test bench directory = " getShellEnvVar("TBDIR") "\n"))
    ocnPrint(?output p ?numberNotation 'scientific wave)
    close(p)
  )
)
 


which for my simple example of a parametric sweep of a transistor's width while measuring gm vs. Vgs produces the following:
Code:
---------------------------------------------------------------
-		Cadence ADE Waveform Output			    -
-		generated by skill code 'logwaves'		   -
---------------------------------------------------------------
Waveform Name   = gm
OuterSweep Name = W
InnerSweep Name = Vgs
Num Columns W = 2
Test bench directory = /home/lehne/SampleRx/Gmcells/designs/tb_nfet_Id_Vds

Vgs		   getData("T0:gm    getData("T0:gm

W		     1.000e-06	   4.000e-05
 3.00000e-01	 4.40907e-06	 1.32986e-04
 3.10000e-01	 5.71620e-06	 1.72568e-04
 3.20000e-01	 7.40040e-06	 2.23675e-04
 3.30000e-01	 9.56440e-06	 2.89519e-04
 3.40000e-01	 1.23351e-05	 3.74117e-04
 3.50000e-01	 1.58670e-05	 4.82440e-04
 3.60000e-01	 2.03443e-05	 6.20543e-04
 3.70000e-01	 2.59807e-05	 7.95668e-04
 3.80000e-01	 3.30147e-05	 1.01624e-03
 3.90000e-01	 4.16990e-05	 1.29170e-03
--snip--
 


The extra header information allows easy reading of the ascii file by my import scripts.
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

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

Posts: 1742
Bracknell, UK
Re: wave name in Cadence SKILL function
Reply #4 - Feb 3rd, 2010, 12:05pm
 
Judging by some of the code, I'm presuming you also looked at http://www.cadence.com/Community/forums/p/14425/24431.aspx#24431 !

Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
makelo
Community Member
***
Offline



Posts: 34
Hillsboro, OR
Re: wave name in Cadence SKILL function
Reply #5 - Feb 3rd, 2010, 1:47pm
 
Yes.  The foreach(outerVal sweepValues(data)loop makes stepping through the inner sweep names possible.

However, instead of using the fprintf function, as in the link, to print out the arrays inside the loop, I simply used OcnPrint since it already works for a wide variety of parametric, monte carlo sweeps and using the fprintf function would require a separate procedure to handle each case.
Back to top
 
 
View Profile   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.