📄 test_slotextractioncompare.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: test_SlotExtractionCompare.m.rca $
% $Revision: 1.2 $
% $Date: Mon Oct 30 13:37:56 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compares the outputs from mSlotExtraction.m and SlotExtraction.dll
%
% status = test_SlotExtractionCompare(seed)
%
%-- Matlab files used by this file
% mSlotExtraction
% mZoneStart
%-- End of list
function status = test_SlotExtractionCompare(seed)
% clear global
% clear functions
% close all
addpath('../../../../SPManager/matlab');
addpath('../../../../../../CM/matlab');
addpath('./..')
FPULNTILE = 6;
FPULNSYMBOLPERSLOT = 3;
NDATA = FPULNTILE * 8;
NPILOT = FPULNTILE * 4;
fname = 'SlotExtraction';
Q = 15;
if (exist('seed','var') == 0)
seed = sum(100*clock);
end
rand('state',seed);
if ((exist('seed','var') == 1) & (seed == 0))
NFFT = 512;
NFFTUsed = 408;
CellId = 21;
FrameNr = 0;
NSlotVec = 3;
SlotVecStart = 1;
NSubCh = 17;
PermBase = 2;
SubgroupCodeOffset = 0;
NMLORangCodes = 256;
DirName = '01';
FrameNrString = '0';
NSymbol = FPULNSYMBOLPERSLOT*(NSlotVec-SlotVecStart+1);
for SlotVec=1:NSlotVec
for SubCh=1:NSubCh
SlotUIUC(SlotVec,SubCh) = 1;
end
end
for SymbolNum=1:FPULNSYMBOLPERSLOT
Val = NFFT*(SymbolNum-1) + 309;
for Carrier=1:(NFFTUsed/2)
Symbol(SymbolNum,Carrier) = Val - Val*i;
Val = Val + 1;
end
Val = NFFT*(SymbolNum-1) + 2;
for Carrier=((NFFTUsed/2)+1):NFFTUsed
Symbol(SymbolNum,Carrier) = Val - Val*i;
Val = Val + 1;
end
end
Symbol(4,:)= Symbol(1,:);
Symbol(5,:)= Symbol(2,:);
Symbol(6,:)= Symbol(3,:);
Symbol(7,:)= Symbol(1,:);
Symbol(8,:)= Symbol(2,:);
Symbol(9,:)= Symbol(3,:);
else
NFFTRand = round(rand);
if (NFFTRand == 1)
NFFT = 512;
NFFTUsed = 408;
NSubCh = 17;
else
NFFT = 1024;
NFFTUsed = 840;
NSubCh = 35;
end
CellId = round(rand*(2^16-1));
FrameNr = round(rand*(2^32-1));
NSlotVec = 7;
SlotVecStart = 1;
PermBase = round(rand*69);
NSymbol = FPULNSYMBOLPERSLOT*(NSlotVec-SlotVecStart+1);
FrameNrString = 'RND';
SubgroupCodeOffset = 0;
NMLORangCodes = 256;
for SlotVec=1:NSlotVec
for SubCh=1:NSubCh
SlotUIUC(SlotVec,SubCh) = round(rand*15);
end
end
DirName = ['RND',num2str(NFFT)];
% generates symbol random data
SymbolReal = round((2^(Q+1)-1).*rand(NSymbol,NFFTUsed)-2^Q);
SymbolImag = round((2^(Q+1)-1).*rand(NSymbol,NFFTUsed)-2^Q);
Symbol = SymbolReal + SymbolImag.*i;
end
disp('SlotExtraction.dll test - very Basic Test ');
disp('=====================================');
disp(' ');
%%%%%%%%%%%%%%%%%%%%%% Initialize Paramters %%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('*********Initializing Parameters*********')
disp(strcat('SEED = ',num2str(seed)));
[PNCodeLUT,TileLocationLUT,PilotPhyLoc,DataPhyLoc,RangingCodeLUT]= ...
mZoneStart(CellId,FrameNr,NFFT,NFFTUsed,NSubCh,...
NSlotVec,PermBase,SlotUIUC,SubgroupCodeOffset,NMLORangCodes);
for SlotVec=SlotVecStart:NSlotVec
SlotVecIndex = SlotVec-SlotVecStart+1;
SymbolSlot = Symbol(((SlotVecIndex-1)*FPULNSYMBOLPERSLOT+1):(SlotVecIndex*FPULNSYMBOLPERSLOT),:);
for SubCh = 1:NSubCh
SubChTileLocationLUT = TileLocationLUT(SlotVecIndex,SubCh,:);
% matlab outputs
[mDataSubCh,mPilotSubCh]= mSlotExtraction(NFFTUsed,(SlotVecIndex-1),SymbolSlot,SubChTileLocationLUT,PNCodeLUT);
% dll outputs
[fpDataSubCh,fpPilotSubCh]= SlotExtraction(NFFTUsed,(SlotVecIndex-1),SymbolSlot,SubChTileLocationLUT,PNCodeLUT);
mData(SlotVecIndex,((SubCh-1)*NDATA+1):SubCh*NDATA) = mDataSubCh;
mPilot(SlotVecIndex,((SubCh-1)*NPILOT+1):SubCh*NPILOT) = [mPilotSubCh(1,:) mPilotSubCh(2,:)];
fpData(SlotVecIndex,((SubCh-1)*NDATA+1):SubCh*NDATA) = fpDataSubCh;
fpPilot(SlotVecIndex,((SubCh-1)*NPILOT+1):SubCh*NPILOT) = [fpPilotSubCh(1,:) fpPilotSubCh(2,:)];
diff1=mData-fpData;
diff2=mPilot-fpPilot;
% look for any difference between the outputs
if any(diff1)
error('Error: differences between mData and fpData.');
status(1) = -1 ;
else
status(1) = 1 ;
end
if any(diff2)
error('Error: differences between mPilot and fpPilot.');
status(2) = -1 ;
else
status(2) = 1 ;
end
end
end
disp('Basic test passed ok for SlotExtraction.dll .');
rmpath('../../../../SPManager/matlab');
rmpath('../../../../../../CM/matlab');
rmpath('./..')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -