Analog Operator Restrictions

A number of functions are classed as analog operators. These functions store state information. That is, their return value depends on previous history and not just on the current value of its arguments. Because of this, analog operators are subject to some restrictions on where they may be used. These restrictions are as follows:

  1. Analog operators may not be used inside a conditional statement (if or case) if the conditional expression controlling that statement could change during the course of a transient analysis. For example, the following is not permitted

    if (V(n1)>0)
    I(out) <+ ddt(cap*V(out)) ;

    In the above V(n1)>0 could change in a transient analysis if the voltage on node n1 rises above or below zero. This means that ddt would only get executed some of the time and so its state history would not always be correct.

    The following is permitted

    paramter integer enable_cap = 0 ;
    if (enable_cap)
    I(out) <+ ddt(cap*V(out)) ;

    this is OK because enable_cap is a parameter and will have a fixed value during the course of a transient analysis. So either ddt will always be executed or it will never be executed. Both scenarios will work correctly.
  2. Analog operators are not permitted in repeat or while loops nor are they permitted in for loops that are not analog-for loops.

Analog operators are permitted in analog for loops. These are for loops controlled by a genvar controlling variable. This is explained in Analog For Loops and genvars.

The analog operator restrictions apply to the following functions: