Main Content

Calculate SNDR and RLM with System Object Scripting

Since R2025a

This example shows how to calculate the Signal-to-Noise and Distortion Ratio (SNDR) and Ratio of Level Mismatch (RLM) for waveforms generated by using scripting for MATLAB System Objects. SNDR and RLM are important metrics for standards such as PCIe6 and PCIe7 [1] as well as IEEE 802.3 and OIF-CEI interface standards.

The metric calculations use Multi-Pulse Fit Response (MPFR)-based methodologies. This calculation involves extracting pulse responses from the transmitter output compliance pattern waveform. This approach reduces the impact of channel loss and duty cycle distortion from the metric calculation. The SNDR metric is the ratio of the signal strength to the noise and distortion. The signal strength is quantified by the effective pulse response maximum. The random noise is extracted through comparison of the compliance pattern repetitions. The distortion term comes from the pulse fit error. The RLM metric comes from quantifying the difference between the observed PAM4 symbol voltages to their ideal level separation. The SNDR must be at least 34 dB and RLM at least 0.95 to meet compliance for both PCIe6 and PCIe7.

This example is part of a collection of three examples where the SNDR and RLM calculations are featured. Calculate SNDR and RLM with SerDes Simulink Model (Signal Integrity Toolbox) illustrates how to generate PCIe7 transmitter compliant output waveforms and calculate SNDR and RLM from Simulink simulation results. Calculate SNDR and RLM with IBIS-AMI Simulator (Signal Integrity Toolbox) shows how to post-process Serial Link Designer simulation results to calculate the SNDR and RLM.

Input Parameters

Set up the PCIe7 system parameters for the 128.0 GT/s symbol time, compliance data pattern, package loss, desired level of injected RLM, and injected jitter.

% Define Symbol time. For PAM4 128.0 GT/s is 15.625 ps
SymbolTime = 15.625e-12; %seconds

% Define modulation.  For now, the SNDR calculation requires modulation to
% be 4 for PAM4 modulation.
Modulation = 4;

% Define number of pattern repetitions.  While the PCIe7 spec requires at least
% 250 repetitions, choose a smaller number while experimenting with the
% calculations to reduce computation time.
R_PAT = 10;

% Define samples per symbol of input waveform. This is set to 4 here so that
% the SNDR object can resample the waveform.
SamplesPerSymbol = 4;

% Define signal rise time as proportional to the symbol time.
RiseTime = SymbolTime/4; % 20/80% rise time

% Define package model
TxPackageLoss = 8.5; % dB @ 1/SymbolTime/2
TxC = 0.1e-12; % Farads
RxC = 0.2e-12; % Farads

% Define injected transmitter noise and jitter
randomNoiseSigma = 0.016; % Random sample noise standard deviation
InjectedDCD = 0.05; % UI (odd/even jitter effects present)
InjectedDj = 0; % UI
InjectedRj = 0; % UI
InjectedSj = 0; % UI
InjectedSjFrequency = 135e3; % Hz

% Define the desired RLM impairment used in the calculation of non-ideal
% PAM4 symbol voltages
desiredRLM = 0.95;

% Define PCIe6 compliance pattern selection
lane = 0;  % valid lanes: 0, 1, 2, 3, 4, 5, 6, 7

Derived Parameters and Constants

Calculate derived parameters like the sample time and the voltage bias needed to achieve the desired RLM. You can also calculate the RLM of these symbol voltages to compare to the RLM later extracted from the waveform.

% Calculate symbol bias voltage to disturb the ideal symbol voltages to
% achieve the desired RLM impairment.
symbolBias = (abs(desiredRLM)-1)/6;
symbolVoltages = [-0.5 -1/6 1/6+symbolBias, 0.5];

% Calculate the RLM of the input symbol voltages
InputRLM = sndr.RatioLevelMismatch(symbolVoltages(1),symbolVoltages(2),...
                                   symbolVoltages(3),symbolVoltages(4));

% Fixed-step sample time interval
dt = SymbolTime/SamplesPerSymbol;

Create Data Pattern

There are 8 PCIe6/7 compliance data patterns. Each are 8768 PAM4 symbols long and have sections of random data, sections of toggle 0 to 3 PAM4 symbol transitions and sections where each PAM4 symbol is held for 64 UI or symbol times. See the sndr method plotDataPattern for a visualization of the data pattern.

% Get PCIe 6 compliance data patterns
DataPattern = si.PCIeCompliancePattern(lane);

Initialize Stimulus System Object

The stimulus System object defines the modulation, data rate, data pattern, and jitter.

% Create stimulus system object
stimulus1 = serdes.Stimulus(...
    'SampleInterval',dt,...
    'SymbolTime',SymbolTime,...
    'Specification','Symbol Pattern',...
    'SymbolPattern',DataPattern,...
    'DCD',InjectedDCD,...
    'Dj',InjectedDj,...
    'Rj',InjectedRj,...
    'Sj',InjectedSj,...
    'SjFrequency',InjectedSjFrequency,...
    'MapToVoltage',symbolVoltages,...
    'Modulation',Modulation);

