summaryrefslogtreecommitdiff
path: root/testsuite/vests/vhdl-ams/ad-hoc/fromUC/regression_test/test169.ams
blob: c0b15e18f347975093917c05456c5e7b355c42b4 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143

-- Copyright (C) 1999-2002 The University of Cincinnati.  
-- All rights reserved. 

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

-- UC MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
-- SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
-- OR NON-INFRINGEMENT.  UC SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
-- LICENSEE AS A RESULT OF USING, RESULT OF USING, MODIFYING OR
-- DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

-- By using or copying this Software, Licensee agrees to abide by the
-- intellectual property laws, and all other applicable laws of the U.S.,
-- and the terms of this license.

-- You may modify, distribute, and use the software contained in this
-- package under the terms of the "GNU GENERAL PUBLIC LICENSE" version 2,
-- June 1991. A copy of this license agreement can be found in the file
-- "COPYING", distributed with this archive.

-- 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 

-- ---------------------------------------------------------------------
--
-- $Id: test169.ams,v 1.1 2002-03-27 22:11:19 paw Exp $
-- $Revision: 1.1 $
--
-- ---------------------------------------------------------------------

--------------------------------------------------------------------
--  Ebers-moll Model for a transistor                             --
--  VHDL-AMS Implementation                                       --
--  Developed at the Distributed Processing Lab at the University --
--  of Cincinnati                                                 -- 
--  by VishwaShanth Kasula on May 10, 1999                        --
--------------------------------------------------------------------
--  Circuit Topology                                              --
--  BJT Ebers-Moll static model
--  Testbench Ckt to evaluate the DC operatioing point of an npn BJT,
--  Sedra smith page no. 152, fig 4.9
--------------------------------------------------------------------

-- Three regions are simulated
-- Active region, vbb = 4.0 V
-- Saturation region, vbb = 6.0 V
-- Cutoff region, vbb = 0.0;

PACKAGE electricalSystem IS
    NATURE electrical IS real ACROSS real THROUGH ground reference;
    FUNCTION SIN(X : real) RETURN real;
    FUNCTION EXP(X : real) RETURN real;
END PACKAGE electricalSystem;

use work.electricalsystem.all;

entity bjt_npn is
  generic(isat : real := 1.0e-16;         -- Saturation Current
          bf   : real := 100.0;           -- Ideal maximus forward current
          br   : real := 1.0;             -- ideal maximum reverse current
          rb   : real := 1.0e-5;          -- Base resistance
          rc   : real := 1.0e-5;          -- collector resistance
          re   : real := 1.0e-5;          -- emmiter resistance
          vaf  : real := 100.0);          -- Forward Early Voltage
  port(terminal e,b,c : electrical);
end bjt_npn;

architecture structure of bjt_npn is
  terminal b1, c1, e1 : electrical;
  quantity vbo across ib through b to b1;
  quantity vco across ic through c to c1;
  quantity veo across ie through e to e1;
  quantity vct across Ict through c1 to e1;--current source
  quantity vbe across ibe through b1 to e1;
  quantity vbc across ibc through b1 to c1;
  quantity vce : real := 1.0;           -- used to calculate VCE
  constant gmin : real := 1.0e-12;      -- condutsnce in parallel with every pn junction
  constant vt : real := 0.02589; -- thermal voltage
 
begin
  brk : break vbe => 1.0, vbc => -1.0;

  diodecond1 : if(vbe > -5.0*vt) use
    diodebef : ibe == ((isat*(exp(vbe/vt) - 1.0)) + (gmin*vbe))/bf;
  elsif (vbe <= -5.0*vt ) use
    diodeber: ibe == ((-1.0*isat) + (gmin*vbe))/bf;
  end use;
  diodecond2 : if(vbc > -5.0*vt) use
    diodebcf : ibc == ((isat*(exp(vbc/vt) - 1.0)) + (gmin*vbc))/br;
  elsif(vbc <= -5.0*vt) use
    diodebcr : ibc == ((-1.0*isat) + (gmin*vbc))/br;
  end use;
  bres : vbo == ib * 1.0e-6;
  cres : vco == ic * 1.0e-6;
  eres : veo == ie * 1.0e-6;
  kcl_eqn : ie == -1.0*(ib + ic);
  vcevolt : vce == vbe - vbc;
  ictdep : Ict == ((Ibe*bf) - (Ibc*br)) * (1.0 -(vbc/vaf));
  
end architecture structure;


--*****************************************************
--TEST BENCH
use std.textio.all;
use work.electricalsystem.all;

entity bjt_testbench is
end bjt_testbench;

architecture structure of bjt_testbench is
  terminal t1, t2, t3, t4 : electrical ;
  component bjt_npn_comp
    generic(isat : real := 1.0e-16;         -- Saturation Current
            bf : real := 100.0;           -- Ideal maximus forward current
            br : real := 1.0;             -- ideal maximum reverse current
            rb : real := 1.0e-5;          -- Base resistance
            rc : real := 1.0e-5;          -- collector resistance
            re : real := 1.0e-5;          -- emmiter resistance
            vaf : real := 100.0);         -- Forward Early Voltage
    port(terminal e,b,c : electrical);	  
  end component;
  for all : bjt_npn_comp use entity work.bjt_npn(structure);
  
  quantity vcc across icc through t1 to electrical'reference;
  quantity vrc across irc through t1 to t2;
  quantity vbb across ibb through t3 to electrical'reference;
  quantity vre across ire through t4 to electrical'reference;
  
begin
   
   bjt : bjt_npn_comp
     generic map (isat => 1.8104e-15, vaf => 100.0)
     port map(t4,t3,t2);
   emres : vre == ire * 3.3e3;
   ccurr : vcc == 10.0;
   ecurr : vbb == 6.0;
   cores : vrc == irc * 4.7e3;

end architecture structure;