Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
VAMS-LRM-2-3-1.pdf
Скачиваний:
43
Добавлен:
05.06.2015
Размер:
3.73 Mб
Скачать

Accellera

 

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

branch

(p,n) out;

 

analog begin

 

// add

behavioral statement here

 

end

 

 

endmodule

 

 

The model for a voltage controlled voltage source is

V(out) <+ A * V(in);

The model for a voltage controlled current source is

I(out) <+ A * V(in);

The model for a current controlled voltage source is

V(out) <+ A * I(in);

The model for a current controlled current source is

I(out) <+ A * I(in);

5.6.3 Resistor and conductor

Figure 5-3 shows the model for a linear conductor.

module my_conductor(p,n);

 

 

 

 

 

 

 

 

 

 

 

inout p, n;

 

 

 

 

 

 

 

 

 

 

 

electrical p,n;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

parameter real G=1;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

branch (p,n) cond;

 

 

 

v

 

 

 

 

 

G

 

 

 

 

 

 

 

analog begin

Gv

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I(cond) <+ G * V(cond);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

end

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

endmodule

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 5-3: Linear conductor model

The assignment to I(cond) makes cond a current source branch and V(cond) simply accesses the potential probe built into the current source branch.

Figure 5-4 shows the model for a linear resistor.

Copyright © 2009 Accellera Organization, Inc.

100

 

Accellera

Analog and Mixed-signal Extensions to Verilog HDL

Version 2.3.1, June 1, 2009

module my_resistor(p,n);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

inout p,n;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

electrical p,n;

 

 

i

parameter real R=1;

 

 

 

 

 

 

 

 

R

branch (p,n) res;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

analog begin

 

 

 

 

Ri

 

 

 

 

 

 

 

V(res) <+ R * I(res);

 

 

 

 

 

 

 

 

 

end

 

 

 

 

 

 

 

 

 

endmodule

 

 

 

 

 

 

 

Figure 5-4: Linear resistor model

The assignment to V(res) makes res a potential source branch and I(res) simply accesses the optional flow probe built into the potential source branch.

5.6.4 RLC circuits

A series RLC circuit is formulated by summing the voltage across its three components,

 

d

1

 

t

v(t) = Ri(t) + L

 

i(t) + ---

i(τ)dτ

 

dt

C

 

which can be defined as

V(p, n) <+ R*I(p, n) + L*ddt(I(p, n)) + idt(I(p, n))/C;

A parallel RLC circuit is formulated by summing the currents through its three components,

v(t) d 1t τ τ i(t) = ------- + C v(t) + -- v( )d

R dt L

which can be defined as

I(p, n) <+ V(p, n)/R + C*ddt(V(p, n)) + idt(V(p, n))/L;

5.6.5 Switch branches

Contribution to a branch may be switched between potential and a flow during a simulation. This type of branch is useful when modeling ideal switches and mechanical stops. As a result, contribution statements are allowed within conditional statements but are not allowed within event control statements. Note that the contribution statements shall not use analog operators when the condition can change during the course of a simulation.

101

Copyright © 2009 Accellera Organization, Inc. All rights reserved.

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

f

p

Position of the switch depends on whether a potential or flow is assigned to the branch.

Figure 5-5: Circuit model for a switched source branch

For example, an ideal relay (a controlled switch) can be implemented using a switch branch as follows:

module relay (p, n, cp, cn); inout p, n, cp, cn; electrical p, n, cp, cn; branch (p,n) out;

branch (cp,cn) ctrl; parameter real thresh = 0;

analog begin

@(cross(V(ctrl) - thresh, 0))

; // acts only to resolve threshold crossings

if (V(ctrl) > thresh) V(out) <+ 0;

else

I(out) <+ 0; // optional due to value retention

end endmodule

A discontinuity of order zero (0) is assumed to occur when the branch switches and so it is not necessary to use the $discontinuity function with switch branches. Usage of contribution statements inside event control statements is disallowed as these statements may not be executed at every timepoint.

5.6.6 Implicit Contributions

An important feature of contribution statements is that the value of the target may be expressed in terms of itself. This is referred to as an implicit or fixed-point formulation.

Example:

I(diode) <+ is*(limexp((V(diode) - r*I(diode))/$vt) - 1);

Copyright © 2009 Accellera Organization, Inc.

102

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]