libsidplayfp 2.15.0
Public Member Functions | List of all members
reSIDfp::OpAmp Class Reference

#include <OpAmp.h>

Public Member Functions

 OpAmp (const std::vector< Spline::Point > &opamp_voltages, double Vddt, double vmin, double vmax)
 
void reset () const
 
double solve (double n, double vi) const
 

Detailed Description

Find output voltage in inverting gain and inverting summer SID op-amp circuits, using a combination of Newton-Raphson and bisection.

          +---R2--+
          |       |
vi ---R1--o--[A>--o-- vo
          vx

From Kirchoff's current law it follows that

IR1f + IR2r = 0

Substituting the triode mode transistor model K*W/L*(Vgst^2 - Vgdt^2) for the currents, we get:

n*((Vddt - vx)^2 - (Vddt - vi)^2) + (Vddt - vx)^2 - (Vddt - vo)^2 = 0

where n is the ratio between R1 and R2.

Our root function f can thus be written as:

f = (n + 1)*(Vddt - vx)^2 - n*(Vddt - vi)^2 - (Vddt - vo)^2 = 0

Using substitution constants

a = n + 1
b = Vddt
c = n*(Vddt - vi)^2

the equations for the root function and its derivative can be written as:

f = a*(b - vx)^2 - c - (b - vo)^2
df = 2*((b - vo)*dvo - a*(b - vx))

Constructor & Destructor Documentation

◆ OpAmp()

reSIDfp::OpAmp::OpAmp ( const std::vector< Spline::Point > &  opamp_voltages,
double  Vddt,
double  vmin,
double  vmax 
)
inline

Opamp input -> output voltage conversion

Parameters
opampopamp mapping table as pairs of points (in -> out)
Vddttransistor dt parameter (in volts)
vmin
vmax

Member Function Documentation

◆ reset()

void reSIDfp::OpAmp::reset ( ) const
inline

Reset root position

◆ solve()

double reSIDfp::OpAmp::solve ( double  n,
double  vi 
) const

Solve the opamp equation for input vi in loading context n

Parameters
nthe ratio of input/output loading
viinput voltage
Returns
vo output voltage

The documentation for this class was generated from the following files: