Main Content

This example shows how to design a 5G NR system information block type 1 (SIB1) resource grid recovery model optimized for HDL code generation and hardware implementation and decode SIB1 from its output.

The Simulink® models described in this example are fixed-point HDL optimized implementations of SIB1 resource grid recovery for 5G NR frequency range 1 (FR1). This example is one of a related set which show the workflow for designing and deploying a 5G NR cell search and MIB and SIB1 recovery algorithm to hardware. The complete workflow is shown.

Each step in this workflow is demonstrated by one or more related examples.

The

*MATLAB Golden Reference Algorithm*step consists of the NR Cell Search and MIB and SIB1 Recovery (5G Toolbox) example, which shows the floating-point golden reference algorithm.The

*MATLAB Hardware Reference Algorithm*step consists of the NR HDL Downlink Receiver MATLAB Reference example, which models hardware friendly algorithms and generates test waveforms. This MATLAB® code operates on vectors and matrices of floating-point data samples and does not support HDL code generation.The

*Simulink Fixed-Point Implementation Model*step consists of multiple examples. The NR HDL Cell Search example demonstrates a 5G cell search Simulink subsystem that uses the same algorithm as the MATLAB reference. The NR HDL MIB Recovery example adds a broadcast channel decoding and MIB recovery subsystem. The NR HDL SIB1 Recovery example (this example) adds a subsystem that recovers the SIB1 resource grid, and shows how to decode its output using MATLAB reference code. The NR HDL MIB Recovery for FR2 example shows cell search and MIB recovery models which have been extended to support FR2. These models operate on fixed-point data and are optimized for HDL code generation.The

*Simulink SoC Deployment Model*step consists of the Deploy NR HDL Reference Applications on SoCs examples, which build on the fixed-point implementation models and use hardware support packages to deploy the algorithms on hardware.

For a general description of how MATLAB and Simulink can be used together to develop deployable models, see Wireless Communications Design for FPGAs and ASICs.

SIB1 recovery requires cell search, master information block (MIB) decoding, recovery of the SIB1 grid (the area of the resource grid containing CORESET0 and SIB1), and decoding of the PDCCH and PDSCH from the SIB1 grid. This example focuses on SIB1 grid recovery. The process of MIB recovery is described in the NR HDL MIB Recovery example. The final decoding stages are described in the NR HDL Downlink Receiver MATLAB Reference example. This example focuses on the SIB1 Demodulation Simulink model and uses the MATLAB reference to generate test input and verify the behavior of the model. As a final step, the example shows a Simulink model that combines MIB recovery and SIB1 demodulation to recover the SIB1 grid from a baseband waveform.

After MIB recovery, the MIB contents needs to be parsed and used to determine the resource allocation of CORESET0 in time and frequency. With this knowledge the SIB1 grid can be OFDM demodulated when its timing occasion is reached.

This example uses these files.

Simulink models

`nrhdlSIB1Demodulation.slx`

: This Simulink model uses the`nrhdlSIB1DemodulationCore`

model reference to simulate the SIB1 grid demodulation part of the SIB1 recovery process.`nrhdlSIB1GridRecovery.slx`

: This Simulink model combines the processing of the SSB detector, the SSB decoder, and the SIB1 demodulator into an integrated model illustrating the complete SIB1 grid recovery process. This model uses the`nrhdlSSBDetectionFR1Core`

,`nrhdlSSBDecodingCore`

, and`nrhdlSIB1DemodulationCore`

model references.`nrhdlSIB1DemodulationCore.slx`

: This model reference implements the SIB1 Demodulation algorithm.`nrhdlSSBDecodingCore.slx`

: This model reference implements the SSB decoding algorithm.`nrhdlSSBDetectionFR1Core.slx`

: This model reference implements the SSB detection algorithm.

Simulink data dictionary

`nrhdlReceiverData.sldd`

: This Simulink data dictionary contains bus objects that define the buses contained in the example models.

MATLAB code

`runSIB1DemodulationModel.m`

: This script uses the MATLAB reference to implement the MIB recovery algorithm, then runs the`nrhdlSIB1Demodulation`

