• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to properly handle wave family in custom calculator...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 16481
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to properly handle wave family in custom calculator function

alexstepanov75
alexstepanov75 over 7 years ago

Hi,

I needed a function that will resample waveform using points from another waveform.

So I wrote function below:

;Function to resample sourceWave by points from pointsWave
;sourceWave waveform to be resamled
;pointsWave from this waveform points taken to resample sourceWave
procedure( resampleByWave(sourceWave pointsWave)
let( (xVec yVec wave yFactor numOfPoints thisX sweepVal i sweepName sweepValues currentSourceWave currentPointsWave sweepValType)
cond(
(drIsWaveform(sourceWave)
;printf("%L\n" sourceWave->??)
wave=drCreateEmptyWaveform()
xVec=drGetWaveformXVec(pointsWave);x vector created from pointsWave
numOfPoints=drVectorLength(xVec)
yVec=drCreateVec(drType(drGetWaveformYVec(sourceWave)) numOfPoints);empty y vector
for( i 0 sub1(numOfPoints);for each point from pointsWave
thisX=drGetElem(xVec i);x value
currentValue=value(sourceWave thisX );y value from sourceWave corresponding to x value from pointsWave
drAddElem(yVec currentValue);add y element
);for
drPutWaveformXVec(wave xVec)
drPutWaveformYVec(wave yVec)

wave~>leafSignalTypeName=sourceWave~>leafSignalTypeName
wave~>leafDataSet=sourceWave~>leafDataSet
wave~>leafAnalysisType=sourceWave~>leafAnalysisType
);drIsWaveform(sourceWave)
(famIsFamily(sourceWave)
sweepName=famGetSweepName(sourceWave)
sweepValues=famGetSweepValues(sourceWave)
sweepValType=type(car(sweepValues))
case(sweepValType
('fixnum wave=famCreateFamily(sweepName 'intlong))
('flonum wave=famCreateFamily(sweepName 'float))
('string wave=famCreateFamily(sweepName 'string))
(t error("resampleByWave: unable to understand type %L\n" sweepValType))
);case
foreach( sweepVal sweepValues
currentSourceWave=famValue(sourceWave sweepVal)
currentPointsWave=famValue(pointsWave sweepVal)
famAddValue(wave sweepVal resampleByWave(currentSourceWave currentPointsWave ))
);foreach
);famIsFamily(sourceWave)
(t
error("resampleByWave: invalid waveform %L\n" sourceWave)
);t
);cond
wave
);let
);proc

I am not sure about a case when input waveforms are family of plots. Is this part of the code correct? 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Your code is unnecessarily complicated in the famIsFamily branch. You should just be able to do:

    (famIsFamily(sourceWave)
      famMap('resampleByWave sourceWave pointsWave)
    )

    This takes care of iterating through the families (you could have families, or families of families, or families of families of families - etc) and then applying the resampleByWave to the layer beneath and reconstructing the curves or families from that.

    Note, I didn't test your code (lack of indentation made it hard to read too); my suggestion is however the way I do this all the time.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 7 years ago in reply to Andrew Beckett

    By the way, a similar approach is necessary for any custom function in order to work in ADE XL with sweeps, corners, and Monte Carlo (see https://support.cadence.com/wps/mypoc/cos?uri=deeplinkmin:ViewSolution;solutionNumber=20467133).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Frank Wiedmann

    There are also plenty of examples in the Custom IC Calculator SKILL Function Library (there will be more as I update a number of my articles on Cadence Online Support to use the new calculator GUI template that was introduced in IC617).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Frank Wiedmann

    There are also plenty of examples in the Custom IC Calculator SKILL Function Library (there will be more as I update a number of my articles on Cadence Online Support to use the new calculator GUI template that was introduced in IC617).

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information