aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/vests/vhdl-ams/ashenden/compliant/analog-modeling/inline_05a.vhd
blob: f0ed183a0280e4af30af34f7e1e19f985991d6f0 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
-- 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_proposed;  use ieee_proposed.electrical_systems.all;

entity inline_05a is

end entity inline_05a;


architecture test of inline_05a is

begin

  block_1 : block is

    constant cap : real := 1.0e-9;
    constant rleak : real := 1.0E6;

    -- code from book

    terminal p1, p2 : electrical;
    quantity vcap across icap, ileak through p1 to p2;

    -- end code from book

  begin

    -- code from book

    icap == cap * vcap'dot;
  
    ileak == vcap / rleak;

    -- end code from book

  end block block_1;


  block_2 : block is

    -- code from book

    nature electrical_vector is array (natural range <>) of electrical;
    terminal a_bus : electrical_vector(1 to 8);
    terminal signal_ground : electrical;

    --

    quantity bus_drops across bus_currents through a_bus to signal_ground;

    --

    terminal p1 : electrical_vector(0 to 3);
    terminal p2 : electrical;
  
    quantity v across i through p1 to p2;

    --

    constant tc1 : real := 1.0e-3; -- Linear temperature coefficient
    constant tc2 : real := 1.0e-6; -- Second-order temperature coefficient
    constant temp : real := 27.0; -- Ambient temperature
    constant tnom : real := 50.0; -- Nominal temperature
    constant res : real_vector := (1.0e3, 2.0e3, 4.0e3, 8.0e3); -- Nominal resistances

    --

    constant res_factor : real := (1.0 + tc1*(temp-tnom) + tc2*(temp-tnom)**2);

    -- end code from book

  begin

    -- code from book

    v(0) == i(0) * res(0) * res_factor;
    v(1) == i(1) * res(1) * res_factor;
    v(2) == i(2) * res(2) * res_factor;
    v(3) == i(3) * res(3) * res_factor;

    -- end code from book

  end block block_2;

end architecture test;