PR stuff
This commit is contained in:
@@ -136,6 +136,7 @@ classdef PAMsource
|
||||
|
||||
%%%%%% Duobinary %%%%%%%%%%%
|
||||
|
||||
% this is translation from user input to db_mode which was added later... "precode" und "encode" sind auch besser zu verstehen an dieser stelle daher hab ichs gelassen
|
||||
if obj.db_precode
|
||||
obj.duobinary_mode = db_mode.db_precoded;
|
||||
end
|
||||
@@ -148,10 +149,13 @@ classdef PAMsource
|
||||
case db_mode.no_db
|
||||
|
||||
case db_mode.db_precoded
|
||||
symbols = Duobinary().precode(symbols);
|
||||
% symbols = Duobinary().precode(symbols);
|
||||
symbols = Partialresponse().precode(symbols);
|
||||
case db_mode.db_encoded
|
||||
symbols = Duobinary().precode(symbols);
|
||||
symbols = Duobinary().encode(symbols);
|
||||
% symbols = Duobinary().precode(symbols);
|
||||
% symbols = Duobinary().encode(symbols);
|
||||
symbols = Partialresponse().precode(symbols);
|
||||
symbols = Partialresponse().encode(symbols);
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -191,8 +191,9 @@ classdef Signalgenerator
|
||||
% PAMsource behavior. If length is omitted, it sets the
|
||||
% output length. Internally it is converted to the PRMS
|
||||
% order per stream.
|
||||
% Default output length is 2^(order-1), except for
|
||||
% PAM-6-style dimension = 5 where it is 2^(order-2).
|
||||
% Default output length is 2^(order-1) for all mapper
|
||||
% shapes. PAM-6 still reduces the internal PRMS order
|
||||
% to keep the register length manageable.
|
||||
% skip Number of PRMS symbols to advance before output. This
|
||||
% is useful when different blocks should use shifted
|
||||
% sections of the same deterministic sequence.
|
||||
@@ -275,6 +276,10 @@ classdef Signalgenerator
|
||||
switch obj.form
|
||||
case {signalform.random, signalform.prms}
|
||||
if obj.is_pam6_shape()
|
||||
% PAM-6 consumes 5 input bits for 2 output symbols.
|
||||
% To keep the symbol count aligned with the other
|
||||
% PAM formats, reduce the number of generated rows
|
||||
% before flattening to the mapper-ready bit vector.
|
||||
length = 2^max(0, obj.order - 2);
|
||||
else
|
||||
length = 2^max(0, obj.order - 1);
|
||||
@@ -291,19 +296,16 @@ classdef Signalgenerator
|
||||
end
|
||||
|
||||
function prms_order = internal_prms_order(obj)
|
||||
bits_per_symbol = obj.prms_bits_per_symbol();
|
||||
bits_per_symbol = obj.prms_parallel_width();
|
||||
|
||||
prms_order = max(1, floor(obj.order / bits_per_symbol));
|
||||
end
|
||||
|
||||
function bits_per_symbol = prms_bits_per_symbol(obj)
|
||||
if (~isempty(obj.M) && obj.M == 6) || (isempty(obj.M) && obj.dimension == 5)
|
||||
% PAM-6 mapping in this repo consumes 5 bits for 2 symbols.
|
||||
bits_per_symbol = 2.5;
|
||||
elseif ~isempty(obj.M)
|
||||
bits_per_symbol = log2(obj.M);
|
||||
function width = prms_parallel_width(obj)
|
||||
if ~isempty(obj.M)
|
||||
width = obj.mapper_bit_dimension();
|
||||
else
|
||||
bits_per_symbol = obj.dimension;
|
||||
width = obj.dimension;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,16 +2,21 @@ classdef Partialresponse
|
||||
%PARTIALRESPONSE Generalized symbol-domain partial-response coding.
|
||||
|
||||
properties
|
||||
M = []
|
||||
order = 1
|
||||
end
|
||||
|
||||
methods
|
||||
function obj = Partialresponse(varargin)
|
||||
parser = inputParser;
|
||||
parser.addParameter("order", 1);
|
||||
parser.parse(varargin{:});
|
||||
function obj = Partialresponse(options)
|
||||
arguments
|
||||
options.M = [];
|
||||
options.order = 1;
|
||||
end
|
||||
|
||||
obj.order = parser.Results.order;
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
end
|
||||
|
||||
function signal = precode(obj, signal, options)
|
||||
@@ -134,13 +139,19 @@ classdef Partialresponse
|
||||
end
|
||||
end
|
||||
|
||||
function M = resolveM(~, data, M)
|
||||
function M = resolveM(obj, data, M)
|
||||
if isempty(M)
|
||||
M = obj.M;
|
||||
end
|
||||
if isempty(M)
|
||||
M = numel(unique(round(data, 12)));
|
||||
end
|
||||
end
|
||||
|
||||
function M = resolveEncodedM(obj, data, M)
|
||||
if isempty(M)
|
||||
M = obj.M;
|
||||
end
|
||||
if isempty(M)
|
||||
I = numel(unique(round(data, 12)));
|
||||
if obj.order == 1
|
||||
|
||||
Reference in New Issue
Block a user