Many changes for 400G DSP

Minimal Example
...
This commit is contained in:
sioe
2024-12-17 16:17:58 +01:00
parent 397cfa61dd
commit e47a4dbbbe
68 changed files with 2749 additions and 2948 deletions

View File

@@ -1,4 +1,4 @@
function [eq_signal,eq_noise,ber,numErrors] = vnle(EQ,M,rx_signal,tx_symbols,tx_bits)
function [eq_signal,eq_noise,ber,numErrors] = vnle(EQ,M,rx_signal,tx_symbols,tx_bits,emulate_precode)
%VNLE Apply an equalization algorithm to the received signal and calculate BER
% This function takes an equalizer object, a received signal, and the
% transmitted symbols to apply equalization, map the received signal back to bits,
@@ -16,6 +16,17 @@ function [eq_signal,eq_noise,ber,numErrors] = vnle(EQ,M,rx_signal,tx_symbols,tx_
%FFE or VNLE
[eq_signal,eq_noise] = EQ.process(rx_signal,tx_symbols);
eq_signal = PAMmapper(M,0).quantize(eq_signal);
if emulate_precode
eq_signal = Duobinary().encode(eq_signal);
eq_signal = Duobinary().decode(eq_signal);
tx_symbols= Duobinary().encode(tx_symbols);
tx_symbols = Duobinary().decode(tx_symbols);
tx_bits = PAMmapper(M,0).demap(tx_symbols);
end
% M = numel(unique(tx_symbols.signal));
rx_bits = PAMmapper(M,0).demap(eq_signal);

View File

@@ -3,12 +3,15 @@ function [eq_signal,eq_noise,ber,numErrors] = vnle_postfilter_mlse(eq_,pf_,mlse_
%FFE or VNLE
[eq_signal,eq_noise] = eq_.process(rx_signal,tx_symbols);
% eq_noise.signal = eq_noise.signal - movmean(eq_noise.signal,[5000,0]);
eq_signal = pf_.process(eq_signal,eq_noise);
%M = numel(unique(tx_symbols.signal));
mlse_.DIR = pf_.burg_coeff;
mlse_.trellis_states = PAMmapper(M,0).levels;
mlse_.M = M;
eq_signal = mlse_.process(eq_signal);
rx_bits = PAMmapper(M,0).demap(eq_signal);

View File

@@ -0,0 +1,57 @@
function beautifyBERplot()
% BEAUTIFYBERPLOT Enhances a BER plot for publication-quality figures.
%
% This function automatically adjusts the aesthetics of an existing plot.
% It sets limits based on the data already plotted and modifies the
% appearance for publication-ready figures.
% Set line properties for all current plot lines
lines = findall(gca, 'Type', 'Line');
markers = {'o', 's', 'd', '^', 'v', '>', '<', 'p', 'h'}; % Define marker styles
num_markers = length(markers);
for i = 1:length(lines)
lines(i).LineWidth = 1.5; % Set a thicker line width
lines(i).LineStyle = '-'; % Solid lines for simplicity
lines(i).Marker = markers{mod(i-1, num_markers) + 1}; % Assign markers cyclically
lines(i).MarkerSize = 6; % Set marker size
lines(i).MarkerFaceColor = 'auto'; % Use line color for marker face
end
% Change all text interpreters to LaTeX
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
% Set figure background to white
set(gcf, 'Color', 'w');
% Set axis labels with LaTeX
xlabel('Bit Rate in Gbps', 'Interpreter', 'latex');
ylabel('Bit Error Rate', 'Interpreter', 'latex');
% Determine x and y limits from the data in the plot
x_data = [];
y_data = [];
for i = 1:length(lines)
x_data = [x_data; lines(i).XData(:)]; %#ok<AGROW> % Append x data
y_data = [y_data; lines(i).YData(:)]; %#ok<AGROW> % Append y data
end
x_min = min(x_data);
x_max = max(x_data);
y_min = 1e-4; % Ensure no negative or zero values for log scale
y_max = 0.5;
% Adjust axis ranges
xlim([x_min, x_max]);
ylim([y_min, y_max]);
% Set logarithmic scale for y-axis
set(gca, 'YScale', 'log');
% Customize grid and box appearance
set(gca, 'Box', 'on', 'LineWidth', 1.2); % Add a thicker border
grid on;
grid minor;
% Adjust font size and style for better readability
set(gca, 'FontSize', 12, 'FontName', 'Times New Roman');
end

View File

@@ -0,0 +1,5 @@
function signal_out = awgn_channel(signal_in)
signal_out = signal_in;
end

View File

@@ -0,0 +1,76 @@
function copyStylingFrom(figNumSource, figNumTgt)
% Get handles to the source and target figures
sourceFig = figure(figNumSource);
targetFig = figure(figNumTgt);
% Get axes of source and target figures
sourceAxes = findall(sourceFig, 'type', 'axes');
targetAxes = findall(targetFig, 'type', 'axes');
% Ensure the number of axes match
if length(sourceAxes) ~= length(targetAxes)
error('Number of axes in source and target figures must be the same.');
end
% Loop through each pair of axes and copy styling properties
for i = 1:length(sourceAxes)
copyAxesProperties(sourceAxes(i), targetAxes(i));
end
% Apply general figure properties if desired
targetFig.Color = sourceFig.Color; % Background color
end
function copyAxesProperties(sourceAx, targetAx)
% List of properties to copy from source to target axes
propsToCopy = {'XColor', 'YColor', 'ZColor', 'FontSize', 'FontName', ...
'GridColor', 'GridLineStyle', 'MinorGridColor', 'Box', ...
'XGrid', 'YGrid', 'ZGrid', 'XMinorGrid', 'YMinorGrid', 'ZMinorGrid', ...
'LineWidth', 'TitleFontSizeMultiplier', 'LabelFontSizeMultiplier'};
% Copy properties from source to target
for i = 1:length(propsToCopy)
try
targetAx.(propsToCopy{i}) = sourceAx.(propsToCopy{i});
catch
% Skip property if it doesn't exist or can't be copied
end
end
% Copy axis labels and titles
targetAx.Title.String = sourceAx.Title.String;
targetAx.XLabel.String = sourceAx.XLabel.String;
targetAx.YLabel.String = sourceAx.YLabel.String;
targetAx.ZLabel.String = sourceAx.ZLabel.String;
% Copy children elements like lines, patches, etc.
sourceChildren = allchild(sourceAx);
targetChildren = allchild(targetAx);
% Ensure the number of children elements match
if length(sourceChildren) ~= length(targetChildren)
warning('Number of elements in source and target axes differ. Styling may not be applied completely.');
end
% Copy properties of children (like lines, patches, etc.), except colors and legends
for i = 1:min(length(sourceChildren), length(targetChildren))
copyObjectProperties(sourceChildren(i), targetChildren(i));
end
end
function copyObjectProperties(sourceObj, targetObj)
% List of common properties to copy for plot elements (lines, patches, etc.)
propsToCopy = {'LineStyle', 'LineWidth', 'Marker', 'MarkerSize', ...
'MarkerEdgeColor', 'MarkerFaceColor', 'DisplayName'};
% Copy properties from source to target, excluding colors
for i = 1:length(propsToCopy)
try
if ~contains(propsToCopy{i}, 'Color') % Skip color properties
targetObj.(propsToCopy{i}) = sourceObj.(propsToCopy{i});
end
catch
% Skip property if it doesn't exist or can't be copied
end
end
end

View File

@@ -0,0 +1,47 @@
folderPath = "/Volumes/NT-Labor/2024/sioe/High Speed Messungen Oktober/";
% Get list of all files in the folder and subfolders
fileList = dir(fullfile(folderPath, '**', '*'));
% Loop through each file
for i = 1:length(fileList)
% Get the file name and path
oldFileName = fileList(i).name;
oldFilePath = fullfile(fileList(i).folder, oldFileName);
% Skip if its a directory or hidden file
if fileList(i).isdir || startsWith(oldFileName, '.')
continue;
end
ismat = strfind(oldFileName, '.mat');
if ismat
continue;
else
% Find position of last dot (for file extension)
dotIndex = strfind(oldFileName, '.');
% Only proceed if there is more than one dot in the file name
if ~isempty(dotIndex)
% Replace all dots in the "base name" with underscores
sanitizedBaseName = strrep(oldFileName, '.', '_');
% Create the new file name with the corrected extension
newFileName = [sanitizedBaseName, '.mat'];
% Full path of the new file
newFilePath = fullfile(fileList(i).folder, newFileName);
% Rename the file
movefile(oldFilePath, newFilePath);
fprintf('Renamed: %s -> %s\n', oldFilePath, newFilePath);
end
end
end