mirror of https://github.com/pvnis/srsRAN_4G.git
Improved SFBC decoder and added SSE version. Fixed bug in MIB decoding. Improved calibration of synchronization constants
parent
799af37bed
commit
c3268a93e2
@ -0,0 +1,46 @@
|
||||
clear
|
||||
|
||||
addpath('../../build/srslte/lib/mimo/test')
|
||||
|
||||
enb = lteRMCDL('R.10');
|
||||
|
||||
cec = struct('FreqWindow',9,'TimeWindow',9,'InterpType','cubic');
|
||||
cec.PilotAverage = 'UserDefined';
|
||||
cec.InterpWinSize = 1;
|
||||
cec.InterpWindow = 'Causal';
|
||||
|
||||
cfg.Seed = 1; % Random channel seed
|
||||
cfg.NRxAnts = 1; % 1 receive antenna
|
||||
cfg.DelayProfile = 'ETU'; % EVA delay spread
|
||||
cfg.DopplerFreq = 100; % 120Hz Doppler frequency
|
||||
cfg.MIMOCorrelation = 'Low'; % Low (no) MIMO correlation
|
||||
cfg.InitTime = 0; % Initialize at time zero
|
||||
cfg.NTerms = 16; % Oscillators used in fading model
|
||||
cfg.ModelType = 'GMEDS'; % Rayleigh fading model type
|
||||
cfg.InitPhase = 'Random'; % Random initial phases
|
||||
cfg.NormalizePathGains = 'On'; % Normalize delay profile power
|
||||
cfg.NormalizeTxAnts = 'On'; % Normalize for transmit antennas
|
||||
|
||||
[txWaveform, ~, info] = lteRMCDLTool(enb,[1;0;0;1]);
|
||||
n = length(txWaveform);
|
||||
cfg.SamplingRate = info.SamplingRate;
|
||||
|
||||
txWaveform = txWaveform+complex(randn(n,2),randn(n,2))*1e-3;
|
||||
|
||||
rxWaveform = lteFadingChannel(cfg,txWaveform);
|
||||
|
||||
rxGrid = lteOFDMDemodulate(enb,sum(rxWaveform,2));
|
||||
|
||||
[h,n0] = lteDLChannelEstimate(enb,cec,rxGrid);
|
||||
|
||||
signal=rxGrid(:,1);
|
||||
hest(:,1,1)=reshape(h(:,1,1,1),[],1);
|
||||
hest(:,1,2)=reshape(h(:,1,1,1),[],1);
|
||||
|
||||
output_mat = lteTransmitDiversityDecode(signal(, hest(1:598,1,:));
|
||||
output_srs = srslte_diversitydecode(signal(1:598), hest(1:598,1,:));
|
||||
|
||||
plot(abs(output_mat-output_srs))
|
||||
mean(abs(output_mat-output_srs).^2)
|
||||
|
||||
|
@ -0,0 +1,116 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2015 Software Radio Systems Limited
|
||||
*
|
||||
* \section LICENSE
|
||||
*
|
||||
* This file is part of the srsLTE library.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "srslte/srslte.h"
|
||||
#include "srslte/mex/mexutils.h"
|
||||
|
||||
/** MEX function to be called from MATLAB to test the predecoder
|
||||
*/
|
||||
|
||||
#define INPUT prhs[0]
|
||||
#define HEST prhs[1]
|
||||
#define NOF_INPUTS 2
|
||||
|
||||
|
||||
void help()
|
||||
{
|
||||
mexErrMsgTxt
|
||||
("[output] = srslte_predecoder(input, hest, nest)\n\n");
|
||||
}
|
||||
|
||||
/* the gateway function */
|
||||
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
||||
{
|
||||
cf_t *input = NULL;
|
||||
cf_t *hest = NULL;
|
||||
cf_t *output = NULL;
|
||||
uint32_t nof_symbols = 0;
|
||||
|
||||
if (nrhs < NOF_INPUTS) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
// Read input symbols
|
||||
nof_symbols = mexutils_read_cf(INPUT, &input);
|
||||
if (nof_symbols < 0) {
|
||||
mexErrMsgTxt("Error reading input\n");
|
||||
return;
|
||||
}
|
||||
// Read channel estimates
|
||||
uint32_t nof_symbols2 = mexutils_read_cf(HEST, &hest);
|
||||
if (nof_symbols < 0) {
|
||||
mexErrMsgTxt("Error reading hest\n");
|
||||
return;
|
||||
}
|
||||
if ((nof_symbols2 % nof_symbols) != 0) {
|
||||
mexErrMsgTxt("Hest size must be multiple of input size\n");
|
||||
return;
|
||||
}
|
||||
// Calculate number of ports
|
||||
uint32_t nof_ports = nof_symbols2/nof_symbols;
|
||||
|
||||
cf_t *x[8];
|
||||
cf_t *h[4];
|
||||
|
||||
/* Allocate memory */
|
||||
output = srslte_vec_malloc(sizeof(cf_t)*nof_symbols);
|
||||
int i;
|
||||
for (i = 0; i < nof_ports; i++) {
|
||||
x[i] = srslte_vec_malloc(sizeof(cf_t)*nof_symbols);
|
||||
h[i] = &hest[i*nof_symbols];
|
||||
}
|
||||
for (;i<8;i++) {
|
||||
x[i] = NULL;
|
||||
}
|
||||
for (i=nof_ports;i<4;i++) {
|
||||
h[i] = NULL;
|
||||
}
|
||||
|
||||
srslte_predecoding_diversity(input, h, x, nof_ports, nof_symbols);
|
||||
srslte_layerdemap_diversity(x, output, nof_ports, nof_symbols / nof_ports);
|
||||
|
||||
|
||||
if (nlhs >= 1) {
|
||||
mexutils_write_cf(output, &plhs[0], nof_symbols, 1);
|
||||
}
|
||||
|
||||
if (input) {
|
||||
free(input);
|
||||
}
|
||||
if (output) {
|
||||
free(output);
|
||||
}
|
||||
for (i=0;i<8;i++) {
|
||||
if (x[i]) {
|
||||
free(x[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue