Generated banner for Matlab Model Serdes Systems
Generated logo for Matlab Model Serdes Systems

Matlab Model Serdes Systems

MathWorksOfficialCreated by MathWorks

  • Skill
  • Tool integration
  • Science and research
  • BSD-2-Clause
  • No issues found

From the author

Model, simulate, and optimize Serializer/Deserializer (SerDes) systems — serial and parallel links — using MATLAB SerDes Toolbox. Design NRZ and PAM-N links (PAM3 through PAM16) — explore equalization architectures (FFE, CTLE, DFE), sweep or optimize parameters with genetic algorithms, and characterize channels from loss models, S-parameter files, or crosstalk scenarios. Process captured waveforms through equalization chains, build eye diagrams, and decompose jitter. Deliver IBIS-AMI models for Tx, Rx, Redriver, or Retimer by exporting to Simulink and compiling .ami/.ibs/.dll/.so files. Covers the full arc from initial design exploration and parameter optimization to compliance testing and compiled model validation, including custom datapath blocks for nonstandard equalization.
— the description by MathWorks

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a comprehensive framework for designing and validating Serializer/Deserializer (SerDes) systems. It covers the full development lifecycle, from initial architecture exploration and channel characterization to parameter optimization and the generation of industry-standard IBIS-AMI models. Users can simulate NRZ and PAM-N links, evaluate equalization architectures like FFE, CTLE, and DFE, and perform compliance testing using statistical and time-domain analysis.

What it does

  • Models and simulates high-speed serial and parallel links including NRZ and PAM-N signaling.
  • Characterizes channels using loss models, S-parameter files, and crosstalk scenarios.
  • Optimizes equalization architectures such as FFE, CTLE, and DFE using genetic algorithms.
  • Performs statistical and time-domain analysis including eye diagrams and jitter decomposition.
  • Exports designs to Simulink for IBIS-AMI model generation and compilation.
  • Validates compiled models against behavioral baselines for compliance and performance.

When to use it

  • When designing SerDes links for specific data rates and channel loss profiles.
  • When evaluating and tuning equalization architectures to meet signal integrity targets.
  • When you need to generate IBIS-AMI models for Tx, Rx, Redriver, or Retimer components.
  • When performing compliance checks using eye masks and jitter budgets.
  • When analyzing captured waveforms from oscilloscopes or simulations.

Advantages

  • Full-arc workflow from design exploration to compiled model delivery.
  • Supports advanced PAM-N modulation schemes up to PAM16.
  • Enables programmatic parameter sweeps and optimization for design space exploration.
  • Provides robust validation tools to ensure compiled models match behavioral references.
  • Integrates seamlessly with Simulink for complex time-domain system simulations.

Usage examples

“Create a SerdesSystem object for a PAM4 link and run a statistical analysis.”
The agent initializes a SerdesSystem with specified Tx/Rx blocks, configures the channel, and executes the analysis() method to generate eye diagrams and performance metrics.
“Export my current SerDes design to a Simulink model for AMI generation.”
The agent uses exportToSimulink(sys) to generate the Simulink representation and prepares the IbisAmiManager settings for model compilation.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/matlab/matlab-model-serdes-systems/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip matlab-model-serdes-systems.zip -d .agents/skills

Documentation by MathWorks

Modeling and Simulating SerDes Systems

Design, analyze, and deliver high-speed serial link models using SerDes Toolbox. From architecture exploration through IBIS-AMI model generation, covers the full workflow for NRZ and PAM-N links (PAM3 through PAM16).

When to Use

System design and architecture exploration

  • Designing SerDes links for a target data rate, signaling scheme (NRZ, PAM4, PAM-N), and channel loss

  • Evaluating equalization architectures (FFE, CTLE, DFE) and optimizing tap settings

  • Sweeping design parameters to find optimal configurations

  • Using industry reference designs (PCIe, USB4, DDR5, CEI, UCIe) as starting points

  • Characterizing Tx/Rx analog effects (parasitic capacitance, rise time, termination impedance)

  • Building custom datapath blocks for nonstandard equalization

Channel modeling and characterization

  • Loading S-parameter Touchstone files into SerdesSystem

  • Modeling channels with loss profiles, crosstalk (FEXT/NEXT), and aggressors

  • Fitting CTLE transfer functions from measured data via ctlefit

IBIS-AMI model generation

  • Building IBIS-AMI models for Tx, Rx, Redriver, or Retimer configurations

  • Exporting to Simulink, configuring AMI parameters, and compiling .ami/.ibs/.dll/.so

  • Scripting Simulink simulations and parameter sweeps with sim/parsim

Analysis and validation

  • Running statistical and time-domain simulations

  • Processing eye diagrams (eye height, eye width, COM, VEC, bathtub curves)

  • Decomposing jitter (TJ, RJ, DJ, DDJ, DCD, ISI)

  • Validating compiled AMI models against behavioral baselines

  • Running compliance checks with eye masks and jitter budgets

When NOT to Use

  • RF/microwave circuit design, antenna modeling, or baseband DSP filter design

  • General Simulink model scripting unrelated to SerDes

Must-Follow Rules

System Setup
  • SymbolTime / SampleInterval must yield an integer SamplesPerSymbol — fractional ratios cause silent errors

  • TxModel/RxModel are Transmitter/Receiver objects — not cell arrays. Construct with Transmitter('Blocks', {block1, block2}). Transmitter requires single-quoted property names — Transmitter("Blocks", ...) throws an ismember error. Receiver and all other classes accept double quotes

  • Signal conversion functions require column vectors — impulse2pulse, pulse2stateye, etc. error on row vectors

  • Include AnalogModel and JitterAndNoise for realistic results — bare Transmitter/Receiver without analog models produce optimistic COM (1-2 dB higher). See reference/equalization-tuning.md for parameter guidance (rise time, parasitic C, termination R)

Equalization
  • Set WaveType explicitly when using datapath blocks directly in MATLAB — Simulink sets this automatically, but MATLAB defaults to "Sample"

  • Adapted DFE/CTLE parameters are in results.outparams — NOT on the block object. After analysis(), sys.RxModel.Blocks{k}.TapWeights still holds initial values. In system objects chains, adapted taps are the second output: [y, taps] = dfecdr(x)

  • DFECDR Mode=0 is passthrough in Sample mode — DFE only applies with Mode≥1. Pre-load adapted taps from outparams with Mode=1 for instant convergence, or use Mode=2 with 10x EqualizationGain (9.6e-04) for self-converging chains

  • Set Modulation on DFECDR for PAM-N in system objects chains — Simulink inherits it from the model workspace, but MATLAB defaults to 2 (NRZ). Without this, PAM4 DFE adaptation fails silently

Metrics and Waveforms
  • Metrics.summary.EW is in picoseconds (already scaled) — do NOT multiply by 1e12. EH is in volts. PAM-N returns N-1 values per metric (e.g., PAM4 → 3 eyes, PAM8 → 7 eyes)

  • Channel impulse from analysis() is in V/s — when using filter() for time-domain convolution, multiply by dt: filter(impulse * dt, 1, wave). Without scaling, amplitudes blow up by ~10^11

  • pulse2wave operates on the stimulus provided — the output modulation depends on the input pattern (NRZ or PAM-N)

  • Init-Only models cannot adapt — if DFE taps or CDR converge at runtime, you need a Dual model (both Init and GetWave)

  • AMI validation requires Signal Integrity Toolbox — serdes.AMI runner and the AMI Simulink block need both SerDes Toolbox and Signal Integrity Toolbox

  • AMI GetWave: call in a chunked loop — serdes.AMI passes BlockSize (default 1024) to AMI_GetWave, so only BlockSize samples are processed per call. You must call the object in a for loop with BlockSize-length chunks. State is preserved between calls via the DLL memory handle

  • AMI GetWave: set SkipFirstBlock = false when calling from MATLAB — the default (true) is for Simulink's internal signal buffering and causes the first block to pass through unprocessed

  • AMI Init: RowSize must match impulse length — serdes.AMI crashes MATLAB (process termination, no error) if RowSize doesn't match numel(impulse)

  • AMI generation requires Simulink model — use IbisAmiManager GUI or serdes.AMIExport with export() programmatically (see Programmatic AMI Generation)

