📄 parameters.bsv
字号:
syms[i] = x[j]; for(i = 116; i < 128 ; i = i + 1, j = j + 1) syms[i] = x[j]; for(i = 129; i < 141 ; i = i + 1, j = j + 1) syms[i] = x[j]; for(i = 142; i < 166 ; i = i + 1, j = j + 1) syms[i] = x[j]; for(i = 167; i < 191 ; i = i + 1, j = j + 1) syms[i] = x[j]; for(i = 192; i < 216 ; i = i + 1, j = j + 1) syms[i] = x[j]; for(i = 217; i < 228 ; i = i + 1, j = j + 1) syms[i] = x[j]; //pilot carriers syms[40] = mapBPSK(True, ppv); // UL: T, DL: T syms[65] = mapBPSK(False, ppv); // UL: F, DL: F syms[90] = mapBPSK(True, ppv); // UL: T, DL: T syms[115] = mapBPSK(False, ppv); // UL: F, DL: F syms[141] = mapBPSK(True, ppv); // UL: T, DL: F syms[166] = mapBPSK(True, ppv); // UL: T, DL: T syms[191] = mapBPSK(True, ppv); // UL: T, DL: F syms[216] = mapBPSK(True, ppv); // UL: T, DL: T return syms;endfunction// FFT/IFFT:typedef PilotOutDataSz FFTIFFTSz;typedef 1 FFTIFFTNoBfly;// CPInsert:typedef FFTIFFTSz CPInsertDataSz;function CPInsertCtrl cpInsertMapCtrl(TXGlobalCtrl ctrl); // UL: SendLong, DL: SendBoth let fstEle = ctrl.firstSymbol ? SendLong : SendNone; return tuple2(fstEle, ctrl.cpSize);endfunction// Synchronizer:// specific for OFDM specificationtypedef 64 SSLen; // short symbol length (auto correlation delay 16)typedef 128 LSLen; // long symbol length (auto correlation delay 64)typedef 320 LSStart; // when the long symbol starttypedef 640 SignalStart; // when the signal (useful data) starttypedef 320 SymbolLen; // one symbol length// implementation parameterstypedef 192 SSyncPos; // short symbol synchronization position ( 2*SSLen <= this value < LBStart)typedef 448 LSyncPos; // long symbol synchronization position ( LSStart <= this value < SinglaStart) typedef 16 FreqMeanLen; // how many samples we collect to calculate CFO (power of 2, at most 32, bigger == more tolerant to noise)typedef 720 TimeResetPos; // reset time if coarCounter is larger than this, must be bigger than SignalStarttypedef 2 CORDICPipe; // number of pipeline stage of the cordictypedef 16 CORDICIter; // number of cordic iterations (max 16 iterations, must be multiple of CORDICPIPE)typedef RXFPIPrec SyncIntPrec; // number of integer bits for internal arithmetictypedef RXFPFPrec SyncFractPrec; // number of fractional bits for internal arithmetic // Unserializer:typedef FFTIFFTSz UnserialOutDataSz;// ChannelEstimator:typedef UnserialOutDataSz CEstInDataSz;typedef PilotInDataSz CEstOutDataSz;function Symbol#(CEstOutDataSz,RXFPIPrec,RXFPFPrec) pilotRemover (Symbol#(CEstInDataSz,RXFPIPrec,RXFPFPrec) x); Integer i =0, j = 0; // assume all guards initially Symbol#(CEstOutDataSz,RXFPIPrec,RXFPFPrec) syms = newVector; // data carriers for(i = 29; i < 40; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 41; i < 65; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 66; i < 90 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 91; i < 115 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 116; i < 128 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 129; i < 141 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 142; i < 166 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 167; i < 191 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 192; i < 216 ; i = i + 1, j = j + 1) syms[j] = x[i]; for(i = 217; i < 228 ; i = i + 1, j = j + 1) syms[j] = x[i]; return syms;endfunction// Demapper:typedef CEstOutDataSz DemapperInDataSz;typedef MapperInDataSz DemapperOutDataSz;Bool demapperNegateOutput = mapperNegateInput;// Deinterleaver:typedef DemapperOutDataSz DeinterleaverDataSz;function Integer deinterleaverGetIndex(Modulation m, Integer j); Integer s = 1; Integer ncbps = valueOf(MinNcbps); case (m) BPSK: begin ncbps = ncbps; s = 1; end QPSK: begin ncbps = 2*ncbps; s = 1; end QAM_16: begin ncbps = 4*ncbps; s = 2; end QAM_64: begin ncbps = 6*ncbps; s = 3; end endcase // case(m) Integer f = (j/s); Integer i = s*f + (j + (12*j/ncbps))%s; Integer k = 12*i-(ncbps-1)*(12*i/ncbps); return (j >= ncbps) ? j : k;endfunction // Depuncturer:typedef DemapperOutDataSz DepuncturerInDataSz;typedef PuncturerInDataSz DepuncturerOutDataSz;// typedef TMul#(2,DepuncturerInDataSz) DepuncturerInBufSz; // to be safe 2x inDataSz// typedef TMul#(2,DepuncturerOutDataSz) DepuncturerOutBufSz; // to be safe 2x outDataSz // typedef TDiv#(DepuncturerOutDataSz,4) DepuncturerF1Sz; // no. of 2/3 in parallel// typedef TMul#(DepuncturerF1Sz,3) DepuncturerF1InSz; // typedef TMul#(DepuncturerF1Sz,4) DepuncturerF1OutSz;// typedef TDiv#(DepuncturerOutDataSz,6) DepuncturerF2Sz; // no. of 3/4 in parallel// typedef TMul#(DepuncturerF2Sz,4) DepuncturerF2InSz; // typedef TMul#(DepuncturerF2Sz,6) DepuncturerF2OutSz;// typedef TDiv#(DepuncturerOutDataSz,10) DepuncturerF3Sz; // no. of 5/6 in parallel// typedef TMul#(DepuncturerF3Sz,6) DepuncturerF3InSz; // typedef TMul#(DepuncturerF3Sz,10) DepuncturerF3OutSz;typedef TAdd#(DepuncturerInDataSz,6) DepuncturerInBufSz; // to be safe 2x inDataSztypedef TAdd#(DepuncturerInBufSz,DepuncturerOutDataSz) DepuncturerOutBufSz; // to be safe 2x outDataSz typedef 1 DepuncturerF1Sz; // no. of 2/3 in paralleltypedef 3 DepuncturerF1InSz; typedef 4 DepuncturerF1OutSz;typedef 1 DepuncturerF2Sz; // no. of 3/4 in paralleltypedef 4 DepuncturerF2InSz; typedef 6 DepuncturerF2OutSz;typedef 1 DepuncturerF3Sz; // no. of 5/6 in paralleltypedef 6 DepuncturerF3InSz; typedef 10 DepuncturerF3OutSz;function DepunctData#(4) dp1 (DepunctData#(3) x); DepunctData#(4) outVec = replicate(4); outVec[0] = x[0]; outVec[2] = x[1]; outVec[3] = x[2]; return outVec;endfunction // Bit function DepunctData#(6) dp2 (DepunctData#(4) x); DepunctData#(6) outVec = replicate(4); outVec[0] = x[0]; outVec[1] = x[1]; outVec[3] = x[2]; outVec[4] = x[3]; return outVec;endfunction // Bit// not used in wifi function DepunctData#(10) dp3 (DepunctData#(6) x); DepunctData#(10) outVec = replicate(4); outVec[0] = x[0]; outVec[1] = x[1]; outVec[3] = x[2]; outVec[4] = x[3]; outVec[7] = x[4]; outVec[8] = x[5]; return outVec;endfunction // Bit// Viterbi:typedef ConvEncoderOutDataSz ViterbiInDataSz;typedef ConvEncoderInDataSz ViterbiOutDataSz;typedef ConvEncoderHistSz KSz; // no of input bitstypedef 35 TBLength; // the minimum TB length for each outputtypedef 5 NoOfDecodes; // no of traceback per stage, TBLength dividible by this valuetypedef 3 MetricSz; // input metrictypedef 1 FwdSteps; // forward step per cycletypedef 4 FwdRadii; // 2^(FwdRadii+FwdSteps*ConvInSz) <= 2^(KSz-1)typedef 1 ConvInSz; // conv input sizetypedef 2 ConvOutSz; // conv output size// ReedDecoder:typedef ReedEncoderDataSz ReedDecoderDataSz;// Decoder: (Construct from Depuncturer,Viterbifor and ReedDecoder)typedef DepuncturerInDataSz DecoderInDataSz;typedef ReedDecoderDataSz DecoderOutDataSz;// Descrambler:typedef ScramblerDataSz DescramblerDataSz; typedef ScramblerShifterSz DescramblerShifterSz;Bit#(DescramblerShifterSz) descramblerGenPoly = scramblerGenPoly;typedef TXScramblerCtrl RXDescramblerCtrl;typedef struct { RXDescramblerCtrl descramblerCtrl; Bit#(11) length; Bool isNewPacket;} RXDescramblerAndGlobalCtrl deriving(Eq, Bits); function RXDescramblerCtrl descramblerMapCtrl(RXDescramblerAndGlobalCtrl ctrl); return ctrl.descramblerCtrl;endfunction// typedef struct {// RXDescramblerCtrl descramblerCtrl;// RXGlobalCtrl globalCtrl;// } RXDescramblerAndGlobalCtrl deriving(Eq, Bits); // function RXDescramblerCtrl // descramblerMapCtrl(RXDescramblerAndGlobalCtrl ctrl);// return ctrl.descramblerCtrl;// endfunction// function Bit#(0) // descramblerConvertCtrl(RXDescramblerAndGlobalCtrl ctrl);// return ?;// endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -