The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 11:40pm
Pages: 1
Send Topic Print
How do I generate the following voltage profile? (Read 1639 times)
Rosh
Junior Member
**
Offline



Posts: 21

How do I generate the following voltage profile?
Jan 19th, 2016, 7:18pm
 
Hi everyone,

I am trying to generate the following voltage profile.

Picture attached.





The specifications are :
Vhigh: Voltage 1
Tr: Rise time
Vlow: Voltage 2
Time: Time after which Vhigh falls to Vlow
Tf: Fall time


Code:

`include "disciplines.vams"

module series_rlc1 (p, n1);

    parameter real r=1,vout_high=5, //VHIGH value
	trise = 100u, //Fall Time
    tfall = 100u, //Rise Time
	vout_low=3, //VLOW Value
	droop_time=3000u;//Time after which VHIGH falls to VLOW

    inout p, n1;
    electrical p, n1;

    analog begin


	V(n1) <+ transition(vout_high,0,trise,tfall);

	if($abstime==droop_time)
	V(n1) <+ transition(vout_low,0,trise,tfall);


    end
endmodule
 





However, I get an error saying I cannot include a transition operator inside a conditional statement. So how do I tell the compile to drop the voltage after a time?
Back to top
 

Vdriver.jpg
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: How do I generate the following voltage profile?
Reply #1 - Jan 20th, 2016, 8:05am
 
I think you are missing some basic understanding of how the Verilog-A contribution operator works.  The code you posted would set the voltage on "n1" to vout_high for all time *except* for the timepoint exactly at droop_time.

I think the code below will work better.

Code:
`include "disciplines.vams"

module series_rlc1 (p, n1);

    parameter real r=1,vout_high=5, //VHIGH value
	trise = 100u, //Fall Time
	tfall = 100u, //Rise Time
	vout_low=3, //VLOW Value
	droop_time=3000u;//Time after which VHIGH falls to VLOW

    inout p, n1;
    electrical p, n1;

    real vout;

    analog begin
	@(initial_step) begin
		vout = vout_high;
	end
	if($abstime>=droop_time) begin
		vout = vout_low;
	end

	V(n1) <+ transition(vout,0,trise,tfall);
    end
endmodule
 





However, I get an error saying I cannot include a transition operator inside a conditional statement. So how do I tell the compile to drop the voltage after a time? [/quote]
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.