Workflow

Design Exploration

Most projects start here. The goal is to find the right equalization architecture and settings for your channel.

  1. Design — Create a SerdesSystem with Tx/Rx blocks and channel (loss model or S-parameters)

  2. Analyze — Run analysis for statistical results, plotStatEye for eye diagrams, analysisReport for metrics

  3. Sweep — Vary channel loss, FFE taps, CTLE gain, DFE taps, or jitter to map the design space

  4. Compare — Evaluate architectures (FFE-only vs FFE+CTLE vs FFE+CTLE+DFE) using COM, eye height, eye width

  5. Select — Choose the configuration that meets margin targets, then freeze equalization settings

Use SerdesSystem for programmatic exploration; serdesDesigner for interactive GUI work.

Waveform Processing

When you have a captured or imported waveform (e.g., from an oscilloscope or simulation) and want to equalize and analyze it directly:

  1. Load — Import the waveform and define timing (SampleInterval, SymbolTime)

  2. Equalize — Stream through datapath blocks (FFE, CTLE, DFECDR) with WaveType = "Sample"

  3. Analyze — Build an eye diagram with eyeDiagramSI, extract metrics (eye height, COM, VEC)

  4. Decompose jitter — Run jitter() on the equalized waveform for TJ, RJ, DJ, DDJ, ISI breakdown

DFECDR and DFE require a sample-by-sample for loop in Sample mode; FFE and CTLE accept full vectors. See reference/waveform-processing.md for the Direct Equalization pattern.

IBIS-AMI Model Delivery

When you need compiled models (.ami/.ibs/.dll/.so) for EDA tools or IP delivery:

  1. Export — Call exportToSimulink(sys) to generate a Simulink model from the frozen design

  2. Configure — Set AMI parameters, IBIS component/pin data, and model type via IbisAmiManager or serdes.AMIExport

  3. Generate — Build .ami/.ibs and compile .dll/.so via serdes.AMIExport with export()

  4. Validate — Load compiled DLL/SO with serdes.AMI, compare against behavioral reference (Init for impulse, GetWave for waveform)

  5. Cross-check — The Simulink path (sim with Rx WaveOut) is the preferred time-domain reference. Compare against: statistical analysis(), system objects direct chain, and compiled AMI DLLs. See reference/simulink-serdes-simulation.md

  6. Iterate — Fix discrepancies, re-export, re-validate until all paths agree

AMI Model Types

Choose the model type based on which equalization blocks need to adapt at runtime:

TypeInit_Returns_ImpulseGetWave_ExistsUse For
Init-OnlytruefalseLTI equalization (fixed FFE, CTLE). Supports statistical analysis
GetWave-OnlyfalsetrueTime-domain only. No statistical analysis
DualtruetrueAdaptive equalization (DFE, CDR). All analysis types

Every IBIS-AMI model implements AMI_Init (required), AMI_GetWave (optional), and AMI_Close (required) per the IBIS standard.

Key Classes

ClassPurpose
SerdesSystemTop-level system. Methods: analysis, plotStatEye, plotImpulse, plotPulse, plotAlignedPulse, plotWavePattern, analysisReport, exportToSimulink
TransmitterTx container. Construct: Transmitter('Blocks', {serdes.FFE(...)})
ReceiverRx container. Construct: Receiver('Blocks', {serdes.CTLE(...), serdes.DFECDR(...)})
ChannelDataChannel spec. Props: ChannelLossdB, ChannelLossFreq (default 5 GHz — must override to Nyquist), ChannelDifferentialImpedance, or Impulse/dt
JitterAndNoiseIBIS 7.0 jitter/noise. 4 groups: Tx jitter (Rj/Dj/DCD/Sj), Rx jitter, Rx clock recovery (5 params, active with RxClockMode='clocked', 'convolved', or 'normal'), Rx noise. Values in seconds (default) or UI. See reference/serdes-api-reference.md
serdes.AMIRun compiled AMI DLLs/SOs. Call: [waveOut, impulseOut] = ami(waveIn, impulseIn, clockIn)
serdes.AMIExportProgrammatic AMI export (R2026a+). Methods: export, getExportSettings. Props: ModelTypeTx, DLLFiles, LinuxCrossCompile
SParameterChannelS-parameter to impulse response. Handles .s4p through .s16p (multi-port returns Nx(K) matrix: col 1=thru, cols 2+=aggressors). Props: FileName, SampleInterval, StopTime, PortOrder
eyeDiagramSIWaveform eye diagram (R2024a+). Step: eyeObj(wave) — no output. Metrics: eyeHeight, eyeWidth, com, vec, margin
ctlefitCTLE pole/zero fitter. Import: ctlefit.readcsv. Output: GPZ matrix for serdes.CTLE("Specification", "GPZ Matrix")
Datapath Blocks
BlockRoleMode ValuesKey Properties
serdes.FFEFeed-forward equalizer0, 1TapWeights, TapSpacing, Normalize
serdes.CTLEContinuous-time linear EQ0, 1, 2Specification, DCGain, ACGain, PeakingGain, GPZ
serdes.DFECDRDFE + clock recovery0, 1, 2TapWeights, CDRMode, PhaseDetector, Count
serdes.DFEStandalone DFE0, 1, 2TapWeights, EqualizationGain, EqualizationStep
serdes.CDRStandalone CDR0, 1CDRMode, Count, Step, Sensitivity. Mode is deprecated
serdes.AGCAuto gain control0, 1TargetRMSVoltage, MaxGain, AveragingLength
serdes.VGAVariable gain amplifier0, 1Gain
serdes.SaturatingAmplifierLimiting amplifier0, 1Limit, LinearGain, Specification
serdes.PassThroughNo-op placeholder——

Mode values: 0 = Fixed (not exported), 1 = Fixed (exported as AMI parameter), 2 = Adaptive (GetWave). Only CTLE, DFECDR, and DFE support Mode=2.

Set CTLE Specification before setting gain properties — using ACGain with the default spec triggers a warning. GPZ Matrix requires Mode=1 for ConfigSelect to switch rows. See reference/equalization-tuning.md for the 4 specification options.

Patterns

Each reference file includes executable code patterns for its topic. Load the relevant reference before writing code — it contains correct calling conventions, constructor arguments, and property names. See the References table in Conventions below for the full routing map.

Common Mistakes

See reference/common-mistakes.md for 37 documented anti-patterns with wrong/correct code pairs covering API misuse, wrong property names, silent failures, and performance pitfalls.

Conventions

Design
  • Use SerdesSystem for programmatic design; serdesDesigner for interactive exploration. Always run analysis/plotStatEye before exporting

  • CRITICAL: ChannelLossFreq defaults to 5 GHz — always override to Nyquist (1/(2*SymbolTime)). Without this, 15 dB at 5 GHz becomes 40+ dB at Nyquist and the eye appears closed. Use SParameterChannel for real channels

  • analysis() does not auto-optimize FFE taps — use canonical de-emphasis with sum(abs(taps)) ≈ 1.0

  • DFE taps initialized to zero are optimized by the statistical solver automatically

  • Industry reference designs: serdesDesigner or openExample('serdes/PCIe5TransmitterReceiverIBISAMIModelExample'). See reference/equalization-tuning.md for starting-point configurations

