The purpose of this paper is to define support for small-signal frequency domain concepts in VHDL 1076.1. The paper addresses small-signal frequency domain modeling and simulation as well as small-signal noise modeling and simulation.
The table of contents of this document is available here.
[after LRM 7.5-683]
7.6 Linear Forms
The equivalent function EF of an expression E with respect to the name N of a value bearing object that appears in E is defined as follows:
function EF (N: <typeofN>) return <typeofE> is begin return E; end EF;
where EF is a name unique to the expression and the name, <typeofN> is the type of the value denoted by the name N, and <typeofE> is the type of expression E. Given an expression E, of a base type with the subtraction ("-") operation defined on it, an increment function INCF can be defined with respect to the name N of a value bearing object in E, at a value V for N, as follows:
function INCF (N, V: <typeofN>) return <typeofE> is definition of EF; begin return EF(N) - EF(V); end INCF;
where V has the same type as N and other names are as given above. The partial derivative function, PDF, of an expression E with respect to the name N of a value bearing object in expression E, at a value V for N, where the base type of E has the subtraction ("-") and division ("/") operations defined, may be defined as follows:
function PDF (N, V: <typeofN>) return <typeofE> is definition of INCF; begin implement PDF; end PDF;
where "implement PDF" is any reasonable numerical algorithm that returns the limit of the following expression:
INCF(N, V) / (N - V)
as the value of N approaches the value of V, INCF is formed from the expression as above, and other names are as above.
An expression E is said to be linear with respect to the name N of a value bearing object in E if the value of PDF(N, V) is the same for any value of V in its subtype. An expression is linear in a set of names if it is linear with respect to each name in the set. An expression is independent of the name if the value of the expression does not change regardless of the value of the name.
The linearized form of any expression with respect to the quantity names N0, ..., Nm in that expression at the values V0, ..., Vm is the following expression:
PDF0(N0, V0)*N0 + PDF1(N1, V1)*N1 + ... + PDFm(Nm, Vm)*Nm
where the PDF's for each name in the expression is constructed as above. This expression is linear in all its quantities.
[In package STANDARD]
type DOMAIN_TYPE is (INITIALIZATION_DOMAIN, TIME_DOMAIN, FREQUENCY_DOMAIN);
signal DOMAIN: DOMAIN_TYPE;
[At 1076.1 LRM 4.1.3.6-538]
quantity_declaration ::= free_quantity_declaration | branch_quantity_declaration | source_quantity_declaration
[At 1076.1 LRM 4.3.1.6-544]
source_quantity_declaration ::= quantity identifier_list : subtype_indication source_aspect ;
[At 1076.1 LRM 4.3.1.6-550]
source_aspect ::= spectrum magnitude_simple_expression , phase_simple_expression | noise magnitude_simple_expression
[At 1076.1 LRM 4.3.1.6-553]
A source quantity declaration declares a source quantity. A source quantity whose source aspect includes the reserved word spectrum is a spectral source quantity. A source quantity whose source aspect includes the reserved word noise is a noise source quantity.
[At 1076.1 LRM 4.3.1.6-576]
The tolerance group of each scalar subelement of a source quantity is the tolerance group of the corresponding scalar subelement of its subtype.
[At 1076.1 LRM 4.3.1.6-591]
The type of the magnitude simple expression and phase simple expression in a source aspect must be that of the source quantity. It is an error if the name of a source quantity appears in an expression in a source aspect.
[In package STANDARD]
-- a function that returns the current simulation frequency function FREQUENCY return REAL;
[At ???]
The predefined function FREQUENCY returns the value of the current simulation frequency if the value of the predefined signal DOMAIN is FREQUENCY_DOMAIN; it returns 0.0 otherwise. It is an error if a call to the FREQUENCY function appears in an expression that is not part of a source aspect.
[In section 14]
Q'ZOH(T, INITIAL_DELAY)
use ieee.math_real.all; block generic (t: real; initial_delay: real := 0.0); generic map (t => t, initial_delay => initial_delay); port (quantity q: in <type_of_q>; quantity zoh: out <type_of_q>); port map (q => q, zoh => q'Zoh(t, initial_delay)); signal s: <type_of_q> := 0.0; begin process begin wait on DOMAIN; if initial_delay > 0.0 then wait for initial_delay; -- needs real timeout clause end if; loop s <= q; break when s /= q; wait for t; -- requires real timeout clause end loop; end process; if DOMAIN = FREQUENCY_DOMAIN use if FREQUENCY = 0.0 use zoh == q; else zoh == q'Delayed(0.5 * t) * sin(FREQUENCY*math_pi*t) / (FREQUENCY*math_pi*t); end use; elsif DOMAIN'Delayed = INITIALIZATION_DOMAIN use if initial_delay = 0.0 use zoh == q; -- follow q during initialization else zoh == 0.0; end use; else -- time domain zoh == s; end use; end block;
Notes
[In package STANDARD]
type REAL_VECTOR is array(NATURAL range <>) of REAL;
[In section 14]
Q'LTF(NUM, DEN)
block generic (num, den: REAL_VECTOR); generic map (num => num, den => den); port (quantity q: in <type_of_q>; quantity qtf: out <type_of_q>); port map (q => q, qtf => Q'Ltf(num, den)); constant nnum: INTEGER := num'Length-1; constant nden: INTEGER := den'Length-1; alias b: REAL_VECTOR(0 to nnum) is num; alias a: REAL_VECTOR(0 to nden) is den; quantity qin: REAL_VECTOR(0 to nnum); quantity qout: REAL_VECTOR(0 to nden); function "*"(v1, v2: REAL_VECTOR) return REAL is variable result: REAL := 0.0; begin for i in v1'Range loop result := result + v1(i)*v2(i); end loop; return result; end function "*"; begin q == qin(0); qin(1 to nnum) == qin(0 to n-1)'Dot; qtf == qout(0); qout(1 to nden) == qout(0 to nden-1)'Dot; qout(0) == (qin * b - qout(1 to nden) * a(1 to nden)) / a(0); end block;
Q'ZTF(NUM, DEN, T, INITIAL_DELAY)
block generic (num, den: REAL_VECTOR; t: REAL; initial_delay: REAL := 0.0); generic map (num => num, den => den, t => t, initial_delay => initial_delay); port (quantity q: in <type_of_q>; quantity qtf: out <type_of_q>); port map (q => q, qtf => Q'Ztf(num, den, T, initial_delay)); constant nnum: INTEGER := num'Length-1; constant nden: INTEGER := den'Length-1; alias b: REAL_VECTOR(0 to nnum) IS num; alias a: REAL_VECTOR(0 to nden) is den; quantity qin: REAL_VECTOR(0 to nnum); quantity qout: REAL_VECTOR(0 to nden); function "*"(v1, v2: REAL_VECTOR) return REAL is variable result: REAL := 0.0; begin for i in v1'Range loop result := result + v1(i)*v2(i); end loop; return result; end function "*"; begin qin(0) == q'Zoh(T, initial_delay); qin(1 to nnum) == qin(0 to n-1)'Delayed(T); qtf == qout(0); qout(1 to nden) == qout(0 to nden-1)'Delayed(T); qout(0) == (qin * b - qout(1 to nden) * a(1 to nden)) / a(0); end block;
Given a system model described by the equations
F(x, dx/dt, t) = 0
and a solution x0, dx0/dt at t0. The Taylor expansion of F about the solution at t0 is:
F(x-x0, dx/dt-dx0/dt, t-t0) = F(x0, dx0/dt, t0) + PF(x, dx/dt, t)/Px . (x-x0) + PF(x, dx/dt, t)/P(dx/dt) . (dx/dt-dx0/dt) + PF(x, dx/dt, t)/Pt . (t-t0) + higher order terms
where the P indicates partial differential and all partial derivatives are evaluated at the solution x0, dx0/dt. The small-signal model is defined as the linear terms in this expansion. It is a linear incremental model of the form G(x, x0) = F(x-x0) - F(x0) = PF(x)/Px . (x - x0), and we can solve the linear system of equations G(x, x0) = rhs, where rhs is a constant vector formed from the small-signal stimulus applied to the model. We also note that for traditional small-signal analyses the time is held constant and that, by convention, the increment (x-x0) in G is mapped onto x, so the value of an unknown x has to be interpreted differently in large-signal and small-signal simulations.
For a small-signal frequency domain simulation G(x, x0) can be transformed into the frequency domain using the Fourier transform, and rhs will be a complex vector.
Section 2.1 provides a formal definition for the partial differential PDF of an expression with respect to an object whose name appears in the expression, evaluated at a specified value for the object. With the exception of taking the limit, it is based on the VHDL expression evaluation semantics, i.e. it avoids symbolic manipulations of the expression. The linearized form of the expression, i.e. its total differential, is then defined in terms of the PDFs.
The small signal model is then built by replacing each explicit characteristic expression (CE) by its linear form for small-signal frequency domain calculations and small-signal noise calculations. Additionally, we replace the implicit CEs related to quantities of the form Q'Dot, Q'Integ and Q'Delayed(T) by their respective Fourier transformed forms. Depending on the small-signal simulation we also must replace the implicit CE corresponding to some source quantities; this will be discussed below. We note that nothing needs to be done to the other implicit CEs, because they are linear, so their linearized form is identical to their original form.
As a result of discussions in the LDC we distinguish between three domains: initialization, time, and frequency. The domain concept is implemented by a signal DOMAIN whose value is initialized to INITIALIZATION_DOMAIN and changes when the simulation has reached the quiescent point. See Initialization for details.
There are two kinds of stimuli for small-signal analyses: stimulus for a small-signal frequency domain simulation (similar to a SPICE AC analysis), and stimulus for a noise simulation. Although they are treated differently by the respective algorithms they share many common properties.
The common requirements are as follows.
Additionally, the following requirements apply to noise stimulus only.
The definition unify the two kinds of stimuli under the concept of a source quantity. Since the CE of a source quantity Q is Q, its value is equal to zero under most conditions. This allows a source quantity to be used in any VHDL expression, with no effect except in its related small-signal simulation. There, its effect is as expected, due to the definition of the linearized form and the corresponding calculations to obtain small-signal results. For example, an expression of the form f(q) . Q, where Q is a source quantity and q represents other quantities, appears as f(q0) . Q in the linearized form about q0.
Source quantities are declared by a source quantity declaration. This allows a user to give each such quantity a unique name as well as an appropriate type, which can be a composite type. Source quantities come in two kinds. The spectral source quantity implements a stimulus for a small-signal frequency domain (AC) simulation, while the noise source quantity supports noise stimulus. The kind can be determined from the declaration, which uses special syntax. The reserved word spectrum in a source quantity declaration identifies a spectral source quantity, the reserved word noise identifies a noise source quantity. Both declarations take arguments that are expressions of the same type as the source quantity. These expressions are not required to be static, i.e. they can contain the names of quantities and signals. These expressions are used to form characteristic expressions when the simulations related to the source quantity are done. For a spectral source quantity they support the specification of a complex spectrum, for a noise source quantity only the magnitude of the spectrum can be specified.
The predefined function FREQUENCY returns, during frequency domain simulations, the value of the current simulation frequency. Calls to the FREQUENCY function can appear only in expressions that are part of the declaration of source quantities.
Among the noise sources it is an easy task for the analyzer to identify those whose magnitude simple expression is of the form [ expression1 mul_op ] FREQUENCY ** expression2 [ mul_op expression3 ] where mul_op ::= * | /. These are the flicker noise sources. Because of this possibility there is no need to syntactically distinguish between a flicker noise spectrum and other noise spectra.
The definitions cover the calculations for a single frequency point. First, the quiescent point is determined, about which the model will be linearized. Then the small-signal model is constructed by replacing
Before the CEs corresponding to the source quantities are handled the desired simulation frequency must be established. For a small-signal frequency domain (AC) simulation the definition of the frequency domain augmentation set guarantees that the CEs corresponding to the spectral source quantities get the complex values specified by the magnitude simple expression and the phase simple expression in its declaration. For a small-signal noise simulation the noise source quantities must be handled one after the other to allow the summing of the noise powers.
This is a useful primitive whose frequency domain behavior cannot be described using the VHDL 1076.1 language. This is the reason why it is a predefined quantity. It allows the specification of the sampling period, which must be a static expression with a positive value, and an initial delay after which sampling starts. The delay must also be a static expression. Its value defaults to zero and must not be negative.
The Laplace transfer function implements, in the frequency domain, a ratio of two polynomials in the Laplace operator s. In the time domain this corresponds to a linear ODE with constant coefficients. In the language the Laplace transfer function is defined as an attribute of kind quantity, similar to the quantities Q'Dot or Q'Integ. Its value is defined by a linear ODE with constant coefficients, by means of an equivalent block. This approach resolves a definitional problem related to initial conditions: From the perspective of the text of the model none of the derivatives of Q exist, so an initial condition for say Q'Dot specified in the text of the model does not affect the derivatives appearing in the equivalent block.
The Z transfer function implements a ratio of two polynomials in the variable z**-1, which represents a delay by a constant T. Like the Laplace transfer function, the Z transfer function is defined as an attribute of kind quantity, by means of an equivalent block. The parameter initial_delay allows to specify when the first sampling occurs, after that it occurs at intervals of length T.
In both cases numerator and denominator polynomials are specified as real arrays. They must be constant, to permit an analytical transformation of the resulting characteristic expressions into the frequency domain. Further, the first scalar subelement of the denominator array must be non-zero, to avoid the need for initial conditions.
The transfer functions require the definition of type REAL_VECTOR for the specifications of the polynomial coefficients. This type is defined in package STANDARD as an unconstrained array with a natural index.
Because type REAL_VECTOR is not part of VHDL 1076, it is possible or even likely that it will be also defined somewhere in a package. According to the VHDL visibility rules we have two cases to distinguish if such a package is made visible through a USE clause:
We cannot do much about this problem except to list it in an appendix as a potential portability problem when upgrading from VHDL 1076 to VHDL 1076.1.
Unlike Q'Dot, Q'Integ and Q'Delayed(T), Q'Ltf and Q'Ztf are defined only for scalar quantities. In control system applications matrix transfer functions would make sense, with Q being an array, but this kind of functionality has its problems:
Other forms of transfer functions allowing specification of poles and/or zeros have not been defined here for the following reasons.
The DOMAIN concept could be implemented as a function. However, this would still require a signal to allow changes in the time domain model when the quiescent point has been reached. As a consequence, some information would be duplicated, as DOMAIN = INITIALIZATION_DOMAIN always implies that the quiescent point has not yet been reached. The current version with DOMAIN as a signal removes this duplication and is therefore cleaner.
In earlier versions of this document the source quantities were implicit quantities with names of the form spectrum(mag, phase), noise(mag), and flicker_noise(mag, exp). This caused the following definitional problems.
The separate treatment of flicker noise was removed in favor of a uniform syntactic treatment for all noise source quantities based on the assertion of compiler experts that it is an easy task to analyze the magnitude simple expression in a noise quantity declaration and discover whether it has the form of a flicker noise specification. The uniform treatment avoids an extra reserved word in the language without loss of functionality.