AMS - OpAmp Text Book Example Wont Quite Compile #519
Answered
by
caryr
mixotricha
asked this question in
Q&A
Replies: 2 comments
-
I'm not familiar with Verilog AMS, but I know iverilog only supports a subset of the language. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Icarus does not currently support the contribution statement or the ddt() function.
Cary
On Wednesday, June 2, 2021, 1:33:00 PM PDT, martinwhitaker ***@***.***> wrote:
I'm not familiar with Verilog AMS, but I know iverilog only supports a subset of the language.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
caryr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
iverilog version : 10.3 (stable)
// ------------------------------------------------------------------------------------------------------------------
// Operational Amplifier taken from https://m.eet.com/media/1171203/ms-part3.pdf
// ------------------------------------------------------------------------------------------------------------------
`include "disciplines.vams"
module ampl (
inp,
inm,
out,
vdd,
vss
);
input inp,inm,vdd,vss; output out;
electrical inp,inm,out,vdd,vss,N;
parameter real Gain=1k, // DC gain (V/V)
Vio=0, // input offset (V)
GBW=10M, // Gain-Bandwidth product (Hz)
Rdc=300, // DC output resistance (ohms)
Rac=100; // AC & Sat output resistance (ohms)
real Gm, Rres, Ccap, Vnom; // internal variables
// Macro for diode-like exponential dependence between voltage & current:
// Returns current of isat when voltage is zero, and decreases by
// a factor of 100 for each dV decrease of input voltage:
define fclip(V,isat,dV) isat * exp(4.6*(V)/(dV) ) analog begin @(initial_step) begin // constants computed at startup Rres = Rdc-Rac; // inner resistor value Gm = Gain/Rres; // input transconductance Ccap = 1 / (
M_TWO_PI*GBW/Gm); // capacitor to get specifed GBWend
// Contributions of current for each branch in the topology diagram:
I(N,vss) <+ -GmV(inp,inm); // transconductance from input
I(N,vss) <+ (V(N,vss)-V(vdd,vss)/2)/Rres; // resistor equation: I=V/R
I(N,vss) <+ ddt(CcapV(N,vss)); // capacitor equation: I=d(CV)/dT
// top & bottom parts of limiter
I(N,vss) <+
fclip(V(N,vdd),1,40m) -
fclip(V(vss,N),1,40m);I(N,out) <+ V(N,out) / Rac; // series resistance on output
end
endmodule
// -----------------------------------------------------------------------------------
from the shell : iverilog -gverilog-ams opamp.v
Something wrong in the syntax of this example or is the AMS support not up to this yet?
I see the disciplines.vams did get included and is part of my iverilog install.
Beta Was this translation helpful? Give feedback.
All reactions