Visualization and Metrics
  • All SerdesSystem plot methods (plotStatEye, plotImpulse, plotPulse, plotAlignedPulse, plotWavePattern) render into the current axes — use tiledlayout/nexttile or subplot for multi-panel layouts

  • eyeDiagramSI (R2024a+) for waveform eye diagrams; jitter (R2024b+) for jitter decomposition

  • DFECDR/DFE in "Sample" WaveType require scalar (sample-by-sample) input; FFE/CTLE accept full vectors

  • When generating PRBS waveforms via pulse2wave, ask the user for PRBS order and symbol count — default PRBS-10 (1023 symbols) if unspecified

  • Use serdes.utilities.SignalIntegrityColorMap (not hot/parula) for pulse2stateye plots. For compliance, use margin(eyeObj, eyeMask)

  • See reference/visualization-and-metrics.md for all plot methods, metrics fields/units, eyeDiagramSI, and jitter

AMI Export and Validation
  • Use serdes.AMIExport with export() for programmatic AMI generation — not slbuild (legacy, R2025b and earlier only)

  • Validate compiled DLLs/SOs with serdes.AMI before sending to EDA tools — both Init (impulse correlation) and GetWave (waveform chain)

  • Simulink is the preferred time-domain path — sim() with Rx WaveOut is the ground truth for adaptive systems. Compare against system objects chain and compiled AMI DLLs as cross-checks. Use the same PRBS stimulus across all time-domain paths

  • AMI export parameters on Simulink blocks use *AMI suffix ('ModeAMI', 'TapWeightsAMI'); model-level settings go through IbisAmiManager or serdes.AMIExport

  • No compiled DLLs/SOs ship with the toolbox. Cross-compile for Linux .so via serdes.utilities.createCrossCompiler

Script-First Workflow

For design, analysis, or sweep tasks — write code to .m files on disk, not inline MCP snippets. For quick one-off checks, inline evaluate_matlab_code is fine.

  1. Create a .m file (e.g., serdes_pam4_design.m), run via run_matlab_file, iterate by editing and re-running

  2. Deliver a polished script — %% Parameters block at top, %% Section headers, summary fprintf at end

References
Load when...Reference
Building or modifying a SerdesSystemreference/serdes-api-reference.md
Debugging wrong API names or silent failuresreference/common-mistakes.md
Working with S-parameter files or crosstalkreference/channel-modeling.md
Tuning CTLE, FFE, DFE, or fitting transfer functionsreference/equalization-tuning.md
Sweeping parameters or running GA optimizationreference/optimization.md
Plotting eyes, reading metrics, or decomposing jitterreference/visualization-and-metrics.md
Equalizing captured or imported waveforms directlyreference/waveform-processing.md
Exporting to Simulink, compiling AMI DLLs, or validating AMI modelsreference/programmatic-ami-generation.md
Scripting Simulink simulations or parsim sweepsreference/simulink-serdes-simulation.md
Building custom datapath blocksreference/custom-datapath-blocks.md
Looking up utility functions (SNR, ICN, resample)reference/serdes-utilities.md

Files

reference/custom-datapath-blocks.md

Custom Datapath Blocks for SerDes Toolbox

Create custom equalization or signal-processing blocks that integrate into the SerDes Toolbox datapath alongside built-in blocks like serdes.FFE, serdes.CTLE, and serdes.DFECDR.

When to Use

  • The built-in blocks don't cover your equalization algorithm

  • You need a custom Tx or Rx processing stage (e.g., nonlinear equalizer, custom AGC)

  • You want your custom block to export AMI parameters and compile into a DLL/SO

Architecture

Custom datapath blocks inherit from serdes.SerdesAbstractSystemObject, which itself inherits from matlab.System. This base class provides the SerDes-specific interface that the toolbox framework expects.

Class Hierarchy
matlab.System
  └── serdes.SerdesAbstractSystemObject    ← inherit from this
        ├── serdes.FFE                      (built-in examples)
        ├── serdes.CTLE
        ├── serdes.DFECDR
        └── YourCustomBlock                 (your block)

Required Interface

Properties

Inherited from base class (do not redefine):

PropertyTypePurpose
SymbolTimedoubleSymbol duration (s) — set by framework
SampleIntervaldoubleSample interval (s) — set by framework
ModulationintegerModulation levels (2=NRZ through 16) — set by framework

