summaryrefslogtreecommitdiff
path: root/testsuite/vests/vhdl-ams/ashenden/compliant/frequency-modeling/opamp_2pole.vhd
blob: 8bef2bb8f669605268118196dcf297808a124235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc

-- This file is part of VESTs (Vhdl tESTs).

-- VESTs is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; either version 2 of the License, or (at
-- your option) any later version. 

-- VESTs is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-- for more details. 

-- You should have received a copy of the GNU General Public License
-- along with VESTs; if not, write to the Free Software Foundation,
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

library ieee;  use ieee.math_real.all;
library ieee_proposed;  use ieee_proposed.electrical_systems.all;

entity opamp_2pole is
  port ( terminal in_pos, in_neg, output : electrical );
end entity opamp_2pole;

----------------------------------------------------------------

architecture dot of opamp_2pole is

  constant A : real := 1.0e6;                      -- open loop gain
  constant fp1 : real := 5.0;                      -- first pole
  constant fp2 : real := 9.0e5;                    -- second pole
  constant tp1 : real := 1.0 / (fp1 * math_2_pi);  -- first time constant
  constant tp2 : real := 1.0 / (fp2 * math_2_pi);  -- second time constant
  quantity v_in across in_pos to in_neg;					
  quantity v_out across i_out through output;

begin

  v_in == (tp1 * tp2) * v_out'dot'dot / A
          + (tp1 + tp2) * v_out'dot / A + v_out / A;

end architecture dot;

----------------------------------------------------------------

architecture ltf of opamp_2pole is

  constant A : real := 1.0e6;		   -- open loop gain
  constant fp1 : real := 5.0;		   -- first pole (Hz)
  constant fp2 : real := 9.0e5;		   -- second pole (Hz)
  constant wp1 : real := fp1 * math_2_pi;  -- first pole (rad/s)
  constant wp2 : real := fp2 * math_2_pi;  -- second pole (rad/s)
  constant num : real_vector := (0 => wp1 * wp2 * A);
  constant den : real_vector := (wp1 * wp2, wp1 + wp2, 1.0);
  quantity v_in across in_pos to in_neg;
  quantity v_out across i_out through output;

begin

  v_out == v_in'ltf(num, den);

end architecture ltf;