Packet Processing - 2021.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
UG1076
ft:locale
English (United States)
Release Date
2021-12-17
Version
2021.2 English

The first 32-bit word of a packet must always be a packet header, which encodes several bit fields as shown in the following table.

Table 1. Packet Bit Fields
Bits Field
4-0 Packet ID
11-5 7'b0000000
14-12 Packet Type
15 1'b0
20-16 Source Row
27-21 Source Column
30-28 3'b000
31 Odd parity of bits[30:0]

The packet ID is assigned by the compiler based on routing requirements. The packet type can be any 3-bit pattern that you want to insert to identify the type of packet. The source row and column denote the AI Engine tile coordinates from where the packet originated. By convention, source row and column for packets originating in the programmable logic (PL) is -1,-1.

It is your responsibility to construct and send an appropriate packet header at the beginning of every packet. On the receive side, the packet header needs to be received and decoded before reading the data.

The following operations help to assemble or disassemble the packet header in the AI Engine kernel.

void writeHeader(output_pktstream *str, unsigned int pcktType, unsigned int ID);
void writeHeader(output_pktstream *str, unsigned int pcktType, unsigned int ID, bool tlast);


uint32 getPacketid(input_pktstream *w, int index);
uint32 getPacketid(output_pktstream *w, int index);

The writeHeader API allows a packet header to be assembled with a given packet ID and packet type. The source row and column are inserted automatically using the coordinates of the AI Engine tile where this API is executed.

The getPacketid API allows the compiler assigned packet ID to be queried on the input or output packet stream data structure. The index argument refers to the split or merge branch edge in the graph specification.

Important: The writeHeader() and getPacketid() APIs are not supported in PL kernels.
Important: The generateHeader API has been deprecated and replaced with the writeHeader API.

See Explicit Packet Switching for more details.