Must define on your subclass:

PropertyTypeAttributesPurpose
Modeintegerpublic0 = Fixed (not exported), 1 = Fixed (exported), 2 = Adaptive
WaveTypecharpublic'Impulse' or 'Sample' — set by framework, drives stepImpl
IsLinearlogicalHidden, SetAccess = immutabletrue if block is linear. Enables statistical (Init) analysis
IsTimeInvariantlogicalHidden, SetAccess = immutabletrue if block parameters do not adapt over time
Methods
MethodAccessRequiredPurpose
stepImpl(obj, x)protectedYesCore algorithm. Must handle both WaveType values
resetImpl(obj)protectedYesReset internal states
getAMIParameters(obj)publicYes (abstract)Return AMI parameter definitions for .ami file
getAMIInputNames(obj)publicYes (abstract)Return input port names for AMI
getAMIOutputNames(obj)publicYes (abstract)Return output port names for AMI

Class Template

classdef (StrictDefaults) CustomEQ < serdes.SerdesAbstractSystemObject
%CustomEQ Custom equalizer for SerDes datapath.

    properties(Nontunable)
        NumTaps (1,1) {mustBeInteger, mustBePositive} = 3
    end

    properties
        TapWeights (1,:) double = [0 1 0]
        Mode (1,1) {mustBeMember(Mode, [0 1 2])} = 1
    end

    properties(DiscreteState)
        Buffer
    end

    properties(Access = private)
        pSamplesPerSymbol
    end

    % WaveType: set by Simulink framework; set manually in standalone MATLAB
    properties
        WaveType (1,:) char {mustBeMember(WaveType, {'Impulse','Sample'})} = 'Sample'
    end

    % IsLinear/IsTimeInvariant: immutable — set once in constructor, cannot change
    % IMPORTANT: no size spec or validators on inherited abstract properties
    properties(Hidden, SetAccess = immutable)
        IsLinear
        IsTimeInvariant
    end

    methods
        function obj = CustomEQ(varargin)
            % Set immutable properties before setProperties
            obj.IsLinear = true;
            obj.IsTimeInvariant = true;
            setProperties(obj, nargin, varargin{:});
        end
    end

    methods (Access = protected)
        function setupImpl(obj, x)
            obj.pSamplesPerSymbol = round(obj.SymbolTime / obj.SampleInterval);
        end

        function y = stepImpl(obj, x)
            switch obj.WaveType
                case "Impulse"
                    % Init path: convolve with impulse response
                    % Input x is the channel impulse response (column vector)
                    h = upsample(obj.TapWeights(:), obj.pSamplesPerSymbol);
                    y = conv(x, h);
                    y = y(1:numel(x));  % truncate to input length

                case "Sample"
                    % GetWave path: process time-domain samples
                    % Input x is a block of waveform samples
                    nTaps = obj.NumTaps;
                    nSamples = numel(x);
                    y = zeros(size(x));
                    for k = 1:nSamples
                        % Shift buffer
                        obj.Buffer = [x(k); obj.Buffer(1:end-1)];
                        % Apply FIR
                        y(k) = obj.TapWeights * obj.Buffer(1:nTaps);
                    end
            end
        end

        function resetImpl(obj)
            obj.Buffer = zeros(obj.NumTaps, 1);
        end
    end

    % getAMI* methods are public (abstract on base class)
    methods
        function params = getAMIParameters(obj)
            params = struct();
            params.TapWeights = struct(...
                'Usage', 'InOut', ...
                'Type', 'Float', ...
                'Default', obj.TapWeights, ...
                'Description', 'FIR tap weights');
        end

        function names = getAMIInputNames(~)
            names = {"in"};
        end

        function names = getAMIOutputNames(~)
            names = {"out"};
        end
    end

    methods (Access = protected, Static)
        function simMode = getSimulateUsingImpl
            simMode = "Code generation";
        end
    end
end

