UCI和数据复用在pusch上传输(第六部分)---ldpc编码

article/2025/10/14 1:11:08

ldpc编码针对的是上下行数据的编码,也是5G最重要的一种编码。

1 TB块添加CRC

这个是和UCI POLAR区别的一个地方,UCI是对每个cb块添加crc.
在这里插入图片描述

  % Get transport block size after CRC attachment according to 38.212% 6.2.1 and 7.2.1, and assign CRC polynomial to CRC field of output% structure infoif A > 3824L        = 24;info.CRC = '24A';elseL        = 16;info.CRC = '16';end
**此处会对TB块进行crc的添加,具体添加crc的过程已经在上一篇文章
《UCI和数据复用在pusch上传输(第五部分)---polar编码》分享过了,
这里就不在做复述。**

2 graph选择

在这里插入图片描述

   % LDPC base graph selectionif A <= 292 || (A <= 3824 && R <= 0.67) || R <= 0.25bgn = 2;elsebgn = 1;end

3 cb块分段和cb块添加crc

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
具体添加crc的过程已经在上一篇文章
《UCI和数据复用在pusch上传输(第五部分)—polar编码》分享过了,
这里就不在做复述。

% Get the maximum code block sizeif bgn == 1Kcb = 8448;elseKcb = 3840;end% Get number of code blocks and length of CB-CRC coded blockif B <= KcbL = 0;C = 1;Bd = B;elseL = 24; % Length of the CRC bits attached to each code blockC = ceil(B/(Kcb-L));Bd = B+C*L;end% Obtain the number of bits per code block (excluding CB-CRC bits)cbz = ceil(B/C);% Get number of bits in each code block (excluding filler bits)Kd = ceil(Bd/C);% Find the minimum value of Z in all sets of lifting sizes in 38.212% Table 5.3.2-1, denoted as Zc, such that Kb*Zc>=Kdif bgn == 1Kb = 22;elseif B > 640Kb = 10;elseif B > 560Kb = 9;elseif B > 192Kb = 8;elseKb = 6;endendZlist = [2:16 18:2:32 36:4:64 72:8:128 144:16:256 288:32:384];Zc =  min(Zlist(Kb*Zlist >= Kd));% Get number of bits (including <NULL> filler bits) to be input to the LDPC% encoderif bgn == 1K = 22*Zc;  %这块为啥一定要是Zc的倍数,这个是个问题?elseK = 10*Zc;end

4 UL_SCH的通道编码(这是编码最难的部分需要进一步搞清楚)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

% Get lifting set numberZSets = {[2  4  8  16  32  64 128 256],... % Set 1[3  6 12  24  48  96 192 384],... % Set 2[5 10 20  40  80 160 320],...     % Set 3[7 14 28  56 112 224],...         % Set 4[9 18 36  72 144 288],...         % Set 5[11 22 44  88 176 352],...        % Set 6[13 26 52 104 208],...            % Set 7[15 30 60 120 240]};              % Set 8for setIdx = 1:8    % LDPC lifting size set indexif any(Zc==ZSets{setIdx})break;endend% Pre-stored H types for each BGN and setIdx pair% 这个是怎么来的不知道,需要进一步看看Htype = {3, 3, 3, 3, 3, 3, 2, 3;4, 4, 4, 1, 4, 4, 4, 1};% Get the matrix with base graph number 'bgn' and set number 'setIdx'.% The element of matrix V in the following is H_BG(i,j)*V(i,j), where% H_BG(i,j) and V(i,j) are defined in TS 38.212 5.3.2; if V(i,j) is not% defined in Table 5.3.2-2 or Table 5.3.2-3, the elements are -1.% %这个就是协议中的v_ijswitch bgncase 1switch setIdxcase 1V = bgs.BG1S1;case 2V = bgs.BG1S2;case 3V = bgs.BG1S3;case 4V = bgs.BG1S4;case 5V = bgs.BG1S5;case 6V = bgs.BG1S6;case 7V = bgs.BG1S7;otherwise % 8V = bgs.BG1S8;endNplus2Zc = Zc*(66+2);otherwise % bgn = 2switch setIdxcase 1V = bgs.BG2S1;case 2V = bgs.BG2S2;case 3V = bgs.BG2S3;case 4V = bgs.BG2S4;case 5V = bgs.BG2S5;case 6V = bgs.BG2S6;case 7V = bgs.BG2S7;otherwise % 8V = bgs.BG2S8;end Nplus2Zc = Zc*(50+2);%为啥要求这和?endP = nr5g.internal.ldpc.calcShiftValues(V,Zc);%根据V和Zc得到P P=mod(V,Zc)% The element of matrix P in the following is P(i,j) in TS 38.212 5.3.2% when V(i,j) are defined in Table 5.3.2-2 or Table 5.3.2-3. If not% defined, the elements are -1.P = zeros(size(V));for i = 1:size(V,1)for j = 1:size(V,2)if V(i,j) == -1P(i,j) = -1;elseP(i,j) = mod(V(i,j),Z);endendendP1 = P(:,1:(size(P,2) - size(P,1)));%取了P的前面(52-42)或者(67-45)行,为啥要取这个?C = size(infoBits,2); %获取层数 codewords = zeros(Nplus2Zc,C);% Get shift values matrixP = nr5g.internal.ldpc.calcShiftValues(V,Zc);P1 = P(:,1:(size(P,2) - size(P,1)));C = size(infoBits,2);codewords = zeros(Nplus2Zc,C);for r = 1:C% Per code-block processing onlyinfoVec = reshape(infoBits(:,r),Zc,[]);%将信息bit(协议中的C_k)变成Zc行,K/Zc列。d = blockMultiply(P1,infoVec);d0 = d(:,1:4);% Solve 4 equations for Htype * m = d0switch Htype{bgn,setIdx}case 1% H1 = [  1  0 -1 -1;%        -1  0  0 -1;%         0 -1  0  0;%         1 -1 -1  0 ];m1 = sum(d0, 2);m2 = d0(:,1) + m1([2:end 1]);m3 = d0(:,2) + m2;m4 = d0(:,3) + m1 + m3;case 2% H2 = [  0  0 -1 -1;%       105  0  0 -1;%        -1 -1  0  0;%         0 -1 -1  0 ];m1 = sum(d0, 2);shift = mod(105, Zc);if shift > 0m1 = m1([(end-shift+1):end 1:(end-shift)]);endm2 = d0(:,1) + m1;m4 = d0(:,4) + m1;m3 = d0(:,3) + m4;case 3% H3 = [  1  0 -1 -1;%         0  0  0 -1;%        -1 -1  0  0;%         1 -1 -1  0 ];m1 = sum(d0, 2);m2 = d0(:,1) + m1([2:end 1]);m3 = d0(:,2) + m1 + m2;m4 = d0(:,3) + m3;otherwise % == 4% H4 = [  0  0 -1 -1;%        -1  0  0 -1;%         1 -1  0  0;%         0 -1 -1  0 ];m1 = sum(d0, 2);m1 = m1([end 1:(end-1)]);m2 = d0(:,1) + m1;m3 = d0(:,2) + m2;m4 = d0(:,4) + m1;end% Get other parity bitsP3 = P(5:end,size(P1,2)+(1:4));p = blockMultiply(P3, [m1 m2 m3 m4]) + d(:,5:end);% Form codeword and assign to outputcodewords(:,r) = [infoBits(:,r); mod([m1; m2; m3; m4; p(:)],2)];  end
end           

5 速率匹配

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

% Get code block soft buffer sizeif ~isempty(Nref)fcnName = 'nrRateMatchLDPC';validateattributes(Nref, {'numeric'}, ...{'scalar','integer','positive'},fcnName,'NREF');Ncb = min(N,Nref);else    % No limit on buffer sizeNcb = N;end% Get starting position in circular bufferif bgn == 1if rv == 0k0 = 0;elseif rv == 1k0 = floor(17*Ncb/N)*Zc;elseif rv == 2k0 = floor(33*Ncb/N)*Zc;else % rv is equal to 3k0 = floor(56*Ncb/N)*Zc;endelseif rv == 0k0 = 0;elseif rv == 1k0 = floor(13*Ncb/N)*Zc;elseif rv == 2k0 = floor(25*Ncb/N)*Zc;else % rv is equal to 3k0 = floor(43*Ncb/N)*Zc;endend% Get rate matching output for all scheduled code blocks and perform% code block concatenation according to Section 5.4.2 and 5.5out = [];for r = 0:C-1if r <= C-mod(outlen/(nlayers*Qm),C)-1E = nlayers*Qm*floor(outlen/(nlayers*Qm*C));elseE = nlayers*Qm*ceil(outlen/(nlayers*Qm*C));endout = [out; cbsRateMatch(in(:,r+1),E,k0,Ncb,Qm)]; %#ok<AGROW>endendfunction e = cbsRateMatch(d,E,k0,Ncb,Qm)
% Rate match a single code block segment as per TS 38.212 Section 5.4.2% Bit selection, Section 5.4.2.1k = 0;j = 0;e = zeros(E,1,class(d));while k < Eif d(mod(k0+j,Ncb)+1) ~= -1     % Filler bitse(k+1) = d(mod(k0+j,Ncb)+1);k = k+1;endj = j+1;end% Bit interleaving, Section 5.4.2.2e = reshape(e,E/Qm,Qm);e = e.';e = e(:);end

http://chatgpt.dhexx.cn/article/1AAu7iV5.shtml

相关文章

【编码译码】基于matlab实现LDPC编码和解码

✅作者简介&#xff1a;热爱科研的Matlab仿真开发者&#xff0c;修心和技术同步精进&#xff0c;matlab项目合作可私信。 &#x1f34e;个人主页&#xff1a;Matlab科研工作室 &#x1f34a;个人信条&#xff1a;格物致知。 更多Matlab仿真内容点击&#x1f447; 智能优化算法 …

【LDPC编码】CDR系统中LDPC编码,LDPC编码的码长为9216

1.软件版本 matlab2013b 2.系统描述 在广播通信系统中&#xff0c;消息发送的速度和性能是一对矛盾&#xff0c;当发送速度快&#xff0c;则必然会降低消息的可靠性&#xff0c;当要求系统的性能&#xff0c;则必然会降低发送码率。为了提高系统的性能&#xff0c;并尽可能的…

5G LDPC编码流程

参照3GPP的标准文档&#xff0c;摘录其中下行共享信道与寻呼信道的LDPC编码流程&#xff0c;以便于进行对应的软件仿真 传输块加CRC校验   记待传输的数据块序列为 a 0 , a 1 , ⋯ , a A − 1 a_0,a_1,\cdots,a_{A-1} a0​,a1​,⋯,aA−1​&#xff0c;其中 A A A为传输块的负…

linux杀进程

linux学习心得 查看所有进行中的后台进程 命令 &#xff1a;ps aux ps命令查看应用进程。 后面的参数 -a &#xff1a; 显示现行终端机下的所有进程&#xff0c;包括其他用户的进程&#xff1b; -u &#xff1a;以用户为主的进程状态 &#xff1b; x &#xff1a;通常与 a …

Linux找到进程并杀死

第一种情况&#xff1a; 写脚本的时候没没把程序杀死&#xff0c;再次启动发现端口被占用了&#xff0c;于是找到原来的端口然后kill掉重启 用下面2个命令可以&#xff1a; netstat -tunlp|grep 8080t&#xff1a;表示查看tcp u&#xff1a;表示查看udp n&#xff1a;表示端口…

在 Linux 中杀死一个进程

在 Linux 中&#xff0c;假如一个进程的 PID 为 3810&#xff0c;那么结束一个进程可以使用如下命令&#xff1a; $ kill -9 3810 以 Postman 为例&#xff0c;首先我们需要找到它的进程号&#xff0c;然后才能杀死。 查找进程号使用 ps 命令&#xff0c;不过有一个强大的参…

Linux命令行下杀死一个进程

在做项目的时候经常会出现程序死机、锁死、无响应等情况&#xff0c;这时候就需要找到程序相应的进程将其杀掉即可。步骤如下&#xff1a; 1.定位进程 top命令&#xff1a;可以实时动态地查看系统的整体运行情况&#xff0c;是一个综合了多方信息监测系统性能和运行信息的实用…

linux中进程杀不死解决办法

如图&#xff0c;多次在kill -9 此进程后依然存在 先说解决办法&#xff0c;输入过滤命令ps -ef|grep xxx&#xff08;此处写要过滤的进程名字&#xff09;&#xff0c;例如 之后kill掉对应的进程号&#xff0c;如图 问题解决。 如果有多个子进程可以先过滤再一起杀死&#xf…

