The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 2:20pm
Pages: 1
Send Topic Print
Solving ODE in Verilog-AMS (Read 3816 times)
Sumit Adhikari
Community Member
***
Offline



Posts: 44

Solving ODE in Verilog-AMS
Mar 28th, 2011, 3:38am
 
Does anybody has any idea, if it is possible to solve an ODE in Verilog-AMS ? All my tries failed.
Regards,
Sumit
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: Solving ODE in Verilog-AMS
Reply #1 - Mar 28th, 2011, 8:18am
 
Sumit,

What do you want to achieve? It should be obvious how to solve an ODE if you use a time derivative, so I suppose that's not what you want.

B O E
Back to top
 
 
View Profile   IP Logged
Sumit Adhikari
Community Member
***
Offline



Posts: 44

Re: Solving ODE in Verilog-AMS
Reply #2 - Mar 28th, 2011, 8:52am
 
You are absolutely correct, I also thought that way. I am in need to solving current and voltage equations as the way I wish  and add them with some other currents/voltages. I want to study transport equations modified quantum mechanical effects in DSM technology, for this Verilog-AMS is good, as I have good controllability. For a warm up I took SHM equation (ddt(ddt(V(p,n))) <+ -k * V(p,n), which should give me sinusoidal out put like a0*sin(wt). Following is the code :



`include "discipline.vams"
`include "constants.vams"

module oscillations_ode (p, n);

   inout               p ;
   inout               n ;
   electrical          p ;
   electrical          n ;
   electrical          d_1 ;
   electrical          d_2 ;

   parameter real k   = 10000.0      ;

   real reff;

   analog
   begin//{
       //@(initial_step)
       @(initial_step("dc", "ac", "tran", "xf"))
       begin//{
         V(p,n)   <+ 1.0 ;
         V(d_1,n) <+ 0.0 ;
         V(d_2,n) <+ 0.0 ;
       end//}

       V(d_1,n) <+ ddt(V(p,n)) ;
       V(d_2,n) <+ ddt(V(d_1,n)) ;
       V(d_2,n) <+ -k*V(p,n) ;

   end //}

endmodule

output of this block (p) is driving a small parallel load of a resistor and a capacitor.

The solver is running, but I am always getting 0 output.

Do not understand why  >:(

Regards,
Sumit
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: Solving ODE in Verilog-AMS
Reply #3 - Mar 29th, 2011, 7:39am
 
Sumit,

your code is wrong.
Code:
V(d_2,n) <+ ddt(V(d_1,n)) ;
V(d_2,n) <+ -k*V(p,n) ; 

is equivalent to Code:
V(d_2,n) <+ ddt(V(d_1,n)) - k*V(p,n) ; 

which is not what you want. Correct would e.g. be Code:
V(d_1,n) <+ ddt(V(p,n)) ;
V(d_2,n) <+ ddt(V(d_1,n)) ;
V(p,n) <+ -1/k*V(d_2,n) ; 


This works with my simulator.

B O E

PS: You misused the contribution statement. It is not an assignment.
Back to top
 
 
View Profile   IP Logged
Sumit Adhikari
Community Member
***
Offline



Posts: 44

Re: Solving ODE in Verilog-AMS
Reply #4 - Apr 1st, 2011, 11:56am
 
Thanks for pointing out my mistake.
Regards,
Sumit
Back to top
 
 
View Profile   IP Logged
Sumit Adhikari
Community Member
***
Offline



Posts: 44

Re: Solving ODE in Verilog-AMS
Reply #5 - Apr 1st, 2011, 11:58am
 
Thanks for pointing out my mistake.
Regards,
Sumit
Back to top
 
 
View Profile   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.