writePort
Description
Register Port
Streaming Port
writes input data numSamples
= writePort(dut
,portName
,data
)data
to a specified DUT streaming port
portName
on the target DUT DUT
and returns the
number of samples transmitted numSamples
.
Examples
Access DUT, Map RFNoC Register Interface and Write Data
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 register interface to your DUT.
addRFNoCRegisterInterface(dut, ... "InterfaceID", "DUTName", ... "RFNoCBlock", "0/DUTName#0");
Create a hdlcoder.DUTPort
object for the DUT port and specify the properties.
DUTPort_Write_Register = hdlcoder.DUTPort("Write_Register", ... "Direction", "IN", ... "DataType", "int16", ... "IsComplex", false, ... "Dimension", [1 1], ... "IOInterface", "DUTName", ... "IOInterfaceMapping", 128);
Map the DUT port to the RFNoC interface you added to your DUT.
mapPort(dut, DUTPort_Write_Register);
Connect to the radio and apply radio front end properties.
setup(device);
Write data to the DUT port.
data = 20;
writePort(dut,"Write_Register",data)
Release the hardware resources.
release(dut);
Access DUT, Map RFNoC Streaming Interface and Write Data
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 a hdlcoder.DUTPort
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 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 the DUT port.
data = randn(dataLength,1);
numSamps = writePort(dut,"Data_In",data)
numSamps = 1000
Release the hardware resources.
release(dut);
Input Arguments
dut
— Target DUT on the FPGA of a target NI™ USRP™ radio device
fpga
object
Target DUT on the FPGA of a target NI USRP radio device, specified as an fpga
object.
portName
— DUT port name
string
DUT port name, specified as a string. You create the DUT port as a hdlcoder.DUTPort
(HDL Coder) object array. Before you specify the
portName
, you must have mapped the port to an RFNoC interface
using the mapPort
function.
Data Types: string
data
— Input data
scalar | vector
Register Port
Input data to write to the DUT register port portName
,
specified as a scalar. The data type must match the data type specified by the
DataType (HDL Coder)
property of the hdlcoder.DUTPort
(HDL Coder) object.
Streaming Port
Input data to write to the DUT streaming port portName
,
specified as a matrix. The data type must match the data type specified by the
DataType (HDL Coder)
property of the hdlcoder.DUTPort
(HDL Coder) object.
The number of elements in data
must be equal to the FrameSize
specified in addRFNoCStreamInterface
.
Data is written either continuously or once, depending on the value of WriteMode
you
specified when you added the RFNoC streaming interface with the addRFNoCStreamInterface
function.
Output Arguments
numSamples
— Number of successfully transmitted samples
positive integer
Number of successfully transmitted samples, returned as a positive integer.
Data Types: double
Version History
Introduced in R2024a
See Also
Objects
Functions
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)