Contenido principal

From pixelcontrol

R2026b

Convert pixelcontrol bus to AXI-Stream control signals

Since R2026b

  • From pixelcontrol block

Libraries:
Vision HDL Toolbox / I/O Interfaces

Description

The From pixelcontrol block accepts the pixelcontrol bus protocol used by Vision HDL Toolbox™ blocks and converts to AXI4-Stream control signals. Use this block and the To pixelcontrol block when your model contains Vision HDL Toolbox blocks and algorithms that use AXI interfaces.

This diagram shows the dataflow using these conversion blocks. The To pixelcontrol block converts input AXI4-Stream signals to the pixelcontrol protocol. If you send more than one pixel, or more than one component per pixel, in each AXI4-Stream transfer, you must unpack the data output and create a numPixels-by-numComponents matrix for the pixel input to the Vision HDL Toolbox algorithm. At the output of the Vision HDL Toolbox algorithm, you can pass a scalar pixel value to the From pixelcontrol block, or repack numPixels-by-numComponents values into the data input.

The waveform shows a 2-line-by-3-pixel frame arriving at the input in pixelcontrol bus protocol and the output in AXI4-Stream protocol. Each data value represents a single pixel. The block converts the input pixelcontrol start-of-line (hStart), end-of-line (hEnd), start-of-frame (vStart), and end-of-frame (vEnd) signals to AXI4-Stream packets where each packet represents one video line. The TLAST signal indicates the end of each video line. The block buffers one line before making any AXI4-Stream transfers, so that the output line has continuous valid pixels. The block maintains inactive cycles between lines and frames, according to the specified Video format.

For more information on the pixelcontrol protocol, see Streaming Pixel Interface. For more information on the requirements for inactive cycles in the pixelcontrol protocol, see Configure Blanking Intervals.

Input and output waveforms of the From pixelcontrol block

Ports

Input

expand all

Packed pixel data representing one or more pixels, with one or more components per pixel. You can pass a scalar pixel value from the Vision HDL Toolbox algorithm or you can repack numPixels-by-numComponents values into a scalar value.

To generate HDL code with floating point data types, see Generate Target-Independent HDL Code with Native Floating-Point (HDL Coder).

Data Types: uint | int | fixed point | double | single

The pixelcontrol bus contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Control signal indicating when downstream blocks can accept transfers. When this signal is set to true, the block sends AXI transfers. When this signal is set to false, the block stops sending transfers.

When you select the Simplified AXI4-Stream protocol, the block may send one extra transfer the cycle after TREADY is set to false.

When you select the AXI4-Stream protocol, while TREADY is false the block sends no output transfers.

Data Types: Boolean

Output

expand all

Packed pixel data, returned as the same data type and dimensions as the input pixel port.

Data Types: uint | int | fixed point | double | single

Control signal indicating whether the TDATA transfer is valid.

Data Types: Boolean

Control signal indicating when the TDATA transfer represents pixels at the end of a horizontal line. The last pixel in TDATA represents the end of the line.

Data Types: Boolean

Indicates whether the block can accept pixel stream data. The Vision HDL Toolbox blocks do not support backpressure, so connect this signal to the To pixelcontrol block upstream of your Vision HDL Toolbox algorithm. Because the Vision HDL Toolbox blocks do not support backpressure, set the Almost full threshold (lines) parameter to accommodate the in-flight lines from your Vision HDL Toolbox algorithm.

The block ignores any data that arrives while ready is set to false.

Data Types: Boolean

The block sets this output to true when an input vStart signal interrupts an in-progress frame. In this case, the block resets its counters and data in the pixel buffer is overwritten with the new frame data. The output frameReset signal indicates the end of an incomplete frame and the start of the next frame.

Data Types: Boolean

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Select the output control protocol. Both options implement the basics of an AXI4-Stream protocol where each packet represents one video line. The TLAST signal indicates the end of each video line. TDATA contains packed pixel data and TVALID qualifies the data transfer.

  • Use the Simplified AXI4-Stream protocol when you model AXI4-Stream interfaces with MathWorks® library blocks and use the HDL Coder™ IP core workflow. For more information on modeling an AXI4-Stream interface, see Model Design for AXI4-Stream Interface Generation (HDL Coder).

  • Use the AXI4-Stream protocol if you model the AXI4-Stream interface yourself, or use external IP blocks.

Specify the number of pixels represented in each pixel value. The block uses this number to count pixels in lines.

Dimensions of active and inactive regions in a video frame. To select a predefined format, select from the Video format list. The actual frame dimensions are displayed in the Video Format Parameters section. For a custom format, select Custom, and then specify the dimensions as integers.

