With the HDL Coder™ software, you can implement a simplified, streaming protocol in your model. The software generates AXI4-Stream interfaces in the IP core.
When you want to generate an AXI4-Stream interface in your IP core, in your DUT interface, implement the following signals:
When you map scalar DUT ports to an AXI4-Stream interface, you can optionally model the following signals and map them to the AXI4-Stream interface:
Other protocol signals, such as:
When the Data signal is valid, the Valid signal is asserted.
If you want to generate a hardware IP core, but do not need to model and simulate the interaction between the software and hardware, use scalar data ports at your DUT interface. Map the data ports to AXI4-Stream interfaces.
To model the Data and Valid signals in Simulink®:
Enclose the algorithm that processes the Data signal by using an enabled subsystem.
Control the enable port of the enabled subsystem by using the Valid signal.
For example, you can directly connect the Valid signal to the enable port.
You can also use a controller in your DUT that generates an enable signal for the enabled subsystem.
The AXI4-Stream interfaces in your DUT can optionally include a Ready signal. In a Slave interface, the Ready signal enables you to apply back pressure. In a Master interface, the Ready signal enables you to respond to back pressure.
If you model the Ready signal in your AXI4-Stream interfaces, your Master interface ignores the Data and Valid signals one clock cycle after the Ready signal is deasserted. You can start sending Data and Valid signals once the Ready signal is asserted. You can send one more Data and Valid signal after the Ready signal is deasserted.
If you do not model the Ready signal, HDL Coder generates the signal and the associated back pressure logic.
For example, if you have a FIFO in your DUT to store a frame of data, to apply back pressure to the upstream component, you can model the Ready signal based on the FIFO Full signal.
If you enable delay balancing, the coder can insert one or more delays on the Ready signal. Disable delay balancing for the Ready signal path.
You can optionally model other AXI4-Stream protocol signals.
If you model only the required Data and Valid signals, the coder generates
If you do not model the
TLAST signal, the
coder generates a programmable register in the IP core so that you
can specify your packet size. The details of the programmable packet
size register are in your IP core generation report.
If you want to model and simulate the system interaction between the software and hardware, and generate code for the software driver, use vector data ports at your DUT interface. Map the data ports to AXI4-Stream interfaces.
When you map vector ports to AXI4-Stream interfaces, your model has these requirements:
Connect each DUT input vector data port to a Serializer1D block.
The Serializer1D block must have a ValidOut port and the Ratio set to the vector bit width.
Connect each DUT output vector data port to a Deserializer1D block.
The Deserializer1D block must have a ValidIn port and the Ratio set to the vector bit width.
Connect ach scalar port that maps to an AXI4-Lite interface to a Rate Transition block.
The Ratio in the Rate Transition block must match the Ratio in the Serializer1D and Deserializer1D blocks.
Each scalar port that maps to an external port must have the same sample time as the streaming algorithm subsystem.
The streaming algorithm subsystem follows the same Data and Valid signal modeling pattern as for mapping scalar ports to an AXI4-Stream interfaces. See Data and Valid Signal Modeling Pattern.
For an example that shows how to map vector ports to AXI4-Stream
interfaces, open the
the streaming algorithm subsystem.
The HDL Coder software supports designs with multiple sample rates when you run the IP Core Generation workflow. When you map the interface ports to AXI4-Stream Master or AXI4-Stream Slave interfaces, to use multiple sample rates, ensure that the DUT ports that map to these AXI4 interfaces run at the fastest rate of the design after HDL code generation.
To learn more, see Multirate IP Core Generation (HDL Coder).
When you map scalar or vector DUT ports to AXI4-Stream interfaces:
The DUT can have at most one AXI4-Stream Master channel and one AXI4-Stream Slave channel.
Xilinx® Zynq®-7000 or Intel® Quartus® Prime must be your target platform.
Xilinx Vivado® or Intel Quartus Prime must be your synthesis tool.
Processor/FPGA synchronization must
When you map vector DUT ports to AXI4-Stream interfaces, you cannot use protocol signals other than Data and Valid. For example, Ready and TLAST are not supported.