The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 11:42am
Pages: 1
Send Topic Print
Do not use the `absdelay' analog operator in a conditionally-executed statement (Read 1230 times)
Rosh
Junior Member
**
Offline



Posts: 21

Do not use the `absdelay' analog operator in a conditionally-executed statement
Aug 29th, 2016, 11:32pm
 
Hello,

I am trying to simulate the following code

Code:
	@(cross( V(utility)- V(ref),1))

		begin
                               V(tout)<+ absdelay(V(dut),10n);

		end

	 




However, the error states I cannot embed an "absdealy" statement in a conditional executed statement.

Is there any workaround for this?


Thank you,
Rosh
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Do not use the `absdelay' analog operator in a conditionally-executed statement
Reply #1 - Aug 30th, 2016, 11:08am
 
What are you trying to do??

What do you think happens on the "tout" terminal (port) when the cross event is not active?

What you've written, if any simulator were to try to implement it, would say that you want V(tout), at the instant that V(utility) - V(ref) crosses 0, to be a delayed sample of V(dut) from 10n earlier, and otherwise there is no contribution to the "tout" port.  That doesn't make any sense.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Rosh
Junior Member
**
Offline



Posts: 21

Re: Do not use the `absdelay' analog operator in a conditionally-executed statement
Reply #2 - Aug 31st, 2016, 8:12pm
 
What exactly doesn't make sense here?

If utility crosses a reference voltage, V(tout) should be a delayed version of V(dut)?
How would I write such a statement then?





Geoffrey_Coram wrote on Aug 30th, 2016, 11:08am:
What are you trying to do??

What do you think happens on the "tout" terminal (port) when the cross event is not active?

What you've written, if any simulator were to try to implement it, would say that you want V(tout), at the instant that V(utility) - V(ref) crosses 0, to be a delayed sample of V(dut) from 10n earlier, and otherwise there is no contribution to the "tout" port.  That doesn't make any sense.

Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Do not use the `absdelay' analog operator in a conditionally-executed statement
Reply #3 - Sep 2nd, 2016, 11:29am
 
What happens if utility doesn't cross the reference voltage?

Your cross statement only says what the model should do at the exact moment of crossing; you haven't said what happens for all the other timepoints of the simulation.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Do not use the `absdelay' analog operator in a conditionally-executed statement
Reply #4 - Sep 2nd, 2016, 11:38am
 
I would think you want something more like this:

Code:
    real vout, vsamp;
    @(initial_step) begin
	  vout = 0;
    end

    vsamp = absdelay(V(dut),10n);
    @(cross( V(utility)- V(ref),1)) begin
	  vout = vsamp;
    end

    V(tout)<+ vout;
 



At the crossing, this captures a sample from 10n earlier, and holds this until the next crossing.  But I don't know if you wanted a hold, or if you wanted the output to be zero between crossings, or if you wanted the output to be zero until a crossing, and after the crossing to track (a delayed copy of) the input.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   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.