Simulink model. The script verifies the operation of the model using 5G Toolbox™ and the MATLAB reference code.`runSIB1GridRecoveryModel.m`

: This script uses the MATLAB reference to perform the search mode of the SSB detection algorithm, then runs the`nrhdlSIB1GridRecovery`

Simulink model to demodulate and decode the SSB, and then demodulate the SIB1 grid. The script verifies the operation of the model using 5G Toolbox and the MATLAB reference code.`nrhdlexamples`

: Package containing the MATLAB reference code and utility functions for verifying the implementation models.

This figure shows the `nrhdlSIB1Demodulation`

model. The top level of the model reads the signals from the MATLAB base workspace, passes them to the SIB1 Demodulation subsystem, and writes the outputs back to the workspace.

The SIB1 Demodulation subsystem contains an instance of the `Input Scaling`

subsystem and the `nrhdlSIB1DemodulationCore`

model reference. The `Input Scaling`

subsystem scales the input by a factor of 0.875, providing headroom for the subsequent processing stages. The `nrhdlSIB1DemodulationCore`

algorithm is described in the next section.

Inputs

*dataIn*: 16-bit signed complex-valued signal, sampled at 61.44 Msps.*validIn*: 1-bit control signal to validate*dataIn*.*paramsIn*: Bus of type SIB1GridParamBus.*start*: 1-bit control signal used to start a SIB1 grid recovery operation.*clearStatus*: Clear the state of the status signal.

SIB1GridParamBus

*ssbFrequencyOffset*: 32-bit signed value specifying the frequency offset applied to the SSB. This signal is connected to an NCO with a 32-bit accumulator. Use this equation to convert the value to Hz:*ssbFrequencyOffset_Hz*=*ssbFrequencyOffset** 61.44e6 / 2^32.*ssbTimingOffset*: 21-bit unsigned value that is the timing offset of the detected SSB. The timing offset is in samples at 61.44 Msps from 0 to 1228799.*scsSSB*: 2-bit unsigned value specifying the subcarrier spacing (SCS) of the detected SSB. Set this signal to 0 to select 15 kHz, or 1 to select 30 kHz.*ssbIndex3Lsb*: 3-bit unsigned value that is the 3 least significant bits of the SSB index.*pbchPayload*: 32-bit unsigned value that contains the MIB and additional PBCH timing data.*minChanBW*: 2-bit unsigned value specifying the minimum channel bandwidth. A value of 0 indicates 5 MHz, 1 indicates 10 MHz and 2 indicates 40 MHz.*ssbPattern*: 2-bit unsigned value specifying the SSB pattern. A value of 0 indicates 'Case A', 1 indicates 'Case B', and 2 indicates 'Case C'.

Outputs

*status*: 2-bit unsigned value indicating the progress of the SIB1 demodulation operation.*dataOut*: 16-bit signed complex-valued SIB1 resource grid data. The algorithm outputs the 28 OFDM symbols of the SIB1 grid, one resource element (RE) per cycle.*validOut*: 1-bit control signal that validates the*dataOut*output.*coreset0Resources*: Bus of type coreset0ResourcesBus.*coreset0Occasion*: Bus of type coreset0OccasionBus.*parsedMIB*: Bus of type MIBBus.

coreset0ResourcesBus

*resourceBlocks*: 2-bit unsigned value specifying the number of resource blocks. A value of 0 indicates 24, 1 indicates 48, and 2 indicates 96.*ofdmSymbols*: 2-bit unsigned value that is the number of OFDM symbols CORESET0 spans.*frequencyOffset*: 32-bit signed value specifying the relative frequency offset from the SSB to CORESET0. This signal is connected to an NCO with a 32-bit accumulator. Use this equation to convert the value to Hz:*frequencyOffset_Hz*=*frequencyOffset** 61.44e6 / 2^32.

coreset0OccasionBus

*slotOffset*: 5-bit unsigned value that is the slot offset from the even frame head to the first monitored slot.*firstSymbol*: 3-bit unsigned value specifying the first occupied OFDM symbol in the slot.

MIBBus

