hardware accelerators for nr sib1 recovery -凯发k8网页登录
this example shows the design of 5g sib1 accelerators optimized for hdl code generation and hardware implementation.
introduction
the simulink® models described in this example are fixed-point hdl optimized implementations of hardware accelerators for sib1 recovery for 5g nr. the example details three individual hardware accelerators that perform:
sib1 grid recovery
coreset0 decoding
sib1 ldpc decoding
the sib1 grid recovery algorithm is designed and optimized for frequency range 1 (fr1). the coreset0 and sib1 ldpc decoding algorithms support both frequency ranges. the example shows how to integrate hardware accelerators with ssb detection and decoding designs to implement a complete sib1 recovery model. a design supporting both fr1 and fr2 is implemented in the example.
this example is one of a related set, for more information see .
file structure
this example uses these files.
simulink models
nrhdlsib1demodulation.slx
: this simulink model references thenrhdlddcfr1core
andnrhdlsib1demodulationfr1core
models to simulate the sib1 grid demodulation step of sib1 recovery.nrhdlcoreset0decoding.slx
: this model references thenrhdlcoreset0decodingcore
andnrhdlpolardecodingchaincore
models to simulate the coreset0 decoding step of sib1 recovery.nrhdlsib1ldpcdecoding.slx
: this model references thenrhdlldpcdecodingchaincore
model to simulate the sib1 ldpc decoding step of sib1 recovery.nrhdlddcfr1core.slx
: this model implements a ddc to create sample streams for sib1 and ssbs.nrhdlsib1demodulationfr1core.slx
: this model implements the sib1 demodulation algorithm.nrhdlcoreset0decodingcore.slx
: this model implements the coreset0 decoding algorithm.nrhdlpolardecodingchaincore.slx
: this model implements the common polar decoding chain.nrhdlldpcdecodingchaincore.slx
: this model implements the sib1 ldpc decoding algorithm.
simulink data dictionary
nrhdlreceiverdata.sldd
: this simulink data dictionary contains bus objects that define the buses contained in the example models.
matlab code
runsib1acceleratormodels.m
: this script uses the matlab reference to implement the mib recovery algorithm, then runs thenrhdlsib1demodulation
,nrhdlcoreset0decoding
, andnrhdlsib1ldpcdecoding
simulink models. 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.
nr hdl sib1 demodulation
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.
models.demodulationtop = 'nrhdlsib1demodulation';
open_system(models.demodulationtop);
sib1 demodulation subsystem
the sib1 demodulation subsystem references the nrhdlddcfr1core
and nrhdlsib1demodulationfr1core
models. the algorithm of the nrhdlsib1demodulationfr1core
model is described in the next section. for details about the nrhdlddcfr1core
model see the nr hdl cell search example. the output of the ddc is the input to the sib1 demodulation algorithm. the frequency offset applied to the ddc combines the ssb frequency offset estimation term, from a successful mib recovery, with the ssb to sib1 offset. the combined frequency offset centers coreset0 in the received waveform.
set_param([models.demodulationtop '/sib1 demodulation'],'open','on');
inputs
datain: 14-bit signed complex-valued signal, sampled at 61.44 msps.
validin: 1-bit control signal to validate datain.
frequencyoffset: 32-bit signed value specifying the frequency offset to be corrected. this signal is connected to an nco with a 32-bit accumulator. use this equation to convert the value to hz: ssbfrequencyoffset_hz = frequencyoffset * 61.44e6 / 2^32.
paramsin: bus of type sib1gridparambus.
stopdemod: 1-bit control signal that stops the wideband grid demodulation operation when asserted.
start: 1-bit control signal used to start a sib1 grid recovery operation.
clearstatus: 1-bit control signal used to clear the state of the status signal.
griddemodparambus
mode: 1-bit unsigned value that controls the grid demodulation mode. 0 indicates sib1, and 1 represents wideband (fr1 fr2 configuration only).
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'.
lmax: 2-bit unsigned number which indicates the maximum number of ssbs in a burst. a value of 0 indicates 4 ssbs, a value of 1 indicates 8 ssbs, a value of 2 indicates 64 ssbs.
scsgrid: 2-bit unsigned value specifying the subcarrier spacing used for the wideband grid mode. the values 0, 1, 2 and 3 represent subcarrier spacings of 15, 30, 60 and 120 khz respectively.
nrbgrid: 9-bit unsigned value specifying the bandwidth of the wideband grid demodulation in resource blocks.
rboffsetgrid: 9-bit unsigned value specifying the wideband grid frequency offset in resource blocks.
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.
muxpattern: 2-bit unsigned value specifying the coreset0 multiplexing pattern.
coreset0occasionbus
slotoffset: 8-bit unsigned value that is the slot offset from the even frame head to the first monitored slot.
firstsymbol: 4-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.
sib1 demodulation model
this diagram shows the top level of the nrhdlsib1demodulationfr1core
model. the design operates on iq data at 61.44 mhz sample rate and requires parameters from a successful mib recovery. the start signal begins a sib1 demodulation operation, set this signal to 1 when all input ports on the paramsin bus are valid. you must hold the values on paramsin constant for the duration of the demodulation.
models.demodulationcore = 'nrhdlsib1demodulationfr1core'; load_system(models.demodulationcore); set_param(models.demodulationcore,'simulationcommand','update'); set_param([models.demodulationcore '/griddemodulationcore'],'open','on');
when the ofdm demod
subsystem receives a start signal, it ofdm demodulates the input data and outputs the sib1 grid. the subsystem computes a variable size fft, with configurable cyclic prefix length and number of 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 values 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 ofdm demod
subsystem requires configuration values to successfully demodulate the sib1 grid. these values are computed from the results of mib recovery. the configuration
subsystem constructs the mib from the pbch payload and parses the pdcchsib1config
field to determine 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 is 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.
nr hdl coreset0 decoding
this figure shows the nrhdlcoreset0decoding
model. the top level of the model reads the signals from the matlab base workspace, passes them to the coreset0 decoding subsystem, and writes the outputs back to the workspace.
models.coreset0top = 'nrhdlcoreset0decoding';
open_system(models.coreset0top);
coreset0 decoding subsystem
the coreset0 decoding subsystem references the nrhdlcoreset0decodingcore
and nrhdlpolardecodingchaincore
models. the algorithm of the nrhdlcoreset0decodingcore
model is described in the next section. the nrhdlpolardecodingchaincore
model is covered in the nr hdl mib recovery example. the subsystem performs channel estimation and equalization, qpsk symbol demodulation, descrambling, rate recovery, polar decoding, and crc decoding of coreset0 candidates. the design provides back pressure with the nextframe signal to indicate when it can accept a new candidate. the processing is split over two models to allow for the nrhdlpolardecodingchaincore
to be shared between the ssb decoding and sib1 coreset0 decoding in the example. this section describes the inputs and outputs for the subsystem.
set_param([models.coreset0top '/coreset0 decoding'],'open','on');
inputs
griddatain: 16-bit signed coreset0 candidate ofdm grid data.
gridctrlin: sample control bus signal to validate griddatain.
nsym: 4-bit ofdm symbol number for the current resource element group (reg).
baserbidx: 7-bit base coreset0 resource block index for the current reg.
searchspaces: 3-bit unsigned vector of length 3 indicating the number of search spaces at aggregation levels 4, 8, and 16.
coreset0syms: 2-bit unsigned value that is the number of ofdm symbols coreset0 spans.
coreset0rbs: 2-bit unsigned value specifying the number of resource blocks. a value of 0 indicates 24, 1 indicates 48, and 2 indicates 96.
nslot: 7-bit unsigned value that specifies the slot number for the first monitored coreset0 slot.
ncellid: 10-bit unsigned value that is the cell id of the demodulated ssb.
restart: 1-bit control signal to restart the processing.
outputs
status: 3-bit unsigned value indicating the progress of the coreset0 decoding process.
dcidata: 41-bit unsigned data that contains the final decoded dci.
firstorsecondslot: 1-bit value indicating if the decoded dci was found in the first (0) or second (1) monitored slot.
searchfailed: 1-bit value indicating that the coreset0 dci search failed.
dcivalid: 1-bit value indicating the search is complete.
nextframe: 1-bit signal to provide back pressure to signal when the next candidate can be input.
status signal states
0
: initial state. waiting for start pulse.1
: performing channel estimation, equalization, symbol demodulation and descrambling.2
: performing polar rate recovery.3
: performing polar and crc decoding.4
: candidate decode failed, waiting for next attempt.5
: decoded all candidates with no successes.6
: successfully decoded the dci from a candidate.
coreset0 decoding model
this diagram shows the top level of the nrhdlcoreset0decodingcore
model. to decode coreset0 a blind search is performed over multiple candidates. the correct candidate is determined by the crc remainder equaling the sib1 rnti 65535. the design coordinates each search step and generates the required parameters to decode the candidate with the nrhdlpolardecodingchaincore
model. after a candidate is decoded, the crc result is checked. if the crc passes, the decoded data is output on the dcidata port. if the crc fails, the algorithm signals with nextframe that it is ready for the next candidate. if all candidates are decoded with no success then searchfailed is set high. the number of search candidates per slot is determined from the searchspaces input, this signal is a vector of 3 values corresponding to the number of candidates for the three possible aggregation values [4 8 16]. the design expects candidates to be input in decreasing order of aggregation level. the total number of searches is twice the search spaces since two slots are monitored for decoding. the firstorsecondslot output signals which slot the dci was decoded in. the status signal can be used to monitor the progress of the decoding. each candidate failure is indicated by state 4
and the final result is signalled by either state 5
(failure) or state 6
(success).
models.coreset0decoding = 'nrhdlcoreset0decodingcore'; load_system(models.coreset0decoding); set_param(models.coreset0decoding,'simulationcommand','update'); set_param(models.coreset0decoding,'open','on');
nr hdl sib1 ldpc decoding
this figure shows the nrhdlsib1lpdcdecoding
model. the top level of the model reads the signals from the matlab base workspace, passes them to the sib1 ldpc decoding subsystem, and writes the outputs back to the workspace.
models.ldpctop = 'nrhdlsib1ldpcdecoding';
open_system(models.ldpctop);
sib1 ldpc decoding subsystem
the sib1 ldpc decoding
subsystem references the nrhdlldpcdecodingchaincore
model. the subsystem performs ldpc decoding, codeblock desegmentation, and crc decoding. this section describes the inputs and outputs for the subsystem.
set_param([models.ldpctop '/sib1 ldpc decoding'],'open','on');
inputs
ldpcdta: 16-bit signed ldpc codeword llr data.
ldpcctrl: sample control bus for validating ldpcdata.
g: 15-bit length of the input codeword.
ldpczc: 16-bit unsigned value indicating the lifting size used for the ldpc codeword.
tbs: 12-bit unsigned value indicating the length of the decoded output data.
clearstatus: 1-bit control signal used to clear the state of the status signal.
outputs
status: 3-bit unsigned value indicating the progress of the sib1 decoding process.
sib1bits: 1-bit data that is the final decoded sib1 payload.
sib1bitsctrl: sample control bus for validating sib1bits.
sib1err: 1-bit value indicating if the sib1 crc failed.
diagnostics: bus containing diagnostic signals.
status signal states
0
: initial state. waiting for start pulse.1
: performing ldpc rate recovery.2
: performing ldpc decoding.3
: performing crc decoding.4
: failed to decode sib1.5
: successfully decoded sib1.
sib1 ldpc decoding model
this diagram shows the top level of the nrhdlldpcdecodingchaincore
model. the design accepts input llrs along with a sample control bus and additional constants. the first stage performs ldpc rate recovery, this includes signal scaling and wordlength reduction to prepare the data for ldpc decoding. the second stage decodes the ldpc data using min-sum layered belief propagation with lifting factor from input port. for the sib1 use case only base graph 2 is supported so the bgn input is constant. the algorithm then performs codeblock desegmentation. for sib1 this only requires the removal of the padding bits from the end of the data to produce a length of tbs 16 crc bits. the final stage performs crc decoding using crc16 with no scrambling. the decoded sib1 bits and the error status are output. additionally, a status port is provided to show the algorithms progress. the output from the rate recovery stage is provided on the diagnostic port.
models.ldpcdecoding = 'nrhdlldpcdecodingchaincore'; load_system(models.ldpcdecoding); set_param(models.ldpcdecoding,'simulationcommand','update'); set_param([models.ldpcdecoding '/ldpc decoding chain'],'open','on');
sib1 accelerators simulation setup
the 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 coreset0 candidates are extracted from the grid and decoded using matlab and simulink. the dci result is used to extract the sib1 ldpc codeword from the resource grid and the final decode is performed in matlab and simulink. at each stage matlab and simulink results are compared to confirm their equivalence.
the test bench options
section of the runsib1acceleratormodels
script includes these variables to configure the simulation:
simulationcase: specifies the configuration of the generated waveform. the table shows the set of simulation cases:
disp(nrhdlexamples.generatefr1rxwaveform('list'));
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 6 3 4 "simcase 3" "case a" 30 4 20 2 8 "simcase 4" "case a" 15 84 7 0 4
numsubframes: specifies the number of 1 ms subframes generated as input stimulus.
sib1 accelerators simulation
use the runsib1acceleratormodels
script to run a sib1 recovery simulation using the hardware accelerators. the script displays its progress at the matlab command prompt, and produces plots of inputs and outputs for analysis. this example shows the results of running "simcase 1". the resource grids produced by matlab and simulink from the sib1 demodulation are displayed along with the difference between them and their relative mean squared error (mse). the grid plots are labelled to highlight the decoded pdcch and pdsch. the dci fields from coreset0 decoding are displayed and the final sib1 bits are compared. this comparison verifies that the simulink implementations closely matches the matlab reference.
runsib1acceleratormodels;
runsib1acceleratormodels;
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. ### model reference simulation target for nrhdlddcfr1core is up to date. ### model reference simulation target for nrhdlsib1demodulationfr1core is up to date. build summary 0 of 2 models built (2 models already up to date) build duration: 0h 0m 1.1265s .......... matlab and simulink grids relative mse : -62.7854 db extracting coreset0 candidates from the sib1 grid. decoding coreset0 candidates using matlab reference. decoding coreset0 candidates using simulink. running nrhdlcoreset0decoding.slx ### starting serial model reference simulation build. ### model reference simulation target for nrhdlcoreset0decodingcore is up to date. ### model reference simulation target for nrhdlpolardecodingchaincore is up to date. build summary 0 of 2 models built (2 models already up to date) build duration: 0h 0m 0.68171s .......... dci from matlab: riv: 528 tddindex: 0 vrbtoprbinterleaving: 0 modcoding: 0 rv: 0 siindicator: 0 reserved: 0 dci from simulink: riv: 528 tddindex: 0 vrbtoprbinterleaving: 0 modcoding: 0 rv: 0 siindicator: 0 reserved: 0 dci successfully decoded from simulink grid with hardware acceleration extracting ldpc codeword from the sib1 grid. decoding sib1 using matlab reference. decoding sib1 using simulink. running nrhdlsib1ldpcdecoding.slx ### starting serial model reference simulation build. ### model reference simulation target for nrhdlldpcdecodingchaincore is up to date. build summary 0 of 1 models built (1 models already up to date) build duration: 0h 0m 0.57395s .......... sib1 successfully decoded from simulink grid with hardware acceleration sib1 bits from matlab and simulink match
hdl code generation and implementation results
to generate the hdl code for this example, you must have an hdl coder™ license. use the makehdl
and makehdltb
commands to generate hdl code and an hdl test bench for the nrhdlsib1demodulation/sib1 demodulation
, nrhdlcoreset0decoding/coreset0 decoding
or nrhdlsib1ldpcdecoding/sib1 ldpc decoding
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:
t = table(... categorical({'slice registers'; 'slice luts'; 'ramb18'; 'ramb36'; 'dsp48'}),... [13018; 7711; 18; 10; 35],... 'variablenames',{'resource','usage'}); disp(t);
resource usage _______________ _____ slice registers 13018 slice luts 7711 ramb18 18 ramb36 10 dsp48 35
resource utilization for nrhdlcoreset0decoding model:
t = table(... categorical({'slice registers'; 'slice luts'; 'ramb18'; 'ramb36'; 'dsp48'}),... [8297; 11099; 8; 4; 16],... 'variablenames',{'resource','usage'}); disp(t);
resource usage _______________ _____ slice registers 8297 slice luts 11099 ramb18 8 ramb36 4 dsp48 16
resource utilization for nrhdlsib1ldpcdecoding model:
t = table(... categorical({'slice registers'; 'slice luts'; 'ramb18'; 'ramb36'; 'dsp48'}),... [61827; 42120; 289; 20; 3],... 'variablenames',{'resource','usage'}); disp(t); fields = fieldnames(models); for k=1:length(fields) close_system(models.(fields{k}),0); end
resource usage _______________ _____ slice registers 61827 slice luts 42120 ramb18 289 ramb36 20 dsp48 3