Skip to content

olo_base_stream_split

Back to Entity List

Status Information

VHDL Source: olo_base_stream_split

Description

This entity cuts the packets of an AXI4-Stream into segments. The size of every segment is given in bytes on a command interface, so a segment may end at any byte. Every segment starts in lane 0 and ends with Out_Last. The segment in which the input packet ends is marked with Out_InLast; it is shorter than its command size if the packet ends before.

Usage examples:

  • Writing a received packet into DMA buffers of any length: the entity cuts the packet at the end of every buffer and starts the next buffer in lane 0.
  • Cutting packets into chunks of a number of bytes: with Seg_Valid = '1' and a constant Seg_Size. olo_base_chunker cuts into chunks of whole beats without moving any byte.

olo_base_stream_join is the counterpart that joins segments into packets.

Segments

  • A segment command (Seg_Size in bytes, 1 to MaxSegSize_g) is accepted with Seg_Valid and Seg_Ready while no segment is active. It applies in the clock cycle it is accepted.
  • The segment takes the next Seg_Size bytes of the current packet, or the rest of the packet if the packet ends before.
  • Out_InLast = '1' on the last beat of the segment in which the packet ends, also if the packet ends exactly with the last byte of the segment. The next segment then starts with the first byte of the next packet.
  • A packet without any byte (one empty beat with In_Last) uses one segment command and gives one beat with Out_Be all '0', Out_Last = '1' and Out_InLast = '1'.
  • No input beat is accepted while no segment is active: a packet waits at the input until its first segment is commanded.

Byte Enables

In_Be marks the valid bytes of every input beat, as for olo_base_stream_join: they must be contiguous from lane 0 (bit 0 first, no gaps), and any number from 0 to Width_g/8 is allowed. This includes the Trailing-Only Byte-Enable convention (see Conventions); in addition, any beat may be partial or empty. An empty beat with In_Last only ends the packet (closing beat).

Every segment follows the Trailing-Only Byte-Enable convention: its beats are full except the last one. The only exception is the beat of a packet without any byte (Out_Be all '0'). Data lanes with Out_Be = '0' are zero.

Timing

The entity outputs one beat per clock cycle. A segment that ends inside an input beat can insert one clock cycle: the input waits while the held bytes already fill the rest of the segment.

A beat that uses up all bytes received so far is held until the next input beat shows whether the packet continues, so that an empty closing beat still marks it with Out_InLast. On an aligned stream, an output beat therefore follows one input beat later.

The outputs and Seg_Ready are registered. Because a segment command applies in the clock cycle it is accepted, In_Ready depends on Out_Ready, Seg_Valid and Seg_Size within the clock cycle. Rst clears the held bytes and the active segment at any time.

Integration

Seg_Valid and Seg_Size must not depend combinationally on In_Ready or on any Out signal; otherwise a combinational loop forms through In_Ready. Drive the segment commands from registers or from a FIFO, as a DMA engine does with its descriptors.

The example below (Width_g = 32) shows a packet of 10 bytes and segments of 6 and 8 bytes. The second segment ends with the packet after 4 bytes. Digits stand for the bytes (lane 3 left), '-' for lanes without a valid byte.

Split

Generics

Name Type Default Description
Width_g positive - Data width in bits, a multiple of 8 (8 to 1024)
MaxSegSize_g positive - Largest segment size in bytes (1 to 2^30 - 1); sets the width of Seg_Size

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' Valid bytes of the beat, contiguous from lane 0 (all '0' allowed)
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
Depends combinationally on Out_Ready, Seg_Valid and Seg_Size
In_Last in 1 '0' AXI4-Stream end of packet signaling for In_Data

Segment Commands

Name In/Out Length Default Description
Seg_Size in ceil(log2(MaxSegSize_g + 1)) - Size of the segment in bytes (1 to MaxSegSize_g)
In_Ready depends on it combinationally, see Integration
Seg_Valid in 1 '1' AXI4-Stream handshaking signal for Seg_Size
In_Ready depends on it combinationally, see Integration
Seg_Ready out 1 N/A AXI4-Stream handshaking signal for Seg_Size

Output Data

Name In/Out Length Default Description
Out_Data out Width_g N/A Output data (lanes without a valid byte are zero)
Out_Be out Width_g/8 N/A Output byte enables (Trailing-Only per segment)
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 segment
Out_InLast out 1 N/A End of the input packet: last beat of the segment in which the packet ends

Architecture

The entity keeps the bytes not yet output in a carry register (up to Width_g/8 bytes, from lane 0). The carry and the valid bytes of the input beat form a sequence of up to two beats of bytes. An output beat takes as many bytes as the segment still needs, at most one beat; the rest is shifted down into the carry. An input beat is accepted only while the carry holds at most the bytes of the next output beat, so the carry never overflows.

The two shifters are multiplexers per byte lane with up to Width_g/8 + 1 inputs, so the logic grows with the square of the number of byte lanes.