Main Content

addRFNoCStreamInterface

Add RFNoC streaming interface to your DUT

Since R2024a

Add-On Required: This feature requires the Wireless Testbench™ Support Package for NI™ USRP™ Radios add-on.

Description

addRFNoCStreamInterface(dut,Name=Value) adds an RFNoC streaming interface that you can use to control the DUT ports mapped to data streaming interfaces in the generated IP core from MATLAB® and specifies name-value arguments.

example

Examples

collapse all

Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

device = usrp("MyRadio");

Configure your radio with the target interfaces.

describeFPGA(device,"ModelName_wthandoffinfo.mat"); 

Create an fpga object to access your DUT on the FPGA of your radio.

dut = fpga(device);

Add an RFNoC streaming interface to your DUT.

addRFNoCStreamInterface(dut, ...
    "InterfaceID","RX_STREAM#0", ...
    "Streamer","0/RX_STREAM#0", ...
    "Direction","OUT", ...
    "FrameSize",1000, ...
    "DDRAllocation",1000, ...
    "Timeout",[]);

Create an hdlcoder.DUTPort (HDL Coder) object for the DUT port and specify the properties.

DUTPort_Data_Out = hdlcoder.DUTPort("Data_Out", ...
	"Direction", "OUT", ...
	"DataType", "uint32", ...
	"IsComplex", false, ...
	"Dimension", [1 1], ...
	"IOInterface", "RX_STREAM#0");

Map the DUT port to the RFNoC interface that you added to your DUT.

mapPort(dut,DUTPort_Data_Out);

Connect to the radio and apply radio front end properties.

setup(device);

Call the usrp System object as a function to start the radio front end. Request 1000 samples.

device(1000);

Read data from the DUT port.

[dataRx,numSamps,overflow] = readPort(dut,"Data_Out")
dataRx = 1000×1 uint32 column vector

   4294901766
            5
       262150
            4
   4294901760
   4294639613
       131073
   4294574078
   4294639617
   4294967294
      ⋮

numSamps = 1000
overflow = logical
   0

Release the hardware resources.

release(dut);

Create a usrp System object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

device = usrp("MyRadio");

Configure your radio with the target interfaces.

describeFPGA(device,"ModelName_wthandoffinfo.mat"); 

Create an fpga object to access your DUT on the FPGA of your radio.

dut = fpga(device);

Add an RFNoC streaming interface to your DUT. Specify a frame size and DDR allocation of dataLength samples.

dataLength = 1000;
addRFNoCStreamInterface(dut, ...
    "InterfaceID","TX_STREAM#0", ...
    "Streamer","0/TX_STREAM#0", ...
    "Direction","IN", ...
    "FrameSize",dataLength, ...
    "DDRAllocation",dataLength, ...
    "WriteMode","continuous");

Create an hdlcoder.DUTPort (HDL Coder) object for the DUT port and specify the properties.

DUTPort_Data_In = hdlcoder.DUTPort("Data_In", ...
	"Direction", "IN", ...
	"DataType", "uint32", ...
	"IsComplex", false, ...
	"Dimension", [1 1], ...
	"IOInterface", "TX_STREAM#0");

Map the DUT port to the RFNoC interface that you added to your DUT.

mapPort(dut,DUTPort_Data_In);

Connect to the radio and apply radio front end properties.

setup(device);

Generate random data with length dataLength and write it to the DUT port.

data = randn(dataLength,1);
numSamps = writePort(dut,"Data_In",data)
numSamps = 1000

Release the hardware resources.

release(dut);

Input Arguments

collapse all

Target DUT on the FPGA of a target NI USRP radio device, specified as an fpga object.

Name-Value Arguments

Specify pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: InterfaceID="yourDUTSubsystemName", Streamer="0/RX_STREAM#0"

Name assigned to the RFNoC streaming interface, specified as a string scalar.

Example: "yourDUTSubsystemName"

Data Types: string

Name of the RFNoC streamer, specified as a string. The RFNoC streamer name is generated from the interfaces that you assign in the Map Target Interfaces step of the targeting workflow. The format is:

  • Data_In0 — "0/RX_STREAM#0"

  • Data_InN"0/RX_STREAM#N"

  • Data_Out0 — "0/TX_STREAM#0"

  • Data_OutN"0/TX_STREAM#N"

Example: "0/RX_STREAM#2"

Data Types: string

Interface direction, specified as one of the following options:

  • "IN" — The interface is an input to the DUT.

  • "OUT" — The interface is an output from the DUT.

Data Types: string

Number of samples, specified as an even positive integer.

  • You must provide this number of elements in the data input to writePort.

  • The readPort function returns this number of elements in data.

Example: 250e6

Memory allocation in the PL DDR buffer in samples, specified as an even positive integer. Set this to the same value as FrameSize.

Set this property only if you specified streaming connections to the PL DDR buffer in the Map Target Interfaces step of the targeting workflow.

Example: 250e6

Timeout in seconds of the readPort function, specified as a positive integer or an empty array.

If you do not set this argument or set it to [], the timeout is calculated based on the frame size and sample rate, where 'Timeout'=1+(FrameSize/SampleRate) and SampleRate is a property of the usrp object.

Example: 5

Dependencies

Specify this argument only if the streaming interface is an output from the DUT.

Write mode, specified as one of these options.

  • "continuous" — The writePort function writes data data continuously to the specified DUT port.

  • "once" — The function transmits data data once in a single-shot transmission.

You can write data continuously only if the data streaming interface is connected to the PL DDR Buffer. You specify this connection in the Map Target Interfaces step of the targeting workflow.

Example: 5

Dependencies

Specify this argument only if the streaming interface is an input to the DUT.

Version History

Introduced in R2024a