*sfn*: 10-bit unsigned value that is the system frame number (SFN).*scsCommon*: 1-bit unsigned value specifying the common subcarrier spacing. A value of 0 indicates 15 kHz, and 1 indicates 30 kHz.*Kssb*: 5-bit unsigned value that is the offset between the SSB and the overall resource block grid.*drmsTypeAPos*: 1-bit unsigned value specifying the position of the DMRS symbol for PDSCH allocation type A, where 0 represents position 2 and 1 indicates position 3.*pdcchConfigSIB1*: 8-bit unsigned value containing the configuration for CORESET0*cellBarred*: 1-bit value indicating whether the cell is barred.*intraFreqReselection*: 1-bit value indicating whether intra frequency reselection is allowed.*hrf*: 1-bit value that is the half frame bit.*ssbIdx*: 3-bit value that is the index of the SSB.

Status Signal States

`0`

: Initial state. Waiting for start pulse.`1`

: Waiting for the CORESET0 timing occasion.`2`

: OFDM demodulating and outputting the SIB1 grid data.

This diagram shows the top level of the `nrhdlSIB1DemodulationCore`

model. The design operates on IQ data at 61.44 MHz and requires parameters from a successful MIB recovery. The start signal begins a SIB1 demodulation operation and can be asserted once all input ports on the paramsIn bus are valid. You must hold the values on paramsIn constant for the duration of the demodulation.

The first processing stage for the SIB1 demodulator is a DDC. The DDC takes input data at 61.44 MHz, performs a frequency shift to center CORESET0 and then downsamples to 30.72 MHz using a halfband filter. The output sample rate was selected because it is the minimum bandwidth required to perform a power of 2 FFT for the maximum sizes of CORESET0 at SCS 15 and 30 KHz.

The OFDM demodulator takes input from the DDC and outputs the SIB1 grid when it receives a start signal. The subsystem is configured to compute a variable size FFT, with configurable cyclic prefix length and guard subcarriers. The FFT size is selected depending on the subcarrier spacing of the SIB1 grid. For SCS 15 a 2048-point FFT is used, and for SCS 30 a 1024-point FFT is used. These both correspond to the sample rate of 30.72 MHz. The cyclic prefix length varies during OFDM demodulation of the SIB1 grid to account for the longer cyclic prefix symbols present at the halfsubframe boundaries. The number of guard subcarriers is used to extract the SIB1 grid from the full demodulation bandwidth.

The DDC and OFDM demodulator subsystems require configuration values to successfully demodulate the SIB1 grid. These values are computed from the results of MIB recovery. The SIB1 Config subsystem constructs the MIB from the PBCH payload and parses the `pdcchSIB1Config`

field to produce the `coreset0Resources`

and `coreset0TimingOccasion`

. The `coreset0Resources`

signal contains the frequency offset from the SSB to CORESET0 and the bandwidth of the CORESET0 resource grid. The `coreset0TimingOccasion`

signal contains the slot offset from the even SFN frame head to the first monitored slot i.e. the slot within 2 system frames. The monitored slot timing offset subsystem converts the `coreset0TimingOccasion`

slot offset to a timing reference count. The SSB pattern, SSB index, and SSB timing reference are used to compute the timing reference of the even SFN frame head, from which the timing reference value of CORESET0 can be computed. A timing reference counter, synchronized with the SSB detection references, is used to track the SIB1 data stream. Once the start signal is asserted, the startController waits for the SIB1 timing reference to reach the target offset computed by the monitored slot timing offset subsystem and then triggers the OFDM demodulation to begin. The diagram shows an example of the timing references for the monitored SSB, the even frame head, and the CORESET0 timing occasion. These offsets depend on the configuration of the transmitting cell.

The block diagram shows the simulation setup implemented by this example. 5G Toolbox functions are used to generate a test waveform. MATLAB reference code is then used to perform the steps required for MIB recovery - SSB search, demodulation and decoding. The results provide the input data for the SIB1 demodulation stage. The same input is passed to both MATLAB and Simulink implementations of SIB1 demodulation, and the output grids are directly compared. The simulink grid is verified by using the MATLAB reference to finish the SIB1 recovery operation by decoding the PDCCH and then the PDSCH.

Use the `runSIB1DemodulationModel`

