%%  所有mod(ceil(Zc/64),2)==0条件下的参数生成
% Zclut = [72,80,88,96,104,112,120,128,208,224,240,256,352,384];
% for zc = Zclut
%     HB = BG1CheckMatrix(zc);
%     GenBG1Para(zc,3,HB,['Zc' num2str(zc)]);
% end

%% 算法与微码中间结果对比
zc = 384;
iteration = 8;
CodeRate = 3;
row = [1, 2, 3, 4];
if CodeRate == 3
  row = [row, 5, 6, 8, 10, 13, 18, 23, 26, 31, 35, 40, 45];
end
res = 0;
folder = sprintf('case_66Zc%d_Iter%d_delay1',zc,iteration);
for iter = 1:iteration
    path = 'E:/project/2022.10/LdpcDecBG1/inc/testdata/';
    path = sprintf('%s%s/iter%d/',path,folder,iter);
%     path = sprintf('E:/project/2022.10/LdpcDecBG1/inc/testdata/case_24Zc128_IterX_Layer2/iter%d/',iter);
    for r = row
        filename = sprintf('8_Zn_r%d.dat',r);
        res = res + ChangeZn2MReg(zc,path,filename);
    end
    if ~mod(iter,2) 
        res = res + ChangeCheck2MReg(zc,1,path,'11_r1_bytes.dat');
        res = res + ChangeCheck2MReg(zc,2,path,'11_r2_bytes.dat');
        res = res + ChangeCheck2MReg(zc,3,path,'11_r3_bytes.dat');
        res = res + ChangeCheck2MReg(zc,4,path,'11_r4_bytes.dat');
        res = res + ChangeDec2MReg(zc,path,'9_decode.dat');
    end
end
path = sprintf('../testdata/%s/',folder);
DataFileStitching(iteration,3,path);