Main Content

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.

Frame to sample conversion overview and AXI4-Stream interface

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.

Frame to sample conversion for AXI4-Stream Video interface

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.

Stream Multiple Samples per Cycle

Since R2025a

To stream multiple samples per cycle, set the Samples per cycle parameter to a value greater than one. When you specify more than one sample per cycle, HDL Coder packs the samples together and streams them in a single clock cycle. All streamed ports use the same value for Samples per cycle.

When your streamed ports are non-complex ports, you can set the Packing Mode parameter in the HDL Workflow Advisor to Bit Aligned or Power of 2 Aligned. For more information on packing modes, see Packing Mode.

When you enable host script generation as part of the IP core generation, you can specify the SamplePackingFactor and SampleAlignment name-value arguments to the addAXI4StreamInterface function. The SampleAlignment parameter sets the value of the Packing Mode parameter for the streamed port.

Modeling Requirements

  • Model only the Data signals. The frame-to-sample conversion optimization generates the Ready and Valid signals.

  • When you have multiple samples per cycle and both master and slave channels, the packing mode for both channels must be the same.

  • When you stream multiple samples per cycle, you must set the Scalarize ports configuration set option to dutlevel.

  • When your streamed ports are complex ports you can set the Packing Mode parameter to Power of 2 Aligned only.

  • 3D ports are not supported for IP core generation.

  • You cannot stream multiple samples per cycle when you use an AXI4-Stream Video interface.

See Also

Topics

See Also

Topics