| Design | Spectra | Loop Filter | MASH Simulation | Back to projects | 15-25 MHz Synthesizer |
The output of the MASH structure is a repetitive pseudo-random sequence. The mean value of ΔN has a very useful property

Where MOD is the modulus of the overflowing accumulators within the MASH. The length of the sequence depends on MOD and is typically very long. The range of values which ΔN can take depends on the number of stages (order) of the MASH.
MASH output noise is concentrated at higher frequencies which are attenuated by the loop.
The graph opposite illustrates the effect, known as noise shaping.
This is the spectral content of the PFD output.
The log frequency scale is normalised to sequence repetition rate, which is a very low frequency.
I simulated a 4th order MASH with 16-bit accumulators and fractional command F=1.
Since MASH output noise rises at 80 dB per decade for a 4-stage MASH, and the divide-by-N (ΔN freq → phase) is an integration, I expected a 60 dB per decade slope; but, as another simulation better illustrates, there are distortion products rising at 20 dB per decade superimposed on the anticipated 60 dB slope. The PFD output is a form of PWM, which is inherently distorting; but why the 20 dB slope? Software simulationAlthough the PFD output waveform is complex, it is (a) predictable and (b) periodic enabling us to perform Fourier analysis. The procedure is actually very simple:
|
Update May 2007: Please visit my PLL Simulation page.
Returning to my "open loop" simulation, the MASH sequence ΔN is generated using C++ class MASH as follows:
MASH m;
for (int i=0; i<SEQLEN; i++) Delta[i] = m.Clock();
|
From the ΔN sequence, it's easy to calculate the position, width and polarity of every PFD output pulse:
int t=0;
for (i=0; i<SEQLEN; i++)
{
t += Delta[i];
tVCO[i] = (i+1)*N + t;
tREF[i] = (i+1)*N + (i+1)*double(F)/double(MODULO);
}
|
Finally, we calculate Fourier series coefficents for the repetitive PFD output waveform:
// 2L = Sequence length (in VCO periods)
const double L = SEQLEN/2 * (N + double(F)/double(MODULO));
for (double h=1; h<1e7; h=h<100?h+1:h*1.01)
{
double a=0, b=0, n=floor(h);
// Superposition of pulses
for (i=0; i<SEQLEN; i++)
{
// Fourier series integrals over period 0....2L for nth harmonic
a += 1.0/n/PI * (sin(n*PI/L*tVCO[i]) - sin(n*PI/L*(tREF[i])));
b -= 1.0/n/PI * (cos(n*PI/L*tVCO[i]) - cos(n*PI/L*(tREF[i])));
}
printf("%g,%g\n", log10(n), 10*log10(a*a + b*b));
}
|
For clarity, this code is unoptimised. It's unnecessary and inefficient to call trig functions in a loop like this. A dramatic performance improvement can be realised using recurrence relations, which made it practical for me to do a 24-bit simulation for my MASH theory page.
|
Relationship between reference period and VCO period
All times are normalised to the VCO period in the C++ code.
|
Position of i th reference edge
Position of i th VCO-divider edge
|
The Fourier series coefficients an, bn of the nth harmonic of a repetitive function f(x) with period 2L are
![]() |
![]() |
Using the principle of superposition, the Fourier coefficients of the PFD output sequence can be found by calculating and summing the coefficients of each individual pulse separately. The coefficients for a pulse of amplitude IPD starting at time t1 and ending at time t2 are
![]() |
![]() |
![]() |
![]() |
The following limits are substituted into the above integrals
| Leading edge | Polarity | Integral limits |
| REF | +VE
IPD > 0 |
t1 = tREF
t2 = tVCO |
| VCO | -VE
IPD < 0 |
t1 = tVCO
t2 = tREF |
Negative signs conveniently cancel yielding the same expressions for both +ve and -ve pulses


The graph reveals harmonic distortion at 128, 192, 256 and 320. The sampling rate is visible at 65536.
Let's try a 2-tone test:
tFall[i] = i + 0.5 + 0.25 * sin(2*PI*69*i/SEQLEN)
+ 0.25 * sin(2*PI*64*i/SEQLEN);
|
|
|||||||||||||||||||||||||
|
Now we've got intermodulation distortion (IMD) as well. The lowest beat note is 69 - 64 = 5. The product amplitudes give a clue to their order.
The intrinsic nonlinearity of uniformly sampled PWM produces in-band distortion: the signal is corrupted; a perfect replica of the baseband cannot be recovered by low-pass filtering. Naturally sampled PWM on the other hand, which can be generated by applying the signal and a triangle wave to a comparator, is linear within the baseband frequency range.
| Copyright © Andrew Holme, 2004. |
|