Linux中kill命令杀不掉进程的解决办法

1、进程杀不掉的原因有两种&#xff1a; &#xff08;1&#xff09;这个进程是僵尸进程 &#xff1b; &#xff08;2&#xff09;此进程是"核心态"进程。 2、解决办法&#xff1a; &#xff08;1&#xff09;进入到“/proc/进程号”目录下&#xff0c;执行“cat stat…

Linux 批量杀进程

1.查需要杀死的进程 ps -ef | grep yum 2.去除掉里面的grep ps -ef | grep yum | grep -v grep 3.打印kill命令 ps -ef | grep yum | grep -v grep | awk {print "kill "$2} 4.执行kill命令 ps -ef | grep yum | grep -v grep | awk {print "kill "$2} …

linux 找出谁杀了进程

目录 Linux Signal 到底是什么信号 OOM 谁发的信号 systemtap audit 案例与总结 服务端的程序&#xff0c;一般都希望比较长时间的运行&#xff0c;比如7*24小时。不过&#xff0c;程序也需要更新&#xff0c;比如修Bug&#xff0c;比如增加新功能&#xff0c;比如修复增…

Linux操作系统之批量杀死进程

前言 在Linux操作系统中&#xff0c;一般常用的杀死进程的命令是 kill 、 pkill 、 killall &#xff0c;根据杀死单个进程拓展至批量杀死进程。 1、查看指定名称的进程&#xff0c;如下查看运行wps程序的进程&#xff1a; ps -ef | grep wps | grep -v grep 结果如下&…

在 VUE中,动态加载JS文件

需求 在vue组件中需要调用的函数方法名是相同的&#xff08;接口相同&#xff09;&#xff0c;但是按照页面不同需要导入不同JS文件 。如下&#xff1a; 然而上面这种写法肯定是行不通的&#xff0c;但表达的需求很明确。根据menuId的不同从JS文件中获取方法 解决方案 promi…

原生js实现动态加载js文件?

一、写在前面 今天拼多多笔试题&#xff0c;题目如下&#xff1a; 实现一个动态加载函数function loadScript(src, attrs)返回Promise, 其中 src是脚本地址&#xff0c;attrs是脚本属性。二、具体实现 <script>function loadScript(src, attrs) {return new Promise((r…

JavaScript网页实例:在网页里动态加载JavaScript

把一些逻辑独立的JavaScript脚本文件单独加载&#xff0c;是一种常见的JavaScript动态加载技术。这样做的好处有很多&#xff0c;比如可以减少不必要的JavaScript脚本文件的加载&#xff0c;以提高网页浏览速度。 补充代码&#xff0c;要求用户在网页中点击【动态加载】按钮后…

html动态加载js方法,动态引入js四种方法总结

这次给大家带来动态引入js四种方法总结,动态引入js四种方法的注意事项有哪些,下面就是实战案例,一起来看一下。 index.html test.jsalert("hello! I am test.js"); var str="1"; dynamic.js//第一种方式:直接document.write 但这样会把当前的页面全覆写…

动态加载js文件

1、使用场景 例如本人当前需求——给当前的管理系统的bootstarpTable的提示语修改各个国家的语言&#xff08;语言提示根据当前管理系统的语言环境&#xff09;。 也就是根据如图所示的语言&#xff0c;来变换bootstarptable的提示语&#xff0c; 类似这种提示语。 看看是怎么做…

js中动态加载js

下面介绍一种JS代码优化的一个小技巧&#xff0c;通过动态加载引入js外部文件来提高网页加载速度 【基本优化】 将所有需要的<script>标签都放在</body>之前&#xff0c;确保脚本执行之前完成页面渲染而不会造成页面堵塞问题&#xff0c;这个大家都懂的。 【合…

统计学 假设检验 P值

统计学 假设检验 P值 什么是P值 案例分析 来自总体方差检测的题目 p值的计算 P值

统计假设检验中的P值及置信区间理解

置信区间&#xff0c;就是一种区间估计。 例如&#xff0c;使用95%假设区间估计&#xff0c; 正式的期望无法获取&#xff0c;可用期望的均值替代 显著性P-value 假设&#xff1a;说你的硬币是公平的 检验假设&#xff1a;扔十次&#xff0c;看实验的结果是不是和假设相符 …