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
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