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
This example uses:
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 by using the describeFPGA function.
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 by using the addRFNoCRegisterInterface function.
addRFNoCRegisterInterface(dut, ... "InterfaceID","DUTName", ... "RFNoCBlock","0/DUTName#0");
Create an 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);
Using the mapPort function, 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 by calling the setup function.
setup(device);
Write data to the DUT port by using the writePort function.
data = 20;
writePort(dut,"Write_Register",data)Release the hardware resources.
release(dut);
This example uses:
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 by using the describeFPGA function.
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 by using the addRFNoCStreamInterface function. 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 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");
Using the mapPort function, 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 by calling the setup function.
setup(device);
Generate random data with length dataLength and write it to the DUT port by using the writePort function.
data = randn(dataLength,1);
numSamps = writePort(dut,"Data_In",data)numSamps = 1000
Release the hardware resources.
release(dut);
Input Arguments
Target DUT on the FPGA of a target NI
USRP radio device, specified as an fpga
object.
DUT port name, specified as a string. You create the DUT port as an hdlcoder.DUTPort object array. Before you specify
portName, you must have mapped the port to an RFNoC interface
using the mapPort
function.
Data Types: string
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 property of the hdlcoder.DUTPort
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 property of the hdlcoder.DUTPort
object.
The number of elements in data must be equal to the FrameSize you
specified when you added the interface using the
addRFNoCStreamInterface function.
Data is written either continuously or once, depending on the WriteMode
that you specified when you added the interface using the
addRFNoCStreamInterface function.
Output Arguments
Number of successfully transmitted samples, returned as a positive integer.
Data Types: double
Version History
Introduced in R2024a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)