Model Design for Frame-Based IP Core Generation
You can use the frame-to-sample optimization to generate IP cores for frame-based models. The frame-to-sample optimization maps matrices and vectors to the AXI4-Stream ports and matrices to AXI4-Stream Video interfaces, and then creates the necessary logic to handle the streamed data in the frame-based design.
Frame-Based Modeling for AXI4-Stream Interfaces
If your model includes streamed data, but does not process videos, you can use the frame-to-sample optimization to generate an IP core that operates on frames of data, then map the data ports to the streaming interface. You can then translate and implement your frame-based models on pixel-based hardware. See HDL Code Generation from Frame-Based Algorithms.
When you generate the IP core, you map the frame data ports at the DUT boundary to AXI4-Stream interfaces. HDL Coder™ generates the Valid and Ready signals for each port. This image shows a top-level overview of the frame-to-sample optimization and IP core generation.
Map vectors, complex vectors, matrices, and complex matrix data to AXI4-Stream interfaces by using frame-to-sample conversion optimization. The TLAST signal is created in the generated IP core and the signal is asserted when the number of valid samples counts to the frame size of the data port.
For an example on modeling a frame-based model with AXI4-Stream interfaces, see Generate IP Core for Frame-Based Model with AXI4 Stream Interfaces.
To model your algorithm using a simplified streaming protocol and a sample-based DUT, see Model Design for AXI4-Stream Interface Generation.
Frame-Based Modeling for AXI4-Stream Video Interfaces
If your model includes streamed video ports, you can use the frame-to-sample optimization to map the two-dimensional matrix ports of your DUT to an AXI4-Stream Video interface. You can then prototype your algorithm in Simulink® using frame-based modeling and test the functionality on live video inputs and outputs.
When you use the frame-to-sample optimization, HDL Coder:
Converts the interface and generates the Data, Valid, and Ready signals for each port.
Inserts the video porch and handles the start of frame (SOF) signal.
This image shows a top-level overview of the frame-to-sample optimization and IP core generation.
Map matrix ports to an AXI4-Stream Video interface by using the frame-to-sample optimization. The TUSER and TLAST signals are created during IP core generation. TUSER is asserted at the start of every frame and TLAST is asserted at the end of each line.
Video Porch Insertion Logic
Video capture systems scan video signals from left to right and from top to bottom. As these systems scan, they generate inactive intervals between lines and frames of active video. This inactive interval is called a video porch. When you generate an IP core using frame-to-sample conversion, the active pixels per line and the active lines in each frame are defined by the frame size of the frame-based model and they are not configurable at runtime. However, you can configure the horizontal and vertical porch. HDL Coder inserts vertical and horizontal porch to the pixel stream based on the AXI4-Lite registers in the generated IP core. You can customize these porch parameters for each video frame:
Horizontal porch length (Default: 280)
Vertical porch length (Default: 45)
The default values correspond to the porch values of a 1080p video frame.
This figure shows a video frame with the horizontal porch split into a front and a back porch.
To model your algorithm using a sample-based DUT and the streaming pixel protocol, see Model Design for AXI4-Stream Video Interface Generation.
For an example on modeling a frame-based model with AXI4-Stream Video interfaces, see Generate IP Core from Frame-Based Model with AXI4 Stream Video Interface.
Enable the Optimization
To use the frame-to-sample optimization:
Enable the frame-to-sample optimization. See, Enable frame to sample conversion.
Enable frame-to-sample optimization on the input data signal on the DUT that maps to the AXI4 Stream or AXI4-Stream Video interfaces.
Modeling Requirements
Model only the Data signals. The frame-to-sample conversion optimization generates the Ready and Valid signals.
Set the
SamplesPerCycle
parameter of the frame-to-sample optimization to 1. See Samples per cycle.
Related Topics
- Model Design for AXI4-Stream Interface Generation
- Streaming Pixel Interface (Vision HDL Toolbox)
- Model Design for AXI4-Stream Interface Generation
- HDL Code Generation from Frame-Based Algorithms