The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> How do I generate the following voltage profile?
https://designers-guide.org/forum/YaBB.pl?num=1453259912

Message started by Rosh on Jan 19th, 2016, 7:18pm

Title: How do I generate the following voltage profile?
Post by Rosh on Jan 19th, 2016, 7:18pm

Hi everyone,

I am trying to generate the following voltage profile.

Picture attached.


http://imgur.com/141W8kp


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?

Title: Re: How do I generate the following voltage profile?
Post by Geoffrey_Coram on 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]

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.