PDSCH CB segmentation computation used erroneous CB length

master
ismagom 10 years ago
parent 4ef21f0439
commit ed4d500532

@ -44,7 +44,7 @@
#define INF 9e4
#define ZERO 9e-4
#define MAX_LONG_CB 6114
#define MAX_LONG_CB 6144
#define MAX_LONG_CODED (RATE*MAX_LONG_CB+TOTALTAIL)
typedef float llr_t;

@ -354,11 +354,11 @@ static int codeblock_segmentation(struct cb_segm *s, uint32_t tbs) {
B = tbs + 24;
/* Calculate CB sizes */
if (B < 6114) {
if (B < MAX_LONG_CB) {
s->C = 1;
Bp = B;
} else {
s->C = (uint32_t) ceilf((float) B / (6114 - 24));
s->C = (uint32_t) ceilf((float) B / (MAX_LONG_CB - 24));
Bp = B + 24 * s->C;
}
ret = lte_find_cb_index(Bp / s->C);
@ -397,7 +397,7 @@ int pdsch_harq_init(pdsch_harq_t *p, pdsch_t *pdsch) {
p->cell = pdsch->cell;
ret = ra_tbs_from_idx(26, p->cell.nof_prb);
if (ret != LIBLTE_ERROR) {
p->max_cb = (uint32_t) ret / (6114 - 24) + 1;
p->max_cb = (uint32_t) ret / (MAX_LONG_CB - 24) + 1;
p->pdsch_w_buff_f = malloc(sizeof(float*) * p->max_cb);
if (!p->pdsch_w_buff_f) {
@ -722,7 +722,7 @@ int pdsch_decode(pdsch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], float noise_
* The MAX-log-MAP algorithm used in turbo decoding is unsensitive to SNR estimation,
* thus we don't need tot set it in the LLRs normalization
*/
demod_soft_sigma_set(&q->demod, sqrt((float) lte_mod_bits_x_symbol(harq_process->mcs.mod)/2));
demod_soft_sigma_set(&q->demod, sqrt(0.5));
demod_soft_table_set(&q->demod, &q->mod[harq_process->mcs.mod]);
demod_soft_demodulate(&q->demod, q->pdsch_d, q->pdsch_e, nof_symbols);

@ -161,7 +161,14 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
free(prbset);
ra_prb_get_re_dl(&prb_alloc, cell.nof_prb, cell.nof_ports, cell.nof_prb<10?(cfi+1):cfi, cell.cp);
if (pdsch_harq_setup(&harq_process, mcs, &prb_alloc)) {
mexErrMsgTxt("Error configuring HARQ process\n");
return;
}
//mexPrintf("C: %d, K1: %d, K2: %d\n", harq_process.cb_segm.C, harq_process.cb_segm.K1, harq_process.cb_segm.K2);
/** Allocate input buffers */
if (mexutils_read_cf(INPUT, &input_signal) < 0) {
mexErrMsgTxt("Error reading input signal\n");
@ -178,14 +185,17 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
lte_fft_run_sf(&fft, input_signal, input_fft);
if (nrhs > NOF_INPUTS) {
cf_t *cearray;
cf_t *cearray = NULL;
nof_re = mexutils_read_cf(prhs[NOF_INPUTS], &cearray);
cf_t *cearray_ptr = cearray;
for (i=0;i<cell.nof_ports;i++) {
for (int j=0;j<nof_re;j++) {
for (int j=0;j<nof_re/cell.nof_ports;j++) {
ce[i][j] = *cearray;
cearray++;
}
}
}
if (cearray_ptr)
free(cearray_ptr);
} else {
chest_dl_estimate(&chest, input_fft, ce, sf_idx);
}
@ -195,11 +205,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} else {
noise_power = chest_dl_get_noise_estimate(&chest);
}
if (pdsch_harq_setup(&harq_process, mcs, &prb_alloc)) {
mexErrMsgTxt("Error configuring HARQ process\n");
return;
}
uint8_t *data = malloc(sizeof(uint8_t) * mcs.tbs);
if (!data) {
@ -222,7 +227,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexutils_write_cf(pdsch.pdsch_d, &plhs[3], harq_process.prb_alloc.re_sf[sf_idx], 1);
}
if (nlhs >= 5) {
mexutils_write_cf(ce[0], &plhs[4], 12*14*cell.nof_prb, 1);
mexutils_write_f(pdsch.pdsch_e, &plhs[4], harq_process.prb_alloc.re_sf[sf_idx]*lte_mod_bits_x_symbol(mcs.mod), 1);
}
chest_dl_free(&chest);

@ -7,10 +7,10 @@
recordedSignal=[];
Npackets = 4;
SNR_values = linspace(5,6,4);
SNR_values = linspace(10,20,4);
%% Choose RMC
[waveform,rgrid,rmccFgOut] = lteRMCDLTool('R.4',[1;0;0;1]);
[waveform,rgrid,rmccFgOut] = lteRMCDLTool('R.7',[1;0;0;1]);
waveform = sum(waveform,2);
if ~isempty(recordedSignal)
@ -78,7 +78,8 @@ for snr_idx=1:length(SNR_values)
%% Demodulate
frame_rx = lteOFDMDemodulate(rmccFgOut, rxWaveform);
for sf_idx=0:Nsf
%for sf_idx=0:Nsf
sf_idx=1;
subframe_waveform = rxWaveform(sf_idx*flen+1:(sf_idx+1)*flen);
subframe_rx=frame_rx(:,sf_idx*14+1:(sf_idx+1)*14);
rmccFgOut.NSubframe=sf_idx;
@ -87,8 +88,8 @@ for snr_idx=1:length(SNR_values)
% Perform channel estimation
[hest, nest] = lteDLChannelEstimate(rmccFgOut, cec, subframe_rx);
[cws,symbols,indices,pdschSymbols,pdschHest] = ltePDSCHDecode2(rmccFgOut,rmccFgOut.PDSCH,subframe_rx,hest,nest);
[trblkout,blkcrc] = lteDLSCHDecode(rmccFgOut,rmccFgOut.PDSCH, ...
[cws,symbols] = ltePDSCHDecode(rmccFgOut,rmccFgOut.PDSCH,subframe_rx,hest,nest);
[trblkout,blkcrc,dstate] = lteDLSCHDecode(rmccFgOut,rmccFgOut.PDSCH, ...
rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1),cws);
decoded(snr_idx) = decoded(snr_idx) + ~blkcrc;
@ -103,7 +104,7 @@ for snr_idx=1:length(SNR_values)
dec2 = 1;
end
decoded_liblte(snr_idx) = decoded_liblte(snr_idx)+dec2;
end
%end
if ~isempty(recordedSignal)
recordedSignal = recordedSignal(flen*10+1:end);
@ -113,8 +114,8 @@ for snr_idx=1:length(SNR_values)
end
if (length(SNR_values)>1)
semilogy(SNR_values,1-decoded/Npackets/(Nsf),'bo-',...
SNR_values,1-decoded_liblte/Npackets/(Nsf), 'ro-')
semilogy(SNR_values,1-decoded/Npackets/(Nsf+1),'bo-',...
SNR_values,1-decoded_liblte/Npackets/(Nsf+1), 'ro-')
grid on;
legend('Matlab','libLTE')
xlabel('SNR (dB)')

@ -1,8 +1,8 @@
clear
blen=1008;
SNR_values_db=linspace(-1,0.5,6);
Nrealizations=1000;
blen=5184;
SNR_values_db=linspace(-1.3,-0.7,6);
Nrealizations=600;
addpath('../../debug/lte/phy/lib/fec/test')
@ -34,7 +34,8 @@ for snr_idx=1:length(SNR_values_db)
errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data);
end
fprintf('SNR: %.2f\n', SNR_values_db(snr_idx));
fprintf('SNR: %.2f BLER: %f-%f\n', SNR_values_db(snr_idx), ...
errors1(snr_idx)/Nrealizations, errors2(snr_idx)/Nrealizations);
end
if (length(SNR_values_db) > 1)

Loading…
Cancel
Save