WaveType: The Critical Dispatch

The WaveType property is the key to dual-mode (Init + GetWave) operation:

WaveTypeWhen SetInput x ContainsAlgorithm Should
"Impulse"Init path (statistical analysis)Channel impulse responseApply LTI transfer function via convolution
"Sample"GetWave path (time-domain)Block of waveform samplesProcess samples, update adaptive state

Critical: Simulink sets WaveType automatically before each call. In standalone MATLAB usage, you must set it explicitly:

eq = CustomEQ('TapWeights', [0.2 0.6 0.2]);
eq.SymbolTime = 100e-12;
eq.SampleInterval = 6.25e-12;

% For impulse processing
eq.WaveType = "Impulse";
yImpulse = eq(channelImpulse);

% For sample processing (reset first)
release(eq);
eq.WaveType = "Sample";
ySamples = eq(waveformBlock);

Integration Workflow

Option A: Replace PassThrough in SerdesSystem
  1. Design the system with serdes.PassThrough as a placeholder

  2. Export to Simulink via exportToSimulink

  3. In the Simulink model, replace the PassThrough MATLAB System block with your custom block

% Step 1: Design with placeholder
sys = SerdesSystem(...
    'RxModel', Receiver('Blocks', ...
        {serdes.CTLE, serdes.PassThrough, serdes.DFECDR}), ...
    'SymbolTime', 100e-12, ...
    'SamplesPerSymbol', 16);

% Step 2: Export
exportToSimulink(sys);

% Step 3: Replace PassThrough block in Simulink
% Open the model, find the PassThrough MATLAB System block,
% and change its System object name to 'CustomEQ'
% Or programmatically:
mdl = 'untitled';
blk = [mdl '/Rx/PassThrough'];
set_param(blk, 'System', 'CustomEQ');
% Create and configure
eq = CustomEQ('NumTaps', 5, 'TapWeights', [-0.1 -0.05 0.8 -0.05 -0.1]);
eq.SymbolTime = 100e-12;
eq.SampleInterval = 6.25e-12;

% Process impulse (Init path)
eq.WaveType = "Impulse";
impulse = zeros(1024, 1);
impulse(1) = 1;
yInit = eq(impulse);

% Convert to pulse and analyze
pulse = impulse2pulse(yInit, 16, 6.25e-12);
metrics = optPulseMetric(pulse, 16, 6.25e-12, 1e-6);

Example: Saturating Amplifier

The built-in serdes.SaturatingAmplifier provides a basic limiter. Here is how to use it as a custom Rx stage for signal conditioning before DFE:

% Built-in saturating amplifier — no custom class needed
amp = serdes.SaturatingAmplifier;
amp.Limit = 0.4;              % clip at ±400 mV
amp.LinearGain = 2;           % 2x gain in linear region
amp.Specification = "Limit";  % "Limit" or "LinearGain"
amp.Mode = 1;                 % export as AMI parameter

% Place between CTLE and DFECDR in the Rx chain
sys = SerdesSystem(...
    'RxModel', Receiver('Blocks', {ctle, amp, dfecdr}), ...
    'TxModel', Transmitter('Blocks', {ffe}), ...
    'SymbolTime', symbolTime, 'SamplesPerSymbol', 16);
When to Write a Custom Block Instead

Use serdes.SaturatingAmplifier for simple clipping/limiting. Write a custom serdes.SerdesAbstractSystemObject subclass when you need:

  • Nonstandard transfer functions (e.g., polynomial, piecewise)

  • State-dependent behavior (e.g., AGC with custom adaptation law)

  • Multiple interacting parameters not covered by built-in blocks

Common Mistakes

1. Inheriting from matlab.System Instead of serdes.SerdesAbstractSystemObject
% WRONG — won't integrate with SerDes framework
classdef CustomEQ < matlab.System

% CORRECT — inherits SerDes interface
classdef CustomEQ < serdes.SerdesAbstractSystemObject
2. Not Handling Both WaveType Values
% WRONG — only handles samples, Init path gives wrong results
function y = stepImpl(obj, x)
    y = filter(obj.TapWeights, 1, x, obj.Buffer);
end

% CORRECT — dispatch on WaveType
function y = stepImpl(obj, x)
    switch obj.WaveType
        case "Impulse"
            y = conv(x, upsample(obj.TapWeights(:), obj.pSamplesPerSymbol));
            y = y(1:numel(x));
        case "Sample"
            y = filter(obj.TapWeights, 1, x, obj.Buffer);
    end
end
3. Confusing IsLinear with IsTimeInvariant for Adaptive Blocks
% WRONG — adaptive linear equalizer marked as time-invariant
obj.IsLinear = true;
obj.IsTimeInvariant = true;   % NO — adaptation means time-varying

% CORRECT — adaptive LINEAR blocks (DFE, adaptive FIR):
obj.IsLinear = true;           % YES — it's a linear filter (Init uses optimal taps)
obj.IsTimeInvariant = false;   % NO — taps change during GetWave

% For truly NONLINEAR blocks (limiter, decision feedback with slicing):
obj.IsLinear = false;           % Disables statistical (Init) analysis
obj.IsTimeInvariant = false;

Note: serdes.DFECDR uses IsLinear=true, IsTimeInvariant=false. The Init path computes optimal DFE taps and applies them as a linear operation. Adaptation (time-varying behavior) only matters during GetWave.

4. Forgetting to Set WaveType in Standalone MATLAB
% WRONG — WaveType defaults to "Sample", impulse processing is incorrect
eq = CustomEQ;
eq.SymbolTime = 100e-12;
eq.SampleInterval = 6.25e-12;
y = eq(impulseResponse);  % Processes as samples, not impulse

% CORRECT — set WaveType before calling
eq.WaveType = "Impulse";
y = eq(impulseResponse);  % Correct impulse-domain processing
5. Impulse Convolution Boundary Effects

Custom blocks using conv(x, h) truncated to y(1:numel(x)) may produce small boundary differences compared to built-in blocks like serdes.FFE. The built-in blocks use optimized internal convolution that handles edge samples differently. For most practical purposes the difference is negligible (< 1e-15 in the main lobe), but it can appear in the trailing edge of the impulse response. This is expected — not a bug in your block.

6. strjoin Fails on getAMIInputNames / getAMIOutputNames

getAMIInputNames and getAMIOutputNames return cell arrays of strings (not char vectors). strjoin rejects this — wrap with string() first:

% WRONG — strjoin errors on cell of strings
inNames = eq.getAMIInputNames();
fprintf("%s\n", strjoin(inNames, ", "));  % ERROR: InvalidCellType

% CORRECT — convert to string array
fprintf("%s\n", strjoin(string(inNames), ", "));
7. GetWave Produces NaN/Inf from Uninitialized Persistent Variables

Custom blocks using persistent variables in stepImpl for GetWave (Sample mode) must initialize them in setupImpl or resetImpl. Uninitialized persistent variables default to [], and arithmetic on [] propagates NaN/Inf through the entire waveform. The DLL compiles and loads successfully — the failure only appears at runtime as corrupted output.

% WRONG — persistent not initialized, first GetWave call produces NaN
function y = stepImpl(obj, x)
    persistent prevSample
    y = x - prevSample;      % prevSample is [] on first call → NaN
    prevSample = x;
end

% CORRECT — initialize in resetImpl
function resetImpl(obj)
    obj.PrevSample = 0;      % use DiscreteState property instead
end

File Placement

Place your custom System object .m file on the MATLAB path. For Simulink integration, the file must be accessible when the model is opened and built. Recommended location: alongside the Simulink model, or in a project src/ folder added to the path via startup.m.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
MathWorks
Publisher
MathWorks (Official)
Source
matlab/matlab-agentic-toolkit · skills-catalog/rf-and-mixed-signal/matlab-model-serdes-systems · commit 2a7f215
Licence
BSD 2-Clause License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-model-serdes-systems.zip