Analog Circuit Simulation:Verilog-A.
Verilog-A
Verilog-A is a new language designed for simulation of analog circuits at various levels. Mathematical equations can be entered directly as well as normal SPICE-type circuit elements.
Groups of equations and elements can be combined into reusable “modules” that are similar to subcir- cuits. Special functions are also provided for converting analog signals into digital equivalents, and vice versa. Systems-type elements such as LaPlace operators, integrators, and differentators are also provided. This makes it possible to perform new types of modeling which were not possible in simulators like SPICE:
• Equations can be used to construct new models for electrical devices (for example, the Ebers-Moll model described earlier could be easily implemented).
• Behavioral models for complex circuits like op-amps, comparitors, phase detectors, etc. can be constructed. These models can capture the key behavior of a circuit and yet be simulated in a small fraction of the time it takes to simulate at the circuit level.
• Special interface elements make it possible to connect an analog block to a digital simulator, making mixed-mode simulation possible. Verilog-A is related to and compatible with the popular Verilog-D modeling language for digital circuits.
As an example, consider a phase-locked loop circuit which is designed as an 50X frequency multiplier. A block diagram for the PLL is shown in Figure 13.14 and the Verilog-A input listing is shown in Figures 13.15 and 13.16.
Simulation of this system at the circuit level is very time consuming due to the extreme difference in frequencies. The phase detector operates at a low frequency of 1.0 MHz, while the VCO operates at close to 50 MHz. However, we need to simulate enough complete cycles at the phase detector output to verify that the circuit correctly locks onto the reference signal.
The circuit is broken up into five blocks or modules: The “top module,” VCO, divider, phase detector, and loop filter. The VCO has a simple linear dependence of frequency on the VCO input voltage and produces a sinusoidal output voltage. The VCO frequency is calculated by the simple expression freq = center + gain * (Vin - Vmin). Center and gain are parameters which can be passed in when the VCO is created within the top module by the special syntax “#(gain(2e7),. center(3e7)” in the top module. If the parameters are not specified when the module is created,
then the default values specified within the module are used instead. The special V() operator is used to obtain the voltage at a node (in this case V(in) and V(Vdd). The sinusoidal output is created using the SIN and IDT operators. SIN calculates the sin of its argument. Idt calculates the integral of its argument with respect to time. The amplitude of the output is taken from the Vdd input, thus making it easy to integrate the VCO block with others. Given that Vdd = 5 volts, gain = 2e7 Hz/V center = 3e7 Hz, and in = 1.8, the final expression for the VCO output is:
The phase detector functions as a charge pump which drives current into or out of the loop filter, depending on the phase difference between its two inputs. The @cross(V1,dir) function becomes true whenever signal V1 crosses zero in the direction specified by dir. This either increments or decrements the variable STATE. The “transition” function is used to convert the STATE signal, which is essentially digital and changes abruptly, into a smoothly changing analog signal which can be applied to the rest of the circuit. The “<+” (or contribution) operator adds the current specified by the equation on the right to the node on the left. Therefore, the phase detector block forces current into the output node whenever the VCO signal leads the reference signal and forcing current out of the output node whenever the reference leads the vco signal. The phase detector also has an output resistance which is specified by parameter ROUT.
The loop filter is a simple SPICE subcircuit composed of two resistors and one capacitor. Of course, this subcircuit could contain other types of elements as well and can even contain other Verilog-A modules. The divider block simply counts zero crossings and, when the count reaches the preset divisor, the output of the divider is toggeled from 0 to 1, or vice versa. The transition function is used to ensure that a smooth, continuous analog output is generated by the divider.
This PLL was simulated using AMS from Antrim Design Systems. The results of the simulations are shown in Figure 13.17. The top of Figure 13.17 shows the output from the loop filter (Vcnt). After a few cycles, the PLL has locked onto the reference signal. The DC value of the loop filter output is approximately 2.8 V. Referring back to the VCO model, this gives an output frequency of 2e7*(2.8 – 1.8) + 3e7 = 50 MHz,
which is as expected. The lower portion of Figure 13.17 shows the divider output (Vdiv) and the reference signal (Vref ). It can be seen that the two signals are locked in phase. Figure 13.18 shows the VCO output and the divider output. As expected, the VCO frequency is 50 times the divider frequency.
The behavioral models used in this example are extremely simple ones. Typically, more complex models must be used to accurately simulate the operation of an actual PLL. A better model might include effects such as the non-linear dependence of the VCO frequency on the input voltage, the effects on signals introduced through power supply lines, delays in the divider and phase detector, and finite signal rise and fall times. These models can be built up from measurements, or transistor-level simulation of the under- lying blocks (a process known as characterization). Of course, during the simulation, any of the behavioral blocks could be replaced by detailed transistor level models or complex Verilog-D digital models.
Another Verilog-A example is shown in Figure 13.19. Here, the Ebers-Moll model developed earlier is implemented as a module. This module can then be used in a circuit in much the same way as the normal built-in models. Verilog-A takes care of calculating all the derivatives needed to form the Jacobian matrix. The “parameter” entries can be used in the same way as the parameters on a SPICE.MODEL statement. Observe the special “ddt” operator. This operator is used to take the time derivative of its argument. In this case, the time derivative of the charge (a current) is calculated and summed in with the other DC components. The “$limexp” operation is a special limited exponential operator designed to give better convergence when modeling pn junctions. Of course, this module could be expanded and additional features could be added.
Comments
Post a Comment