191 lines
6.7 KiB
Matlab
191 lines
6.7 KiB
Matlab
%%% Run parameters
|
|
% TX
|
|
M = 4;
|
|
fsym = 180e9;
|
|
|
|
apply_pulsef = 1;
|
|
fdac = 256e9;
|
|
fadc = 256e9;
|
|
random_key = 1;
|
|
|
|
db_precode = 0;
|
|
db_encode = 0;
|
|
|
|
rcalpha = 0.05;
|
|
kover = 16;
|
|
vbias_rel = 0.5;
|
|
u_pi = 2.9;
|
|
vbias = -vbias_rel*u_pi;
|
|
laser_wavelength = 1310;
|
|
laser_linewidth = 0;
|
|
tx_bw_nyquist = 1;
|
|
|
|
% Channel
|
|
link_length = 1;
|
|
|
|
% RX
|
|
rop = 0;
|
|
rx_bw_nyquist = 0.99;
|
|
|
|
vnle_order1 = 50;
|
|
vnle_order2 = 3;
|
|
vnle_order3 = 3;
|
|
|
|
vnle_order=[vnle_order1,vnle_order2,vnle_order3];
|
|
dfe_order = [0 0 0];
|
|
|
|
pf_ncoeffs = 1;
|
|
|
|
alpha = 0;
|
|
|
|
len_tr = 4096*2;
|
|
|
|
mu_ffe1 = 0.0001;
|
|
mu_ffe2 = 0.0008;
|
|
mu_ffe3 = 0.001;
|
|
mu_dc = 0.005;
|
|
% mu_dc = 0;
|
|
|
|
mu_ffe = [mu_ffe1 mu_ffe3 mu_ffe3];
|
|
mu_dfe = 0.0004;
|
|
|
|
|
|
dfe_ = sum(dfe_order)>0;
|
|
|
|
doub_mode = db_mode.no_db;
|
|
|
|
|
|
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rc","pulselength",16,"alpha",rcalpha);
|
|
|
|
db_precode = 0;
|
|
db_encode = 0;
|
|
duob_mode = db_mode.no_db;
|
|
apply_pulsef = 1;
|
|
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
|
|
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
|
"fs_out",fdac,...
|
|
"applyclipping",0,"clipfactor",1.5,...
|
|
"applypulseform",apply_pulsef,"pulseformer",Pform,...
|
|
"randkey",random_key,...
|
|
"mrds_code",0,"mrds_blocklength",512,"duobinary_mode",duob_mode).process();
|
|
|
|
Digi_sig.spectrum("displayname",'Digi Spectrum','fignum',10,'normalizeTo0dB',1);
|
|
|
|
|
|
% %% proof of concept memoryless inverse mapping (direct db targeting and decoding)
|
|
% Symbols_db = Duobinary().encode(Symbols);
|
|
% mim_decoded = Duobinary().decode(Symbols_db,"M",M);
|
|
% rx_bits_mim_decoded = PAMmapper(M,0,"eth_style",0).demap(mim_decoded);
|
|
% [~,~,ber_mim_decode,~] = calc_ber(rx_bits_mim_decoded_.signal,Tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
% fprintf('BER mim: %.2e \n',ber_mim_decode);
|
|
|
|
%%
|
|
|
|
|
|
%%%%% AWG
|
|
% El_sig = M8199A("kover",kover).process(Digi_sig);
|
|
El_sig = AWG("fdac",fdac,"f_cutoff",fsym,"lpf_active",0,"kover",kover,"bit_resolution",12,"upsampling_method","samplehold","precomp_sinc_rolloff",1).process(Digi_sig);
|
|
% El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',0);
|
|
% El_sig = El_sig.setPower(0,"dBm");
|
|
|
|
%%%%% Low-pass el. components %%%%%%
|
|
f_nyquist = fsym/2;
|
|
tx_bwl = tx_bw_nyquist.*f_nyquist;
|
|
% tx_bwl = 80e9;
|
|
El_sig = Filter('filtdegree',4,"f_cutoff",tx_bwl,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(El_sig);
|
|
% El_sig.spectrum("displayname",'Digi Spectrum','fignum',100,'normalizeTo0dB',1);
|
|
|
|
%%%%% Electrical Driver Amplifier %%%%%%
|
|
El_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","gain","amplification_db",3).process(El_sig);
|
|
El_sig = El_sig.normalize("mode","oneone");
|
|
|
|
%%%%% MODULATE E/O CONVERSION %%%%%%
|
|
[Opt_sig] = EML("mode",eml_mode.im_cosinus,"power",3,"fsimu",El_sig.fs,"lambda",laser_wavelength,"bias",vbias,"u_pi",u_pi,"linewidth",laser_linewidth,"randomkey",random_key+1).process(El_sig);
|
|
|
|
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
|
|
|
|
%%%%%% ROP %%%%%%
|
|
Rx_sig = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",rop).process(Opt_sig);
|
|
|
|
%%%%%% PD Square Law %%%%%%
|
|
Rx_sig = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20,"nep",1.8e-11).process(Rx_sig);
|
|
|
|
%%%%%% Low-pass RX (PD, El. Connectors and Scope %%%%%%
|
|
rx_bwl = rx_bw_nyquist.*f_nyquist;
|
|
% rx_bwl = 80e9;
|
|
Rx_sig = Filter('filtdegree',4,"f_cutoff",rx_bwl,"fs",fdac*kover,"filterType",filtertypes.butterworth,"active",true).process(Rx_sig);
|
|
|
|
% %%%%%% Low-pass Scope %%%%%%
|
|
Lp_scpe = Filter('filtdegree',4,"f_cutoff",110e9,"fs",fadc,"filterType",filtertypes.butterworth,"active",true);
|
|
|
|
% Rx_sig.spectrum("displayname",'Analog Rx Spectrum','fignum',100,'normalizeTo0dB',1);
|
|
|
|
%%%%%% Scope %%%%%%
|
|
Scpe_sig = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
|
"delay",0,"fixed_delay",0,"filtertype",filtertypes.butterworth,...
|
|
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
|
"adcresolution",8,"quantbuffer",0.1,'block_dc',1,'lpf_active',1,'H_lpf',Lp_scpe).process(Rx_sig);
|
|
|
|
Scpe_sig_resampled = Scpe_sig.resample("fs_out",2*fsym);
|
|
|
|
[~, Scpe_cell, ~, found_sync] = Scpe_sig_resampled.tsynch("reference", Symbols, "fs_ref", fsym, "debug_plots", 1);
|
|
|
|
eq_ = EQ("Ne",[vnle_order1,vnle_order2,vnle_order3],"Nb",[dfe_order],"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
|
pf_ = Postfilter("ncoeff",pf_ncoeffs,"useBurg",1);
|
|
% mlse_ = MLSE_viterbi("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
|
mlse_ = MLSE("duobinary_output",0,'M',M,'trellis_states',PAMmapper(M,0).levels);
|
|
|
|
if duob_mode == db_mode.no_db
|
|
|
|
% FFE or VNLE
|
|
[eq_signal_sd, eq_noise] = eq_.process(Scpe_cell{1}, Symbols);
|
|
|
|
% Hard decision on VNLE output
|
|
eq_signal_hd = PAMmapper(M, 0).quantize(eq_signal_sd);
|
|
|
|
% Process through postfilter and MLSE
|
|
[mlse_sig_sd,whitened_noise] = pf_.process(eq_signal_sd, eq_noise);
|
|
mlse_.DIR = pf_.coefficients;
|
|
mlse_sig_sd = mlse_.process(mlse_sig_sd,Symbols);
|
|
|
|
|
|
% BER
|
|
rx_bits = PAMmapper(M,0,"eth_style",0).demap(eq_signal_hd);
|
|
[~,tot_err,ber_vnle,a] = calc_ber(rx_bits.signal,Tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
|
|
rx_bits = PAMmapper(M,0,"eth_style",0).demap(mlse_sig_sd);
|
|
[~,tot_err,ber_mlse,a] = calc_ber(rx_bits.signal,Tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
|
|
elseif duob_mode == db_mode.db_precoded
|
|
|
|
%%
|
|
[EQ_sig, Noi] = eq_.process(Scpe_cell{1},Duobinary().encode(Symbols));
|
|
|
|
showLevelHistogram(EQ_sig,Duobinary().encode(Symbols),"displayname",101);
|
|
|
|
mim_decoded = Duobinary().decode(EQ_sig,"M",M);
|
|
|
|
showLevelHistogram(mim_decoded,Symbols,"displayname",101);
|
|
|
|
rx_bits_mim_decoded = PAMmapper(M,0,"eth_style",0).demap(mim_decoded);
|
|
|
|
rx_bits_mim_decoded_.signal = circshift(rx_bits_mim_decoded.signal,0);
|
|
|
|
[~,~,ber_mim_decode,~] = calc_ber(rx_bits_mim_decoded_.signal,Tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
|
|
fprintf('BER mim: %.2e \n',ber_mim_decode);
|
|
|
|
%%
|
|
mlse_sig_hd = MLSE("DIR",[1,1],"duobinary_output",1,"M",M,"trellis_states",PAMmapper(M,0).levels).process(EQ_sig,Symbols);
|
|
|
|
mlse_sig_hd_decoded = Duobinary().encode(mlse_sig_hd,"M",M);
|
|
|
|
mlse_sig_hd_decoded = Duobinary().decode(mlse_sig_hd_decoded,"M",M);
|
|
|
|
rx_bits_mlse_decoded = PAMmapper(M,0,"eth_style",0).demap(mlse_sig_hd_decoded);
|
|
|
|
[~,errors_db_diff_precoded,ber_db_diff_precoded,a] = calc_ber(rx_bits_mlse_decoded.signal,Tx_bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
|
|
%%
|
|
|
|
end |