Skip to content

olo_base_chunker

Back to Entity List

Status Information

VHDL Source: olo_base_chunker

Description

This entity splits every packet of an AXI4-Stream into chunks of ChunkBeats_g beats. Every chunk is a packet of its own and ends with Out_Last. If the input packet ends before a chunk is full, its last chunk is shorter: no padding is added. The last beat of the last chunk of an input packet is additionally marked by Out_InLast, so the consumer knows where the original packet ended.

Usage examples:

  • Splitting long packets into frames of a protocol with a maximum frame size
  • Processing a long stream in independent units of limited size (e.g. one CRC or one authentication tag per chunk)
  • Cutting a continuous stream without In_Last into packets of fixed size

Example for ChunkBeats_g = 3 and an input packet of 7 beats (D0 to D6):

Beat Data In_Last Out_Last Out_InLast Chunk
0 D0 '0' '0' '0' 1
1 D1 '0' '0' '0' 1
2 D2 '0' '1' '0' 1
3 D3 '0' '0' '0' 2
4 D4 '0' '0' '0' 2
5 D5 '0' '1' '0' 2
6 D6 '1' '1' '1' 3 (shorter)

The next beat after a beat with Out_InLast = '1' starts the first chunk of the next input packet. A consumer that needs to know whether a chunk is the first one of a packet tracks Out_InLast of the previous chunk (the first chunk after reset is the first chunk of a packet).

The chunk size is given in beats. For byte oriented data, a chunk holds ChunkBeats_g x Width_g/8 bytes.

Byte Enables

In_Be and Out_Be follow the Trailing-Only Byte-Enable convention (see Conventions): only the last beat of an input packet may have byte enables deasserted. Because this beat always ends a chunk, every chunk follows the convention as well. The byte enables are passed through unchanged and are not interpreted by the entity.

Byte enables are only meaningful for Width_g being a multiple of 8. Leave In_Be unconnected otherwise.

Timing

The entity does not add any latency or buffering. Data, byte enables and handshaking signals are passed through combinationally (In_Ready = Out_Ready, Out_Valid = In_Valid), only Out_Last depends on a beat counter. Add an olo_base_pl_stage at the input or output if a register stage is required for timing.

Generics

Name Type Default Description
Width_g positive - Data width in bits
ChunkBeats_g positive - Number of beats of a chunk (the last chunk of a packet may be shorter)

Interfaces

Control

Name In/Out Length Default Description
Clk in 1 - Clock
Rst in 1 - Reset input (high-active, synchronous to Clk)

Input Data

Name In/Out Length Default Description
In_Data in Width_g - Input data
In_Be in Width_g/8 all '1' Input byte enables (Trailing-Only Byte-Enable convention)
In_Valid in 1 '1' AXI4-Stream handshaking signal for In_Data
In_Ready out 1 N/A AXI4-Stream handshaking signal for In_Data
In_Last in 1 '0' AXI4-Stream end of packet signaling for In_Data

Output Data

Name In/Out Length Default Description
Out_Data out Width_g N/A Output data
Out_Be out Width_g/8 N/A Output byte enables (equal to In_Be)
Out_Valid out 1 N/A AXI4-Stream handshaking signal for Out_Data
Out_Ready in 1 '1' AXI4-Stream handshaking signal for Out_Data
Out_Last out 1 N/A End of a chunk
Out_InLast out 1 N/A End of the input packet: last beat of its last chunk (equal to In_Last)

Architecture

A counter counts the transferred beats of the current chunk. Out_Last is asserted when the counter reaches ChunkBeats_g - 1 or when In_Last is asserted. The counter restarts at zero after every chunk and after reset.