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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

electrical BD;

...

end endmodule

Conditional generate constructs make it possible for a module to contain an instantiation of itself. The same can be said of loop generate constructs, but it is more easily done with conditional generates. With proper use of parameters, the resulting recursion can be made to terminate, resulting in a legitimate model hierarchy. Because of the rules for determining top-level modules, a module containing an instantiation of itself will not be a top-level module.

The following example is a continuously running (unclocked) pipeline analog-to-digital converter that instantiates a lower resolution version of itself as part of its structure.

module pipeline_adc (in, out); parameter bits=8, fullscale=1.0; inout in;

inout [0:bits-1] out; electrical in;

electrical [0:bits-1] out;

comparator #(.ref(fullscale/2)) cmp (in, out[bits-1]);

generate

if (bits > 1) begin electrical n1, n2;

subtractor #(.level(fullscale)) sub (in, out[bits-1], n1); amp2x amp (n1, n2);

pipeline_adc #(.bits(bits-1)) section (n2, out[0:bits-2]); end

endgenerate endmodule

Some of the functionality of conditional generate constructs can also be achieved using paramset overloading, see 6.4.2. For instance, selection of a particular module based on the value or presence of a parameter can also be handled by constructing appropriate paramsets.

6.6.2.1 Dynamic parameters

A special case exists for DC sweep simulations: a series of operating point analyses where one or more parameters of the circuit change value between each analysis, see also 4.6.1 on the Analysis function. Digital simulations do not normally allow a parameter to vary during simulation; in analog simulation it is quite common to sweep a parameter during simulation to get information on how the parameter values influence the circuit behavior and hence the simulation results.

In connection with the conditional generate construct, an implementation may choose to limit the possible parameters to sweep to those that do not influence the structure of the circuit.

6.6.3 External names for unnamed generate blocks

Although an unnamed generate block has no name that can be used in a hierarchical name, it needs to have a name by which external interfaces can refer to it. A name will be assigned for this purpose to each unnamed generate block as described in the next paragraph.

Each generate construct in a given scope is assigned a number. The number will be 1 for the construct that appears textually first in that scope and will increase by 1 for each subsequent generate construct in that

Copyright © 2009 Accellera Organization, Inc.

142

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