Prepare Hardware Model for Deployment
R2026bTo deploy an SDR algorithm on an NI™ USRP™ radio, prepare a Simulink® model that meets the hardware constraints described in this topic. For the full workflow, see Target NI USRP Radios Workflow.
Preparing a model for deployment requires a configured development environment and a connected radio. To prepare your Simulink model:
Determine the capabilities of your radio device, such as the number of channels and the supported baseband sample rates. For details, see Determine Radio Device Capabilities.
Implement your algorithm using blocks that support HDL code generation. For more information, see Basic Guidelines for Modeling HDL Algorithm in Simulink (HDL Coder).
To model the boundary of the user logic, use the guidelines in Configure Hardware Interfaces.
Determine Radio Device Capabilities
Before you start implementing your model, consider the constraints of your hardware. This table details the capabilities of supported NI USRP radios. The radio can transmit and receive at a sample rate equal to the maximum supported master clock rate (MCR) of the radio divided by a supported interpolation or decimation factor.
| Radio Device | Supported MCRs | Supported Interpolation or Decimation Factors | Number of Channels | Supported Center Frequencies | Supported Channel Gains | PL DDR Buffer Size and Connections* |
|---|---|---|---|---|---|---|
USRP E320 (since R2025a) |
|
| 2† | 70 MHz to 6 GHz | Transmit: 0 dB to 89.8 dB Receive: 0 dB to 76 dB | 2 GB (229 samples) 2 connections |
| USRP N310 |
|
| 4 | 1 MHz to 6 GHz Note: Only two independent center frequencies can be set, with two channels sharing the same center frequency | Transmit: 0 dB to 65 dB Receive: 0 dB to 75 dB | 2 GB (229 samples) 4 connections |
USRP N320 USRP N321 |
|
| 2 | 1 MHz to 6 GHz | 0 dB to 60 dB | 2 GB (229 samples) 4 connections |
USRP X310 + UBX 160 |
|
| 2 | 10 MHz to 6 GHz | 0 dB to 31.5 dB | 1 GB (228 samples) 2 connections |
USRP X310 + OBX 160 (since R2026b) |
|
| 2 | 10 MHz to 8.4 GHz | 0 dB to 31.5 dB | 1 GB (228 samples) 2 connections |
USRP X310 + TwinRX (since R2026a) | 200 MHz |
| 4 (receive only) | 10 MHz to 6 GHz | 0 dB to 93 dB | 1 GB (228 samples) 2 connections |
| USRP X410 |
|
| 4 | 1 MHz to 8 GHz | 0 dB to 60 dB | 4 GB (230 samples) 4 connections |
* The PL DDR buffer
connections are shared between streaming interfaces mapped to | ||||||
† Supported TX/RX configurations on a USRP E320 radio are 1-by-0, 0-by-1, 1-by-1, and 2-by-2. To use a 1-by-2 or 2-by-1 TX/RX configuration, implement a dummy transmit or receive channel in your model. | ||||||
Configure Hardware Interfaces
Your design under test (DUT) communicates with other subsystems on the radio through hardware interfaces. You can include three types of interface in your DUT:
Register interfaces — Read and write scalar control values in the DUT from MATLAB®.
Radio streaming interfaces — Stream IQ data between the DUT and the radio front end for over-the-air transmission or reception.
Host streaming interfaces — Stream data between the DUT and the host computer, either directly or through the PL DDR buffer.
After you configure your interfaces, map them to the reference design in the Map Target Interfaces step. To interact with these interfaces from MATLAB after deployment, see Run and Verify Hardware Implementation.
Register Interface Guidelines
Use register interfaces to access control registers in your DUT.
Use scalar ports only.
Use any real data type up to 32-bits.
When you deploy your design to your radio, you can read and write registers using the
readPort and
writePort
functions.
Choose Streaming Interface
The streaming interfaces available on NI USRP radios serve different use cases. Use this table to determine which streaming interface to include in your model before you begin implementing your DUT.
| Interface Path | Use When | Constraints |
|---|---|---|
| DUT to Radio | The DUT generates or processes IQ data for over-the-air transmission. |
|
| Radio to DUT | The DUT processes IQ data received from the air in real time. |
|
| DUT to Host (direct) | The DUT sends processed data to the host at a rate the host can sustain. |
|
| DUT to Host (PL DDR buffer) | The DUT produces data faster than the host can process, or you need to guarantee no samples are dropped. |
|
| Host to DUT (direct) | The host sends data to the DUT synchronously. | |
| Host to DUT (PL DDR buffer) | The DUT consumes data from a pre-loaded PL DDR buffer. |
|
Streaming Interface Guidelines
These requirements apply to all streaming interfaces in your DUT:
Use sample-based processing.
Use scalar ports at the top-level DUT boundary.
Use blocks that support HDL code generation. For supported blocks, see Basic Guidelines for Modeling HDL Algorithm in Simulink (HDL Coder).
Model each streaming interface using the AXI-Stream protocol signals described in the per-direction sections below.
The following sections describe the shared AXI-Stream protocol, buffering concepts, and signal-level implementation for each streaming direction.
AXI-Stream Protocol
Include the following signals for each streaming data interface:
Ready— A flag that is asserted when data is ready to be received.Data— A 32-bit bus that carries data between subsystems.Valid— A flag that is asserted when the data is valid.Last— A flag that is asserted for the duration of the last sample in a data packet.
Optionally, you can also include these signals:
EOB(end of burst) — A flag that is asserted for the duration of the last data packet in a burst of data packets.Timestamp— A 64-bit signal that contains the time of the first data sample in the packet.HasTime— A flag that is asserted when a valid timestamp signal is present.
Backpressure is sink driven. The sink is the downstream block that consumes the data.
The sink asserts the Ready signal to indicate it can accept data. Data is
transferred only when both the Valid and Ready signals
are asserted.
The timing diagram shows an example of these signals with a data packet length of 4
samples and a burst length of 3 packets. Samples transfer only when the receiving block
asserts the Ready signal.
For more information, see:
The Handshake Signaling section in AMBA AXI-Stream Protocol Specification.
The Timestamps and Data Bursts section in RFNoC FPGA Specification.
Stream Buffer Size and Frame Size
Two independent settings control data transfer size and buffering at different points in the streaming data path:
Stream buffer size — An FPGA-side endpoint buffer, used for flow control. You set this value in the interface mapping table during the Map Target Interfaces step. The default is the maximum possible buffer size, which is 32768 samples. The buffer size must be a power of two for optimal use of the FPGA RAM resources.
Frame size — The number of samples per host-side
readPortorwritePortoperation. You set this value in the generated setup script using theFrameSizeargument of theaddRFNoCStreamInterfacefunction.
The generated setup script sets the frame size to 1e5 samples by
default. Set this value based on how much data the host processes per call. For example, if
your DUT outputs 2048-sample FFT frames and you want to read 1000 frames per
readPort call, set FrameSize to
2048e3. For an example, see Introduction to Streaming Interfaces on NI USRP Radio.
Stream Data Between DUT and Radio
These interfaces carry IQ data between the DUT and the radio front end for over-the-air transmission and reception. Both directions use the AXI-Stream protocol with complex signed 16-bit data.
DUT to Radio
To implement this interface in your Simulink model:
Set the output port data type to
int16or any signed 16-bit fixed-point data type. The data must be complex (IQ).Gate
valid_outwith theready_insignal. Only assertvalid_outand send data whenready_inis high. If the DUT sends data whenready_inis de-asserted, the radio drops the samples.The radio asserts
ready_inwhen it can accept a sample. The radio consumes data at the sample rate. To set this rate, use the Sample Rate parameter in the Configure HDL Code Generation Settings step of the workflow, or theSampleRateproperty on theusrpSystem object. For more information, see DUT Clock Frequency and Sample Rate.Send a sample every time
ready_inis asserted to avoid underflow at the transmitter. The DUT can produce data at any rate up to the DUT clock frequency.
Count output samples and assert
last_outon the final sample of each packet to define the packet boundary. The recommended packet size is 256 samples.Group packets into bursts of contiguous IQ data. Assert
EOB_outfor the duration of the last packet in each burst. When bothlast_outandEOB_outare high, the radio transmits the final packet and ends the over-the-air transmission. For continuous transmission, do not assertEOB_out.To schedule a transmission, assert
HasTime_outand drivetimestamp_outwith a 64-bit unsigned integer on the first packet of the burst. The timestamp represents the radio time in MCR clock cycles. If you do not explicitly set the radio time using thesetTimeNextPPSfunction, this value is the number of MCR clock cycles since you calledsetupon theusrpSystem object. The radio acknowledges a timestamp only on the first packet of a burst. For more information about the call sequence, see Object Functions.
Note
Add a register interface to your DUT that controls an output-enable signal. This
register allows the host to disable DUT output before releasing the radio, which
prevents a 30-second stream flush timeout. Without this register, the DUT continues
asserting valid_out during shutdown and the stream buffer must drain
completely before the system can release.
For an example of a transmit streaming pipeline that handles packetization and backpressure buffering, see Tone Transmitter on NI USRP Radio.
Radio to DUT
To implement this interface in your Simulink model:
Set the input port data type to
int16or any signed 16-bit fixed-point data type. The radio streams complex IQ data to the DUT.Assert
ready_outwhen the DUT can accept a sample. The radio sends one IQ sample each timeready_outis high.Assert
ready_outat a rate at least equal to the baseband sample rate to prevent the stream buffer from overflowing. If the buffer overflows, the radio ends the current stream. To restart, call theusrpSystem object as a function, for example:device(numSamples)
The maximum rate at which the DUT can request samples is the DUT clock frequency. For more information, see DUT Clock Frequency and Sample Rate.
The radio sends IQ samples in packets sized according to the
SamplesPerPacketproperty on theusrpSystem object. The recommended packet size is 256 samples. The radio asserts thelast_inflag on the final sample of each packet.The radio groups packets into bursts. The burst length equals the number of packets required to deliver the requested data. The radio asserts the
EOB_inflag for the duration of the last packet in a burst.The radio drives
HasTime_inandtimestamp_inon each packet. The timestamp is a 64-bit unsigned integer representing the radio time in MCR clock cycles. If you do not explicitly set the radio time using thesetTimeNextPPSfunction, this value is the number of MCR clock cycles since you calledsetupon theusrpSystem object. For more information about the call sequence, see Object Functions.
Note
If your design uses multiple receive antennas, samples from different antennas do not arrive at the DUT simultaneously. Buffer samples from each antenna until valid data arrives on all channels before processing. For an example of how to synchronize data streams from multiple antennas, see Spectrum Visualization on NI USRP Radio.
Stream Data Between DUT and Host
These interfaces transfer data between the DUT and the host running MATLAB. You can connect directly or route through the PL DDR buffer. Direct connections offer lower latency but require the host to keep pace with the DUT. PL DDR buffered connections decouple DUT timing from host processing, which reduces the risk of dropped samples and underflows. If the DUT writes data faster than the host reads it, the PL DDR buffer can overflow.
DUT to Host (Direct)
To implement this interface in your Simulink model:
Set the output port data type to any complex data type up to 16 bits or real data type up to 32 bits. Data travels in a 32-bit bus.
Gate
valid_outwith theready_insignal. Only assertvalid_outand send data whenready_inis high.The host asserts
ready_inafter it connects to the radio by callingsetupon theusrpSystem object. For more information about the call sequence, see Object Functions.The host buffers received data in RAM and reads it using the
readPortfunction. If the DUT sends data faster than the host reads it, internal buffers can overflow. Theoverflowoutput argument indicates this condition. If overflows occur, reduce the DUT send rate or use the PL DDR buffer.
Count output samples and assert
last_outon the final sample of each packet. The recommended packet size is 256 samples.Group packets into bursts of contiguous data. Assert
EOB_outon the last packet of each burst.
DUT to Host (PL DDR Buffer)
To implement this interface in your Simulink model:
Set the output port data type to any complex data type up to 16 bits or real data type up to 32 bits. Data travels in a 32-bit bus.
Gate
valid_outwith theready_insignal. Only assertvalid_outand send data whenready_inis high.After the host connects to the radio by calling
setupon theusrpSystem object, the PL DDR buffer assertsready_inat the MCR. For example, on a USRP N310 radio with a 25 MS/s baseband sample rate, the MCR is 125 MHz and the buffer assertsready_inat 125 MHz.The PL DDR buffer de-asserts
ready_inwhen the buffer is full or while the host reads data using thereadPortfunction. After a read operation, the buffer flushes and is ready to receive data again.
The host reads data from the buffer using the
readPortfunction with no dropped samples or overflow.Count output samples and assert
last_outon the final sample of each packet. The recommended packet size is 256 samples.Group packets into bursts of contiguous data. Assert
EOB_outon the last packet of each burst.
Host to DUT (Direct)
To implement this interface in your Simulink model:
Set the input port data type to any complex data type up to 16 bits or real data type up to 32 bits. The host streams data in a 32-bit bus.
Assert
ready_outwhen the DUT can accept a sample. The host sends one sample each timeready_outis high during awritePortoperation.If the DUT does not assert
ready_out, thewritePortfunction times out.If the DUT expects continuous data and the host does not call
writePortfrequently enough to keep up with the DUT consumption rate, underflows occur. To receive data asynchronously and avoid underflows, use the PL DDR buffer.
The host sends data in packets. The
last_inflag is asserted on the final sample of each packet. The host does not send an end-of-burst signal.
Host to DUT (PL DDR Buffer)
To implement this interface in your Simulink model:
Set the input port data type to any complex data type up to 16 bits or real data type up to 32 bits. The PL DDR buffer streams data in a 32-bit bus.
Assert
ready_outwhen the DUT can accept a sample. The PL DDR buffer sends one sample each timeready_outis high. This path eliminates dropped samples and underflows.The host writes data to the PL DDR buffer using the
writePortfunction. ThewriteModeargument controls delivery:'Once'— The buffer sends all data to the DUT once, then stops.'Continuous'— The buffer sends data to the DUT repeatedly until the host starts a newwritePortoperation, or callsreleaseorreseton theusrpSystem object.
The PL DDR buffer sends data in packets. The
last_inflag is asserted on the final sample of each packet. TheEOB_inflag is asserted for the duration of the last packet in a burst.
See Also
usrp | addRFNoCStreamInterface | readPort | writePort | transmit