script to run a SIB1 demodulation simulation. The script displays its progress at the MATLAB command prompt, and produces plots of inputs and outputs for analysis. The testbench supports multiple simulation cases. The full set of cases, and their parameters, are shown. This example shows the results of running "SimCase 1". The resource grids produced by MATLAB and Simulink are displayed along with the difference between them and their relative mean squared error (MSE). This verifies that the Simulink implementation closely matches the MATLAB reference. The grid plots are labelled to highlight the decoded PDCCH and PDSCH. The final stage of the script decodes the Simulink SIB1 grid to ensure its correctness.

Simulation Case SSB Pattern Subcarrier Spacing Common PDCCH Config SIB1 SNR dB Strongest SSB index Lmax _______________ ___________ _________________________ _________________ ______ ___________________ ____ "SimCase 1" "Case C" 30 164 50 4 8 "SimCase 2" "Case B" 15 100 5 7 8 "SimCase 3" "Case A" 30 4 20 2 8 "SimCase 4" "Case A" 15 84 7 0 4

runSIB1DemodulationModel;

Generating test waveform. Searching for SSBs using MATLAB reference. Demodulating the strongest SSB using MATLAB reference. Decoding the demodulated SSB using MATLAB reference. Demodulating the SIB1 grid using MATLAB reference. Demodulating the SIB1 grid using Simulink model. Running nrhdlSIB1Demodulation.slx ### Starting serial model reference simulation build ### Successfully updated the model reference simulation target for: nrhdlSIB1DemodulationCore Build Summary Simulation targets built: Model Action Rebuild Reason ============================================================================================================== nrhdlSIB1DemodulationCore Code generated and compiled nrhdlSIB1DemodulationCore_msf.mexa64 does not exist. 1 of 1 models built (0 models already up to date) Build duration: 0h 1m 23.925s .......... MATLAB and Simulink grids relative MSE : -60.7415 dB PDCCH RMS EVM: 0.611% DCI successfully decoded from Simulink grid. SIB1 successfully decoded from Simulink grid.

The `nrhdlSIB1GridRecovery`

model combines the SIB1 demodulation model (`nrhdlSIB1DemodulationCore`

) with the two reference models for SSB Decoding and SSB Detection (`nrhdlSSBDecodingCore`

and `nrhdlSSBDetectionFR1Core`

) to create a complete SIB1 grid recovery implementation. This model can be used to recover the SIB1 grid from baseband 5G waveforms.

Use the `runSIB1GridRecoveryModel`

script to run this model and compare against the MATLAB reference. To speed up the simulation the cell search part of the algorithm is performed in MATLAB. Once the strongest SSB has been determined, the simulink model is used to re-acquire, demodulate and decode the SSB, and then the SIB1 grid is demodulated.

The status signals from the SSB detector and decoder are used to register the values required by the SIB1 demodulator. When the bchStatus reaches state 4, indicating a successful MIB decode, the SIB1 demodulation processing is started. Once the timing occasion is reached the SIB1 grid is OFDM demodulated and output.

To generate the HDL code for this example, you must have HDL Coder™ product. Use the `makehdl`

and `makehdltb`

commands to generate HDL code and an HDL test bench for `nrhdlSIB1Demodulation/SIB1 Demodulation`

or `nrhdlSIB1GridRecovery/SIB1 Grid Recovery`

subsystems. The resulting HDL code was synthesized for a Xilinx® Zynq®-7000 ZC706 evaluation board. The table shows the post place and route resource utilization results. The design meets timing with a clock frequency of 150 MHz.

Resource utilization for nrhdlSIB1Demodulation model:

Resource Usage _______________ _____ Slice Registers 11843 Slice LUTs 6877 RAMB18 19 RAMB36 6 DSP48 33

Resource utilization for nrhdlSIB1GridRecovery model:

Resource Usage _______________ _____ Slice Registers 94857 Slice LUTs 46916 RAMB18 36 RAMB36 11 DSP48 276

To deploy the nrhdlSIB1GridRecovery model to a hardware platform and recover SIB1 from off the air signals, see the Deploy NR HDL Reference Applications on SoCs example.