Main Content


Performs clock data recovery function


The serdes.CDR System object™ provides clock sampling times and estimates data symbols at the receiver using a first order phase tracking CDR model. For more information, see Clock and Data Recovery in SerDes System.

To provide clock data locations:

  1. Create the serdes.CDR object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?



cdr = serdes.CDR returns a CDR object that determines the clock sampling times and estimates the data symbol according to the Bang-Bang CDR algorithm. It does not return or modify the incoming waveform.

cdr = serdes.CDR(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in quotes. Unspecified properties have default values.

Example: cdr = serdes.CDR('Count',8) returns a CDR object with early or late CDR count threshold of 8.


expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.


Early or late CDR count threshold to trigger a phase update, specified as a unitless real positive integer ≥4. Increasing the value of Count provides a more stable output clock phase at the expense of convergence speed. Because the bit decisions are made at the clock phase output, a more stable clock phase has a better bit error rate (BER).

Count also controls the bandwidth of the CDR which is approximately calculated by using the equation:

Bandwidth=1Symbol time · Early/late threshold count · Step

Data Types: double

Clock phase resolution, specified as a real scalar in fraction of symbol time. Step is the inverse of the number of phase adjustments in CDR.

Data Types: double

Clock phase offset, specified as a real scalar in the range [-0.5,0.5] in fraction of symbol time. PhaseOffset is used to manually shift clock probability distribution function (PDF) for better bit error rate (BER).

Data Types: double

Reference clock offset impairment, specified as a real scalar ≤300 in parts per million (ppm). ReferenceOffset is the deviation between transmitter oscillator frequency and receiver oscillator frequency.

Data Types: double

Sampling latch meta-stability voltage, specified as a real scalar in volts. If the data sample voltage lies within the region (+/-Sensitivity), there is a 50% probability of bit error..

Data Types: double


Time of a single symbol duration, specified as a real scalar in s.

Data Types: double

Uniform time step of the waveform, specified as a real scalar in s.

Data Types: double

Modulation scheme, specified as 2, 3 or 4.

Modulation ValueModulation Scheme
2Non-return to zero (NRZ)
3Three-level pulse amplitude modulation (PAM3)
4Four-level pulse amplitude modulation (PAM4)


IBIS does not support PAM3 modulation scheme. So you cannot export to IBIS-AMI model if the modulation scheme is PAM3.

Data Types: double

Input wave type form:

  • 'Sample' — A sample-by-sample input signal.

  • 'Impulse' — An impulse response input signal.

Data Types: char



y = cdr(x)

Input Arguments

expand all

Input baseband signal. The input to the CDR must be applied as one sample at a time and not as a vector.

Output Arguments

expand all

Relative recovered clock phase, returned as a units of SymbolTime in the range [0,1].

AMI clock bus, returned as a structure consisting of:

  • ClockTime — Time taken to sample the data signal.

  • clockValidOnRising — Valid clock time value on the rising edge of a signal

Bus containing additional interior CDR signals, returned as a structure consisting of:

  • clockPhase — Relative clock phase in units of SymbolTime in the range of [0,1].

  • symbolRecovered — Symbol recovered from data signal at ClockTime.

  • voltageSample — Voltage observed from the data signal at ClockTime.

  • PAM4Threshold — The estimated upper eye at PAM4 threshold.

  • CDRedgeVoltage — The voltage observed from the data signal at ClockTime — SymbolTime/2.

  • CDRCounter — The bang-bang CDR internal counter used to trigger samples.

  • CDREarlyLateCounter — The bang-bang CDR accumulated (or filtered) signal used to trigger updated to the CDR phase.

  • PAM4SymbolMiddleVoltage — Estimated PAM4 symbol voltage of the inner eye outer envelope to estimate PAM4 threshold.

  • PAM4OuterVoltage — Estimated PAM4 outer envelope voltage to estimate PAM4 threshold.

  • EyeHeightAbsAve — Estimates eye height.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:


expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object


collapse all

This example shows how to recover clock distribution using serdes.CDR system object™.

Use a symbol time of 100 ps and 16 samples per symbol. The channel has 5 dB loss.

SymbolTime = 100e-12;
SamplesPerSymbol = 16;
dt = SymbolTime/SamplesPerSymbol;
loss = 5;
chan = serdes.ChannelLoss('Loss',loss,'dt',dt,...

Create a random data pattern using a pseudorandom binary sequence of order 10.

ord = 10;                       %PRBS order
nrzPattern = nrz(:)' - 0.5;     %[0,1] --> [-0.5,0.5];
ChannelPulseResponse = impulse2pulse(chan.impulse, SamplesPerSymbol, dt);
waveprbs = pulse2wave(ChannelPulseResponse(:,1),nrzPattern,SamplesPerSymbol);
wave2 = [waveprbs; waveprbs];

Create the CDR object that utilizes NRZ modulation scheme.

CDR1 = serdes.CDR('Modulation',2,'Count',8,'Step',1/64,...

Initialize the outputs.

phase = zeros(1,length(wave2));
CDRearlyLateCount = zeros(1,length(wave2));

Feed the waveform one sample at a time through the CDR object.

for ii = 1:length(wave2)
      [phase(ii), ~, optional] = CDR1(wave2(ii));
      CDRearlyLateCount(ii) = optional.CDRearlyLateCount;

Plot the eye diagram with recovered clock distribution, clock phase vs. time, and early/late count threshold vs. time.

t = (0:length(wave2)-1)/SamplesPerSymbol;
teye = (0:SamplesPerSymbol-1)/SamplesPerSymbol;
eyed = reshape(wave2,SamplesPerSymbol,[]);
subplot(2,2,[1,3]), yyaxis left, plot(teye,eyed, '-b'),
title('Eye Diagram with Recovered Clock Distribution')
xlabel('Symbol Time'), ylabel('Voltage')
yyaxis right,
subplot(2,2,2), plot(t,phase)
xlabel('Number of Symbols'), ylabel('Symbol Time');
title('Clock Phase vs. Time')
subplot(224), plot(t,CDRearlyLateCount)
xlabel('Number of Symbols'), ylabel('Count')
title('Early/Late Count Threshold vs. Time')

Figure contains 3 axes objects. Axes object 1 with title Eye Diagram with Recovered Clock Distribution contains an object of type histogram. Axes object 2 with title Clock Phase vs. Time contains an object of type line. Axes object 3 with title Early/Late Count Threshold vs. Time contains an object of type line.

Extended Capabilities

Introduced in R2019a