📄 testtv_slotextraction.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: testTV_SlotExtraction.m.rca $
% Tag $Name: $
% $Revision: 1.1 $
% $Date: Mon Oct 30 13:37:37 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%-- This function test the generation of random TV from SlotExtraction
%
% function testTV_SlotExtraction(seed)
%
% input:
% seed : (double), random seed
%
% Note: for a good use of mGenBin, make sure your files are not "read only"
%-- Matlab files used by this file
% mZoneStart
% mSlotExtraction
% mGenBin
% mGenHeader
%-- End of list
function testTV_SlotExtraction(seed)
% clear global
% clear functions
% close all
profile off
addpath('../');
addpath('../../../../SPManager/matlab');
addpath('../../../../../../../SP/CM/matlab');
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
system(['del ..\..\vector\log\TC',DirName,'\',fname,'.txt']);
diary(['../../vector/log/TC',DirName,'/',fname,'.txt']);
disp('SlotExtraction Simulation');
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);
save('testTV_SlotExtractionVariables');
for SlotVec=SlotVecStart:NSlotVec
SlotVecIndex = SlotVec-SlotVecStart+1;
SymbolSlot = Symbol(((SlotVecIndex-1)*FPULNSYMBOLPERSLOT+1):(SlotVecIndex*FPULNSYMBOLPERSLOT),:);
for SubCh = 1:NSubCh
SubChTileLocationLUT = TileLocationLUT(SlotVecIndex,SubCh,:);
[DataSubCh,PilotSubCh]= mSlotExtraction(NFFTUsed,(SlotVecIndex-1),SymbolSlot,SubChTileLocationLUT,PNCodeLUT);
Data(SlotVecIndex,((SubCh-1)*NDATA+1):SubCh*NDATA) = DataSubCh;
Pilot(SlotVecIndex,((SubCh-1)*NPILOT+1):SubCh*NPILOT) = [PilotSubCh(1,:) PilotSubCh(2,:)];
end
end
for SlotVec=SlotVecStart:NSlotVec
SlotVecIndex = SlotVec-SlotVecStart+1;
filename = ['../../vector/ref/TC',DirName,'/IF2eRX_',FrameNrString,'_RND_',num2str(SlotVecIndex-1),'_RND'];
mGenBin(Data(SlotVecIndex,:),[filename,'.lod'],'int16','1R1I','b');
filename = ['../../vector/ref/TC',DirName,'/IF2eRXPlt_',FrameNrString,'_RND_',num2str(SlotVecIndex-1),'_RND'];
mGenBin(Pilot(SlotVecIndex,:),[filename,'.lod'],'int16','1R1I','b');
end
filename = ['../../vector/ref/TC',DirName,'/IF2eRX'];
mGenHeader(Data.',[filename,'.h'],'int16','short int gasiRefData','1R1I');
filename = ['../../vector/ref/TC',DirName,'/IF2eRXPlt'];
mGenHeader(Pilot.',[filename,'.h'],'int16','short int gasiRefPilot','1R1I');
for SymbolNum=1:NSymbol
SymbolNumStr = num2str(SymbolNum+((SlotVecStart-1)*FPULNSYMBOLPERSLOT)-1);
filename = ['../../vector/in/TC',DirName,'/IF3RX_',FrameNrString,'_RND_',SymbolNumStr,'_RND'];
mGenBin(Symbol(SymbolNum,:),[filename,'.lod'],'int16','1R1I','b');
end
filename = ['../../vector/in/TC',DirName,'/IF3RX'];
mGenHeader(Symbol.',[filename,'.h'],'int16','short int gasiAntFreqSymbol','1R1I');
filename = ['../../vector/in/TC',DirName,'/IF1RX_SlotUIUC'];
mGenBin(SlotUIUC.',[filename,'.lod'],'int8','R','b');
mGenHeader(SlotUIUC.',[filename,'.h'],'int8','unsigned char gaucSlotUIUC','R');
Param = [FrameNr CellId NFFT NFFTUsed NSubCh NSlotVec PermBase SlotVecStart];
filename = ['../../vector/in/TC',DirName,'/In_Param'];
mGenBin(Param,[filename,'.lod'],'uint32','R','b');
mGenHeader(Param,[filename,'.h'],'uint32','unsigned long int gauliParam','R');
filename = ['../../project/CW27/script/TC_',DirName,'.tcl'];
fid = fopen(filename,'w');
if fid==-1
error('Error: Can not open file "%s".',filename);
end
fprintf(fid,'# FP UL kernels Params\n');
fprintf(fid,'set FN %s\n',FrameNrString);
fprintf(fid,'set ZN RND\n');
fprintf(fid,'set AN RND\n');
fprintf(fid,'set FRAMENUM %d\n',FrameNr);
fprintf(fid,'set CELLID %d\n',CellId);
fprintf(fid,'set NFFT %d\n',NFFT);
fprintf(fid,'set NFFTUSED %d\n',NFFTUsed);
fprintf(fid,'set NSUBCH %d\n',NSubCh);
fprintf(fid,'set NSLOTVEC %d\n',NSlotVec);
fprintf(fid,'set PERMBASE %d\n',PermBase);
fprintf(fid,'set SLOTVECSTART %d\n',SlotVecStart);
fclose(fid);
diary off
%-- Remove paths
rmpath('../');
rmpath('../../../../SPManager/matlab');
rmpath('../../../../../../../SP/CM/matlab');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -