The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 4:15pm
Pages: 1
Send Topic Print
Help me understand this verilog-A code (Read 3997 times)
afridi
Junior Member
**
Offline



Posts: 24

Help me understand this verilog-A code
May 17th, 2011, 4:34am
 
Help me understand this verilog-A code .I simply dont know anything about verilog-A. I want to modify this code for low voltage of 0 and high voltage of 2.5V.Can anyone help me modify this.

   This is a code for a comparator

   "
   module comparator(sigin, sigref, sigout);
   input sigin, sigref;
   output sigout;
   electrical sigin, sigref, sigout;
   parameter real sigout_high = 10;
   parameter real sigout_low = -10;
   parameter real sigin_offset = 0;
   parameter real comp_slope =1000;


   analog begin

   @ ( initial_step ) begin
   if (sigout_high <= sigout_low) begin
   $display("Range specification error. sigout_high = (%E) less than sigout_low = (%E).\n", sigout_high, sigout_low );
   $finish;
   end
   end

   V(sigout) <+ 0.5 * (sigout_high - sigout_low)
   * tanh(comp_slope*(V(sigin, sigref)- sigin_offset))
   + (sigout_high + sigout_low)/2;

   "


REGARDS
Back to top
 
 

The more things you do, the more you can do.(Lucille Ball)
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: Help me understand this verilog-A code
Reply #1 - May 17th, 2011, 8:46am
 
Dfury,

Set sigout_high and sigout_low accordingly.

Note that tanh has an output range of +/-1.

B O E
Back to top
 
 
View Profile   IP Logged
afridi
Junior Member
**
Offline



Posts: 24

Re: Help me understand this verilog-A code
Reply #2 - May 17th, 2011, 8:52am
 
okay.what about how we control the comparators speed? i mean if one input is changing at a rate of 1000MHz then will this work?
Back to top
 
 

The more things you do, the more you can do.(Lucille Ball)
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Help me understand this verilog-A code
Reply #3 - May 17th, 2011, 12:57pm
 
Did you look at the comparator posted on this site?
http://www.designers-guide.org/Books/dg-vams/ch5/ch5-listing05.tgz

It has td and tt (delay and transition time), which you should be able to use to control the speed.
Back to top
 
 

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



Posts: 24

Re: Help me understand this verilog-A code
Reply #4 - May 17th, 2011, 1:24pm
 
okay but is this an analog input comparator?
Back to top
 
 

The more things you do, the more you can do.(Lucille Ball)
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: Help me understand this verilog-A code
Reply #5 - May 18th, 2011, 2:30am
 
Dfury,
The code you suggested in the initial post is infinitely fast. It just scales the input and limits with tanh.
The code Geoffrey suggested is also a continuous-time comparator. However, you need to scale the output appropriately.
B O E
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.