Background and Outline
In many cases, creating a set of sample points to form a piecewise linear description of a square wave does not pose a significant challenge. Creating more complex waves, such as amplitude or phase modulated square waves, can require far more effort and may be non-trivial.
The program described in this document, vpulse, is designed to create a set of samples representing a complex periodic square wave for use with a simulation tool or for studying the properties of the waveform. To demonstrate its use as a signal analysis or education tool, vpulse is used to provide insight into the following three questions.
- How does the bandwidth of a square wave with slew-rate limited transitions compare to one with RC time constant limited transitions when both waveforms have similar transition times?
- When a square wave is amplitude modulated by random noise, how does the nature of its transitions impact its phase noise?
- How does the frequency spectrum compare for a square wave with sinusoidal phase modulation compared to one with sinusoidal amplitude modulation?
Each of the three questions is analyzed using vpulse in the first section. The following section provides a brief overview of the program and its inputs, and final section provides a summary of its capabilities. The program is available to download for those with an interest.3
Signal Analysis Using vpulse
To answer the three questions posed, three analyses are presented that illustrate the operation of vpulse in combination with its optional power spectral density and jitter analysis components. Additional examples are included in its documentation.3
Analysis 1
"How does the bandwidth of a square wave with slew-rate limited transitions compare to one with RC time constant limited transitions when both waveforms have similar transition times?"
To provide insight into this question, two 233 MHz square waves are synthesized using vpulse: a 50% duty cycle square wave with transition times limited by the RC time constant of its post-filter; and a 50% duty cycle waveform with the same 10% to 90% transition times as the RC limited waveform but slew-rate limited. Each simulation includes 1025 periods and is uniformly sampled 1000 times per period for a total of 1.025e6 time samples.
The command lines used to synthesize and analyze each waveform are shown in Example command lines [1] and [2]. The two commands will produce sets of data files containing the temporal waveform data and their power spectral densities.
Table 1 provides the simulated and measured transient parameters.
vpulse 233e6 0 0 0 50 2 1000 1025 1025 y n |
Example command [1] |
vpulse 233e6 0 21.4 21.4 50 7 1000 1025 1025 y n |
Example command [2] |
The waveforms produced by vpulse are time normalized to their 233 MHz period and shown with their derivatives in Figure 1. The 10% to 90% transition times for both waveforms are 17.51% of the period. The slope of the slew-rate limited waveform is limited to about 1 V/ns and remains constant throughout its transition time while the slope of the RC limited waveform has a significant transient from its near zero value followed by an exponential decay from about 3 V/ns to zero.
The power spectral densities from vpulse are shown in Figure 2 and indicate the waveform with the RC limited transition times has a greater number of significant high frequency components than the slew-rate limited waveform. The fundamental amplitude and second harmonic of both waveforms are similar, but the magnitude of all higher harmonics is greater for the RC limited transition time waveform than the slew-rate limited transition time waveform. From a bandwidth perspective, the bandwidth of the RC limited transition time waveform exceeds that of the slew-rate limited waveform.
In summary, in answer to our first question, for square waves with near equal 10% to 90% transition times, the bandwidth of one whose transition times are limited by an RC time constant exceeds that for one whose transition times are slew-rate limited.
Analysis 2
"When a square wave is amplitude modulated by random noise, how does the nature of its transitions impact its phase noise?"
To answer question two, the 233 MHz square waves of Analysis 1 are re-synthesized with 0.20 UI of 1 GHz random Gaussian noise. Example commands [3] and [4] are used to synthesize and analyze the square waves. Both commands utilize vpulse modules psd_sppwr and jitterhist.
vpulse 233e6 0 0 0 50 2 1000 1025 1025 0.20 unfiltered gaussian 1e9 am y y |
Example command [3] |
vpulse 233e6 0 21.4 21.4 50 7 1000 1025 1025 0.20 unfiltered gaussian 1e9 am y y |
Example command [4] |
jitterhist produces data files and plots of the time interval error (TIE) and phase noise. A graphical summary of the TIE and phase noise for both modulated square waves are provided in Figure 3 and Figure 4 respectively.
The negative and positive edge based time interval errors for slew-rate limited and RC limited transition time waveforms show similar behavior. However, the variation in time interval error of the waveform with RC limited transitions is far greater than the variation for the slew-rate limited transition time waveform.
The phase noise of the RC limited transition time waveform exceeds the phase noise of the slew-rate limited waveform over the entire frequency range and shows the same basic behavior.
Figure 4. Phase noise of 233 MHz amplitude modulated square waves with slew-rate and RC limited transition times. m = 0.20, 1 GHz Gaussian random noise, 233 GHz sample rate, 1024 periods. 10% - 90% transition times of both waveforms = 17.5%.
Histograms of the positive and negative edge slopes as they cross the voltage threshold of 500 mV are shown in Figure 5. The slopes of the RC limited waveform exceed those of the slew-rate limited waveform. With its larger slopes, one might expect that the variation in TIE and phase noise of the amplitude modulated RC limited waveform will be less than the amplitude modulated slew-rate limited waveform. However, the rms jitter of the amplitude modulated RC limited waveform is a factor of 4 greater than the rms jitter of the amplitude modulated slew-rate limited waveform.
The reason for this behavior lies in the variation in the duty cycle of the two square waves. The variation in duty cycle with amplitude modulation is greater for the RC limited waveform than the slew-rate limited waveform as shown in Figure 6. The duty cycle variation manifests itself as phase modulation and increases the TIE and phase noise. Consistent with this conclusion, the ratio of the rms jitter of the two waveforms (≈ 4) and the ratio of their zero mean rms duty cycle distortions (≈ 4) are essentially equal.
In answer to our second question, the phase noise and TIE of the amplitude modulated waveform with RC limited transition times is significantly greater than the phase noise and TIE of the amplitude modulated square wave with slew-rate limited transition times.
Analysis 3
"How does the frequency spectrum compare for a square wave with sinusoidal phase modulation compared to one with sinusoidal amplitude modulation?"
To provide insight into question three, two sets of 125 MHz square waves are synthesized using vpulse: a set of eight 23.333 MHz phase modulated square waves with 50% duty cycle and transition times limited by the RC time constant of its post-filter; and a set of eight 23.333 MHz amplitude modulated square waves with 50% duty cycle and transition times limited by the RC time constant of its post-filter. The modulation index of the phase and amplitude modulated waveforms was varied from 0.0 to 0.70 with an increment of 0.10. Without any modulation (m = 0), the simulated and measured transient parameters are shown in Table 2. The simulations were conducted for 1025 periods and include 1000 samples per 125 MHz period. Example command [5] was used to synthesize and analyze the 125 MHz square wave phase modulated at 23.3333 MHz with a modulation index of 0.20.
vpulse 125e6 0 0 0 50 5 1000 1025 1025 0.20 unfiltered sinusoidal 2.333333333333e7 pm |
Example command [5] |
The power spectral density data generated by vpulse with its psd_sppowr module are combined for each modulation type and shown about the fundamental frequency of 125 MHz in Figure 7.
Amplitude modulation creates a single set of 23.3333 MHz sidebands whose amplitude is a monotonically increasing function of the modulation index. The amplitude of the 125 MHz fundamental is the same for all modulation indices. Both behaviors are consistent with amplitude modulation theory.
However, phase modulation creates a series of 23.3333 MHz sidebands whose amplitude vary with the modulation index. In addition, the fundamental 125 MHz amplitude varies non-monotonically with the modulation index. As the modulation index increases, the power in the fundamental is decreased and the power in its sidebands is increased. However, further increases in the modulation index increase the power in the fundamental. The amplitude of the fundamental for a phase modulated sinewave with modulation indexπ (β = 2πm) has been analyzed [6] and is described by the zeroeth order Bessel function of the first kind J0(β). A comparison of the theoretical fundamental amplitude and the integrated fundamental amplitude about 125 MHz from the power spectral density data is shown in Figure 8. The simulated behavior correlates well with phase modulation theory.
This completes the analysis for question three. The amplitude and phase modulated spectrum are significantly different for the range of simulated modulation indices and are consistent with amplitude and phase modulation theory.
Program Description and Inputs
vpulse1 generates periodic piecewise linear square waves. Figure 9 provides the definitions of its input waveform parameters and provides a block diagram that outlines its basic operation and optional features. The program includes the ability to specify an amount of amplitude or phase modulation of various types and to include a first-order lowpass post-filter to limit the bandwidth of the piecewise linear square wave.
The output of the program is a comma-separated variable file containing the samples of the simulated waveform with a single header line.
The square wave frequency, initial phase, rise time, fall time, and duty cycle are programmable as are the number of periods to simulate, the number of samples per period, and number of periods to include in the output file.
Optionally, the square wave can be amplitude or phase modulated with a sinusoidal source or one of two random noise sources. The amount of modulation to apply is specified using its modulation index. The two random noise sources are followed by a single-pole filter with a programmable bandwidth to allow the use of bandlimited noise. If sinusoidal modulation is selected, the parameter used to specify the bandwidth of the noise filter is the frequency of the sinusoidal modulation. Sinusoidal amplitude or phase modulation is not filtered.
An optional first-order post-filter is available to limit the bandwidth of the square wave output and remove the discontinuities of a piecewise linear source.
The UNIX version of the program is invoked from the command line. If not invoked in its command line form with the correct number of inputs, vpulse will prompt for all inputs.
If Gnuplot is installed and in the search path, the program will plot the last 5 cycles of the square wave and place the plot in a Portable Network Graphics (png) file with the same name as the comma-separated variable file but an extension of “png”.
vpulse will invoke a power spectral density program and a jitter analysis program if either is in the executable path of the host system.
The power spectral density program, psd_sppowr, computes and plots the power spectral density of a waveform with N samples using last M samples where M is the largest binary multiple of samples computed from Equation 1. The power spectral density is computed using 4 non overlapping segments and makes use of a Blackman Hanning window to minimize spectral leakage.
(1) ![]()
The power spectral density is plotted and saved to a file in Portable Network Graphics format if Gnuplot is installed and in the executable search path.
A jitter analysis program, jitterhist, computes the time interval error of the N time samples and the phase noise using the last M samples. It reports the peak-to-peak time interval error values for both the positive and negative edge transitions and creates a file of the sample times with the positive and negative time interval error values. It generates a second file containing the phase noise for each edge. Both files are in comma-separated format. If Gnuplot is installed and contained in the executable path, the positive and negative time interval errors and phase noise are plotted and saved to files in Portable Network Graphics format.
The two programs and their documentation are available from the URL in the references.4,5 They are useful as standalone programs for a power spectral density or time interval error analysis of any data.
vpulse Program Inputs
Inputs to vpulse include the frequency of the square wave, its transition times, its duty cycle, an initial phase, the number of time points per period, the number of periods to simulate, the bandwidth multiplier of an optional single-pole post filter, an optional modulation index, the location at which the modulation amplitude is specified, the modulation type (sinusoidal, uniform random noise, or Gaussian random noise), the noise bandwidth, and the type of modulation (AM/PM/none). Table 3 lists the inputs and shows values used in an example that includes amplitude modulation.
If the output square wave has no modulation, only arguments one through nine are necessary and the next five arguments need not be entered
If a non-zero value for the modulation index is included as a tenth argument, the next five arguments must be included. Inputs fifteen and sixteen specify if a power spectral density (PSD) and a time interval error (TIE) analysis is performed. These two inputs are optional and if not included, the default condition is to perform both a PSD analysis and TIE analysis. When there are only nine inputs, inputs fifteen and sixteen become inputs ten and eleven.
The input arguments are audited to determine if their values are sufficient to generate an accurate set of waveform samples. If the audit fails, the program exits with a suggestion to modify or correct the argument flagged by the audit.
The optional single-pole post filter bandwidth is specified using argument six “First order filter bandwidth”. The filter bandwidth is normalized to the square wave frequency. Hence, a value of 3 for a 100 MHz square wave corresponds to a post-filter with a bandwidth of 300 MHz. If the “first order filter bandwidth” is set to zero (as shown the example of Table 3), there is no post-filter applied to the piecewise linear square wave.
The output waveform is sampled at a time interval defined by the square wave input period and the number of points per waveform specified by argument seven. It is simulated for the number of periods specified in argument eight. Argument nine, “Number of periods to plot”, truncates the simulated data and produces an output file with the “Number of periods to plot” in lieu of the entire “Number of periods”. In Table 3, the “Number of periods” and the “Number of periods to plot” are both set to 1000 and hence the output file will contain all 1000 periods of the simulation.
To modulate the square wave, a non-zero modulation index is specified as argument ten “modulation index”. In the case of sinusoidal or amplitude modulation, this expresses the amount of modulation as a fraction of the amplitude of the square wave. For phase modulation, the modulation index represents the phase modulation as a fraction of a unit interval. Hence the peak-to-peak of the amplitude or phase modulation is twice the modulation index. When modulating by random uniform noise, the maximum and minimum values of the zero mean noise are equal in absolute value to the modulation index. If the modulation source is Gaussian random noise, the modulation index is set as 3σ of the distribution, and hence twice the modulation index corresponds to 6σ of the distribution.
Argument eleven specifies the location at which the modulation index is specified. If the location is set to "filtered", the modulation index of the input to the noise filter is set to the specified modulation index. If the argument is set to "unfiltered", the modulation index of the filtered noise is set to the specified modulation index. The latter option sets the modulation index at the input of the noise filter to greater or equal to the specified modulation index.
For both the random uniform and random Gaussian noise generators, the seed is set to a value based on program run time and will vary from one simulation to the next. As a result, one should not expect the noise distributions from two modulated noise simulations using the same set of arguments to be identical.
The bandwidth of a first-order filter is specified as argument thirteen for both the random uniform and random Gaussian noise sources. If the noise type is set to sinusoidal, argument thirteen is the frequency of the sinusoidal modulating source. There is no bandwidth limiting filter in the modulation path when sinusoidal modulation is selected.
Summary
Program vpulse generates a comma-separated variable file containing time domain samples of a square wave is described. In its simplest use case, the program generates a file containing samples of a piecewise linear square wave whose frequency and time domain waveform parameters are adjustable. Optionally, the piecewise linear square wave may be lowpass filtered with a single-pole filter.
The program also offers the ability to include an amount of amplitude or phase modulation by a sinusoidal, filtered random uniform, or filtered Gaussian noise source.
Two post-processing modules, psd_sppowr and jitterhist, are offered for generating and viewing the power spectral density of the sampled square wave, its time interval error, and its phase noise. Each module is instantiated by vpulse if its executable is contained in the UNIX executable path variable. Both are available from the author as a standalone program from the URL in references.4,5
The vpulse output file may be used as a piecewise linear source file to any SPICE based time domain simulator such as SPICE, Cadence Spectre, or Synopsis HSPICE. Alternately, the program and its two post-processing modules are useful for studying the properties of square waves in the temporal and Fourier domains.
Program vpulse is available for download.3
REFERENCES
- J. W. Eaton, D. Bateman, S. Hauberg, R. Wehbring, "GNU Octave Version 8.2.0 Manual: A High-Level Interactive Language for Numerical Computations," 2023.
- The MathWorks Inc., Natick, Mass.
- S. Logan, vpulse Documentation and Program Installation, 2025.
- S. Logan, psd_sppowr Documentation and Program Installation, 2025.
- S. Logan, jitterhist Documentation and Program Installation, 2025.
- M. Schwartz, Information transmission, modulation, and noise, 3rd edition, McGraw-Hill, 1990.