Perform UL-SCH data and control multiplexing
[
returns codeword cw
,info
] = nrULSCHMultiplex(pusch
,tcr
,tbs
,culsch
,cack
,ccsi1
,ccsi2
)cw
by performing uplink shared channel (UL-SCH)
multiplexing on the encoded UL-SCH data and the encoded uplink control information (UCI), as
defined in TS 38.212 Section 6.2.7 [1]. pusch
is the physical uplink shared channel configuration (PUSCH). tcr
is the
target code rate. tbs
is the transport block size for the UL-SCH
transmission. culsch
is the encoded UL-SCH data.
cack
, ccsi1
, and ccsi2
are
the encoded UCI types.
The function internally calculates the number of reserved bits for the hybrid automatic
repeat request acknowledgment (HARQ-ACK) transmission, GACKRvd
and then
compares against the lengths of the coded inputs. This comparison determines the processing
of the HARQ-ACK for rate-matching or puncturing.
The length of cw
equals the bit capacity of the PUSCH.
cw
contains the encoded information up to the bit capacity of PUSCH
and ignores any other additional information in the inputs. The output
cw
contains zeros when not enough encoded UL-SCH and encoded UCI
(HARQ-ACK, channel state information (CSI) 1, or CSI part 2) data is present to achieve the
bit capacity. The function also returns the structure info
, which
contains information about the 1-based locations of each type in the codeword.
Create a default PUSCH configuration object. Allocate the first 21 resource blocks of the bandwidth part to the PUSCH.
pusch = nrPUSCHConfig; pusch.PRBSet = 0:20;
Set the target code rate, payload lengths of the UL-SCH data, HARQ-ACK, CSI part 1, and CSI part 2.
tcr = 0.5; % Target code rate tbs = 100; % Payload length of UL-SCH data (transport block size) oack = 3; % Payload length of HARQ-ACK ocsi1 = 10; % Payload length of CSI part 1 ocsi2 = 10; % Payload length of CSI part 2
Get the rate matched lengths of the UL-SCH data, HARQ-ACK, CSI part 1, and CSI part 2.
rmInfo = nrULSCHInfo(pusch,tcr,tbs,oack,ocsi1,ocsi2);
Create the predefined coded bits of the UL-SCH, HARQ-ACK, CSI part 1, and CSI part 2 for the rate-matched output length obtained from the rmInfo
structure.
culsch = ones(rmInfo.GULSCH,1); cack = 2*ones(rmInfo.GACK,1); ccsi1 = 3*ones(rmInfo.GCSI1,1); ccsi2 = 4*ones(rmInfo.GCSI2,1);
Get the codeword from the predefined coded UL-SCH data and coded UCI types.
cw = nrULSCHMultiplex(pusch,tcr,tbs,culsch,cack,ccsi1,ccsi2);
To see the multiplexing operation, plot the codeword. The codeword starts with the elements of CSI part 1, followed by HARQ-ACK, CSI part 1, CSI part 2, and the mix of UL-SCH data and CSI part 2.
plot(cw) xlabel('Codeword Indices') ylabel('Codeword Values') title('Multiplexing Operation')
Create a PUSCH configuration object with a pi/2-BPSK modulation scheme and no frequency hopping. Set the beta offset factor for HARQ-ACK to 20, and the beta offset factor for CSI part 1 and CSI part 2 to 6.25 each. Specify the scaling factor as 0.8, which limits the number of resource elements (REs) assigned for the UCI.
pusch = nrPUSCHConfig; pusch.Modulation = 'pi/2-BPSK'; pusch.FrequencyHopping = 'neither'; pusch.BetaOffsetACK = 20; pusch.BetaOffsetCSI1 = 6.25; pusch.BetaOffsetCSI2 = 6.25; pusch.UCIScaling = 0.8;
Set the target code rate, payload lengths of the UL-SCH data, HARQ-ACK, CSI part 1, and CSI part 2.
tcr = 0.5; % Target code rate tbs = 1032; % Payload length of UL-SCH data (transport block size) oack = 8; % Payload length of HARQ-ACK ocsi1 = 88; % Payload length of CSI part 1 ocsi2 = 720; % Payload length of CSI part 2
Get the rate matched lengths of the data, HARQ-ACK, CSI part 1, and CSI part 2.
rmInfo = nrULSCHInfo(pusch,tcr,tbs,oack,ocsi1,ocsi2);
Create the random payload bits for the UL-SCH data, HARQ-ACK, CSI part 1, and CSI part 2.
data = randi([0 1],tbs,1); ack = randi([0 1],oack,1); csi1 = randi([0 1],ocsi1,1); csi2 = randi([0 1],ocsi2,1);
Create a UL-SCH encoder System object.
encUL = nrULSCH;
Load the transport block into the UL-SCH encoder.
setTransportBlock(encUL,data);
Get the coded bits of length rmInfo.GULSCH
by calling the encoder.
rv = 0; % Redundancy version is 0
culsch = encUL(pusch.Modulation,pusch.NumLayers,rmInfo.GULSCH,rv);
Encode the random payload of the HARQ-ACK, CSI part 1, and CSI part 2 for the rate-matched output lengths obtained from the rmInfo
structure.
cack = nrUCIEncode(ack,rmInfo.GACK,pusch.Modulation); ccsi1 = nrUCIEncode(csi1,rmInfo.GCSI1,pusch.Modulation); ccsi2 = nrUCIEncode(csi2,rmInfo.GCSI2,pusch.Modulation);
Get the codeword from the coded bits of the UL-SCH and the coded bits of UCI types.
[cw,info] = nrULSCHMultiplex(pusch,tcr,tbs,culsch,cack,ccsi1,ccsi2)
cw = 8112x1 int8 column vector
1
0
1
0
0
0
1
1
1
0
⋮
info = struct with fields:
ULSCHIndices: [1622x1 uint32]
ACKIndices: [1159x1 uint32]
CSI1Indices: [4482x1 uint32]
CSI2Indices: [849x1 uint32]
UCIXIndices: [0x1 uint32]
UCIYIndices: [0x1 uint32]
pusch
— PUSCH configuration parametersnrPUSCHConfig
objectPUSCH configuration parameters, specified as an nrPUSCHConfig
object. This
function uses only these nrPUSCHConfig
object properties.
Modulation
— Modulation scheme'QPSK'
(default) | 'pi/2-BPSK'
| '16QAM'
| '64QAM'
| '256QAM'
| string scalarModulation scheme, specified as 'QPSK'
,
'pi/2-BPSK'
, '16QAM'
,
'64QAM'
, or '256QAM'
, a string scalar, or a
character array.
Modulation Scheme | Number of Bits Per Symbol |
---|---|
'pi/2-BPSK' | 1 |
'QPSK' | 2 |
'16QAM' | 4 |
'64QAM' | 6 |
'256QAM' | 8 |
Data Types: char
| string
NumLayers
— Number of transmission layers1
(default) | 2
| 3
| 4
Number of transmission layers, specified as 1
,
2
, 3
, or 4
.
Data Types: double
MappingType
— Mapping type'A'
(default) | 'B'
Mapping type of the physical shared channel, specified as 'A'
or 'B'
.
Data Types: char
| string
SymbolAllocation
— OFDM symbol allocation[0 14]
(default) | two-element vector of nonnegative integersOFDM symbol allocation of the physical shared channel, specified as a two-element vector of nonnegative integers. The first element of this property represents the start of symbol allocation (0-based). The second element represents the number of allocated OFDM symbols.
When this property is set to
[]
or second element in this two-element vector of nonnegative
integers is 0
, the symbol allocation is empty.
Data Types: double
PRBSet
— PRB allocation[0:51]
(default) | vector of nonnegative integers from 0 to 274Physical resource block (PRB) allocation of PUSCH within the BWP, specified as a vector of nonnegative integers from 0 to 274.
Data Types: double
TransformPrecoding
— Transform precoding flag0
(default) | 1
Transform precoding flag, specified as one of these values.
0
— The transform precoding is disabled and waveform
type is cyclic-prefix orthogonal frequency division multiplexing
(CP-OFDM).
1
— The transform precoding is enabled and waveform
type is discrete fourier transform spread orthogonal frequency division
multiplexing (DFT-s-OFDM).
Data Types: double
| logical
FrequencyHopping
— Frequency hopping'neither'
(default) | 'intraSlot'
| 'interSlot'
Frequency hopping for the physical uplink shared channel, specified as one of these options.
'neither'
'intraSlot'
'interSlot'
If you specify intra-slot frequency hopping and the input coded bits doesn't satisfy the equations of TS 38.212 Section 6.2.7, the function returns the codeword assuming no frequency hopping is present.
Data Types: char
| string
BetaOffsetACK
— Beta offset factor of HARQ-ACK20
(default) | positive integerBeta offset factor of the hybrid automatic repeat request acknowledgment (HARQ-ACK), specified as a positive integer. This property is used to determine the number of resources for multiplexing HARQ-ACK. The nominal value is one of the entry from the Table 9.3-1 of TS 38.213.
Data Types: double
UCIScaling
— Scaling factor1
(default) | scalar in the range (0, 1)Scaling factor to limit the number of the resource elements allocated for the uplink channel information (UCI) on the PUSCH, specified as a scalar in the range (0, 1). The nominal value is 0.5, 0.65, 0.8, or 1.
Data Types: double
RNTI
— Radio network temporary identifier1
(default) | integer from 0 to 65,535Radio network temporary identifier of the user equipment (UE), specified as an integer from 0 to 65,535.
Data Types: double
DMRS
— PUSCH DM-RS configuration parametersnrPUSCHDMRSConfig
object with default
properties (default) | nrPUSCHDMRSConfig
object PUSCH demodulation reference signal (DM-RS) configuration parameters, specified as a
nrPUSCHDMRSConfig
configuration object. This property relates to the demodulation reference signal
configuration and contains all properties of the specified
nrPUSCHDMRSConfig
object.
EnablePTRS
— Enable PT-RS0
(default) | 1
Enable PT-RS, specified as one of these values.
0
— Disable PT-RS configuration.
1
— Enable PT-RS configuration.
Data Types: double
| logical
PTRS
— PUSCH PT-RS configuration parametersnrPUSCHPTRSConfig
object with default
properties (default) | nrPUSCHPTRSConfig
object PUSCH phase tracking reference signal (PT-RS) configuration, specified as a nrPUSCHPTRSConfig
configuration object. This property relates to the phase tracking reference signal
configuration and contains all properties of the specified
nrPUSCHPTRSConfig
object.
tcr
— Target code rateTarget code rate for the codeword in the UL-SCH transmission, specified as a scalar in the range (0, 1).
Data Types: double
tbs
— Transport block sizeTransport block size associated with the codeword in the UL-SCH transmission, specified as a nonnegative integer. A value of 0
indicates no transport block or no UL-SCH transmission on the PUSCH.
Data Types: double
culsch
— Coded UL-SCH data bitsCoded UL-SCH data bits, specified as a binary-valued column vector of length
gulsch
. The gulsch
is the number of coded and
rate matched UL-SCH data bits returned in the info
output
argument of the nrULSCHInfo
function. The
encoded UL-SCH bits, culsch
, is the encoded and rate-matched bits
obtained by processing the transport block. A value of []
indicates
the absence of UL-SCH data transmission. If you specify the tbs
input argument as 0
, the culsch
input argument
must be empty.
The gulsch
must be equal to the bit capacity of the data.
Data Types: int8
| double
cack
— Coded HARQ-ACK bitsCoded HARQ-ACK bits, specified as a real-valued column vector of length
gack
. The gack
is the number of coded and rate
matched HARQ-ACK bits returned in the info
output argument of the
nrULSCHInfo
function. A value of []
indicates
the absence of HARQ-ACK transmission. The nominal values of the HAQR-ACK bits are
0
, 1
, -1
, and
-2
.
The gack
must be a multiple of the product of the number of
transmission layers and the modulation order.
Data Types: int8
| double
ccsi1
— Coded CSI part 1 bitsCoded CSI part 1 bits, specified as a real-valued column vector of length
gcsi1
. The gcsi1
is the number of coded and rate
matched CSI part 1 bits returned in the info
output argument of the
nrULSCHInfo
function. A value of []
indicates
the absence of the CSI part 1 transmission. The nominal values of the CSI part 1 bits
are 0
, 1
, -1
, and
-2
.
The gcsi1
must be a multiple of the product of the number of
transmission layers and the modulation order.
Data Types: int8
| double
ccsi2
— Coded CSI part 2 bitsCoded CSI part 2 bits, specified as a real-valued column vector of length
gcsi2
. The gcsi2
is the number of coded and rate
matched CSI part 2 bits returned in the info
output argument of the
nrULSCHInfo
function. A value of []
indicates
the absence of the CSI part 2 transmission. The nominal values of the CSI part 2 bits
are 0
, 1
, -1
, and
-2
. Nominally, the CSI part 2 is present only when CSI part 1 is
present.
The gcsi2
must be a multiple of the product of the number of
transmission layers and the modulation order.
Data Types: int8
| double
cw
— CodewordCodeword for the transmission on the PUSCH, returned as a real-valued column vector.
If you provide any of the input arguments as data type int8
, the
output data type of the codeword is int8
. The nominal values of the
bits in the codewords are 0
, 1
,
-1
, and -2
.
The length of cw
equals the bit capacity of the PUSCH.
The cw
output is an empty value of size
0
-by-1
for all of these cases.
Data Types: int8
| double
info
— Location informationLocation information about the 1-based locations of each type in output codeword
cw
, returned as a structure containing these fields. The output
data type of each field is uint32.
Field | Description |
---|---|
ULSCHIndices | Locations of coded UL-SCH bits in codeword |
ACKIndices | Locations of coded HARQ-ACK bits in codeword |
CSI1Indices | Locations of coded CSI part 1 bits in codeword |
CSI2Indices | Locations of coded CSI part 2 bits in codeword |
UCIXIndices | Locations of X UCI placeholders in codeword |
UCIYIndices | Locations of Y UCI placeholders in codeword |
If the returned codeword, cw
, is an empty array, each field in
this structure is also an empty array.
[1] 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[2] 3GPP TS 38.213. “NR; Physical layer procedures for control.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
You have a modified version of this example. Do you want to open this example with your edits?