73 lines
2.8 KiB
Mathematica
73 lines
2.8 KiB
Mathematica
![]() |
function [] = DataFileStitching(iteration,CodeRate,path)
|
|||
|
% DataFileStitching:将case中各次迭代拆分的出来的Zn_AMreg和Zn_BMreg拼接成一个文件,便于对比
|
|||
|
% iteration: 本case迭代次数
|
|||
|
% CodeRate: 本case码率,0,1,2,3->24Zc,37Zc,50Zc,66Zc
|
|||
|
% path: 本case路径
|
|||
|
% LayerLut = [4,13,26,45]; %13-17、26-30、45-46分别为合并层
|
|||
|
LayerLut = [4 8 10];
|
|||
|
% LayerLut = [1,2,3,4,5,6,8,10,13,18,23,26,31,35,40,45];
|
|||
|
Afilename = sprintf('%s8_ZnA.dat',path);
|
|||
|
Bfilename = sprintf('%s8_ZnB.dat',path);
|
|||
|
Afid = fopen(Afilename,'w');
|
|||
|
Bfid = fopen(Bfilename,'w');
|
|||
|
if (-1 == Afid)
|
|||
|
fprintf('open [%s] failed! Afid = -1',Afilename);
|
|||
|
return;
|
|||
|
end
|
|||
|
if (-1 == Bfid)
|
|||
|
fprintf('open [%s] failed! Bfid = -1',Bfilename);
|
|||
|
return;
|
|||
|
end
|
|||
|
|
|||
|
fprintf(Afid,'@00000\n');
|
|||
|
fprintf(Bfid,'@00000\n');
|
|||
|
|
|||
|
for iter = 1:iteration
|
|||
|
for Layer = LayerLut%(1:CodeRate+1)
|
|||
|
AZnfilename = sprintf('iter%d/8_Zn_r%d_Amreg.dat',iter,Layer);
|
|||
|
BZnfilename = sprintf('iter%d/8_Zn_r%d_Bmreg.dat',iter,Layer);
|
|||
|
AZnData = u32DataFromFile(path,AZnfilename);
|
|||
|
BZnData = u32DataFromFile(path,BZnfilename);
|
|||
|
fprintf('AZnDataLen = %4d,File = %s%s\n',length(AZnData),path,AZnfilename);
|
|||
|
fprintf(Afid,'0x%08x\n',AZnData);
|
|||
|
fprintf(Bfid,'0x%08x\n',BZnData);
|
|||
|
end
|
|||
|
end
|
|||
|
fclose(Afid);
|
|||
|
fclose(Bfid);
|
|||
|
|
|||
|
ADecfilename = sprintf('%siter2/9_decode_inByte_Amreg.dat',path);
|
|||
|
if exist(ADecfilename,'file')
|
|||
|
Afilename = sprintf('%s9_decode_inByte_A.dat',path);
|
|||
|
Bfilename = sprintf('%s9_decode_inByte_B.dat',path);
|
|||
|
Afid = fopen(Afilename,'w');
|
|||
|
Bfid = fopen(Bfilename,'w');
|
|||
|
if (-1 == Afid)
|
|||
|
fprintf('open [%s] failed! Afid = -1',Afilename);
|
|||
|
return;
|
|||
|
end
|
|||
|
if (-1 == Bfid)
|
|||
|
fprintf('open [%s] failed! Bfid = -1',Bfilename);
|
|||
|
return;
|
|||
|
end
|
|||
|
|
|||
|
fprintf(Afid,'@00000\n');
|
|||
|
fprintf(Bfid,'@00000\n');
|
|||
|
|
|||
|
for iter = 2:2:iteration
|
|||
|
ADecfilename = sprintf('iter%d/9_decode_inByte_Amreg.dat',iter);
|
|||
|
BDecfilename = sprintf('iter%d/9_decode_inByte_Bmreg.dat',iter);
|
|||
|
ADecData = u32DataFromFile(path,ADecfilename);
|
|||
|
BDecData = u32DataFromFile(path,BDecfilename);
|
|||
|
fprintf('ADecByteLen = %4d,File = %s%s\n',length(ADecData),path,ADecfilename);
|
|||
|
fprintf(Afid,'0x%08x\n',ADecData);
|
|||
|
fprintf(Bfid,'0x%08x\n',BDecData);
|
|||
|
end
|
|||
|
fclose(Afid);
|
|||
|
fclose(Bfid);
|
|||
|
end
|
|||
|
|
|||
|
fprintf('cost %d Lines Per Iteration.\n',length(LayerLut)*length(AZnData));
|
|||
|
end
|
|||
|
|