This example covers two topics: the first focuses on the concatenation of three scattering parameters (S-Parameters) that represent a communication channel along with the analog components of a transmitter and of a receiver into a single 4-port S-Parameter, the second focuses on the conversion of this 4-port S-Parameter to an impulse response for use with SerDes Toolbox™. You will use the rationalfit
function from the RF Toolbox™ to find the impulse response of the S-Parameter that represents a communication channel employing True and Complement differential signaling. For more information, see Modeling a High-Speed Backplane (4-Port S-Parameters to a Rational Function).
The S-Parameter file must be a 4-port .s4p
file. Normalize the transmitter (Tx) and receiver (Rx) impedances to 50
Ohms. The Datarate
and SamplesPerSymb
valuses must match the settings of the SerDes system and are set to 10
GHz and 32, respectively. The control parameters for the rationalfit
function include delayStart
, delayStep
, delayStop
, and nPoles
. Adjust the resolution of the impulse response using pointsInImpulse.
filename = 'default.s4p';
TxR = 50;
TxC = 0.1e-12;
RxR = 50;
RxC = 0.2e-12;
datarate = 10*1e9;
samplespersymb = 32;
delayStart = 0.68;
delayStep = 0.01;
delayStop = 0.73;
nPoles = 120;
Rshort = 1.0e-6;
pointsInImpulse = 16384;
showPlots = true;
Calculate the symbol time and the sample interval. Import the S-Parameter data file and keep the original frequency content.
pulsewidth = 1/datarate; ts = pulsewidth/samplespersymb; origSparam = sparameters(filename); freq = origSparam.Frequencies;
Create the analog Tx and Rx circuits as S-Parameters. Then combine the S-Paramater models of the Tx and Rx circuits with S-Parameter model of Communication Channel.
cktTx = circuit('txAnalog'); add(cktTx,[1 3],resistor(TxR,'R1')) add(cktTx,[3 0],capacitor(TxC,'C1')) add(cktTx,[2 4],resistor(TxR,'R2')) add(cktTx,[4 0],capacitor(TxC,'C2')) setports(cktTx,[1 0],[2 0],[3 0],[4 0]) StxAnalog = sparameters(cktTx,freq,50);
cktCh = circuit('ChannelSparam'); channel = nport(filename); % Create s-parameter circuit element add(cktCh,[1 3 2 4],channel); setports(cktCh,[1 0],[2 0],[3 0],[4 0]) Schannel = sparameters(cktCh,freq,50);
cktRx = circuit('rxAnalog'); add(cktRx,[1 0],resistor(RxR,'R3')) add(cktRx,[1 0],capacitor(RxC,'C3')) add(cktRx,[2 0],resistor(RxR,'R4')) add(cktRx,[2 0],capacitor(RxC,'C4')) add(cktRx,[1 3],resistor(Rshort,'R5')) add(cktRx,[2 4],resistor(Rshort,'R6')) setports(cktRx,[1 0],[2 0],[3 0],[4 0]) SrxAnalog = sparameters(cktRx,freq,50);
Concatenate the S-Parameters using cascadesparams
. Set values of data
, freq
and z0
for use by the rationalfit
function. Use s2sdd
to convert the data to a 4-port differential S-Parameter diffdata
and set the port order to 1234
. Note: RF Toolbox applies ports first from top to bottom on an S-parameter, then from left to right.
sparamWithAnalog = cascadesparams(StxAnalog,Schannel,SrxAnalog); data = sparamWithAnalog.Parameters; freq = sparamWithAnalog.Frequencies; z0 = sparamWithAnalog.Impedance; diffdata = s2sdd(data,2); diffz0 = 2*z0; diffsparams = sparameters(diffdata,freq,diffz0);
Find the transfer function from the diffdata
, reference impedance of the S-Parameters, source impedenance in the Tx analog model, and the load impedance in the Rx analog model.
zRef = diffz0; % Reference impedance of S-Parameters zSource = 1e-6; % Short circuit the source impedance since it is included in the Tx Analog model. zLoad = 1e6; % Open circuit the load impedance since it is included in the Rx Analog model. difftransfunc = s2tf(diffdata,zRef,zSource,zLoad);
Create the rationalfit
of the diff S-Parameter. Sweep the delay factor and keep the best fit. Then plot the derived rationalfit
result.
bestErr = 0; bestDelay = 0; bestRationalFit = rfmodel.rational(); for delaySweep = delayStart:delayStep:delayStop [rationalfunc,errdb] = rationalfit(freq,difftransfunc,-50,'DelayFactor',delaySweep,'IterationLimit',100,'NPoles',nPoles); if errdb < bestErr bestErr = errdb; bestDelay = delaySweep; bestRationalFit = rationalfunc; end fprintf('.'); end
......
rationalfunc = bestRationalFit;
npoles = length(rationalfunc.A);
fprintf('\nThe derived rational function achieved %f dB fit with %f delay and %d poles.\n',bestErr,bestDelay,npoles);
The derived rational function achieved -70.053204 dB fit with 0.680000 delay and 120 poles.
Create the impulse response.
[imp,impt]=impulse(rationalfunc,ts,pointsInImpulse);
Plot the magnitude and phase of the original transfer function and the output of rationalfit
.
freqsforresp = linspace(0,max(freq)*2,length(freq))'; resp = freqresp(rationalfunc,freqsforresp); figure(11) subplot(2,1,1) plot(freq*1.e-9,20*log10(abs(difftransfunc)),'r',freqsforresp*1.e-9, ... 20*log10(abs(resp)),'b--','LineWidth',2) title(sprintf('Rational Fitting with %d poles',npoles),'FontSize',12) ylabel('Magnitude (decibels)') xlabel('Frequency (GHz)') legend('Original data','Fitting result') subplot(2,1,2) origangle = unwrap(angle(difftransfunc))*180/pi+360*freq*rationalfunc.Delay; plotangle = unwrap(angle(resp))*180/pi+360*freqsforresp*rationalfunc.Delay; plot(freq*1.e-9,origangle,'r',freqsforresp*1.e-9,plotangle,'b--', ... 'LineWidth',2) ylabel('Detrended phase (deg.)') xlabel('Frequency (GHz)') legend('Original data','Fitting result')
Use the transfer function from rationalfit
to find the impulse response using impulse
.
[imp,impt]=impulse(rationalfunc,ts,pointsInImpulse); plot(impt,imp);