main content

verify 5g wireless applications using systemverilog dpi -凯发k8网页登录

this example shows how to use systemverilog dpi components to verify 5g wireless applications in an hdl environment.

the system in this example uses various 5g components and a parameterizable 5g waveform generator to validate the behavior of the synchronization signal block (ssb) decoding section of the master information block (mib) recovery process.

the verification workflow includes these key benefits:

  • 3gpp 5g new radio (nr) standard requires deep domain expertise. creating a standard-compliant waveform verification model can be challenging. generating a dpi component from a wireless hdl toolbox™ waveform generator simplifies the test bench design process by automatically creating a standard compliant verification ip.

  • the parameterizable 5g waveform generator tests the dut in different scenarios. you can reconfigure the parameters to create a series of test cases to meet coverage.

  • the standalone 5g dpi components generated from simulink® and matlab® can be reused and integrated in customized test benches.

  • the component-based workflow makes designing a standalone test bench faster. you can splice different modules in the top-level test bench to test different 5g function components.

  • full functional control at the top level test bench enables component manipulation according to the process status changes. this control results in performance gains compared to a test-vector-based hdl test bench.

mib recovery process

mib recovery requires ssb detection, demodulation, and decoding. this example shows how to validate the hdl code generated by hdl coder™ for the ssb decoding module.

ssb detection performs a primary synchronization sequence (pss) search, orthogonal frequency division multiplexing (ofdm) demodulation, and a secondary synchronization sequence (sss) search. ssb detection has two modes of operation: search and demodulation. in search mode, the detection searches for ssbs and returns their parameters. in demodulation mode, the detection recovers a specified ssb, ofdm-demodulates its resource grid, and searches for the sss within the appropriate resource elements. the details of ssb detection and demodulation are described in the nr hdl cell search (wireless hdl toolbox) example.

ssb decoding performs a demodulation reference signal (dmrs) search, channel estimation and phase equalization, and broadcast channel (bch) decoding steps. the details of ssb decoding are described in the nr hdl mib recovery (wireless hdl toolbox) example.

5g waveform generator uses 5g toolbox™ functions to generate a test waveform, which is then applied to the ssb detection in search mode. after the strongest ssb is determined, the test waveform is applied to the ssb detection in demodulation mode to recover a specified ssb resource grid and search for the sss within the appropriate resource element.

after an ssb is detected and demodulated, it needs to be decoded to extract the mib content. when ssb decoding has the demodulated grid, the ssb decoding module decodes the ssb and output the pbch payload, which is then parsed to extract the mib data.

file structure

this example uses these files.

simulink models

  • nrhdlssbdetection.slx: this simulink model uses the nrhdlssbdetectionfr1core model reference to simulate the behavior of the ssb detection part of the mib recovery process.

  • nrhdlssbdetectionfr1core.slx: this model reference implements the ssb detection algorithm.

  • nrhdlssbdecoding.slx: this simulink model uses the nrhdlssbdecodingcore model reference to simulate the behavior of the ssb decoding part of the mib recovery process.

  • nrhdlssbdecodingcore.slx: this model reference implements the ssb 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

  • generate5gwaveform.m: this function is a modified version of the wireless hdl toolbox™ 5g waveform generator, which is c code generation compatible.

  • runssbdetectionmodelsearch.m: this script executes and verifies the nrhdlssbdetection model in search mode.

  • runssbdecodingmodel.m: this script uses the matlab reference to implement the cell search algorithm and then runs the nrhdlssbdecoding simulink model. the script verifies the operation of the model using 5g toolbox and the matlab reference code.

  • nrsvdpiexamples: this package contains the matlab reference code and utility functions for verifying the implementation models.

pregenerated hdl test bench components (available for windows® only)

  • 5gnrcelldecodedpitb: this folder contains generated dpi components, hdl code of the decoding module, and the top-level test bench with associated build and simulation scripts.

set up for hdl simulation

this section describes the workflow for generating the dpi component for each 5g functional component and hdl code for the ssb decoding component. the provided top-level test bench instantiates all of the generated components to validate the behavior of the hdl code that is generated from the ssb decoding block. to enable reuse of individual systemverilog dpi components and use a subset of the components in a test bench, generate systemverilog dpi for each 5g component individually.

the 5gnrcelldecodedpitb folder contains all of the necessary generated components. if you do not want to regenerate these components, skip this section.

5g waveform generator

