From 2c93d2a1c9e17b34e986eab5e69404f54f9e96cf Mon Sep 17 00:00:00 2001 From: ismagom Date: Tue, 10 Feb 2015 17:09:50 +0100 Subject: [PATCH] Fixed PUSCH w/o UL-SCH and CQI length lower than 11 --- lte/phy/lib/phch/src/sch.c | 1 + lte/phy/lib/phch/src/uci.c | 10 +++++++--- lte/phy/lib/phch/test/pusch_test.c | 6 +++--- matlab/tests/ulsch_test.m | 16 ++++++++-------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lte/phy/lib/phch/src/sch.c b/lte/phy/lib/phch/src/sch.c index c81c58966..6ddbaa057 100644 --- a/lte/phy/lib/phch/src/sch.c +++ b/lte/phy/lib/phch/src/sch.c @@ -514,6 +514,7 @@ int ulsch_encode(sch_t *q, uint8_t *data, uint8_t *q_bits, return ulsch_uci_encode(q, data, uci_data, q_bits, NULL, NULL, harq_process, rv_idx); } + int ulsch_uci_encode(sch_t *q, uint8_t *data, uci_data_t uci_data, uint8_t *q_bits, uint8_t *q_bits_ack, uint8_t *q_bits_ri, harq_t *harq_process, uint32_t rv_idx) diff --git a/lte/phy/lib/phch/src/uci.c b/lte/phy/lib/phch/src/uci.c index 7cd81c4b6..34778e127 100644 --- a/lte/phy/lib/phch/src/uci.c +++ b/lte/phy/lib/phch/src/uci.c @@ -122,12 +122,12 @@ int encode_cqi_short(uci_cqi_t *q, uint8_t *data, uint32_t nof_bits, uint8_t *q_ for (int i=0;i<32;i++) { q->encoded_cqi[i] = 0; for (int n=0;nencoded_cqi[i] += (data[n] * M_basis_seq[i][n]) % 2; + q->encoded_cqi[i] += (data[n] * M_basis_seq[i][n]); } } for (int i=0;iencoded_cqi[i%32]; + q_bits[i] = q->encoded_cqi[i%32]%2; } return LIBLTE_SUCCESS; } else { @@ -203,7 +203,11 @@ static uint32_t Q_prime_ri_ack(uint32_t O, uint32_t O_cqi, float beta, harq_t *h // If not carrying UL-SCH, get Q_prime according to 5.2.4.1 if (K == 0) { - K = O_cqi+8; + if (O_cqi <= 11) { + K = O_cqi; + } else { + K = O_cqi+8; + } } uint32_t M_sc_init = harq_process->nof_prb_pusch_init * RE_X_RB; diff --git a/lte/phy/lib/phch/test/pusch_test.c b/lte/phy/lib/phch/test/pusch_test.c index 10a7f4747..0552cfc96 100644 --- a/lte/phy/lib/phch/test/pusch_test.c +++ b/lte/phy/lib/phch/test/pusch_test.c @@ -199,9 +199,9 @@ int main(int argc, char **argv) { uci_data.beta_ri = 2.0; uci_data.beta_ack = 2.0; uci_data.uci_cqi = tmp; - uci_data.uci_cqi_len = 20; - uci_data.uci_ri_len = 0; - uci_data.uci_ack_len = 1; + uci_data.uci_cqi_len = 10; + uci_data.uci_ri_len = 1; + uci_data.uci_ack_len = 0; uint32_t nof_symbols = 12*harq_process.prb_alloc.slot[0].nof_prb*RE_X_RB; uint32_t nof_bits_e = nof_symbols * lte_mod_bits_x_symbol(harq_process.mcs.mod); diff --git a/matlab/tests/ulsch_test.m b/matlab/tests/ulsch_test.m index f3bb6191f..d79a04429 100644 --- a/matlab/tests/ulsch_test.m +++ b/matlab/tests/ulsch_test.m @@ -1,23 +1,23 @@ ueConfig=struct('NCellID',1,'CyclicPrefixUL','Normal','NTxAnts',1); -puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',0,'Modulation','64QAM','RV',0,'Shortened',0); +puschConfig=struct('NLayers',1,'OrthCover','Off','PRBSet',0,'Modulation','QPSK','RV',0,'Shortened',0); addpath('../../debug/lte/phy/lib/phch/test') TBs=99; error=zeros(size(TBs)); for i=1:length(error) - %trblkin=randi(2,TBs(i),1)-1; + trblkin=randi(2,TBs(i),1)-1; %trblkin=ones(TBs(i),1); - trblkin=[]; + %trblkin=[]; - puschConfig.BetaCQI = 7.0; - puschConfig.BetaRI = 5.0; - puschConfig.BetaACK = 11.0; + puschConfig.BetaCQI = 2.0; + puschConfig.BetaRI = 2.0; + puschConfig.BetaACK = 2.0; - [mat, info]=lteULSCH(ueConfig,puschConfig,trblkin,[ones(1,25)],[1],[1],[]); + [mat, info]=lteULSCH(ueConfig,puschConfig,trblkin,[],[],[],[]); mat(mat==-2)=2; mat(mat==-1)=3; - [lib]=liblte_ulsch_encode(ueConfig,puschConfig,trblkin,[ones(1,25)],[1],[1]); + [lib]=liblte_ulsch_encode(ueConfig,puschConfig,trblkin,[],[],[]); error(i)=sum(abs(double(mat)-double(lib))); if (length(TBs) == 1) disp(error(i))