Error in Parametric Analysis - it converts my variables into

Guest
Hi all,

I am using Analog Design Environment in ICFB.

Since there is no "delay" parameter available in the cross() and
delay() methods in the Waveform Calculator, I had to make my own
wrapper to add a delay.

I wrote a skip function:

; skips past a certain number of edges that are detected by the built-
in cross function
procedure( skip( wf vthreshold edgetype delay)
a=1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)

; a<30 is to just avoid infinite loops (max limiter)
while( (a<30&&b<delay)
a=a+1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)
)
a
)

I use my skip function like this:

procedure( delay2( wf1 vthreshold1 edgenum1 edgetype1 delay1 wf2
vthreshold2 edgenum2 edgetype2 delay2)

wf1_delay_falling =skip( wf1 vthreshold1 "falling" delay1 )
wf1_delay_rising =skip( wf1 vthreshold1 "rising" delay1 )
wf1_delay_either =skip( wf1 vthreshold1 "either" delay1 )

wf2_delay_falling =skip( wf2 vthreshold2 "falling" delay2 )
wf2_delay_rising =skip( wf2 vthreshold2 "rising" delay2 )
wf2_delay_either =skip( wf2 vthreshold2 "either" delay2 )

if( edgetype1=="falling"
then
wf1_edge_num = wf1_delay_falling
else if( edgetype1=="rising"
then
wf1_edge_num = wf1_delay_rising
else if( edgetype1=="either"
then
wf1_edge_num = wf1_delay_either
else
println( "delay2 error: Invalid edge1 type!" )
)))

if( edgetype2=="falling"
then
wf2_edge_num = wf2_delay_falling
else if( edgetype2=="rising"
then
wf2_edge_num = wf2_delay_rising
else if( edgetype2=="either"
then
wf2_edge_num = wf2_delay_either
else
println( "delay2 error: Invalid edge2 type!" )
)))

; calculate the appropriate edge after the delay
wf1_edge_num = wf1_edge_num + (edgenum1 - 1)
wf2_edge_num = wf2_edge_num + (edgenum2 - 1)

; delay( wf1 vthreshold1 wf1_edge_num edgetype1 wf2 vthreshold2
wf2_edge_num edgetype2 0 0 nil nil )

cross(wf2 vthreshold2 wf2_edge_num edgetype2) - cross(wf1
vthreshold1 wf1_edge_num edgetype1)
)


This works perfectly fine when I use my delay2() function in the
output menu of Analog Environment. However, when I run parametric
analysis, it gives this error:

*Error* Evaluating expression ((tp_HL2 = delay2(VT("/out") VMID2 1
"rising" VAR("IN_DEL") VT("/I1/out2") VMID2 1 "falling"
VAR("IN_DEL")))).
*Error* ("lessp" 11 t nil ("*Error* lessp: can't handle (drwave:
215845064 < drwave:215844952)"))

[ and so on..]

The variable "b" and "delay", which are usually scalars, are turned
into drwaves when I run parametric analysis!

Can anyone suggest how I can fix this?? I have literally spent 10
hours debugging this, and am getting quite frustrated.


Thank you!!
Sincerely,
Rick, IC student
 
On Sep 30, 8:12 am, mosf...@gmail.com wrote:
Hi all,

I am using Analog Design Environment in ICFB.

Since there is no "delay" parameter available in the cross() and
delay() methods in the Waveform Calculator, I had to make my own
wrapper to add a delay.

I wrote a skip function:

; skips past a certain number of edges that are detected by the built-
in cross function
procedure( skip( wf vthreshold edgetype delay)
a=1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)

; a<30 is to just avoid infinite loops (max limiter)
while( (a<30&&b<delay)
a=a+1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)
)
a
)

I use my skip function like this:

procedure( delay2( wf1 vthreshold1 edgenum1 edgetype1 delay1 wf2
vthreshold2 edgenum2 edgetype2 delay2)

wf1_delay_falling =skip( wf1 vthreshold1 "falling" delay1 )
wf1_delay_rising =skip( wf1 vthreshold1 "rising" delay1 )
wf1_delay_either =skip( wf1 vthreshold1 "either" delay1 )

wf2_delay_falling =skip( wf2 vthreshold2 "falling" delay2 )
wf2_delay_rising =skip( wf2 vthreshold2 "rising" delay2 )
wf2_delay_either =skip( wf2 vthreshold2 "either" delay2 )

if( edgetype1=="falling"
then
wf1_edge_num = wf1_delay_falling
else if( edgetype1=="rising"
then
wf1_edge_num = wf1_delay_rising
else if( edgetype1=="either"
then
wf1_edge_num = wf1_delay_either
else
println( "delay2 error: Invalid edge1 type!" )
)))

if( edgetype2=="falling"
then
wf2_edge_num = wf2_delay_falling
else if( edgetype2=="rising"
then
wf2_edge_num = wf2_delay_rising
else if( edgetype2=="either"
then
wf2_edge_num = wf2_delay_either
else
println( "delay2 error: Invalid edge2 type!" )
)))

; calculate the appropriate edge after the delay
wf1_edge_num = wf1_edge_num + (edgenum1 - 1)
wf2_edge_num = wf2_edge_num + (edgenum2 - 1)

; delay( wf1 vthreshold1 wf1_edge_num edgetype1 wf2 vthreshold2
wf2_edge_num edgetype2 0 0 nil nil )

cross(wf2 vthreshold2 wf2_edge_num edgetype2) - cross(wf1
vthreshold1 wf1_edge_num edgetype1)
)

