nrULSCHMultiplex
Description
[
performs uplink shared channel (UL-SCH) multiplexing on encoded UL-SCH data and encoded
uplink control information (UCI), as defined in TS 38.212 Section 6.2.7 [1]. The function returns one or
two multiplexed codewords cw
,info
] = nrULSCHMultiplex(pusch
,tcr
,tbs
,culsch
,cack
,ccsi1
,ccsi2
)cw
and location information
info
about the multiplexing for the specified inputs.
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.
Examples
Generate Codeword with Predefined Coded UL-SCH Data and Coded UCI Types
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')
Generate Codeword with Coded UL-SCH Data and Coded UCI
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]
QUCI: 0
Input Arguments
pusch
— PUSCH configuration parameters
nrPUSCHConfig
object
PUSCH configuration parameters, specified as an nrPUSCHConfig
object. This
function uses only these nrPUSCHConfig
object properties:
tcr
— Target code rate
scalar in the range (0, 1) | two-element vector (since R2024a)
Target code rate for the codewords in the UL-SCH transmission, specified as a scalar in the range (0, 1) or a two-element vector of numeric values in the range (0, 1) for two codewords. When you specify this input as a scalar and there are two codewords, the specified scalar applies to both codewords.
Data Types: double
tbs
— Transport block size
nonnegative integer | two-element vector of nonnegative
integers (since R2024a)
Transport block size associated with the codewords in the UL-SCH transmission, specified as a
nonnegative integer or a two-element vector of nonnegative integers for two codewords.
When you specify this input as a nonnegative integer and there are two codewords, the
specified value applies to both codewords. A value of 0
indicates no
transport block or no UL-SCH transmission on the PUSCH.
Data Types: double
culsch
— Encoded and rate-matched UL-SCH data bits
binary-valued column vector | cell array of one or two column
vectors (since R2024a) | []
Encoded and rate-matched UL-SCH data bits, specified as one of these values:
Binary-valued column vector — Use this option for a single codeword transmission.
Cell array of one or two binary-valued column vectors — You can use this option for a single codeword or a two-codeword transmission, respectively. When processing two-codeword transmission, UCI is multiplexed only on the codeword with the highest modulation and coding scheme index, IMCS. If the two codewords have the same IMCS, the UCI is multiplexed on the first codeword.
[]
— Use this option to indicate the absence of UL-SCH data transmission. If you specify thetbs
input argument as0
, theculsch
input argument must be empty.
The length of each codeword in culsch
must be a
multiple of their respective modulation order times the number of transmission layers.
To obtain this length, use the GULSCH
field of the
info
output from the nrULSCHInfo
function.
Data Types: int8
| double
cack
— Coded HARQ-ACK bits
real-valued column vector | []
Coded hybrid automatic repeat request acknowledgment (HARQ-ACK) bits, specified as one of these values:
Real-valued column vector — The length of the vector must be a multiple of the modulation order times the number of transmission layers of the codeword on which the UCI is multiplexed. To obtain this length, use the
GACK
field of theinfo
output from thenrULSCHInfo
function.[]
— Use this option to indicate the absence of HARQ-ACK transmission.
The nominal values of the HAQR-ACK bits are 0
,
1
, -1
, and -2
.
Data Types: int8
| double
ccsi1
— Coded CSI part 1 bits
real-valued column vector | []
Coded CSI part 1 bits, specified as one of these values:
Real-valued column vector — The length of the vector must be a multiple of the modulation order times the number of transmission layers of the codeword on which the UCI is multiplexed. To obtain this length, use the
GCS1
field of theinfo
output from thenrULSCHInfo
function.[]
— Use this option to indicate the absence of the CSI part 1 transmission.
The nominal values of the CSI part 1 bits are 0
,
1
, -1
, and -2
.
Data Types: int8
| double
ccsi2
— Coded CSI part 2 bits
real-valued column vector | []
Coded CSI part 2 bits, specified as one of these values:
Real-valued column vector — The length of the vector must be a multiple of the modulation order times the number of transmission layers of the codeword on which the UCI is multiplexed. To obtain this length, use the
GCS2
field of theinfo
output from thenrULSCHInfo
function.[]
— Use this option to indicate the absence of the CSI part 2 transmission.
The nominal values of the CSI part 2 bits are 0
,
1
, -1
, and -2
. Nominally, CSI
part 2 is present only when CSI part 1 is present.
Data Types: int8
| double
Output Arguments
cw
— One or two multiplexed codewords
real-valued column vector | cell array of one or two column
vectors (since R2024a) | []
One or two multiplexed codewords for the PUSCH transmission, returned as one of these values:
Real-valued column vector — The function returns this value when you specify
culsch
as a vector.Cell array of one or two real-valued column vectors — The function returns this value when you specify
culsch
as a cell array of one or two vectors, respectively.[]
— The function returns this value in any of these cases:
If any of the input data types is int8
, the output
data type of the codeword is also 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.
cw
contains the encoded information up to the bit capacity of
PUSCH and ignores any other additional information in the inputs. If there is not enough
encoded UL-SCH and encoded UCI data to achieve the bit capacity, cw
contains zeros. To determine the processing of HARQ-ACK for rate-matching or puncturing,
the function compares the number of bits reserved for HARQ-ACK transmission against the
lengths of coded inputs.
Data Types: int8
| double
info
— 1-based location information
structure
1-based location information about the multiplexing, returned as a structure
containing these fields. The output data type of each field is
uint32
.
For two codewords, each field is returned as a 1-by-2
vector (since R2024a).
Field | Description |
---|---|
ULSCHIndices | Locations of coded UL-SCH bits in the codeword |
ACKIndices | Locations of coded HARQ-ACK bits in the codeword |
CSI1Indices | Locations of coded CSI part 1 bits in the codeword |
CSI2Indices | Locations of coded CSI part 2 bits in the codeword |
UCIXIndices | Locations of X UCI placeholders in the codeword |
UCIYIndices | Locations of Y UCI placeholders in the codeword |
QUCI
(since R2024a) | Codeword number of the codeword on which the UCI is multiplexed |
If the returned codeword, cw
, is an empty array,
each field in this structure is also an empty array.
References
[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.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2020bR2024a: Support for two-codeword configurations
The function adds support for two-codeword configurations through the
tbs
, tcr
, pusch
, and
culsch
input arguments and the cw
and
info
output arguments.
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)