Globally Adapt Receiver Components Using Symbol Metrics
This example shows how to perform optimization based on symbol metrics for receiver components during statistical (Init) simulation. You can learn how to setup a CTLE and a DFECDR block so their settings adapt together globally during the simulation. This example shows how to improve the example Globally Adapt Receiver Components Using Pulse Response Metrics to Improve SerDes Performance by leveraging various symbol metrics for compliance against different specification requirements.
The example walks you through the steps of modifying the Custom User Code for Rx Init to perform optimization. In this case, you learn to sweep CTLE configurations to find a best-case statistical eye diagram based on symbol metrics. The example begins with a Simulink® model for PCIe6, but you can apply the principles shown here for the Init code to your own model.
Open SerDes System
Open a Simulink model for PCIe Gen 6. To learn how to create a PCIe Gen 6 model, see: PCIe6 Transmitter/Receiver IBIS-AMI Model.
You can also open the Simulink model pcie6_tx_w_rx_init
attached with this example.
Note: The attached helper file TxFFEPreset_PCIe_G6.m
is called by the Tx block. Even though the example works with the Rx section, the model requires this helper file to run.
Review Receiver Components
Look under the Rx subsystem to find a CTLE and DFECDR block.
Setup Custom User Code in Init
Double click the on the Init block inside the Rx subsytem to open the block parameters dialog box. Click the Show Init button to open the Init
function. You can find the contents of the attached file rx_init_optimize_symbol_metrics.m
in the Custom User Code area. If working from your own model, you can reference this file as a starting point.
The Custom User Code area is found between these lines of Init:
%% BEGIN: Custom user code area (retained when 'Refresh Init' button is pressed) % END: Custom user code area (retained when 'Refresh Init' button is pressed)
Sweep CTLE Parameters
The first section sweeps configurations from 0
to 10
for a PCIe6 CTLE. If working on your own model, note that many block configuration settings can be varied in a similar manner.
% Initialize variables CTLEBestConfig = 0; bestMetric = 0; % Calculate samples per bit SPB = SymbolTime/SampleInterval; % Use serdes.CTLE built-in adaptation to see non-global config CTLEInit.Mode = 2; % Set to auto [~, CTLEBuiltInConfig] = CTLEInit(LocalImpulse); CTLEBuiltInConfig % Set CTLE to fixed mode CTLEInit.Mode = 1; for config = 0:10 % Sweep through configs CTLEInit.ConfigSelect = config; % Set current config % Call blocks [sweepImpulse, ~] = CTLEInit(LocalImpulse); [sweepImpulse, ~, ~, ~, ~] = DFECDRInit(sweepImpulse);
Create Statistical Eye Plot
Next, you need to construct a statistical eye plot in order to find the symbol metrics. Starting from the impulse response, find the pulse response using the impulse2pulse
function. Then find the statistical eye matrix using the pulse2stateye
function. To learn more about impulse responses, see Statistical Analysis in SerDes Systems.
Note: To visualize the plot for debug purposes, you must scale the time axis of the Statistical eye plot to match the symbol time of the system. See pulse2stateye
for instructions on how to plot the output for analysis purposes.
% Convert impulse response to pulse response localPulse = impulse2pulse(sweepImpulse, SPB, SampleInterval); % Find Statistical Eye from pulse response [stateye,vh,th] = pulse2stateye(localPulse, SPB, Modulation); % Scale time axis to SymbolTime th = th*SymbolTime;
Define Metrics for Symbol Characterization
Then the following section generates metrics based on Statistical eye histogram. Note that some function outputs are omitted because they are not relevant for optimization of the CTLE configuration. The example starts with having targetMetric
set to vHeight
:
% Generate metrics [eyeLinearity,VEC,~,~,vHeight,aHeight, ... bestEyeHeight,~,~,bestEyeWidth,~,~, ... ~,~,eyeAreas,eyeAreaMetric,COM] = ... serdes.utilities.calculatePAMnEye(Modulation, 1e-6, th(1),th(length(th)),vh(1),vh(length(vh)),stateye);
Select Metric for Optimization
The next section defines the metric used for optimization. In this case, it will be vHeight returned by the function calculatePAMn
.
% Choose metric to optimize; eye height in this case:
targetMetric = vHeight;
Determine Modulation as NRZ or PAMn
The next section responds to the number of metrics returned from the function calculatePAMnEye
, which is based on the modulation type. In this case, the modulation is PAM4.
% If modulation is not NRZ, use minimum of outer eyes if (size(targetMetric,1)>1) maxMetric = min(targetMetric(1,1),targetMetric(size(targetMetric))); else maxMetric = targetMetric; end
Find Optimal CTLE Configuration
The final section stores the best-case CTLE configuration as the value for CTLEBestConfig
and print its value to the debug console:
% Save config and metric if the best if maxMetric > bestMetric bestMetric = maxMetric(1,1); CTLEBestConfig = config; end CTLEBestConfig % Comment out to avoid printing to command line % Set serdes.CTLE to use best config from sweep CTLEInit.ConfigSelect = CTLEBestConfig;
Observe Effect of Symbol Metrics on Optimal CTLE Configuration
At this point you have reviewed the Custom user code in Rx Init and are ready to see how different choices of metric affect determining an optimal CTLE configuration.
Run the model. When complete, you can see the statistical eye data displayed for each metric. Please take note of one or two of the metrics, because during the next step you will see how changing the targetMetric
can affect optimization.
With targetMetric
set to vHeight
as the optimization metric, you can see in the Simulation Data Inspector that the optimal value for CTLEBestConfig
is found to be configuration 3 by plotting the signal CTLE:2
.
Next, change targetMetric
to VEC
(Vertical Eye Closure) and re-run the model.
% Choose metric to optimize; VEC in this case:
targetMetric = VEC;
With targetMetric
set to VEC
as the optimization metric, you can see in the Simulation Data Inspector that the optimal value for CTLEBestConfig
is found to be configuration 0, by plotting the signal CTLE:2
.
Summary of Available Symbol Metrics
You can customize the evaluation of by setting to any of the following as the target metric.
eyeLinearity
: Measured eye linearity, defined as:VEC
: Measured vertical eye closure, defined as:vHeight
:targetCDF
of eye heights of each eye at Tmid (for example, inner eye height).aHeight
: Mean eye heights. Height of each eye between densest part of eye histogram below and above inner eye.bestEyeHeight
: Max eye height for each eye.bestEyeWidth
: Max eye width for each eye.vmidWidth
: width oftargetCDF
contour atvmidThreshold
.eyeAreas
: Area between upper contour and lower contour of each eye, where the area is divided by the Unit Interval so that it is in units of volts.eyeAreaMetric
: min(eyeAreas), area of eye with smallest area.COM
: Channel Operating Margin, defined as:
See Also
optPulseMetric | DFECDR | CTLE