data和uci复用位置的摆放
本次不介绍跳频,按照不跳频的流程走。
参数
step1:在harq-ack的bit数小于等于2的时候,进行如下操作。
###这块协议特别说明,如果ack的bit数小于或者等于2的时候都按照bit数等于2来计算空间进行预留。
for i = 1:numel(lprime)
sym = lprime(i);
while mACKcount(i) < GACKRvdTemp(i)
if sym > nPUSCHsymall
% Check for the symbol number greater than the number
% of PUSCH allocated symbols in each hop and avoid out
% of bounds indexing
break;
end
if mUCI(sym) > 0
% Total number of reserved elements remaining per hop
numACKRvd = GACKRvdTemp(i)-mACKcount(i);
if numACKRvd >= mUCI(sym)*nlqm
d = 1;
mREcount = mBarULSCH(sym);
else
d = floor((mUCI(sym)*nlqm)/numACKRvd);
mREcount = ceil(numACKRvd/nlqm);
end
phiBarRvd{sym} = phiBarULSCH{sym}((0:mREcount-1)*d+1);
mACKcount(i) = mACKcount(i) + mREcount*nlqm;
end
sym = sym+1;
end % while
end % for Nhop
% Number of reserved elements in each OFDM symbol
mPhiSCRVD = zeros(nPUSCHsymall,1);
for i = 1:nPUSCHsymall
mPhiSCRVD(i) = length(phiBarRvd{i});
end
step2:在harq-ack的bit数大于2的时候,进行如下操作。
% Step 2
% ACK (oACK > 2)
if ~GACKRvd && GACK
GACKTemp = [GACK1 GACK2];
lprime = [l1 l2];
mACKcount = [0 0];
mACKcountall = 0;
for i = 1:numel(lprime)
sym = lprime(i);
while mACKcount(i) < GACKTemp(i)
if sym > nPUSCHsymall
% Check for the symbol number greater than the number
% of PUSCH allocated symbols in each hop and avoid out
% of bounds indexing
break;
end
if mUCI(sym) > 0
% Total number of remaining HARQ-ACK bits to be
% accommodated per hop
numACK = GACKTemp(i)-mACKcount(i);
if numACK >= mUCI(sym)*nlqm
d = 1;
mREcount = mUCI(sym);
else
d = floor((mUCI(sym)*nlqm)/numACK);
mREcount = ceil(numACK/nlqm);
end
% Place coded HARQ-ACK bits in gBar at relevant
% positions
k = phiUCI{sym}((0:mREcount-1)*d+1);
gBar(sym,k+1,1:nlqm) = -1; % -1 for HARQ-ACK
mACKcountall = mACKcountall+(mREcount*nlqm);
mACKcount(i) = mACKcount(i)+(mREcount*nlqm);
phiUCItemp = phiUCI{sym}((0:mREcount-1)*d+1);
phiUCI{sym} = setdifference(phiUCI{sym},phiUCItemp);
phiBarULSCH{sym} = setdifference(phiBarULSCH{sym},phiUCItemp);
mUCI(sym) = length(phiUCI{sym});
mBarULSCH(sym) = length(phiBarULSCH{sym});
end
sym = sym+1;
end % while
end % for Nhop
end % if oACK > 2
step3:CSI 在PUSCH传输,位置的摆放。
先介绍csi port1 位置的摆放
在csi port1放置的时候虽然在计算的时候考虑到为harq-ack保留的空间,放置的时候剔除留给harq-ack的空间.
在csi port2放置的时候完全没有考虑之前给harq-ack预留的位置,csi port2很可能就把之前预留给harq-ack的空间占了。
当然上面说的都是本身传输harq-ack的bit数小于等于2的时候,正常大于2的时候,在csi port1和2放置之前就已经剔除了占用的空间,他们不能占用。
% Step 3
% CSI part 1
if GCSI1
lprime = [lcsi1 lcsi2];
mCSIcount = [0 0];
mCSIcountall = 0;
GCSI1Temp = [GCSI11 GCSI12];
for i = 1:numel(lprime)
sym = lprime(i);
while mUCI(sym)-mPhiSCRVD(sym) <= 0
sym = sym+1;
if sym > nPUSCHsymall
break; % exit loop at end of symbols
end
end
while mCSIcount(i) < GCSI1Temp(i)
if sym > nPUSCHsymall
% Check for the symbol number greater than the number
% of PUSCH allocated symbols in each hop and avoid out
% of bounds indexing
break;
end
% Number of resource elements available for CSI part 1 in
% each symbol
mUCIDiffmPhiRvd = mUCI(sym)-mPhiSCRVD(sym);
% Total number of remaining CSI part 1 bits to be
% accommodated per hop
numCSI1 = GCSI1Temp(i)-mCSIcount(i);
if mUCIDiffmPhiRvd > 0
if numCSI1 >= mUCIDiffmPhiRvd*nlqm
d = 1;
mREcount = mUCIDiffmPhiRvd;
else
d = floor((mUCIDiffmPhiRvd*nlqm)/numCSI1);
mREcount = ceil(numCSI1/nlqm);
end
phitemp = setdifference(phiUCI{sym},phiBarRvd{sym});
% Place coded CSI part 1 bits in gBar at relevant
% positions
k = phitemp((0:mREcount-1)*d+1);
gBar(sym,k+1,1:nlqm) = -2; % -2 for CSI part 1
mCSIcountall = mCSIcountall+(mREcount*nlqm);
mCSIcount(i) = mCSIcount(i)+(mREcount*nlqm);
phiUCItemp = phitemp((0:mREcount-1)*d+1);
phiUCI{sym} = setdifference(phiUCI{sym},phiUCItemp);
phiBarULSCH{sym} = setdifference(phiBarULSCH{sym},phiUCItemp);
mUCI(sym) = length(phiUCI{sym});
mBarULSCH(sym) = length(phiBarULSCH{sym});
end % end if
sym = sym+1;
end % while
end % for Nhop
end % if Gcsi1
% CSI part 2
if GCSI2
lprime = [lcsi1 lcsi2];
mCSIcount = [0 0];
mCSIcountall = 0;
GCSI2Temp = [GCSI21 GCSI22];
for i = 1:numel(lprime)
sym = lprime(i);
while mUCI(sym) <= 0
sym = sym+1;
if sym > nPUSCHsymall
break; % exit loop at end of symbols
end
end
while mCSIcount(i)<GCSI2Temp(i)
if sym > nPUSCHsymall
% Check for the symbol number greater than the
% number of PUSCH allocated symbols in each hop and
% avoid out of bounds indexing
break;
end
if mUCI(sym) > 0
% Total number of CSI part 2 bits remaining to be
% accommodated per hop
numCSI2 = GCSI2Temp(i)-mCSIcount(i);
if numCSI2 >= mUCI(sym)*nlqm
d = 1;
mREcount = mUCI(sym);
else
d = floor((mUCI(sym)*nlqm)/numCSI2);
mREcount = ceil(numCSI2/nlqm);
end
% Place coded CSI part 2 bits in gBar at relevant
% positions
k = phiUCI{sym}((0:mREcount-1)*d+1);
gBar(sym,k+1,1:nlqm) = -3; % -3 for CSI part 2
mCSIcountall = mCSIcountall+(mREcount*nlqm);
mCSIcount(i) = mCSIcount(i)+(mREcount*nlqm);
phiUCItemp = phiUCI{sym}((0:mREcount-1)*d+1);
phiUCI{sym} = setdifference(phiUCI{sym},phiUCItemp);
phiBarULSCH{sym} = setdifference(phiBarULSCH{sym},phiUCItemp);
mUCI(sym) = length(phiUCI{sym});
mBarULSCH(sym) = length(phiBarULSCH{sym});
end % if
sym = sym+1;
end % while
end % for Nhop
end % if GCSI2
step4 :data 在PUSCH传输,位置的摆放。
数据放置没有间隔这个放置规则,等导频,harq-ack csi-port1 csi-port2放置完了剩下什么位置就挨着放就行,这块特殊情况就是harq-ack的bit数小于等于2的时候,data也是可以占用之前需要的空间。
% Step 4
% UL-SCH
mULSCHcount = 0;
if GULSCH
for sym = 0:nPUSCHsymall-1
if mBarULSCH(sym+1) > 0
% Place coded UL-SCH bits in gBar at relevant positions
k = phiBarULSCH{sym+1}(1:mBarULSCH(sym+1));
gBar(sym+1,k+1,1:nlqm) = -4; % -4 for UL-SCH
mULSCHcount = mULSCHcount+(mBarULSCH(sym+1)*nlqm);
end % if
end % for sym
end % if Gulsch
step5 : 如果harq-ack 在PUSCH上传输的bit数小于等于2的话,这块需要重新放置
这块为啥需要重新放置小于2bit的harq-ack,因为一开始按照预留的时候按照2bit的harq-ack空间预留的,并没有真的放置数据,另外在后面放置csi port2以及data的时候有可能将ack预留的位置放置了csi part2或者数据,也就是说,可能被覆盖,在这块又在预留的位置放置,一开始预留的时候是按照2bit最大预留的,而这次放置的时候是按照真实harq-ack需要的bit(小于或者等于2bit)数来放置的。
本次放置是从之前预留的空间里面选择,真实需要传输的bit数比预留的空间小的情况,会在预留空间里面间隔着放置。比如,预留了4个空间,这回只需要2个空间,会在四个选择第一个和第三个放置。
% Step 5
% ACK (oACK <= 2)
if GACKRvd && GACK
lprime = [l1 l2];
mACKcount = [0 0];
mACKcountall = 0;
GACKTemp = [GACK1 GACK2];
for i = 1:numel(lprime)
sym = lprime(i);
while mACKcount(i) < GACKTemp(i)
if sym > nPUSCHsymall
% Check for the symbol number greater than the
% number of PUSCH allocated symbols in each hop and
% avoid out of bounds indexing
break;
end
if mPhiSCRVD(sym)>0
% Total number of remaining HARQ-ACK bits to be
% accommodated per hop
numACK = GACKTemp(i)-mACKcount(i);
if numACK >= mPhiSCRVD(sym)*nlqm
d = 1;
mREcount = mPhiSCRVD(sym);
else
d = floor((mPhiSCRVD(sym)*nlqm)/numACK);
mREcount = ceil(numACK/nlqm);
end
% Place coded HARQ-ACK bits in gBar at relevant
% positions
k = phiBarRvd{sym}((0:mREcount-1)*d+1);
gBar(sym,k+1,1:nlqm) = gBar(sym,k+1,1:nlqm)+5; % Add 5 to get the locations of ACK, overlapped with UL-SCH or CSI2
mACKcountall = mACKcountall+(mREcount*nlqm);
mACKcount(i) = mACKcount(i)+(mREcount*nlqm);
end % if
sym = sym+1;
end % while
end % for Nhop
end % if oack <= 2
step6: 没做啥实质性的操作,就把前面的处理的完位置结果输出到另外一个数组
% Step 6
% Return the multiplexed output
cackInd = zeros(0,1);
ccsi1Ind = zeros(0,1);
ccsi2Ind = zeros(0,1);
culschInd = zeros(0,1);
culschAckInd = zeros(0,1);
ccsi2AckInd = zeros(0,1);
if GULSCH || GACK || GCSI1 || GCSI2
t = 0;
cwLen = sum(mULSCH(:))*nlqm;
cw = zeros(cwLen,1); % Initialize temporary codeword
for sym = 0:nPUSCHsymall-1
for j = 0:mULSCH(sym+1)-1
k = phiULSCH{sym+1}(j+1);
cw(t+1:t+nlqm) = gBar(sym+1,k+1,:);
t = t+nlqm;
end
end
cackInd = sort([find(cw == -1); find(cw > 0)]);
ccsi1Ind = find(cw == -2);
ccsi2Ind = find(cw == -3);
culschInd = find(cw == -4);
culschAckInd = find(cw == 1);
ccsi2AckInd = find(cw == 2);
else
% Inputs ulsch, ack, csi1, csi2 are empty, return empty
cw = zeros(0,1);
end