How Many Segments

I’d like to take this opportunity to thank my readers for your support over the years. I wish you all a safe and happy holiday season.

If you didn't see my recent EDN article Shaping Edges you might want to give it a go-over before reading the following question. The jist of that article is that simple, one-segment PWL approximations do a poor job of representing fast signals in high-speed signal simulations.

How Many Segments?

[Edited] Your column Shaping Edges suggests that piece-wise linear (PWL) representations of digital signal edges do not have the same spectral content as a Gaussian-shaped edge.  However, the second-to-last sentence says: "If you have a record of the actual signal shape..., use it." 

I don't understand how that record will not also be a PWL representation, since it would come in the form of discrete samples.  I understand that with finer spacing in the time steps that one creates a smoother PWL shape and will therefore adjust the spectral content, but it is still a PWL representation.

We may be having a little syntactical mis-understanding. "Shaping Edges" uses the term "PWL edge" to refer to the use of the piecewise-linear function in SPICE to represent each digital signal edge as a single linear ramp. Let's call that a "one-section PWL representation".

You are correct that the IBIS "waveform" representation could also be considered a PWL signal, but one composed of more time steps, and using a much finer scale, than my simple one-section PWL representation. Let's call that a "multi-section PWL representation".

Clearly, the more segments you use to represent a digital signal edge, the better the PWL representation gets.  If you use enough sections, the frequency-domain properties should eventually approach the correct (Gaussian, in this case) values.

In the concluding paragraph of my article, instead of admonishing you against all PWL representations, perhaps I should have said, "don't use a PWL representation made from just one piece-wise linear section; it's too crude". 

What I did not say in the article, and the question I would like to address today, is how many PWL sections are required?

In answer to that question I shall present a number of examples. I generated data for these examples in three steps.

  • Start with a perfect Gaussian edge.  I normalized the rise time to one second.
  • Sample the perfect Gaussian edge, creating PWL approximations with 1, 4, 8, 16 or 32 segments.
  • Compute the frequency response associated with each PWL approximation, assuming SPICE will do linear interpolation between the sample points.

I then prepared plots comparing spectra of the various PWL approximations to the real thing (a Gaussian spectrum).

Technical notes

The Gaussian edge is described as a function in MathCad using the function pnorm(t,0,1/(2π)½), which is the integral of a Gaussian impulse with mean zero and standard deviation equal to 1/(2π)½.  The value 1/(2π)½ is very close to 0.4.  The 10-90% rise/fall time of this signal is very close to 1 second.

The Equivalent Filter response is the Fourier transform of the impulse response associated with each PWL representation. In case you've gotten a little rusty with your linear systems theory, the impulse response is the derivative, with respect to time, of the step response. This method reveals the frequency response of an equivalent filter that could be used to process a perfectly square-edged signal, turning each perfect edge into precisely the shape stipulated by the step response waveform.  

Here's the first plot (Figure 1). The time-domain step appears on the left. In pale lavender the figure shows a true Gaussian step. The single-segment PWL approximation appears in dark blue. The single-segment PWL shape forms only a crude approximation to the underlying signal.

Circles mark the points defining the PWL edge. The circles are not samples of the waveform. They are merely points in time at which the PWL waveform attains levels of zero and 1, respectively.  The spacing between the circles is set at ±0.625 sec. so that the linear ramp intersects the Gaussian curve near its 10% and 90% points, which occur at positions ±0.500 sec.

The spacing between corners of the single-segment ramp is set to 1.25 sec. That spacing creates periodic artifacts in the frequency domain, at repeating intervals of 0.8 Hz. The periodic repetition of frequency-domain artifacts is a central feature of sampled-time data systems. Whatever sampling interval ΔT is used, the frequency-domain transformation displays periodic artifacts spaced at intervals of 1/ΔT. In Figure 1, nulls in the frequency-domain plot occur at frequencies of 0.8, 1.6, 2.4, 3.2, 4.0, and 5.6 Hz.

Those of you with DSP backgrounds may recognize that the frequency-domain artifacts in this figure fall off with intensity proportional to 1/f. For example, comparing the peak at 2.0 Hz to the peak at 4.8 Hz, the amplitude falls off by 7.6 dB. This is an unavoidable property of PWL reconstruction. The sample spacing determines the frequencies where artifact peaks will fall, but the PWL method itself makes those peaks fall off with 1/f.  To obtain a faster roll-off you must use better interpolation (2nd or 3rd-order polynomials work better, as do anti-aliasing filters).

Figure 2 shows a 4-segment PWL representation. It performs marginally better than the single-segment representation. The central three points are exact samples of the underlying Gaussian step. The first and last points are, as in the previous example, set to zero and unity.

Figure 2 also expands (slightly) the region over which those points are sampled.  Whereas Figure 1 modeled the active region of the step from -0.625 to +0.625, Figure 3 uses a wider span, going from -1 to +1 sec. This expansion of the sampled region optimizes the representation accuracy. Given a fixed number of segments, if the sampled region is set too narrow you get a very fine representation of the interior of the rising edge, but large discontinuities at the leading and trailing edges of the representation. If the sampled region is set too wide, you waste large numbers of samples just representing regions of perfect zeroes (before the leading edge) and perfect ones (after the trailing edge).

If you are comfortable with statistics, you may find it useful to think of the width of the sampled region in terms of the standard deviation of the impulse response of the underlying Gaussian step waveform. Figures 2 through 5 set the width of the sampled region to:  ±2.5, ±3, ±3.5 and ±4 standard deviations, respectively.

Figure 3, 4 and 5 add successively more segments to the representation.

Conclusion: If you are modeling high-frequency effects in your system, especially connectors, long vias, or anything that harbors high-frequency resonances, substantial over-sampling (perhaps at least 16 samples per rising edge) may be required to obtain a satisfactory representation of your high-speed edges.

Those of you steeped in the art of digital signal processing may recognize that 8x over-sampling, combined with a terrifically effective interpolation filter, might perform as well or better than 32x over-sampling with simple PWL interpolation. Therefore, if your simulator uses an advanced interpolation method more powerful than simple PWL interpolation, it may not require the degree of over-sampling shown here.

I realize that this data, by itself, does not say precisely what is required for your simulations, because it doesn't take into account your expectations of what you wish to model or with what accuracy, but I do hope that these notes are helpful to you in making your own decision. Personally, I like 32 segments spread across 3x the signal rise time.

Best Regards,
Dr. Howard Johnson