//////////////////////////////////////////////////////////////////////////////// // // // Module: wimax_ControlCC-Convolutional Code modes // // // // FUNCTION: Tx and Rx chain control // // // // Description: Control mode for Downlink WiMAX IEEE802.16e rel 2005 // // // // // // // //June 2009 // //////////////////////////////////////////////////////////////////////////////// #include /** ALOE headers*/ #include #include #include "inputs.h" #include "outputs.h" #include "stats.h" #include "wimaxTxControl.h" //Defines all the WIMAX control parameters #include "control_modules.h" #include "control_modes.h" #define BITSPERCHAR 8 /*GLOBAL VARIABLES*/ CWimax WIMAXcontrol; int Tslot; float EbNo; /*PREDEFINED FUNCTIONS*/ void generate_control_word(int len); ////////////////////////////////////////////////////////////////////////////////////////// //SQUELETON CALLED FUNCTIONS////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //CONTROL ////////////////////////////////////////////////////////////////////////CONTROL/ ////////////////////////////////////////////////////////////////////////////////////////// //INPUT/////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length(in control in type words) of the expected control flow at each time-slot*/ //Funtion activated if control flow has been received*/ /*Check INPUT_MAX_CONTROL*/ int get_controlin_length() { int length=1; length=control_length(); return(length); } /*Process the received control flow according to the length returned by get_controlin_length()*/ /*"len" indicates the number of control words to be processed*/ int process_inputcontrol(int len) { return(1); /*return 1 if OK; return 0 if error*/ } ////////////////////////////////////////////////////////////////////////////////////////// //OUTPUT////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length (in control out type words) of the generated control flow at each time-slot*/ /*Check OUTPUT_MAX_CONTROL*/ int get_controlout_length_datasource(){ if(Tslot==1)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_rando(){ if(Tslot==2)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_rsolomon(){ if(Tslot==3)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_cconv(){ if(Tslot==4)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_puncturing(){ if(Tslot==5)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_interleaver(){ if(Tslot==6)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_symbolmap(){ if(Tslot==7)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_channel(){ if(Tslot==8)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_symboldemap(){ if(Tslot==9)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_deinterleaver(){ if(Tslot==10)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_depuncturing(){ if(Tslot==11)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_viterbi(){ if(Tslot==12)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_dersolomon(){ if(Tslot==13)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_derando(){ if(Tslot==14)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } int get_controlout_length_datasink(){ if(Tslot==15)return(1); //Return control length: Only sent control word at Tslot 1 else return(0); } /*Generate the control word to be send according the length provided by get_controlout_length()*/ /*"len" indicates the number of control words to be generated*/ int generate_outputcontrol(int len) { generate_control_word(len); /*return 1 if OK; return 0 if error*/ return(1); } ////////////////////////////////////////////////////////////////////////////////////////// //DATA/////////////////////////////////////////////////////////////////////////////DATA/// ////////////////////////////////////////////////////////////////////////////////////////// //INPUT/////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length(in data in type words) of the expected data flow at each time-slot*/ //Funtion activated only if data flow has been received*/ /*Check INPUT_MAX_DATA*/ int get_datain_length() { int length=1; length=datain_length(); return(length); } /*Process the received data flow according to the length returned by get_datain_length()*/ /** Run function. return 1 if ok, 0 if error*/ /*"len" indicates the number of data words to be processed*/ int process_inputdata(int len) { process_datainflow(len); return 1; } ////////////////////////////////////////////////////////////////////////////////////////// //OUTPUT////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length (in data out type words) of the generated data flow at each time-slot*/ int get_dataout_length() { int length=1; length=dataout_length(); return(length); } /*Generate the control word to be send according the length provided by get_controlout_length()*/ /** Run function. return 1 if ok, 0 if error*/ /*"len" indicates the number of data words to be generated*/ int generate_outputdata(int len) { return 1; } int InitCustom() { /*DataSource*/ control_datasource.CExec.status=NONACTIVE; control_datasource.CExec.timeslot=0; /*DataSink*/ control_datasink.CExec.status=NONACTIVE; control_datasink.CExec.timeslot=0; /*rando*/ control_rando.CExec.status=NONACTIVE; control_rando.CExec.timeslot=0; /*derando*/ control_derando.CExec.status=NONACTIVE; control_derando.CExec.timeslot=0; /*rsolomon*/ control_rsolomon.CExec.status=NONACTIVE; control_rsolomon.CExec.timeslot=0; /*dersolomon*/ control_dersolomon.CExec.status=NONACTIVE; control_dersolomon.CExec.timeslot=0; /*cconv*/ //control_cconv[0].CExec.status=NONACTIVE; //control_cconv[0].CExec.timeslot=0; /*viterbi*/ //control_viterbi[0].CExec.status=NONACTIVE; //control_viterbi[0].CExec.timeslot=0; /*channel*/ control_channel.CExec.status=NONACTIVE; control_channel.CExec.timeslot=0; /*puncturing*/ control_puncturing.CExec.status=NONACTIVE; control_puncturing.CExec.timeslot=0; /*depuncturing*/ control_depuncturing.status=NONACTIVE; control_depuncturing.time_slot=0; /*interleaver*/ control_inter.CExec.status=NONACTIVE; control_inter.CExec.timeslot=0; /*deinterleaver*/ control_deinter.CExec.status=NONACTIVE; control_deinter.CExec.timeslot=0; /*symbolmap*/ control_symbolmap.CExec.status=NONACTIVE; control_symbolmap.CExec.timeslot=0; /*symboldemap*/ control_symboldemap.CExec.status=NONACTIVE; control_symboldemap.CExec.timeslot=0; return 1; } int RunCustom() { //printf("CONTROL:Tslot=%d status=%d\n", Tslot, output_control[0].CEx.status); Tslot++; return 1; } ////////////////////////////////////////////////////////////////////////////////////////// //END SQUELETON CALLED FUNCTIONS////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //######################################################################################// ////////////////////////////////////////////////////////////////////////////////////////// //ESPECIFIC MODULE FUNCTIONS////////////////////////////////////////////////////////////// //CONTROL////////////////////////////////////////////////////////////////////////CONTROL// ////////////////////////////////////////////////////////////////////////////////////////// int control_length() { return(INPUT_MAX_CONTROL); } //GENERATE CONTROL WORD()///////////////////////////////////////////////////////////////// //MODULATION PARAMETERS INFO////////////////////////////////////////////////////////////// //MODULATION RS_CODE CC_CODE OVERALL_CODING UncodedBlocks(B) Coded Blocks(B)// //BPSK [12,12,0] 1/2 1/2 12 24 // //QPSK [32,24,4] 2/3 1/2 24 48 // //QPSK [40,36,2] 5/6 3/4 36 48 // //16QAM [64,48,8] 2/3 1/2 48 96 // //16QAM [80,72,4] 5/6 3/4 72 96 // //64QAM [108,96,6] 3/4 2/3 96 144 // //64QAM [120,108,6] 5/6 3/4 108 144 // ////////////////////////////////////////////////////////////////////////////////////////// //CONVOLUTIONAL ENCODER RATE ALWAYS 1/2 // //DIFFERENT CODING RATE ACHIEVED BY PUNCTURING // ////////////////////////////////////////////////////////////////////////////////////////// //INTERLEAVING MODES WIMAX //////////////////////////////////////////////////////////////////////////////// // subchannels 16 8 4 2 1 // // Ncbps (BPSK: Ncpc=1) 192 96 48 12 12 // // Ncbps (QPSK: Ncpc=2) 384 192 96 24 24 // // Ncbps (16QAM: Ncpc=4) 768 384 192 48 48 // // Ncbps (64QAM: Ncpc=6) 1152 576 288 72 72 // //////////////////////////////////////////////////////////////////////////////// //CODE RATE // // 1R2=0.5; No puncturing // // 2R3=0.66; // // 3R4=0.75; // // 5R6=0.83 puncturing // //////////////////////////////////////////////////////////////////////////////// void generate_control_word(int len) { static int onetime=0; //Control that each branch be executed only one time// int i, ndataout=0; static int ndatainout=0; static int cPosition=1; if(onetime>50)return; if(onetime==Tslot)return; onetime=Tslot; EbNo=20.0; //modeBPSKCC1R2(); //OK //modeQPSKCC1R2(); //OK //modeQPSKCC3R4(); //OK //mode16QAMCC1R2(); //OK //mode16QAMCC3R4(); //OK //mode64QAMCC2R3(); //OK mode64QAMCC3R4(); //OK control_DataSource(&cPosition,&Tslot,&ndatainout,\ &control_datasource,&WIMAXcontrol); control_Rando(&cPosition,&Tslot,&ndatainout,\ &control_rando,&WIMAXcontrol); control_RSolomon(&cPosition,&Tslot,&ndatainout,\ &control_rsolomon,&WIMAXcontrol); control_genCConvV2(&cPosition,&Tslot,&ndatainout,\ &control_cconv,&WIMAXcontrol); control_Puncturing(&cPosition,&Tslot,&ndatainout,\ &control_puncturing,&WIMAXcontrol); control_Interleaver(&cPosition,&Tslot,&ndatainout,\ &control_inter,&WIMAXcontrol); control_SymbolMap(&cPosition,&Tslot,&ndatainout,\ &control_symbolmap,&WIMAXcontrol); control_Channel(&cPosition,&Tslot,&ndatainout,\ &control_channel,&WIMAXcontrol); control_SymbolDeMap(&cPosition,&Tslot,&ndatainout,\ &control_symboldemap,&WIMAXcontrol); control_Deinterleaving(&cPosition,&Tslot,&ndatainout,\ &control_deinter,&WIMAXcontrol); control_DePuncturing(&cPosition,&Tslot,&ndatainout,\ &control_depuncturing,&WIMAXcontrol); control_genViterbi(&cPosition,&Tslot,&ndatainout,\ &control_viterbi,&WIMAXcontrol); control_DeRSolomon(&cPosition,&Tslot,&ndatainout,\ &control_dersolomon,&WIMAXcontrol); control_DeRando(&cPosition,&Tslot,&ndatainout,\ &control_derando,&WIMAXcontrol); control_DataSink(&cPosition,&Tslot,&ndatainout,\ &control_datasink,&WIMAXcontrol); } ////////////////////////////////////////////////////////////////////////////////////////// //DATA//////////////////////////////////////////////////////////////////////////////DATA// ////////////////////////////////////////////////////////////////////////////////////////// #define DATA_FLOW_LENGTH 0 /*data_length(): Define the data flow length in each time-slot*/ int datain_length() { int length; length=DATA_FLOW_LENGTH; return(length); } int process_datainflow(int len) { int i; return(1); } int dataout_length() { int length; length=DATA_FLOW_LENGTH; return(length); } void ConfigInterfaces() {}