This works perfectly fine when I use my delay2() function in the
output menu of Analog Environment. However, when I run parametric
analysis, it gives this error:

*Error* Evaluating expression ((tp_HL2 = delay2(VT("/out") VMID2 1
"rising" VAR("IN_DEL") VT("/I1/out2") VMID2 1 "falling"
VAR("IN_DEL")))).
*Error* ("lessp" 11 t nil ("*Error* lessp: can't handle (drwave:
215845064 < drwave:215844952)"))

[ and so on..]

The variable "b" and "delay", which are usually scalars, are turned
into drwaves when I run parametric analysis!

Can anyone suggest how I can fix this?? I have literally spent 10
hours debugging this, and am getting quite frustrated.

Thank you!!
Sincerely,
Rick, IC student
I forgot to add that the problem is also that the "<" (lessp) operator
cannot operate on drWaves.

One solution I have thought of is to detect when "b" and "delay" are
drwaves by using drIsWaveform, then manually accessing the correct
elements and doing the less than operation. However, this requires
knowing the "counter" (current iteration) of the parametric analysis..
can I know this somehow? Is it in a global variable??


Thanks again!
 
On Sep 30, 2:16 pm, mosf...@gmail.com wrote:
On Sep 30, 8:12 am, mosf...@gmail.com wrote:



Hi all,

I am using Analog Design Environment in ICFB.

Since there is no "delay" parameter available in the cross() and
delay() methods in the Waveform Calculator, I had to make my own
wrapper to add a delay.

I wrote a skip function:

; skips past a certain number of edges that are detected by the built-
in cross function
procedure( skip( wf vthreshold edgetype delay)
a=1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)

; a<30 is to just avoid infinite loops (max limiter)
while( (a<30&&b<delay)
a=a+1
b=cross(wf vthreshold a edgetype)
(if b==nil b=delay+1)
)
a
)

I use my skip function like this:

procedure( delay2( wf1 vthreshold1 edgenum1 edgetype1 delay1 wf2
vthreshold2 edgenum2 edgetype2 delay2)

wf1_delay_falling =skip( wf1 vthreshold1 "falling" delay1 )
wf1_delay_rising =skip( wf1 vthreshold1 "rising" delay1 )
wf1_delay_either =skip( wf1 vthreshold1 "either" delay1 )

wf2_delay_falling =skip( wf2 vthreshold2 "falling" delay2 )
wf2_delay_rising =skip( wf2 vthreshold2 "rising" delay2 )
wf2_delay_either =skip( wf2 vthreshold2 "either" delay2 )

if( edgetype1=="falling"
then
wf1_edge_num = wf1_delay_falling
else if( edgetype1=="rising"
then
wf1_edge_num = wf1_delay_rising
else if( edgetype1=="either"
then
wf1_edge_num = wf1_delay_either
else
println( "delay2 error: Invalid edge1 type!" )
)))

if( edgetype2=="falling"
then
wf2_edge_num = wf2_delay_falling
else if( edgetype2=="rising"
then
wf2_edge_num = wf2_delay_rising
else if( edgetype2=="either"
then
wf2_edge_num = wf2_delay_either
else
println( "delay2 error: Invalid edge2 type!" )
)))

; calculate the appropriate edge after the delay
wf1_edge_num = wf1_edge_num + (edgenum1 - 1)
wf2_edge_num = wf2_edge_num + (edgenum2 - 1)

; delay( wf1 vthreshold1 wf1_edge_num edgetype1 wf2 vthreshold2
wf2_edge_num edgetype2 0 0 nil nil )

cross(wf2 vthreshold2 wf2_edge_num edgetype2) - cross(wf1
vthreshold1 wf1_edge_num edgetype1)
)

This works perfectly fine when I use my delay2() function in the
output menu of Analog Environment. However, when I run parametric
analysis, it gives this error:

*Error* Evaluating expression ((tp_HL2 = delay2(VT("/out") VMID2 1
"rising" VAR("IN_DEL") VT("/I1/out2") VMID2 1 "falling"
VAR("IN_DEL")))).
*Error* ("lessp" 11 t nil ("*Error* lessp: can't handle (drwave:
215845064 < drwave:215844952)"))

[ and so on..]

The variable "b" and "delay", which are usually scalars, are turned
into drwaves when I run parametric analysis!

Can anyone suggest how I can fix this?? I have literally spent 10
hours debugging this, and am getting quite frustrated.

Thank you!!
Sincerely,
Rick, IC student

I forgot to add that the problem is also that the "<" (lessp) operator
cannot operate on drWaves.

One solution I have thought of is to detect when "b" and "delay" are
drwaves by using drIsWaveform, then manually accessing the correct
elements and doing the less than operation. However, this requires
knowing the "counter" (current iteration) of the parametric analysis..
can I know this somehow? Is it in a global variable??

Thanks again!
The result of a parametric run is a family. You need to wrap your
functions to check if it is a waveform and if it is a family. In the
case it is a family, you call your function recursively. There are
some examples here on the group given by Andrew Beckett that use this
scheme to handle families of curves. look for the family (fam*)
functions in skartistref.pdf
--
Svenn
 

Welcome to EDABoard.com

Sponsor

Back
Top