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

📄 testtv_demodmappermindist.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%***************************************************************************
%  802.16-2004 OFDMA PHY - Matlab Implementation - 
%              OFDMA Simulation
%
%    Description:  
%   
%    Parameters:  
%
%    Functions:
%                 
%    Data Files:
%                N/A
%                   
%***************************************************************************

%***************************************************************************
%  Property of Freescale Semiconductor / NCSG / NCSD / DSO
%***************************************************************************
%  MATLAB Scrpiting Code
%
%  Project Name: 802.16-2005 OFDMA PHY
%
%  FREESCALE CONFIDENTIAL
%***************************************************************************

%***************************************************************************
%  Written by: 
%        Date:
%  Reusability:       N/A
%  Revision History:  
%                      6-Aug-2006   Initial Release
%***************************************************************************

function testTV_DemodMapperMinDist(ModeType,seed)

clear global
clear functions
close all

profile off

addpath('../');
addpath('../../../../../../../SP/CM/matlab');

DEMODMAPGAP = 6;

if (ModeType == 2)
    modename = 'QPSK';
end
if (ModeType == 4)
    modename = '16QAM';
end
if (ModeType == 6)
    modename = '64QAM';
end

dataSize = 48;
fname = 'DemodMapperMinDist';
Q = 15;
QCHANEST = 31;

DEMODMAPGAP = 6;
BitShift = 0;

if (exist('seed','var') == 0)
    seed = sum(100*clock);
end
rand('state',seed);

system(['del ..\..\vector\log\TCRND',modename,'\',fname,'.txt']);
diary(['../../vector/log/TCRND',modename,'/',fname,'.txt']);

disp('DemodMapperMinDist Simulation');
disp('=====================================');
disp(' ');
%%%%%%%%%%%%%%%%%%%%%% Initialize Paramters %%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('*********Initializing Parameters*********')
disp(strcat('SEED = ',num2str(seed)));

disp(strcat('MODE = ',num2str(ModeType)));
 
InReal = round((2^(Q+1)-1).*rand(1,dataSize)-2^Q);
InImag = round((2^(Q+1)-1).*rand(1,dataSize)-2^Q);
In_fixed = int16(InReal + InImag*i);
In = double(In_fixed);
ChanEstReal = round((2^(QCHANEST+1)-1).*rand(1,dataSize)-2^QCHANEST);
ChanEstImag = round((2^(QCHANEST+1)-1).*rand(1,dataSize)-2^QCHANEST);
ChanEst_fixed = int32(ChanEstReal + ChanEstImag*i);
ChanEst = double(ChanEst_fixed);

if (ModeType == 2)
   BitShift = 14; BitShiftMEX = BitShift ;
elseif (ModeType == 4)
   BitShift = 12; BitShiftMEX = BitShift ;
elseif (ModeType == 6)
   BitShift = 12; BitShiftMEX = BitShift - 2 ; %hack : to be solved, pb for 64QAM mismatch
else
   disp('ERROR : Not correct ModType')
end

% add + 10 to bitshift value in order not to go in saturation 
[Out_fixed BlkSize]= mDemodMapperMinDist(In,ChanEst,length(In),ModeType,BitShift+10);
[fpOut_fixed fpBlkSize]= DemodMapperMinDist(In,ChanEst,length(In),ModeType,BitShiftMEX+10);
fpOut_fixed = fpOut_fixed';


[Out_fixed BlkSize]= mDemodMapperMinDist(In,ChanEst,length(In),ModeType,BitShift);
[fpOut_fixed fpBlkSize]= DemodMapperMinDist(In,ChanEst,length(In),ModeType,BitShiftMEX);

fpOut_fixed = fpOut_fixed';

if BlkSize~=fpBlkSize
   disp(' BlkSize mismatch')
end


if ~all(fpOut_fixed==Out_fixed)
   disp('Comparing Matlab and MEX: ')
   disp(' Out_fixed mismatch:')
%    N = 10 ;
%    disp('  MAT  MEX')
%    disp([Out_fixed(1:N)  fpOut_fixed(1:N) ])

   for jj=1:size(Out_fixed,1);
       if ( fpOut_fixed(jj)~=Out_fixed(jj) )
          disp(['i=' int2str(jj) ': Out_fixed=' int2str(Out_fixed(jj)) ' and fpOut_fixed=' int2str(fpOut_fixed(jj))   ])
       end
   end
else
    disp('MEX behaving exactly like Matlab.')
end


Out = zeros(1,dataSize*DEMODMAPGAP);

Out(1:BlkSize) = Out_fixed;

mGenBin(In_fixed,['../../vector/in/TCRND',modename,'/IF2aaRX.lod'],'int16','1R1I','b');
mGenBin(ChanEst_fixed,['../../vector/in/TCRND',modename,'/IF2aaRXCtrl.lod'],'int32','1R1I','b');
mGenBin(Out,['../../vector/ref/TCRND',modename,'/IF2RX.lod'],'int8','R','b');
 
mGenHeader(In_fixed,['../../vector/in/TCRND',modename,'/IF2aaRX.h'],'int16','signed short int gasiIn');
mGenHeader(ChanEst_fixed,['../../vector/in/TCRND',modename,'/IF2aaRXCtrl.h'],'int32','signed long int galiChEst');
mGenHeader(Out,['../../vector/ref/TCRND',modename,'/IF2RX.h'],'int8','signed char gacRefOut','R');

diary off

end



⌨️ 快捷键说明

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