📄 sbx_updlspm_cc.m
字号:
function [BlkSize temp XSLArguments] = SBX_UPDLSPM_CC(temp,IUC,Boosting,DataSize,BlkSize,FECType,PunctMode,ModMode,res,testcase,BurstNo,XSLArguments)
% 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).
%
% temp : input vector, code block basis payload data for one burst
% (unsigned bytes, values 0 or 255)
% IUC : IUC for the particular burst (BurstD(b).IUC)
% Boosting : Boosting type for the particular burst (BurstD(b).Boosting)
% DataSize : row vector, length = number of code blocks
% number of unpadded payload data bytes for each code block
% BlkSize : row vector, length = number of code blocks
% number of padded payload data bytes for each code block
% FECType :
% PunctMode :
% ModMode :
% 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: SBX_UPDLSPM_CC.m.rca $
% $Revision: 1.8 $
% $Date: Thu Nov 9 11:34:27 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/Rand/matlab');
addpath('../../../DL/SPKernel/ConvEnc/matlab');
addpath('../../../DL/SPKernel/Punct/matlab');
addpath('../../../DL/SPKernel/IL/matlab');
addpath('../../../DL/SPKernel/ModMap/matlab');
FN=0;%Frame number and Zone number is concidered as 0 for time being
ZN=0;%Frame number and Zone number is concidered as 0 for time being
%generate test vector directory
if testcase
TCstr=sprintf('TC%03d',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
% NOTE: "temp" is used here as the only temporary buffer to keep the
% Matlab memory requirements low.
%randomize
%%%%%%%%%%%%%%%%%%%%%%%%%%
if IUC~=255, % do not randomize FCH
[temp,BlkSize] = mPadRandomizer(temp,DataSize,BlkSize);
end
%test vector generation
if testcase
for b=1:size(BlkSize,2),
[XSLArguments]=[XSLArguments;{FN,ZN,BurstNo,b-1,BlkSize(b),FECType,PunctMode}];
%at SBX/SP/UP/DL/SPManager/vector/ref
if ~exist(['../vector/ref/',TCstr],'dir')
mkdir(['../vector/ref/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../vector/ref/%s/IF1dTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/ConvEnc/vector/in
if ~exist(['../../SPKernel/ConvEnc/vector/in/',TCstr],'dir')
mkdir(['../../SPKernel/ConvEnc/vector/in/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/ConvEnc/vector/in/%s/IF1dTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/Rand/vector/ref
if ~exist(['../../SPKernel/Rand/vector/ref/',TCstr],'dir')
mkdir(['../../SPKernel/Rand/vector/ref/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/Rand/vector/ref/%s/IF1dTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
end
end
%FEC encoding
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,BlkSize] = FECEncoder(temp,BlkSize,FECType,PunctMode,testcase,TCstr,BurstNo);
%(test vector generation within the FEC Encoder function)
%interleaving
%%%%%%%%%%%%%%%%%%%%%%%%%%
[temp,BlkSize] = mIL(temp,BlkSize,ModMode);
%test vector generation
if testcase
blks=length(BlkSize);
for b=1:blks,
%at SBX/SP/UP/DL/SPManager/vector/ref
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../vector/ref/%s/IF1gTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../vector/ref/%s/IF1gTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/ModMap/vector/in
if ~exist(['../../SPKernel/ModMap/vector/in/',TCstr],'dir')
mkdir(['../../SPKernel/ModMap/vector/in/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/ModMap/vector/in/%s/IF1gTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/ModMap/vector/in/%s/IF1gTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/IL/vector/ref
if ~exist(['../../SPKernel/IL/vector/ref/',TCstr],'dir')
mkdir(['../../SPKernel/IL/vector/ref/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/IL/vector/ref/%s/IF1gTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/IL/vector/ref/%s/IF1gTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
end
end
%modulation mapping
%%%%%%%%%%%%%%%%%%%%%%%%%%
% temp = mModMapper_API(temp,BlkSize,ModMode,res,Boosting);%All code blocks given in once
%Call mode mapper code block by code block
for bl=1:length(BlkSize)
%temp1(:,bl) = mModMapper_API(temp(:,bl),BlkSize(bl),ModMode,res,Boosting);
temp1(:,bl) = mModMapper(temp(:,bl),ModMode,res,Boosting);
end
temp=temp1;
BlkSize=BlkSize/ModMode;
%test vector generation
if testcase
blks=length(BlkSize);
for b=1:blks,
%at SBX/SP/UP/DL/SPManager/vector/ref
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../vector/ref/%s/IF1hTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'int16','1R1I');
%at SBX/SP/UP/DL/SPKernel/RepSlotMap/vector/in
if ~exist(['../../SPKernel/RepSlotMap/vector/in/',TCstr],'dir')
mkdir(['../../SPKernel/RepSlotMap/vector/in/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/RepSlotMap/vector/in/%s/IF1hTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'int16','1R1I');
%at SBX/SP/UP/DL/SPKernel/ModMap/vector/ref
if ~exist(['../../SPKernel/ModMap/vector/ref/',TCstr],'dir')
mkdir(['../../SPKernel/ModMap/vector/ref/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/ModMap/vector/ref/%s/IF1hTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'int16','1R1I');
%IF1hTX = IF1iTX
%at SBX/Manager/DL/DataWriteback/vector/in
if ~exist(['../../../../../Manager/DL/DataWriteback/vector/in/',TCstr],'dir')
mkdir(['../../../../../Manager/DL/DataWriteback/vector/in/',TCstr]);
end
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../../../../Manager/DL/DataWriteback/vector/in/%s/IF1iTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'int16','1R1I');
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [temp,BlkSize] = FECEncoder(temp,BlkSize,FECType,PunctMode,testcase,TCstr,BurstNo)
% This function calls all the modules that belong to the FEC.
% Dependent on the FEC type different modules are called.
FN=0;%Frame number and Zone number is concidered as 0 for time being
ZN=0;%Frame number and Zone number is concidered as 0 for time being
%data unpacking
[temp] = mByteUnpack(temp);
BlkSize=BlkSize*8;
%convolutional encoding
[temp,BlkSize] = mConvEncoder(temp,BlkSize,FECType);
if testcase
blks=length(BlkSize);
for b=1:blks,
%at SBX/SP/UP/DL/SPManager/vector/ref
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../vector/ref/%s/IF1eTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../vector/ref/%s/IF1eTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/Punct/vector/in
if ~exist(['../../SPKernel/Punct/vector/in/',TCstr],'dir')
mkdir(['../../SPKernel/Punct/vector/in/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/Punct/vector/in/%s/IF1eTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/Punct/vector/in/%s/IF1eTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/ConvEnc/vector/ref
if ~exist(['../../SPKernel/ConvEnc/vector/ref/',TCstr],'dir')
mkdir(['../../SPKernel/ConvEnc/vector/ref/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/ConvEnc/vector/ref/%s/IF1eTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/ConvEnc/vector/ref/%s/IF1eTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
end
end
%puncturing
[temp,BlkSize] = mPuncturing(temp,BlkSize,PunctMode);
if testcase
for b=1:blks,
%at SBX/SP/UP/DL/SPManager/vector/ref
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../vector/ref/%s/IF1fTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../vector/ref/%s/IF1fTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/IL/vector/in
if ~exist(['../../SPKernel/IL/vector/in/',TCstr],'dir')
mkdir(['../../SPKernel/IL/vector/in/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/IL/vector/in/%s/IF1fTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/IL/vector/in/%s/IF1fTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%at SBX/SP/UP/DL/SPKernel/Punct/vector/ref
if ~exist(['../../SPKernel/Punct/vector/ref/',TCstr],'dir')
mkdir(['../../SPKernel/Punct/vector/ref/',TCstr]);
end
%packed
mGenBin(mBytePack(temp(1:BlkSize(b),b)),...
sprintf('../../SPKernel/Punct/vector/ref/%s/IF1fTX_%02d_%02d_%02d_%02d.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
%unpacked
mGenBin(temp(1:BlkSize(b),b),...
sprintf('../../SPKernel/Punct/vector/ref/%s/IF1fTX_%02d_%02d_%02d_%02d_bits.lod',TCstr,FN,ZN,BurstNo,b-1),...
'uint8','R');
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -