/******************************************************************************* * 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. * *******************************************************************************/ ;; This file contains the definition of a customized API for clip which will error out when ;; the from & to values are outside the x-vector range. The function can be used for monotonically ;; increasing data ;; function name : awvcClipNoExtrapolate ;; arguments : waveform : waveform ;; from : from value ;; to : scalar value ;; ;; return value : nil if the from and to values passed are outside the input waveform x-vector range ;; clipped waveform ;; This file contains customer calculator function template also to add this function in calculator. procedure(awvcClipNoExtrapolate(wave from to) let((outputWave exprList) outputWave = _vviClipMethod(wave from to) when(or(drIsWaveform(outputWave) famIsFamily(outputWave)) exprList = list(famGetExpr(wave) from to) famSetExpr(outputWave famGenExpr('awvcClipNoExtrapolate exprList)) outputWave ) ) ) defMethod(_vviClipMethod ((wave drIsWaveform) from to) when(_vviIsInRange(wave from to) clipX(wave from to) ) ) defMethod(_vviClipMethod ((fam famIsFamily) from to) famMap('awvcClipNoExtrapolate fam from to) ) procedure(_vviIsInRange(wave from to) let( (firstValue lastValue) firstValue = firstVal(wave) lastValue = lastVal(wave) if( and((firstValue <= from) (lastValue >= from) (firstValue <= to) (lastValue >= to)) then t else printf( "*Warning* The from and to values for the awvcClipNoExtrapolate function are out of\n\t range for input waveform(%L)\n" famGetExpr(wave)) nil ) ) ) ; ;;;;;;;;;;;;;;;;;;;;;;;;;; GUI builder information ;;;;;;;;;;;;;;;;;;;;;;;;;;; ocnmRegGUIBuilder( '(nil function awvcClipNoExtrapolate name awvcClipNoExtrapolate description "awvcClipNoExtrapolate" category ("Custom Functions") analysis (nil general (nil args (wave from to ) signals (nil wave (nil prompt "Signal" tooltip "Signal" ) ) params(nil from (nil prompt "From" tooltip "From" guiRowHint 1 type float required t ) to (nil prompt "To" tooltip "To" guiRowHint 2 type float required t ) ) inputrange t ) ) outputs(result) ) )