Commit b10937db authored by knopp's avatar knopp

Moved CCE allocations from PHY to MAC and updated MAC interfaces for BCCH/RA/UE-SPEC scheduling.

parent e3030b0f
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "PHY/defs.h" #include "PHY/defs.h"
#include "assertions.h"
//#define cmin(a,b) ((a)<(b) ? (a) : (b)) //#define cmin(a,b) ((a)<(b) ? (a) : (b))
...@@ -515,16 +516,14 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC, ...@@ -515,16 +516,14 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
// if (rvidx==3) // if (rvidx==3)
// for (cnt=0;cnt<Ncb;cnt++) // for (cnt=0;cnt<Ncb;cnt++)
// counter_buffer[rvidx][cnt]=0; // counter_buffer[rvidx][cnt]=0;
if (Ncb<(3*(RTC<<5))) { AssertFatal(Ncb>=(3*RTC<<5),"Exiting, RM condition (Ncb %d, Nir/C %d, Nsoft %d, Kw %d\n",Ncb,Nir/C,Nsoft,3*(RTC<<5));
msg("Exiting, RM condition (Nir %d, Nsoft %d, Kw %d\n",Nir,Nsoft,3*(RTC<<5));
return(0);
}
Gp = G/Nl/Qm; Gp = G/Nl/Qm;
GpmodC = Gp%C; GpmodC = Gp%C;
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("lte_rate_matching_turbo: Kw %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",3*(RTC<<5),rvidx, G, Qm,Nl,r); printf("lte_rate_matching_turbo: Ncb %d, Kw %d, Nir/C %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",Ncb,3*(RTC<<5),Nir/C,rvidx, G, Qm,Nl,r);
#endif #endif
if (r < (C-(GpmodC))) if (r < (C-(GpmodC)))
......
...@@ -2108,14 +2108,14 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, ...@@ -2108,14 +2108,14 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
if (dci_alloc[i].L == (uint8_t)L) { if (dci_alloc[i].L == (uint8_t)L) {
#ifdef DEBUG_DCI_ENCODING #ifdef DEBUG_DCI_ENCODING
LOG_I(PHY,"Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].nCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L, LOG_I(PHY,"Generating common DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x)\n",i,num_common_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,1<<dci_alloc[i].L,
*(unsigned int*)dci_alloc[i].dci_pdu); *(unsigned int*)dci_alloc[i].dci_pdu);
dump_dci(frame_parms,&dci_alloc[i]); dump_dci(frame_parms,&dci_alloc[i]);
#endif #endif
if (dci_alloc[i].nCCE>=0) { if (dci_alloc[i].firstCCE>=0) {
e_ptr = generate_dci0(dci_alloc[i].dci_pdu, e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].nCCE), e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length, dci_alloc[i].dci_length,
dci_alloc[i].L, dci_alloc[i].L,
dci_alloc[i].rnti); dci_alloc[i].rnti);
...@@ -2133,9 +2133,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, ...@@ -2133,9 +2133,9 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
dump_dci(frame_parms,&dci_alloc[i]); dump_dci(frame_parms,&dci_alloc[i]);
#endif #endif
if (dci_alloc[i].nCCE >= 0) { if (dci_alloc[i].firstCCE >= 0) {
e_ptr = generate_dci0(dci_alloc[i].dci_pdu, e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].nCCE), e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length, dci_alloc[i].dci_length,
dci_alloc[i].L, dci_alloc[i].L,
dci_alloc[i].rnti); dci_alloc[i].rnti);
...@@ -2537,11 +2537,13 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin ...@@ -2537,11 +2537,13 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin
return(Nreg - 4 - (3*Ngroup_PHICH)); return(Nreg - 4 - (3*Ngroup_PHICH));
} }
uint16_t get_nCCE_max(uint8_t Mod_id,uint8_t CC_id) uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe)
{ {
// check for eNB only ! // check for eNB only !
return(get_nCCE(3,&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,1)); // 5, 15,21 return(get_nCCE(num_pdcch_symbols,
&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,
get_mi(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,subframe)));
} }
void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars, void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,
...@@ -2691,7 +2693,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars, ...@@ -2691,7 +2693,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,
dci_alloc[*dci_cnt].dci_length = sizeof_bits; dci_alloc[*dci_cnt].dci_length = sizeof_bits;
dci_alloc[*dci_cnt].rnti = crc; dci_alloc[*dci_cnt].rnti = crc;
dci_alloc[*dci_cnt].L = L; dci_alloc[*dci_cnt].L = L;
dci_alloc[*dci_cnt].nCCE = CCEind; dci_alloc[*dci_cnt].firstCCE = CCEind;
if (sizeof_bytes<=4) { if (sizeof_bytes<=4) {
dci_alloc[*dci_cnt].dci_pdu[3] = dci_decoded_output[0]; dci_alloc[*dci_cnt].dci_pdu[3] = dci_decoded_output[0];
......
...@@ -266,6 +266,8 @@ typedef struct { ...@@ -266,6 +266,8 @@ typedef struct {
uint8_t Mdlharq; uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo; uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots /// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
...@@ -693,6 +695,8 @@ typedef struct { ...@@ -693,6 +695,8 @@ typedef struct {
uint8_t Mdlharq; uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo; uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// Maximum number of Turbo iterations /// Maximum number of Turbo iterations
uint8_t max_turbo_iterations; uint8_t max_turbo_iterations;
/// accumulated tx power adjustment for PUCCH /// accumulated tx power adjustment for PUCCH
...@@ -737,7 +741,7 @@ typedef struct { ...@@ -737,7 +741,7 @@ typedef struct {
/// Aggregation level /// Aggregation level
uint8_t L; uint8_t L;
/// Position of first CCE of the dci /// Position of first CCE of the dci
int nCCE; int firstCCE;
/// flag to indicate that this is a RA response /// flag to indicate that this is a RA response
boolean_t ra_flag; boolean_t ra_flag;
/// rnti /// rnti
......
...@@ -117,7 +117,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) ...@@ -117,7 +117,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
} }
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigned char N_RB_DL, uint8_t abstraction_flag) LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag)
{ {
LTE_eNB_DLSCH_t *dlsch; LTE_eNB_DLSCH_t *dlsch;
...@@ -148,6 +148,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -148,6 +148,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
bzero(dlsch,sizeof(LTE_eNB_DLSCH_t)); bzero(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch->Kmimo = Kmimo; dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq; dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
for (i=0; i<10; i++) for (i=0; i<10; i++)
dlsch->harq_ids[i] = Mdlharq; dlsch->harq_ids[i] = Mdlharq;
...@@ -395,7 +396,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -395,7 +396,7 @@ int dlsch_encoding(unsigned char *a,
dlsch->harq_processes[harq_pid]->w[r], dlsch->harq_processes[harq_pid]->w[r],
dlsch->harq_processes[harq_pid]->e+r_offset, dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C, // C dlsch->harq_processes[harq_pid]->C, // C
NSOFT, // Nsoft, dlsch->Nsoft, // Nsoft,
dlsch->Mdlharq, dlsch->Mdlharq,
dlsch->Kmimo, dlsch->Kmimo,
dlsch->harq_processes[harq_pid]->rvidx, dlsch->harq_processes[harq_pid]->rvidx,
......
...@@ -81,7 +81,7 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) ...@@ -81,7 +81,7 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
} }
} }
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag) LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
{ {
LTE_UE_DLSCH_t *dlsch; LTE_UE_DLSCH_t *dlsch;
...@@ -113,6 +113,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_ite ...@@ -113,6 +113,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_ite
memset(dlsch,0,sizeof(LTE_UE_DLSCH_t)); memset(dlsch,0,sizeof(LTE_UE_DLSCH_t));
dlsch->Kmimo = Kmimo; dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq; dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
dlsch->max_turbo_iterations = max_turbo_iterations; dlsch->max_turbo_iterations = max_turbo_iterations;
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
...@@ -353,7 +354,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -353,7 +354,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
(uint8_t*)&dummy_w[r][0], (uint8_t*)&dummy_w[r][0],
dlsch_llr+r_offset, dlsch_llr+r_offset,
harq_process->C, harq_process->C,
NSOFT, dlsch->Nsoft,
dlsch->Mdlharq, dlsch->Mdlharq,
dlsch->Kmimo, dlsch->Kmimo,
harq_process->rvidx, harq_process->rvidx,
......
...@@ -56,15 +56,16 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch); ...@@ -56,15 +56,16 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch);
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag); void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag);
/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t abstraction_flag) /** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
\brief This function allocates structures for a particular DLSCH at eNB \brief This function allocates structures for a particular DLSCH at eNB
@returns Pointer to DLSCH to be removed @returns Pointer to DLSCH to be removed
@param Kmimo Kmimo factor from 36-212/36-213 @param Kmimo Kmimo factor from 36-212/36-213
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213) @param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
@param Nsoft Soft-LLR buffer size from UE-Category
@params N_RB_DL total number of resource blocks (determine the operating BW) @params N_RB_DL total number of resource blocks (determine the operating BW)
@param abstraction_flag Flag to indicate abstracted interface @param abstraction_flag Flag to indicate abstracted interface
*/ */
LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t N_RB_DL, uint8_t abstraction_flag); LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag);
/** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) /** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
\brief This function frees memory allocated for a particular DLSCH at UE \brief This function frees memory allocated for a particular DLSCH at UE
...@@ -72,8 +73,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t N_RB_DL, ui ...@@ -72,8 +73,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t N_RB_DL, ui
*/ */
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch); void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch);
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag); /** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
\brief This function allocates structures for a particular DLSCH at eNB
@returns Pointer to DLSCH to be removed
@param Kmimo Kmimo factor from 36-212/36-213
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
@param Nsoft Soft-LLR buffer size from UE-Category
@params N_RB_DL total number of resource blocks (determine the operating BW)
@param abstraction_flag Flag to indicate abstracted interface
*/
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch, uint8_t abstraction_flag); void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch, uint8_t abstraction_flag);
...@@ -1584,7 +1593,7 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin ...@@ -1584,7 +1593,7 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin
uint8_t get_mi(LTE_DL_FRAME_PARMS *frame,uint8_t subframe); uint8_t get_mi(LTE_DL_FRAME_PARMS *frame,uint8_t subframe);
uint16_t get_nCCE_max(uint8_t Mod_id,uint8_t CC_id); uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe);
uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
......
...@@ -399,7 +399,6 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui ...@@ -399,7 +399,6 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
int get_nCCE_offset(unsigned char L, int nCCE, int common_dci, unsigned short rnti, unsigned char subframe);
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
......
This diff is collapsed.
...@@ -347,6 +347,8 @@ int main(int argc, char **argv) ...@@ -347,6 +347,8 @@ int main(int argc, char **argv)
LTE_DL_UE_HARQ_t *dlsch0_ue_harq; LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq; LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
uint8_t Kmimo; uint8_t Kmimo;
uint8_t ue_category=4;
uint32_t Nsoft;
FILE *proc_fd = NULL; FILE *proc_fd = NULL;
char buf[64]; char buf[64];
...@@ -378,7 +380,7 @@ int main(int argc, char **argv) ...@@ -378,7 +380,7 @@ int main(int argc, char **argv)
num_layers = 1; num_layers = 1;
perfect_ce = 0; perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) { while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:U:v:w:B:PLl:Y")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
awgn_flag = 1; awgn_flag = 1;
...@@ -522,7 +524,6 @@ int main(int argc, char **argv) ...@@ -522,7 +524,6 @@ int main(int argc, char **argv)
case 'N': case 'N':
channel_model=AWGN; channel_model=AWGN;
break; break;
default: default:
msg("Unsupported channel model!\n"); msg("Unsupported channel model!\n");
exit(-1); exit(-1);
...@@ -530,6 +531,10 @@ int main(int argc, char **argv) ...@@ -530,6 +531,10 @@ int main(int argc, char **argv)
break; break;
case 'U':
ue_category = atoi(optarg);
break;
case 'x': case 'x':
transmission_mode=atoi(optarg); transmission_mode=atoi(optarg);
...@@ -993,10 +998,27 @@ int main(int argc, char **argv) ...@@ -993,10 +998,27 @@ int main(int argc, char **argv)
else else
Kmimo=1; Kmimo=1;
switch (ue_category) {
case 1:
Nsoft = 250368;
break;
case 2:
case 3:
Nsoft = 1237248;
break;
case 4:
Nsoft = 1827072;
break;
default:
printf("Unsupported UE category %d\n",ue_category);
exit(-1);
break;
}
for (k=0; k<n_users; k++) { for (k=0; k<n_users; k++) {
// Create transport channel structures for 2 transport blocks (MIMO) // Create transport channel structures for 2 transport blocks (MIMO)
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
PHY_vars_eNB->dlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0); PHY_vars_eNB->dlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0);
if (!PHY_vars_eNB->dlsch_eNB[k][i]) { if (!PHY_vars_eNB->dlsch_eNB[k][i]) {
printf("Can't get eNB dlsch structures\n"); printf("Can't get eNB dlsch structures\n");
...@@ -1008,7 +1030,7 @@ int main(int argc, char **argv) ...@@ -1008,7 +1030,7 @@ int main(int argc, char **argv)
} }
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(Kmimo,8,MAX_TURBO_ITERATIONS,N_RB_DL,0); PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(Kmimo,8,Nsoft,MAX_TURBO_ITERATIONS,N_RB_DL,0);
if (!PHY_vars_UE->dlsch_ue[0][i]) { if (!PHY_vars_UE->dlsch_ue[0][i]) {
printf("Can't get ue dlsch structures\n"); printf("Can't get ue dlsch structures\n");
...@@ -1019,7 +1041,7 @@ int main(int argc, char **argv) ...@@ -1019,7 +1041,7 @@ int main(int argc, char **argv)
} }
// structure for SIC at UE // structure for SIC at UE
PHY_vars_UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0); PHY_vars_UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0);
if (DLSCH_alloc_pdu2_1E[0].tpmi == 5) { if (DLSCH_alloc_pdu2_1E[0].tpmi == 5) {
......
...@@ -251,7 +251,8 @@ typedef struct { ...@@ -251,7 +251,8 @@ typedef struct {
typedef struct { typedef struct {
uint8_t Num_ue_spec_dci ; uint8_t Num_ue_spec_dci ;
uint8_t Num_common_dci ; uint8_t Num_common_dci ;
unsigned int nCCE; uint32_t nCCE;
uint32_t num_pdcch_symbols;
DCI_ALLOC_t dci_alloc[NUM_DCI_MAX] ; DCI_ALLOC_t dci_alloc[NUM_DCI_MAX] ;
} DCI_PDU; } DCI_PDU;
/*! \brief CCCH payload */ /*! \brief CCCH payload */
...@@ -765,8 +766,6 @@ typedef struct { ...@@ -765,8 +766,6 @@ typedef struct {
uint8_t Msg3_subframe; uint8_t Msg3_subframe;
/// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user. /// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user.
uint8_t generate_Msg4; uint8_t generate_Msg4;
/// Flag to indicate the eNB should generate the DCI for Msg4, after getting the SDU from RRC.
uint8_t generate_Msg4_dci;
/// Flag to indicate that eNB is waiting for ACK that UE has received Msg3. /// Flag to indicate that eNB is waiting for ACK that UE has received Msg3.
uint8_t wait_ack_Msg4; uint8_t wait_ack_Msg4;
/// UE RNTI allocated during RAR /// UE RNTI allocated during RAR
...@@ -835,8 +834,8 @@ typedef struct { ...@@ -835,8 +834,8 @@ typedef struct {
/// Outgoing CCCH pdu for PHY /// Outgoing CCCH pdu for PHY
CCCH_PDU CCCH_pdu; CCCH_PDU CCCH_pdu;
RA_TEMPLATE RA_template[NB_RA_PROC_MAX]; RA_TEMPLATE RA_template[NB_RA_PROC_MAX];
/// BCCH active flag /// VRB map for common channels
uint8_t bcch_active; uint8_t vrb_map[100];
/// MBSFN SubframeConfig /// MBSFN SubframeConfig
struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
/// number of subframe allocation pattern available for MBSFN sync area /// number of subframe allocation pattern available for MBSFN sync area
...@@ -883,9 +882,11 @@ typedef struct { ...@@ -883,9 +882,11 @@ typedef struct {
/// Common cell resources /// Common cell resources
COMMON_channels_t common_channels[MAX_NUM_CCs]; COMMON_channels_t common_channels[MAX_NUM_CCs];
UE_list_t UE_list; UE_list_t UE_list;
///subband bitmap configuration ///subband bitmap configuration
SBMAP_CONF sbmap_conf; SBMAP_CONF sbmap_conf;
/// CCE table used to build DCI scheduling information
int CCE_table[MAX_NUM_CCs][800];
/// active flag for Other lcid /// active flag for Other lcid
// uint8_t lcid_active[NB_RB_MAX]; // uint8_t lcid_active[NB_RB_MAX];
/// eNB stats /// eNB stats
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -879,3 +879,208 @@ int get_nb_subband(void) ...@@ -879,3 +879,208 @@ int get_nb_subband(void)
return nb_sb; return nb_sb;
} }
void init_CCE_table(int module_idP,int CC_idP)
{
memset(eNB_mac_inst[module_idP].CCE_table[CC_idP],0,800*sizeof(int));
}
int get_nCCE_offset(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe)
{
int search_space_free,m,nb_candidates = 0,l,i;
unsigned int Yk;
/*
printf("CCE Allocation: ");
for (i=0;i<nCCE;i++)
printf("%d.",CCE_table[i]);
printf("\n");
*/
if (common_dci == 1) {
// check CCE(0 ... L-1)
nb_candidates = (L==4) ? 4 : 2;
nb_candidates = min(nb_candidates,nCCE/L);
printf("Common DCI nb_candidates %d, L %d\n",nb_candidates,L);
for (m = nb_candidates-1 ; m >=0 ; m--) {
search_space_free = 1;
for (l=0; l<L; l++) {
printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]);
if (CCE_table[(m*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
printf("returning %d\n",m*L);
for (l=0; l<L; l++)
CCE_table[(m*L)+l]=1;
return(m*L);
}
}
return(-1);
} else { // Find first available in ue specific search space
// according to procedure in Section 9.1.1 of 36.213 (v. 8.6)
// compute Yk
Yk = (unsigned int)rnti;
for (i=0; i<=subframe; i++)
Yk = (Yk*39827)%65537;
Yk = Yk % (nCCE/L);
switch (L) {
case 1:
case 2:
nb_candidates = 6;
break;
case 4:
case 8:
nb_candidates = 2;
break;
default:
DevParam(L, nCCE, rnti);
break;
}
// LOG_I(PHY,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates);
for (m = 0 ; m < nb_candidates ; m++) {
search_space_free = 1;
for (l=0; l<L; l++) {
if (CCE_table[(((Yk+m)%(nCCE/L))*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
for (l=0; l<L; l++)
CCE_table[(((Yk+m)%(nCCE/L))*L)+l]=1;
return(((Yk+m)%(nCCE/L))*L);
}
}
return(-1);
}
}
// Allocate the CCEs
int allocate_CCEs(int module_idP,
int CC_idP,
int subframeP,
int test_onlyP) {
int *CCE_table = eNB_mac_inst[module_idP].CCE_table[CC_idP];
DCI_PDU *DCI_pdu = &eNB_mac_inst[module_idP].common_channels[CC_idP].DCI_pdu;
int nCCE_max = mac_xface->get_nCCE_max(module_idP,CC_idP,DCI_pdu->num_pdcch_symbols,subframeP);
int fCCE;
int i;
int allocation_is_feasible = 1;
DCI_ALLOC_t *dci_alloc;
LOG_I(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP);
init_CCE_table(module_idP,CC_idP);
DCI_pdu->nCCE=0;
while (allocation_is_feasible == 1) {
for (i=0;i<DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci;i++) {
dci_alloc = &DCI_pdu->dci_alloc[i];
LOG_I(MAC,"Trying to allocate DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
i,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci,
dci_alloc->rnti,1<<dci_alloc->L,
DCI_pdu->nCCE,nCCE_max,DCI_pdu->num_pdcch_symbols);
if (DCI_pdu->nCCE + (1<<dci_alloc->L) > nCCE_max) {
if (DCI_pdu->num_pdcch_symbols == 3)
allocation_is_feasible = 0;
else {
DCI_pdu->num_pdcch_symbols++;
nCCE_max = mac_xface->get_nCCE_max(module_idP,CC_idP,DCI_pdu->num_pdcch_symbols,subframeP);
}
break;
}
else { // number of CCEs left can potentially hold this allocation
if ((fCCE = get_nCCE_offset(CCE_table,
1<<(dci_alloc->L),
nCCE_max,
(i<DCI_pdu->Num_common_dci) ? 1 : 0,
dci_alloc->rnti,
subframeP))>=0) {// the allocation is feasible, rnti rule passes
LOG_I(MAC,"Allocating at nCCE %d\n",fCCE);
if (test_onlyP == 0) {
DCI_pdu->nCCE += (1<<dci_alloc->L);
dci_alloc->firstCCE=fCCE;
LOG_I(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP);
}
} // fCCE>=0
else {
if (DCI_pdu->num_pdcch_symbols == 3)
allocation_is_feasible = 0;
else {
DCI_pdu->num_pdcch_symbols++;
nCCE_max = mac_xface->get_nCCE_max(module_idP,CC_idP,DCI_pdu->num_pdcch_symbols,subframeP);
}
break;
} // fCCE==-1
} // nCCE <= nCCE_max
} // for i = 0 ... num_dcis
if (allocation_is_feasible==1)
return (0);
} // allocation_is_feasible == 1
return(-1);
}
boolean_t CCE_allocation_infeasible(int module_idP,
int CC_idP,
int common_flag,
int subframe,
int aggregation,
int rnti) {
DCI_PDU *DCI_pdu = &eNB_mac_inst[module_idP].common_channels[CC_idP].DCI_pdu;
DCI_ALLOC_t *dci_alloc;
int ret;
boolean_t res=FALSE;
if (common_flag==1) {
DCI_pdu->dci_alloc[DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci].rnti = rnti;
DCI_pdu->dci_alloc[DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci].L = aggregation;
DCI_pdu->Num_common_dci++;
ret = allocate_CCEs(module_idP,CC_idP,subframe,1);
if (ret==-1)
res = TRUE;
DCI_pdu->Num_common_dci--;
}
else {
DCI_pdu->dci_alloc[DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci].rnti = rnti;
DCI_pdu->dci_alloc[DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci].L = aggregation;