OP-Amp non linearity in verilog A model

Status
Not open for further replies.

Chinmaye

Full Member level 3
Joined
Jan 18, 2016
Messages
164
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
3,145
Dear all,
I am trying to build a verilog A model of a differntial op-amp which gives an output of type
Vout = A.Vin + A3. Vin^3.

But I am quite unsure of how one can do this. Please help
 

Code:
module opamp_nonlinear(in_p,in_n, out_p,out_n,vcm_out);
voltage in_p, in_n,out_p,out_n,vcm_out;
parameter real Rin = 50 from (0:inf];
parameter real Rout = 50 from (0:inf];
parameter real Gp_dB = 10 from [-100:100];
parameter real a2 = 0 from [0:inf];
parameter real IP1dB =0 from [-100:100];
real Gp=4*(10**(Gp_dB/10)); // The factor 4 is to account for the power loss in the input and output impedances.
real a1=((Gp*Rout)/Rin)**0.5;
real IP1dB_magnitude=(10**(IP1dB/10))*1e-3;
real Vin1dBc=(2*Rin* IP1dB_magnitude)**0.5;
real a3=(4*0.109*a1)/(3*(Vin1dBc**2));
analog begin
    V(out_p,vcm_out)<+ 0.5*(a1*V(in_p,in_n)+a2*(V(in_p,in_n)**2)-a3*(V(in_p,in_n)**3));
    V(out_n,vcm_out)<+ -0.5*(a1*V(in_p,in_n)+a2*(V(in_p,in_n)**2)-a3*(V(in_p,in_n)**3));
end
endmodule
 
Last edited by a moderator:
Thank you for the code. I could not understand the complete code. Here is a code I have for an diff input and diff output op-amp in verilog-A. How can i modify it to include non linearity in the code.
Code:
`include "constants.vams"
`include "disciplines.vams"

`define PI      3.14159265358979323846264338327950288419716939937511

module diff_ampl(voutp,voutn, vin_p, vin_n, vspply_p, vspply_n, vcm );
input vin_p , vin_n , vcm;
inout vspply_p, vspply_n;
output voutp,voutn ;
electrical vin_p, vin_n, voutp, voutn, vspply_p, vspply_n, vcm;


parameter real gain = 400 exclude 0.0;
parameter real pole_freq =800000;
parameter real rin = 12.0M exclude 0.0;
parameter real rout = 10.0;
parameter real ibias = 0.0n;
parameter real vin_offset = 0.0u;


// parameter real slewp = 20.0M from (0:inf);
// parameter real slewn = -20.0M from (-inf:0);

real c1, r1;
real r_rout,gm_nom, vin_val;
electrical coutp, coutn, vref;


analog
begin

@(initial_step)// or initial_step("dc", "ac", "tran", "xf"))
begin
gm_nom = 0.01;
r1 = gain/gm_nom;
c1 = gm_nom/(`M_TWO_PI * pole_freq * gain);
r_rout = rout;

end

vin_val= V(vin_p, vin_n) + vin_offset;


// ------ Vref is at Virtual Ground

V(vref,vspply_n) <+ 0.5*V(vspply_p,vspply_n);



// ------ Input Stage

I(vin_p, vin_n) <+ vin_val / rin;
I(vref, vin_p) <+ ibias;
I(vref, vin_n) <+ ibias;



// ------ GM stage


I(vcm, coutp) <+ (gm_nom/2)*vin_val ;
I(vcm, coutn) <+ -(gm_nom/2)*vin_val ;



// ------ Dominant Pole.

I(coutp, vcm) <+c1*ddt(V(coutp, vcm));
I(coutp, vcm) <+ V(coutp, vcm)/r1;

I(coutn,vcm) <+ c1*ddt(V(coutn, vcm));
I(coutn, vcm) <+ V(coutn, vcm)/r1;




// ------ Output Stage.

I(vcm, voutp) <+ (V(coutp) - V(vcm))/r_rout;
I(voutp, vcm) <+ V(voutp, vcm)/r_rout;

I(vcm, voutn) <+ (V(coutn) - V(vcm))/r_rout;
I(voutn, vcm) <+ V(voutn, vcm)/r_rout;
   end
endmodule
ude non-linearity?
 


I am not going to edit your code for you. Sorry but that is not happening.
You need to find the parameters of the third order equation that describes the non-linear behavior. For that you would need the input 1dB compression point in terms of voltage. Once you have that, you can get the co-efficients of the third order polynomial. Once youhave that, your output voltage = f(input_voltage) where f is the third order polynomial.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…