Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me understand this verilog-A code

Status
Not open for further replies.

dragonfury

Member level 4
Joined
Apr 21, 2007
Messages
69
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,724
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 = 2.5;
parameter real sigout_low = 0;
parameter real sigin_offset = 0;
parameter real comp_slope =1;


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;

"


I need to understand the following part of the code.
V(sigout) <+ 0.5 * (sigout_high - sigout_low)
* tanh(comp_slope*(V(sigin, sigref)- sigin_offset))
+ (sigout_high + sigout_low)/2;


Just want to know what it is this part doing exactly
Regards
 

It's very easy kindergarden level mathematics.

Consider y=S*tanh(A*x)

If A*x=+inf then y=+S
If A*x=-inf then y=-S
If A*x=0 then y=0

dy/dx=S*A*{sech(A*x)}**2

sech(0)=1 so dy/dx at x=0 is S*A

From these, V(sigout) is from sigout_low to sigout_high and is centered at (sigout_high+sigout_low)/2.

Slope at V(sigin, sigref)=sigin_offset is 0.5*(sigout_high - sigout_low)*comp_slope.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top