思泉御宇的个人空间 https://blog.eetop.cn/1628377 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

ideal OP verilogA

热度 10已有 9 次阅读| 2025-3-26 10:31 |系统分类:芯片设计

//     FUNCTION: Non-ideal OpAmp 

// last revised: 22 Jan 2002 jbdavid

// REVISION HISTORY:

// Created BY: Jonathan David with modelwriter 

//  modified for Differential Operation

//      VERSION: $Revision: 1 $

//      AUTHORS: Modelwriter Standard Library

//               Cadence Design Systems, Inc.

// 

// GENERATED BY: Affirma Modelwriter 2.23

//           ON: Tue Jan 22 20:55:47 PST 2002

//

// Description: Universal Opamp

// model opamp -  Non Ideal OpAmp Model

// LIMITATIONS:

// INCLUDE FILES:


`include "discipline.h"

`include "constants.h"

//==========================================================================    

module DiffOpamp (vout_p, vout_n, vcmref, vin_p, vin_n, vspply_p, vspply_n  );

// PINS

  inout  vin_p , vin_n; 

//     vin_p  - positive or non-inverting input

//     vin_n  - negative or inverting input

  inout  vspply_p, vspply_n; // pos and neg    

  output vout_p, vout_n;

  input  vcmref;

  electrical vin_p, vin_n, vout_p, vout_n, vcmref, vspply_p, vspply_n;

 


// INSTANCE PARAMETERS:

//         gain =  Open loop voltage gain, or DC voltage gain

   parameter real         gain = 1000.0 exclude 0.0;

//        ibias =  Input bias current, the value is the same for

// both inputs [A]

   parameter real        ibias = 0.0n;

//    pole_freq =  Dominant pole frequency, or first corner

// frequency, eg. point where gain begins to roll of by 6 dB /

// octave [Hz]

   parameter real  pole_freq = 1.2;

//          rin =  Differential input resistance, or resistance

// measured between both inputs [ohms]

   parameter real           rin = 12.0M exclude 0.0;

//         rout =  Single ended output resistance [ohms]

   parameter real         rout = 75.0;

//   vin_offset =  Input offset voltage, the voltage required for

// 0 volts output [V]

   parameter real vin_offset = 0.0u; 

//        vsoft =  Output soft clipping point, measured from the

// supply rails [V]

   parameter real        vsoft = 0.25; 



// LOCAL VARIABLES:  (Comment each one)


   real c1, r1;  // components of the dominant pole

   real vin_val; // input diff voltage

   real r_rout; // output resistance

   real gm_nom; // first stage gm = gain/rout

// INTERNAL NODES

   electrical coutp, coutn, vref;    

// FUNCTIONS

//     {none}



//==========================================================================    

    Analog begin


       @(initial_step) begin // by default ALL analyses included (446+)

                r1 = gain;

            gm_nom = 1.0;

                c1 = 1/(`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(vref, coutp) <+ gm_nom*vin_val ;       

         I(vref, coutn) <+ -gm_nom*vin_val ;       

      // ------ Dominant Pole.

      I(coutp, vref) <+ 2*c1*ddt(V(coutp, vref));

      I(coutp, vref) <+ 2*V(coutp, vref)/r1;

      I(coutn, vref) <+ 2*c1*ddt(V(coutn, vref));

      I(coutn, vref) <+ 2*V(coutn, vref)/r1;




      // ------ Output Stage.


      I(vref, vout_p) <+ 2*V(coutp, vref)/r_rout;    

      I(vout_p, vref) <+ 2*V(vout_p, vref)/r_rout;

      I(vref, vout_n) <+ 2*V(coutn, vref)/r_rout;    

      I(vout_n, vref) <+ 2*V(vout_n, vref)/r_rout;


 

      // ------ Soft Output Limiting.

      if (V(vout_p) > (V(vspply_p) - vsoft))

           I(coutp, vref) <+ gm_nom*(V(vout_p, vspply_p)+vsoft);

      else if (V(vout_p) < (V(vspply_n) + vsoft))

           I(coutp, vref) <+ gm_nom*(V(vout_p, vspply_n)-vsoft);

      // ------ Soft Output Limiting.

      if (V(vout_n) > (V(vspply_p) - vsoft))

           I(coutn, vref) <+ gm_nom*(V(vout_n, vspply_p)+vsoft);

      else if (V(vout_n) < (V(vspply_n) + vsoft))

           I(coutn, vref) <+ gm_nom*(V(vout_n, vspply_n)-vsoft);

 


    end

endmodule


全部作者的其他最新日志

评论 (0 个评论)

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 1

    获赞
  • 0

    评论
  • 21

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-14 13:18 , Processed in 0.028489 second(s), 14 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部