this function uses 5g toolbox functions to generate a test waveform. the 5g waveform generator has three input arguments: ncellid, snr, and frequencyoffset. when you use this waveform generator in a systemverilog test bench, you can test different scenarios by providing different values for snr, frequencyoffset, and ncellid without changing the component code. for this example, use this command to generate the dpi component from the matlab function generate5gwaveform.

dpigen generate5gwaveform -args {0,0,0} -portsdatatype logicvector

the -args {0,0,0} parameter indicates that three scalar inputs of type double. the -portsdatatype logicvector parameter indicates generating a logic vector type interface for the port.

ssb detection

this component is introduced in the nrhdlssbdetection simulink model and the top-level test bench uses this component for the ssb search and ssb demodulation. use these commands to run a search mode simulation and verify the results in matlab.

clear all;
runssbdetectionmodelsearch;

then use this command to generate a dpi component for the simulink subsystem nrhdlssbdetection/ssb detection.

rtwbuild('nrhdlssbdetection/ssb detection');

choose strongest pss

this component is introduced in the nrhdlssbdetection simulink model and the top-level test bench uses this component to determine the strongest pss from the psss detected by the ssb search. use this command to generate a dpi component for the simulink subsystem nrhdlssbdetection/choosestrongestpss.

rtwbuild('nrhdlssbdetection/choosestrongestpss');

ssb decoding

this component is introduced in the nrhdlssbdecoding simulink model and is the dut in this example. use these commands to run an ssb decoding simulation in matlab.

clear all;
runssbdecodingmodel;

then, use this command to generate hdl code from this component.

makehdl('nrhdlssbdecoding/ssb decoding','targetlanguage','verilog');

parse pbch payload

this component is introduced in the nrhdlssbdecoding simulink model and the top-level test bench uses this component to parse the pbch payload to obtain the mib information. use this command to generate the dpi component for the simulink subsystem nrhdlssbdecoding/parsepbchpayload.

rtwbuild('nrhdlssbdecoding/parsepbchpayload');

the 5gnrcelldecodedpitb folder contains a top-level test bench, celldecode_tb.sv, to simulate the entire process described in the mib recovery process section. in this example, the ncellid parameter is set to 249, the snr parameter is set to 50, and the frequencyoffset parameter is set to 5000. you can modify the values of these parameters to test the design in different scenarios.

run test bench

add the questasim simulator to the matlab system path, and then navigate to the 5gnrcelldecodedpitb folder. to compile and simulate the dut in questasim, enter these commands at the matlab prompt.

!vsim < compile_dut.do
!vsim < sim_5g_waveform.do

observe the following simulation results:

  • in this figure of a waveform, signal names that start with "mib" carry mib information from the waveform generator, and signal names that start with "decode" carry mib information from the decode process. the waveform shows that the decoded mib information matches the mib information from the waveform generator.

using this approach, you can dynamically react to the status of each 5g functional component to save simulation time compared to a vector-based test bench.

  • in this figure of a waveform, the value of the detection status changes from 6 to 8, indicating that the demodulation operation is complete. the sss is found, and a demodulated resource grid is returned. in this case, you can start the ssb decoding process instead of waiting for ssb demodulation to finish processing the input vectors if you are using a vector-based hdl test bench.

  • in this figure of a waveform, the value of the decoding status changes from 2 to 4, indicating that the mib is detected. in this case, you can stop the simulation rather than finish processing the grid resource data. in contrast, the vector-based test bench approach requires simulation for a fixed amount of time before analyzing the results.

reuse dpi component

you can reuse the generated 5g function dpi components in a customized test bench.

  • use these components to test a subset of the mib recover process. for example, reuse the 5g waveform generator to validate the behavior of an ssb search module.

  • use these components to test different 5g function components in the mib recovery process. for example, when you are validating the behavior of ssb demodulation in the mib recovery process, you can reuse the 5g waveform generator, ssb search and parse pbch payload dpi components, and generate a dpi component from ssb decoding. instantiate these components in your top-level test bench to validate the behavior of the ssb demodulate module.

conclusion

this example shows how to use a standalone test bench with dpi components to validate the ssb decoding module of an mib recovery process. the hdl verifier™ generated dpi components support tunable parameters, which enable customization of the 5g test waveform from the top-level test bench. you can reuse each generated dpi component in other custom hdl test benches. you can use this workflow for verifying the hdl ip in your wireless application.

related topics

网站地图