Initialize Transmitter FFE System Object

Define the transmit equalizer feed-forward equalizer (FFE) System object. The PCIe standard instructs the user to calibrate the Tx equalizer to ensure that the equalizer does not unduly impact the SNDR calculation. This example uses the ideal Q0 setting but it may be interesting to explore the sensitivity of the SNDR metric to non-ideal equalizer settings.

TapWeights = [0 0 1 0]; % Ideal Q0 transmitter equalization
% TapWeights = [0 -0.05 1 -0.05]; % Non-ideal Q0 transmitter equalization
txffe = serdes.FFE(...
    'SymbolTime',SymbolTime,...
    'SampleInterval',dt,...
    'Normalize',true,...
    'TapWeights',TapWeights);

Initialize Package Model with ChannelLoss System Object

This example uses 8.5 dB lossy channel to distort and attenuate the signal.

% Create package model at the desired loss loss with the 
F = 1/SymbolTime/2; % Fundamental frequency
packageModel = serdes.ChannelLoss(...
    'Loss',TxPackageLoss,...% Loss at target frequency
    'dt',dt,...             % Sample interval
    'TargetFrequency', F,...% Frequency for desired loss
    'RiseTime',RiseTime,... % Rise time
    'TxR',50,'TxC',TxC,...  % Near ideal Transmitter output impedance
    'RxR',50,'RxC',RxC);    % Near ideal Receiver termination
[~,channelDelaySamples]=max(abs(packageModel.impulse));

Create Transmit Package Output Waveform

The stimulus System object creates a waveform on a sample-by-sample basis, which is then passed through the transmitter FFE and package model. The first few samples of the waveform are truncated to avoid the flat line voltage created by the channel delay and to illustrate that the sndr calculation does its own alignment of the waveform and data pattern.

% Create sample-by-sample waveform with data pattern, tx FFE and package
% effects.
nSamples = ceil(length(DataPattern)*SamplesPerSymbol*R_PAT);
waveAfterTxPackage = zeros(nSamples,1);
for kk = 1:nSamples    
    waveAfterTxPackage(kk) = packageModel(txffe(step(stimulus1) + randomNoiseSigma*randn(1)));
end

% Truncate some number of symbols at the beginning of the waveform to
% emulate the waveform starting with an unknown delay and to discard the
% flat response at the beginning of the received waveform due to the package
% delay.
wave = waveAfterTxPackage(round(channelDelaySamples*1.5):end);

SNDR Calculation

Create the sndr object and run the report method for a short print out of the SNDR and RLM metrics. Additionally, you can compare the measured RLM to the injected RLM.

% Create SNDR object
sndrObj = sndr('Wave',wave,...
    'InputSampleInterval',dt,...
    'DataPattern',DataPattern,...    
    'Standard','PCIe',...            
    'SymbolTime',SymbolTime);

% Generate command window reports
report(sndrObj)
For Standard=pcie
SNDR = 34.5082 dB
	Pmax (Effective) = 282.215 mV
	SigmaNoise = 4.10289 mV
	SigmaError = 3.3723 mV
RLM = 0.945917
	V0 = -257.095 mV
	V1 = -85.7798 mV
	V2 = +81.0636 mV
	V3 = +257.095 mV
disp("Input RLM = " + InputRLM + ", Measured RLM = " + sndrObj.RLM);
Input RLM = 0.95, Measured RLM = 0.94592

These results show that the system under test complies with the PCIe7 SNDR requirement of at least 34 dB, while the RLM metric is below the required 0.95 value.

Conclusion

This example is a demonstration of how to make PCIe6 and PCIe7 compliant SNDR and RLM calculations. It also provides a test bench to investigate the sensitivity of these metrics to many input factors. You are encouraged to play with the example script to create an intuitive understanding of the variables that most strongly influence the SNDR and RLM metrics.

Ideas for Further Exploration

  • Use the sndr plot methods, plotDataPattern, plotAveragingResults, plotWaveResampled, plotSigmaNoise, plotVLik, plotLPFR, plotMPFROddEven, or plotMPFR4 to better understand the metric computational process.

  • How does increasing the number of waveform repetitions to more than 250, as called for by the specification, change the metric calculation?

  • How do the SNDR and RLM metrics change due to samples per symbol changes and/or changing with the sndr property ResampleMethod from 'spline' to 'linear'?

  • What impact does adding SJ to the system make to the averaging results plot and the VLik plot?

  • How does having a non-ideal Q0 Tx FFE setting impact the metrics?

  • How does SNDR and RLM change as the data pattern 'lane' parameter is changed from 0 through 7?

  • How does adding RJ and DJ jitter influence the metrics?

  • How does package loss and/or characteristic impedance and termination impedance impact the metrics?

  • What system parameters have the largest impact on RLM beyond the symbolBias impairment?

  • What factors impact the magnitude of the fit error?

See Also

Topics

External Websites