Added PUSCH resource mapping for non frequency-hopping

master
ismagom 10 years ago
parent daae1da8bc
commit e0b0440c77

@ -49,6 +49,8 @@ LIBLTE_API int dft_precoding_init(dft_precoding_t *q,
LIBLTE_API void dft_precoding_free(dft_precoding_t *q);
LIBLTE_API bool dft_precoding_valid_prb(uint32_t nof_prb);
LIBLTE_API int dft_precoding(dft_precoding_t *q,
cf_t *input,
cf_t *output,

@ -130,7 +130,7 @@ LIBLTE_API int ra_prb_get_dl(ra_prb_t *prb,
ra_pdsch_t *ra,
uint32_t nof_prb);
LIBLTE_API int ra_prb_get_ul(ra_prb_slot_t *prb,
LIBLTE_API int ra_prb_get_ul(ra_prb_t *prb,
ra_pusch_t *ra,
uint32_t nof_prb);
@ -141,10 +141,10 @@ LIBLTE_API void ra_prb_get_re_dl(ra_prb_t *prb_dist,
lte_cp_t cp);
LIBLTE_API uint32_t ra_nprb_dl(ra_pdsch_t *ra,
uint32_t nof_prb);
uint32_t nof_prb);
LIBLTE_API uint32_t ra_nprb_ul(ra_pusch_t *ra,
uint32_t nof_prb);
uint32_t nof_prb);
LIBLTE_API int ra_mcs_from_idx_dl(uint32_t mcs_idx,
uint32_t nof_prb,

@ -284,7 +284,7 @@ int refsignal_dmrs_pusch_gen(refsignal_ul_t *q, refsignal_drms_pusch_cfg_t *cfg,
for (int i=0;i<RE_X_RB*cfg->nof_prb;i++) {
r_pusch[i] = cfg->beta_pusch * cexpf(I*(q->tmp_arg[i] + alpha*i));
}
vec_fprint_c(stdout, r_pusch, RE_X_RB*cfg->nof_prb);
vec_fprint_c(stdout, r_pusch, RE_X_RB*cfg->nof_prb);
ret = 0;
}
return ret;

@ -46,18 +46,21 @@ int dft_precoding_init(dft_precoding_t *q, uint32_t max_prb)
int ret = LIBLTE_ERROR_INVALID_INPUTS;
bzero(q, sizeof(dft_precoding_t));
if (max_prb >= MAX_PRB) {
if (max_prb <= MAX_PRB) {
ret = LIBLTE_ERROR;
for (uint32_t i=0;i<max_prb;i++) {
if((i % 2) == 0 || (i % 3) == 0 || (i % 5) == 0) {
for (uint32_t i=2;i<max_prb;i++) {
if(dft_precoding_valid_prb(i)) {
DEBUG("Initiating DFT precoding plan for %d PRBs\n", i);
if (dft_plan_c(&q->dft_plan[i], i*RE_X_RB, FORWARD)) {
fprintf(stderr, "Error: Creating DFT plan %d\n",i);
goto clean_exit;
}
dft_plan_set_norm(&q->dft_plan[i], true);
if (dft_plan_c(&q->idft_plan[i], i*RE_X_RB, BACKWARD)) {
fprintf(stderr, "Error: Creating DFT plan %d\n",i);
goto clean_exit;
}
}
dft_plan_set_norm(&q->idft_plan[i], true);
}
}
q->max_prb = max_prb;
@ -74,8 +77,9 @@ clean_exit:
/* Free DFT plans for transform precoding */
void dft_precoding_free(dft_precoding_t *q)
{
for (uint32_t i=0;i<q->max_prb;i++) {
if((i % 2) == 0 || (i % 3) == 0 || (i % 5) == 0) {
for (uint32_t i=2;i<q->max_prb;i++) {
if(dft_precoding_valid_prb(i)) {
DEBUG("Freeing DFT precoding plan for %d PRBs\n", i);
dft_plan_free(&q->dft_plan[i]);
dft_plan_free(&q->idft_plan[i]);
}
@ -83,11 +87,19 @@ void dft_precoding_free(dft_precoding_t *q)
bzero(q, sizeof(dft_precoding_t));
}
bool dft_precoding_valid_prb(uint32_t nof_prb) {
if ((nof_prb%2) == 0 || (nof_prb%3) == 0 || (nof_prb%5) == 0) {
return true;
} else {
return false;
}
}
int dft_precoding(dft_precoding_t *q, cf_t *input, cf_t *output,
uint32_t nof_prb, uint32_t nof_symbols)
{
if ((nof_prb%2) || (nof_prb%3) || (nof_prb%5)) {
if (!dft_precoding_valid_prb(nof_prb)) {
fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb);
return LIBLTE_ERROR;
}
@ -102,7 +114,7 @@ int dft_precoding(dft_precoding_t *q, cf_t *input, cf_t *output,
int dft_predecoding(dft_precoding_t *q, cf_t *input, cf_t *output,
uint32_t nof_prb, uint32_t nof_symbols)
{
if ((nof_prb%2) || (nof_prb%3) || (nof_prb%5)) {
if (!dft_precoding_valid_prb(nof_prb)) {
fprintf(stderr, "Error invalid number of PRB (%d)\n", nof_prb);
return LIBLTE_ERROR;
}

@ -34,7 +34,7 @@
#include <assert.h>
#include <math.h>
#include "prb.h"
#include "prb_dl.h"
#include "liblte/phy/phch/pbch.h"
#include "liblte/phy/common/phy_common.h"
#include "liblte/phy/utils/bit.h"

@ -34,7 +34,7 @@
#include <assert.h>
#include <math.h>
#include "prb.h"
#include "prb_dl.h"
#include "liblte/phy/phch/pdsch.h"
#include "liblte/phy/common/phy_common.h"
#include "liblte/phy/utils/bit.h"

@ -34,7 +34,6 @@
#include <assert.h>
#include <math.h>
#include "prb.h"
#include "liblte/phy/phch/regs.h"
#include "liblte/phy/phch/phich.h"
#include "liblte/phy/common/phy_common.h"

@ -29,7 +29,7 @@
#include <stdbool.h>
#include <string.h>
#include "prb.h"
#include "prb_dl.h"
#include "liblte/phy/common/phy_common.h"
//#define DEBUG_IDX

@ -34,5 +34,3 @@ void prb_cp(cf_t **input, cf_t **output, int nof_prb);
void prb_cp_half(cf_t **input, cf_t **output, int nof_prb);
void prb_put_ref_(cf_t **input, cf_t **output, int offset, int nof_refs,
int nof_intervals);
void phch_get_prb_ref(cf_t **input, cf_t **output, int offset, int nof_refs,
int nof_intervals);

@ -34,7 +34,6 @@
#include <assert.h>
#include <math.h>
#include "prb.h"
#include "liblte/phy/phch/pusch.h"
#include "liblte/phy/phch/uci.h"
#include "liblte/phy/common/phy_common.h"
@ -50,45 +49,50 @@
const static lte_mod_t modulations[4] =
{ LTE_BPSK, LTE_QPSK, LTE_QAM16, LTE_QAM64 };
//#define DEBUG_IDX
#ifdef DEBUG_IDX
cf_t *offset_original=NULL;
extern int indices[100000];
extern int indices_ptr;
#endif
int pusch_cp(pusch_t *q, cf_t *input, cf_t *output, ra_prb_t *prb_alloc,
uint32_t nsubframe, bool put)
int pusch_cp(pusch_t *q, ra_prb_t *prb_alloc, cf_t *input, cf_t *output, bool advance_input)
{
return -1;
cf_t *in_ptr = input;
cf_t *out_ptr = output;
uint32_t L_ref = 3;
if (CP_ISEXT(q->cell.cp)) {
L_ref = 2;
}
for (uint32_t slot=0;slot<2;slot++) {
for (uint32_t l=0;l<CP_NSYMB(q->cell.cp);l++) {
if (l != L_ref) {
for (uint32_t n=0;n<q->cell.nof_prb;n++) {
if (prb_alloc->slot[slot].prb_idx[n]) {
uint32_t idx = RE_IDX(q->cell.nof_prb, l+slot*CP_NSYMB(q->cell.cp), n*RE_X_RB);
if (advance_input) {
out_ptr = &output[idx];
} else {
in_ptr = &input[idx];
}
memcpy(out_ptr, in_ptr, RE_X_RB * sizeof(cf_t));
if (advance_input) {
in_ptr += RE_X_RB;
} else {
out_ptr += RE_X_RB;
}
}
}
}
}
}
return RE_X_RB*prb_alloc->slot[0].nof_prb;
}
/**
* Puts PUSCH in slot number 1
*
* Returns the number of symbols written to sf_symbols
*
* 36.211 10.3 section 6.3.5
*/
int pusch_put(pusch_t *q, cf_t *pusch_symbols, cf_t *sf_symbols,
ra_prb_t *prb_alloc, uint32_t subframe) {
return pusch_cp(q, pusch_symbols, sf_symbols, prb_alloc, subframe, true);
int pusch_put(pusch_t *q, ra_prb_t *prb_alloc, cf_t *input, cf_t *output) {
return pusch_cp(q, prb_alloc, input, output, true);
}
/**
* Extracts PUSCH from slot number 1
*
* Returns the number of symbols written to PUSCH
*
* 36.211 10.3 section 6.3.5
*/
int pusch_get(pusch_t *q, cf_t *sf_symbols, cf_t *pusch_symbols,
ra_prb_t *prb_alloc, uint32_t subframe) {
return pusch_cp(q, sf_symbols, pusch_symbols, prb_alloc, subframe, false);
int pusch_get(pusch_t *q, ra_prb_t *prb_alloc, cf_t *input, cf_t *output) {
return pusch_cp(q, prb_alloc, input, output, false);
}
/** Initializes the PDCCH transmitter and receiver */
int pusch_init(pusch_t *q, lte_cell_t cell) {
int ret = LIBLTE_ERROR_INVALID_INPUTS;
@ -118,7 +122,10 @@ int pusch_init(pusch_t *q, lte_cell_t cell) {
sch_init(&q->dl_sch);
dft_precoding_init(&q->dft_precoding, cell.nof_prb);
if (dft_precoding_init(&q->dft_precoding, cell.nof_prb)) {
fprintf(stderr, "Error initiating DFT transform precoding\n");
goto clean;
}
/* This is for equalization at receiver */
if (precoding_init(&q->equalizer, SF_LEN_RE(cell.nof_prb, cell.cp))) {
@ -232,14 +239,14 @@ int pusch_decode(pusch_t *q, harq_t *harq, cf_t *sf_symbols, cf_t *ce, float noi
harq->sf_idx, lte_mod_string(harq->mcs.mod), harq->mcs.tbs, harq->nof_re, harq->nof_bits, harq->rv);
/* extract symbols */
n = pusch_get(q, sf_symbols, q->pusch_d, &harq->prb_alloc, harq->sf_idx);
n = pusch_get(q, &harq->prb_alloc, sf_symbols, q->pusch_d);
if (n != harq->nof_re) {
fprintf(stderr, "Error expecting %d symbols but got %d\n", harq->nof_re, n);
return LIBLTE_ERROR;
}
/* extract channel estimates */
n = pusch_get(q, ce, q->ce, &harq->prb_alloc, harq->sf_idx);
n = pusch_get(q, &harq->prb_alloc, ce, q->ce);
if (n != harq->nof_re) {
fprintf(stderr, "Error expecting %d symbols but got %d\n", harq->nof_re, n);
return LIBLTE_ERROR;
@ -291,18 +298,13 @@ int pusch_uci_encode(pusch_t *q, harq_t *harq, uint8_t *data, uci_data_t uci_dat
{
if (q->rnti_is_set) {
if (harq->mcs.tbs == 0) {
return LIBLTE_ERROR_INVALID_INPUTS;
}
if (harq->mcs.tbs > harq->nof_bits) {
fprintf(stderr, "Invalid code rate %.2f\n", (float) harq->mcs.tbs / harq->nof_bits);
return LIBLTE_ERROR_INVALID_INPUTS;
}
if (harq->nof_re > q->max_re) {
fprintf(stderr,
"Error too many RE per subframe (%d). PUSCH configured for %d RE (%d PRB)\n",
fprintf(stderr, "Error too many RE per subframe (%d). PUSCH configured for %d RE (%d PRB)\n",
harq->nof_re, q->max_re, q->cell.nof_prb);
return LIBLTE_ERROR_INVALID_INPUTS;
}
@ -310,8 +312,7 @@ int pusch_uci_encode(pusch_t *q, harq_t *harq, uint8_t *data, uci_data_t uci_dat
INFO("Encoding PUSCH SF: %d, Mod %s, TBS: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n",
harq->sf_idx, lte_mod_string(harq->mcs.mod), harq->mcs.tbs, harq->nof_re, harq->nof_bits, harq->rv);
if (ulsch_uci_encode(&q->dl_sch, harq, data, uci_data, q->pusch_g, q->pusch_q))
{
if (ulsch_uci_encode(&q->dl_sch, harq, data, uci_data, q->pusch_g, q->pusch_q)) {
fprintf(stderr, "Error encoding TB\n");
return LIBLTE_ERROR;
}
@ -324,7 +325,7 @@ int pusch_uci_encode(pusch_t *q, harq_t *harq, uint8_t *data, uci_data_t uci_dat
harq->prb_alloc.slot[0].nof_prb, harq->nof_symb);
/* mapping to resource elements */
pusch_put(q, q->pusch_z, sf_symbols, &harq->prb_alloc, harq->sf_idx);
pusch_put(q, &harq->prb_alloc, q->pusch_z, sf_symbols);
ret = LIBLTE_SUCCESS;
} else {

@ -143,15 +143,23 @@ void ra_prb_fprint(FILE *f, ra_prb_slot_t *prb, uint32_t nof_prb) {
}
/** Compute PRB allocation for Uplink as defined in 8.1 of 36.213 */
int ra_prb_get_ul(ra_prb_slot_t *prb, ra_pusch_t *ra, uint32_t nof_prb) {
int ra_prb_get_ul(ra_prb_t *prb_dist, ra_pusch_t *ra, uint32_t nof_prb) {
int i;
if (ra->type2_alloc.mode != t2_loc) {
fprintf(stderr, "Uplink only accepts type2 localized scheduling\n");
return LIBLTE_ERROR;
}
for (i = 0; i < ra->type2_alloc.L_crb; i++) {
prb->prb_idx[i] = i + ra->type2_alloc.RB_start;
prb->nof_prb++;
bzero(prb_dist, sizeof(ra_prb_t));
switch (ra->freq_hop_fl) {
case hop_disabled:
for (i = 0; i < ra->type2_alloc.L_crb; i++) {
prb_dist->slot[0].prb_idx[i + ra->type2_alloc.RB_start] = true;
prb_dist->slot[0].nof_prb++;
}
memcpy(&prb_dist->slot[1], &prb_dist->slot[0], sizeof(ra_prb_slot_t));
break;
}
return LIBLTE_SUCCESS;
}

@ -38,7 +38,7 @@
#define CQI prhs[3]
#define RI prhs[4]
#define ACK prhs[5]
#define NOF_INPUTS 3
#define NOF_INPUTS 6
void help()
{
@ -49,41 +49,45 @@ void help()
/* the gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
int i;
lte_cell_t cell;
pusch_t pusch;
uint32_t sf_idx;
uint8_t *trblkin = NULL;
cf_t *sf_symbols = NULL;
ra_mcs_t mcs;
ra_prb_t prb_alloc;
harq_t harq_process;
uint32_t rv;
uint32_t rnti32;
uci_data_t uci_data;
bzero(&uci_data, sizeof(uci_data_t));
if (nrhs != NOF_INPUTS) {
help();
return;
}
lte_cell_t cell;
bzero(&cell, sizeof(lte_cell_t));
cell.nof_ports = 1;
if (mexutils_read_uint32_struct(UECFG, "NCellID", &cell.id)) {
mexErrMsgTxt("Field NCellID not found in pusch config\n");
mexErrMsgTxt("Field NCellID not found in UE config\n");
return;
}
if (mexutils_read_uint32_struct(UECFG, "NSubframe", &sf_idx)) {
mexErrMsgTxt("Field NCellID not found in pusch config\n");
if (mexutils_read_uint32_struct(UECFG, "NULRB", &cell.nof_prb)) {
mexErrMsgTxt("Field NULRB not found in UE config\n");
return;
}
pusch_t pusch;
if (pusch_init(&pusch, cell)) {
mexErrMsgTxt("Error initiating PUSCH\n");
return;
}
uint32_t rnti32=0;
if (mexutils_read_uint32_struct(UECFG, "RNTI", &rnti32)) {
mexErrMsgTxt("Field RNTI not found in pusch config\n");
return;
}
pusch_set_rnti(&pusch, (uint16_t) (rnti32 & 0xffff));
char *mod_str = mexutils_get_char_struct(PUSCHCFG, "Modulation");
uint32_t sf_idx=0;
if (mexutils_read_uint32_struct(UECFG, "NSubframe", &sf_idx)) {
mexErrMsgTxt("Field NSubframe not found in UE config\n");
return;
}
ra_mcs_t mcs;
char *mod_str = mexutils_get_char_struct(PUSCHCFG, "Modulation");
if (!strcmp(mod_str, "QPSK")) {
mcs.mod = LTE_QPSK;
} else if (!strcmp(mod_str, "16QAM")) {
@ -105,13 +109,14 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return;
}
ra_prb_t prb_alloc;
// Only localized PRB supported
prb_alloc.slot[0].nof_prb = mexutils_read_f(p, &prbset);
for (i=0;i<cell.nof_prb;i++) {
for (uint32_t i=0;i<cell.nof_prb;i++) {
prb_alloc.slot[0].prb_idx[i] = false;
for (int j=0;j<prb_alloc.slot[0].nof_prb && !prb_alloc.slot[0].prb_idx[i];j++) {
if ((int) prbset[j] == i) {
for (uint32_t j=0;j<prb_alloc.slot[0].nof_prb && !prb_alloc.slot[0].prb_idx[i];j++) {
if (prbset[j] == i) {
prb_alloc.slot[0].prb_idx[i] = true;
}
}
@ -120,20 +125,30 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
free(prbset);
if (pusch_init(&pusch, cell)) {
mexErrMsgTxt("Error initiating PDSCH\n");
return;
}
pusch_set_rnti(&pusch, (uint16_t) (rnti32 & 0xffff));
uint8_t *trblkin = NULL;
mcs.tbs = mexutils_read_uint8(TRBLKIN, &trblkin);
harq_t harq_process;
if (harq_init(&harq_process, cell)) {
mexErrMsgTxt("Error initiating HARQ process\n");
return;
}
mcs.tbs = mexutils_read_uint8(TRBLKIN, &trblkin);
if (harq_setup_ul(&harq_process, mcs, 0, sf_idx, &prb_alloc)) {
mexErrMsgTxt("Error configuring HARQ process\n");
return;
}
uint32_t nof_re = RE_X_RB*cell.nof_prb*2*CP_NSYMB(cell.cp);
cf_t *sf_symbols = vec_malloc(sizeof(cf_t) * nof_re);
if (!sf_symbols) {
mexErrMsgTxt("malloc");
return;
}
bzero(sf_symbols, sizeof(cf_t) * nof_re);
uci_data_t uci_data;
bzero(&uci_data, sizeof(uci_data_t));
uci_data.uci_cqi_len = mexutils_read_uint8(CQI, &uci_data.uci_cqi);
uint8_t *tmp;
uci_data.uci_ri_len = mexutils_read_uint8(RI, &tmp);
@ -147,14 +162,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
free(tmp);
mexPrintf("TRBL_len: %d, CQI_len: %d, ACK_len: %d, RI_len: %d\n", mcs.tbs,
uci_data.uci_cqi_len, uci_data.uci_ack_len, uci_data.uci_ri_len);
if (mexutils_read_uint32_struct(PUSCHCFG, "RV", &rv)) {
mexErrMsgTxt("Field RV not found in pdsch config\n");
return;
}
if (mexutils_read_float_struct(PUSCHCFG, "BetaCQI", &uci_data.beta_cqi)) {
uci_data.beta_cqi = 2.0;
}
@ -166,26 +174,38 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
mexPrintf("Beta_CQI: %.1f, Beta_ACK: %.1f, Beta_RI: %.1f\n",
uci_data.beta_cqi, uci_data.beta_ack, uci_data.beta_ri);
mexPrintf("TRBL_len: %d, CQI_len: %d, ACK_len: %d (%d), RI_len: %d (%d)\n", mcs.tbs,
uci_data.uci_cqi_len, uci_data.uci_ack_len, uci_data.uci_ack, uci_data.uci_ri_len, uci_data.uci_ri);
sf_symbols = vec_malloc(sizeof(cf_t) * harq_process.nof_re);
if (!sf_symbols) {
mexErrMsgTxt("malloc");
return;
}
if (harq_setup_ul(&harq_process, mcs, rv, sf_idx, &prb_alloc)) {
mexErrMsgTxt("Error configuring HARQ process\n");
return;
}
mexPrintf("NofRE: %d, NofBits: %d, TBS: %d\n", harq_process.nof_re, harq_process.nof_bits, harq_process.mcs.tbs);
int r = pusch_uci_encode(&pusch, &harq_process, trblkin, uci_data, sf_symbols);
if (r < 0) {
mexErrMsgTxt("Error encoding PUSCH\n");
return;
}
uint32_t rv=0;
if (mexutils_read_uint32_struct(PUSCHCFG, "RV", &rv)) {
mexErrMsgTxt("Field RV not found in pdsch config\n");
return;
}
if (rv > 0) {
if (harq_setup_ul(&harq_process, mcs, rv, sf_idx, &prb_alloc)) {
mexErrMsgTxt("Error configuring HARQ process\n");
return;
}
r = pusch_uci_encode(&pusch, &harq_process, trblkin, uci_data, sf_symbols);
if (r < 0) {
mexErrMsgTxt("Error encoding PUSCH\n");
return;
}
}
if (nlhs >= 1) {
mexutils_write_cf(sf_symbols, &plhs[0], harq_process.nof_re, 1);
mexutils_write_cf(sf_symbols, &plhs[0], nof_re, 1);
}
if (nlhs >= 2) {
mexutils_write_cf(pusch.pusch_z, &plhs[1], harq_process.nof_re, 1);
}
pusch_free(&pusch);
free(trblkin);

@ -112,9 +112,7 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) {
pusch_t pusch;
uint8_t *data = NULL;
cf_t *ce;
uint32_t nof_re;
cf_t *sf_symbols;
cf_t *sf_symbols = NULL;
int ret = -1;
struct timeval t[3];
ra_mcs_t mcs;
@ -123,32 +121,13 @@ int main(int argc, char **argv) {
parse_args(argc,argv);
nof_re = 2 * CPNORM_NSYMB * cell.nof_prb * RE_X_RB;
mcs.tbs = tbs;
mcs.mod = modulation;
prb_alloc.slot[0].nof_prb = 1;
bzero(&prb_alloc, sizeof(ra_prb_t));
prb_alloc.slot[0].nof_prb = 2;
memcpy(&prb_alloc.slot[1], &prb_alloc.slot[0], sizeof(ra_prb_slot_t));
/* init memory */
ce = malloc(sizeof(cf_t) * nof_re);
if (!ce) {
perror("malloc");
goto quit;
}
sf_symbols = calloc(sizeof(cf_t) , nof_re);
if (!sf_symbols) {
perror("malloc");
goto quit;
}
data = malloc(sizeof(uint8_t) * mcs.tbs);
if (!data) {
perror("malloc");
goto quit;
}
if (pusch_init(&pusch, cell)) {
fprintf(stderr, "Error creating PDSCH object\n");
goto quit;
@ -160,13 +139,6 @@ int main(int argc, char **argv) {
goto quit;
}
for (uint32_t i=0;i<mcs.tbs;i++) {
data[i] = 1;
}
printf("INPUT: ");
vec_fprint_b(stdout, data, mcs.tbs);
printf("Encoding rv_idx=%d\n",rv_idx);
uint8_t tmp[20];
@ -192,6 +164,22 @@ int main(int argc, char **argv) {
goto quit;
}
uint32_t nof_re = RE_X_RB*cell.nof_prb*2*CP_NSYMB(cell.cp);
sf_symbols = vec_malloc(sizeof(cf_t) * nof_re);
if (!sf_symbols) {
perror("malloc");
goto quit;
}
data = malloc(sizeof(uint8_t) * mcs.tbs);
if (!data) {
perror("malloc");
goto quit;
}
for (uint32_t i=0;i<mcs.tbs;i++) {
data[i] = 1;
}
if (pusch_uci_encode(&pusch, &harq_process, data, uci_data, sf_symbols)) {
fprintf(stderr, "Error encoding TB\n");
@ -209,7 +197,7 @@ int main(int argc, char **argv) {
exit(-1);
}
}
gettimeofday(&t[1], NULL);
//int r = pusch_decode(&pusch, slot_symbols[0], ce, 0, data, subframe, &harq_process, rv);
int r = 0;
@ -228,9 +216,6 @@ quit:
pusch_free(&pusch);
harq_free(&harq_process);
if (ce) {
free(ce);
}
if (sf_symbols) {
free(sf_symbols);
}

@ -78,9 +78,9 @@ void scrambling_b_offset_pusch(sequence_t *s, uint8_t *data, int offset, int len
int i;
assert (len + offset <= s->len);
for (i = 0; i < len; i++) {
if (data[i] == 'x') {
if (data[i] == 3) {
data[i] = 1;
} else if (data[i] == 'y') {
} else if (data[i] == 2) {
if (i > 1) {
data[i] = data[i-1];
}

@ -0,0 +1,66 @@
clear
ueConfig=struct('NCellID',3,'NULRB',6,'NSubframe',0,'RNTI',1,'CyclicPrefixUL','Normal','NTxAnts',1);
puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',[0 2 4 5]','Modulation','QPSK','RV',0,'Shortened',0);
addpath('../../debug/lte/phy/lib/phch/test')
TBs=0:13:211;
cqilen=[0, 8, 17];
mods={'QPSK','16QAM','64QAM'};
rvs=0;
betas=0:3:11;
for i=1:length(TBs)
for m=1:length(mods)
for r=1:length(rvs)
for bcqi=1:length(betas)
for bri=1:length(betas)
for back=1:length(betas)
for c=1:length(cqilen)
trblkin=randi(2,TBs(i),1)-1;
puschConfig.Modulation = mods{m};
puschConfig.RV = rvs(r);
puschConfig.BetaCQI = 2+betas(bcqi);
puschConfig.BetaRI = 2+betas(bri);
puschConfig.BetaACK = 2+betas(back);
if (betas(bri)>0)
ri_bit=randi(2,1,1)-1;
else
ri_bit=[];
end
if (betas(back)>0)
ack_bit=randi(2,1,1)-1;
else
ack_bit=[];
end
if (cqilen(c)>0 || TBs(i)>0)
[cw, info]=lteULSCH(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit,[]);
cw_mat=ltePUSCH(ueConfig,puschConfig,cw);
idx=ltePUSCHIndices(ueConfig,puschConfig);
subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(idx)=cw_mat;
[subframe_lib, cwlib]=liblte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
err=mean(abs(subframe_mat(:)-subframe_lib));
if (err > 10^-6)
disp(err)
error('Error!');
end
end
end
end
end
end
end
end
end
if (length(TBs) == 1)
%disp(info)
n=1:length(mat);
%plot(abs(double(mat)-double(lib)))
plot(n,real(lib(n)),n,real(mat(n)))
end

@ -4,11 +4,12 @@ puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',0,'Modulation','16QAM'
addpath('../../debug/lte/phy/lib/phch/test')
TBs=0:13:222;
cqilen=[0, 8, 17];
mods={'QPSK','16QAM','64QAM'};
rvs=[0, 3];
betas=0:3:11;
TBs=0:13:222;
cqilen=0;%[0, 8, 17];
mods={'QPSK','16QAM','64QAM'};
rvs=0;%[0, 3];
betas=0:3:11;
for i=1:length(TBs)
for m=1:length(mods)

Loading…
Cancel
Save