The dimensions are defined in the diagram.

Note

The sample time of your video source must match the total number of pixels in the frame of your Frame To Pixels block. The total number of pixels is Total pixels per line × Total video lines, so set the sample time to this value.

If your frame size is large, you may reach the fixed-step solver step size limit for sample times in Simulink, and receive an error like this.

The computed fixed step size (1.0) is 1000000.0 times smaller than all
the discrete sample times in the model. 
You can avoid this error by choosing the variable-step solver.

Video FormatSupported for NumPixelsActive Pixels Per LineActive Video LinesTotal Pixels Per LineTotal Video LinesStarting Active LineEnding Active LineFront PorchBack Porch
240p2320240 40232412404438
480p2, 4, or 86404808005253651516 144
480pH27204808585253351216122
576p2 or 47205768646254762212132
720p21280720165075025744110260
768p2, 4, or 8102476813448061077724296
1024p2, 4, or 8128010241688106642106548360
1080p (default)2, 4, or 8192010802200112542112188192
1200p2, 4, or 8160012002160125050124964496
2KCinema-204810802750112542112163963
4KUHDTV2, 4, or 8384021604400225042220188472
8KUHDTV2, 4, or 87680432088004500424361881032
CustomIf all horizontal dimensions are divisible by NumPixels.User-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined
User-
defined

To support these additional formats, select Custom and set the parameters as shown in this table.

Video FormatActive Pixels Per LineActive Video LinesTotal Pixels Per LineTotal Video LinesStarting Active LineEnding Active LineFront PorchBack Porch
480p SDTV7204808585253751616122
576p HDTV7205768646254562012132
720p HDTV1280720165075026745110260
768p HDTV102476813448063680324296

When using a custom format, the values you enter for the active and inactive dimensions of the image must add up to the total frame dimensions. If you specify a format that does not conform to these rules, the block reports an error.

  • For the horizontal direction, Total pixels per line must be greater than or equal to Front porch + Active pixels per line. The block calculates Back porch = Total pixels per line − Front porch − Active pixels per line.

  • For the vertical direction, Total video lines must be greater than or equal to Starting active line + Active video lines − 1. The block calculates Ending active line = Starting active line + Active video lines − 1.

When using the Line Buffer block, or blocks that use an internal line buffer, with a custom video format, further requirements apply:

  • The horizontal blanking interval, or Back porch + Front porch, must meet these guidelines:

    • The total of Back porch + Front porch must be at least 2 times the largest kernel size of the algorithm in the blocks following the Frame To Pixel block.

    • If the kernel size is less than 4, and you are using edge padding, the total porch must be at least 8 pixels.

    • If you disable padding, the total porch must be at least 12 pixels.

    • The Back porch must be at least 6 pixels. This parameter is the number of inactive pixels before the first valid pixel in a frame.

    For more information on blanking intervals, see Configure Blanking Intervals.

When using multipixel streaming (Number of pixels > 1), these requirements apply.

  • The video format must have horizontal dimensions divisible by the Number of pixels parameter value. The horizontal dimensions are set by these parameters: Active pixels per line, Total pixels per line, Front porch, and Back porch. Standard video protocols 480p, 768p, 1024p, 1080p, 1200p, 4k UHD, and 8k UHD support Number of pixels equal to 4 or 8.

  • The minimum input frame size for multipixel streaming is 18 rows by 32 columns.

  • Choose your kernel size and Active pixels per line such that (Active pixels per line)/(Number of pixels) is at least the kernel width.

Number of lines to store, specified as a positive integer. The block implements a FIFO sized for the number of active pixels in a horizontal line specified by the Video format parameter. For example when you set Video format to 240p (240 lines with 320 pixels per line), and Maximum lines to buffer is 3, the FIFO can store 2^nextpow2(320*3)=1024 pixels. When the buffer reaches the Almost full threshold (lines) threshold, the block sets ready to false.

Lines available in the buffer when the block asserts backpressure, specified as a positive integer. The block implements this threshold as a number of pixels, using the number of active-pixels-per-line.

The block sets the ready output to false when there are maxLines - almostFullLines stored in the buffer, where maxLines is the Maximum lines to buffer parameter value and almostFullLines is the Almost full threshold (lines) parameter value. Because the Vision HDL Toolbox blocks do not support backpressure, set this value to accommodate the in-flight lines from your Vision HDL Toolbox algorithm.

Extended Capabilities

expand all

Version History

Introduced in R2026b