⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updltxchain.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
function [temp] = UPDLTXchain(temp,SlotVecs,ZoneD,DLBurstD,testcase,BurstNo)
% Downlink Tx (BS) chain of user processing of IEEE 802.16-2004 (WiMAX, OFDMA only)
% This function chains up all the MEX functions.
%
%     [SlotVecs] = UPDLTXchain(In,SlotVecs,ZoneD,DLBurstD)
%
% This function chains up all the required Matlab functions and processes
% the payload data of one burst (In). After modulation mapping the data is
% mapped into the defined data region of the zone (SlotVecs).
%
% In      : input vector, payload data for one burst
%           (unsigned bytes, values 0 or 255)
% SlotVecs: input/output matrix that is the interface to FP ('int16',complex)
%           one column per slot vector, 48*ZoneD.NumSubch rows
% ZoneD   : zone descriptor
% DLBurstD: downlink burst descriptor
% testcase: If testcase is unequal 0 test vectors are generated in
%           in the folders "../vector/in/TC<testcase>" and
%           "../vector/ref/TC<testcase>" . Default is testcase=0.
% BurstNo : burst number (0..99), for test vector generation,
%           only required if testcase~=0
%
% Matlab 7 Release 14 SP2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: UPDLTXchain.m.rca $
%  $Revision: 1.7 $
%  $Date: Tue Sep 12 03:59:04 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%check 'testcase' parameter
if ~exist('testcase','var')
    testcase=0;  %default
end

%path is relative to the UP/*/SPManager/matlab folder
addpath('../../../CM/Utilities/matlab');
addpath('../../../DL/SPKernel/CodeBlkSeg/matlab');
addpath('../../../DL/SPKernel/Rand/matlab');
addpath('../../../DL/SPKernel/ConvEnc/matlab');
addpath('../../../DL/SPKernel/Punct/matlab');
addpath('../../../DL/SPKernel/IL/matlab');
addpath('../../../DL/SPKernel/SlotSeg/matlab');
addpath('../../../DL/SPKernel/ModMap/matlab');
addpath('../../../DL/SPKernel/RepSlotMap/matlab');



%generate test vector directory
if testcase
   TCstr=sprintf('TC%02d',testcase);
   if ~exist(['../vector/ref/',TCstr],'dir')
      mkdir(['../vector/ref/',TCstr]);
   end
   if ~exist(['../vector/in/',TCstr],'dir')
      mkdir(['../vector/in/',TCstr]);
   end
else
   TCstr='';
end


%generate burst buffer test vector (stimuli)
if testcase
   mGenBin(temp,...
           sprintf('../vector/in/%s/%02d_IF1TX.lod',TCstr,BurstNo),...
           'uint8','R');
end


% NOTE: "temp" is used here as the only temporary buffer to keep the
%       Matlab memory requirements low. 


%code block segmentation
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,BlkSize,DataSize,NumSlots] = mCodeBlkSeg(temp,ZoneD,DLBurstD);
%test vector generation
if testcase
  blks=length(NumSlots);
  for b=1:blks,
    mGenBin(temp(1:BlkSize(b),b),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1aTX.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
  end
end

%randomize
%%%%%%%%%%%%%%%%%%%%%%%%%%

if DLBurstD.IUC~=255, % do not randomize FCH
   [temp,BlkSize] = Randomizer(temp,BlkSize);
end

%test vector generation
if testcase
  for b=1:blks,
    mGenBin(temp(1:BlkSize(b),b),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1bTX.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
  end
end

%FEC encoding
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,BlkSize] = FECEncoder(temp,BlkSize,DLBurstD,testcase,TCstr,BurstNo);
%(test vector generation within the FEC Encoder function)

%interleaving
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,BlkSize] = mIL(temp,BlkSize,DLBurstD.ModMode);
%test vector generation
if testcase
  for b=1:blks,
    %unpacked
    mGenBin(temp(1:BlkSize(b),b),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1gTX_bits.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
    %packed
    mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1gTX.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
  end
end

%slot segmentation
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,SlotSize] = mSlotSeg(temp,BlkSize,NumSlots);
%(test vector generation not required after this module)
%modulation mapping
%%%%%%%%%%%%%%%%%%%%%%%%%%
temp = mModMapper(temp,DLBurstD.ModMode,ZoneD.Resolution,DLBurstD.Boosting);
%test vector generation
if testcase
  Offset=0;
  for b=1:blks,
    mGenBin(temp(:,Offset+(1:NumSlots(b))),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1iTX.lod',TCstr,BurstNo,b-1),...
            'int16','1R1I');
    Offset=Offset+NumSlots(b);
  end
end


%repetition + slot mapping
%%%%%%%%%%%%%%%%%%%%%%%%%%
temp = mRepSlotMap(temp,SlotVecs,ZoneD,DLBurstD);




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [temp,BlkSize] = FECEncoder(temp,BlkSize,DLBurstD,testcase,TCstr,BurstNo)
% This function calls all the modules that belong to the FEC.
% Dependent on the FEC type different modules are called.

%data unpacking
[temp] = mByteUnpack(temp);
BlkSize=BlkSize*8;

%convolutional encoding
[temp,BlkSize] = mConvEncoder(temp,BlkSize,DLBurstD.FECType);
if testcase
  blks=length(BlkSize);
  for b=1:blks,
    %unpacked
    mGenBin(temp(1:BlkSize(b),b),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1eTX_bits.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
    %packed
    mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1eTX.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
  end
end

%puncturing
[temp,BlkSize] = mPuncturing(temp,BlkSize,DLBurstD.PunctMode);
if testcase
  for b=1:blks,
    %unpacked
    mGenBin(temp(1:BlkSize(b),b),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1fTX_bits.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
    %packed
    mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
            sprintf('../vector/ref/%s/%02d_%02d_IF1fTX.lod',TCstr,BurstNo,b-1),...
            'uint8','R');
  end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -