Skip to main content

8 Data Trace Encoder Output Packets

Data trace packets must be differentiated from instruction trace packets, and the means by which this is accomplished is dependent on the trace transport infrastructure. Several possibilities exist: One option is for instruction and data trace to be issued using different IDs (for example, if using ATB transport, different ATID values). Alternatively, an additional field as part of the packet encapsulation can be used (Siemens uses a 2-bit msg_type field to differentiate different trace types from the same source).

By default, all data trace packets include both address and data. However, provision is made for run-time configuration options to exclude either the address or the data, in order to minimize trace bandwidth. For example, if filtering has been configured to only trace from a specific data access address there is no need to report the address in the trace. Alternatively, the user may want to know which locations are accessed but not care about the data value. Information about whether address or data are omitted is not encoded in the packets themselves as it does not change dynamically, and to do so would reduce encoding efficiency. The run-time configuration should be reported in the Format 3, subformat 3 support packet (see Section 7.5). The following sections include examples for all three cases.

As outlined in Section 4.3, two different signaling protocols between the RISC-V hart and the encoder are supported: unified and split. Accordingly, both unified and split trace packets are defined.

note

In the following tables, "clog2" is an abbreviation for "ceiling of log2".

8.1 Load and Store

8.1.1 format field

Types of data trace packets are differentiated by the format field. This field is 2 bits wide if only unified loads and stores are supported, or 3 bits otherwise.

Unified loads and split load request phase share the same code because the encoder will support one or the other, indicated by a discoverable parameter.

Data accesses aligned to their size (e.g. 32-bit loads aligned to 32-bit word boundaries) are expected to be commonplace, and in such cases, encoding efficiency can be improved by not reporting the redundant LSBs of the address.

Table 27. Packet format for Unified load or store, with address and data

Field nameBitsDescription
format2 or 3(other codes select other packet formats)
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff211: Differentail address, differential data
data_lensizeNumber of bytes of data is data_len + 1
data8 * (data_len + 1)Data
addressdaddress_width_pByte address if format is unaligned, otherwise shift left by size to recover byte address

Table 28. Packet format for Unified load or store, with address only

Field nameBitsDescription
format2 or 3(other codes select other packet formats)
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff11: Differential address
addressdaddress_width_pByte address if format is unaligned, otherwise shift left by size to recover byte address

Table 29. Packet format for Unified load or store, with data only

Field nameBitsDescription
format2 or 3(other codes select other packet formats)
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff1 or 211 : Differential data
datadata_width_pData

Table 30. Packet format for Split load - Address only

Field nameBitsDescription
format3(other codes select other packet formats)
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
lridlrid_width_pLoad request ID
diff11: Differential address
addressdaddress_width_pByte address if format is unaligned, otherwise shift left by size to recover byte address

Table 31. Packet format for Split load - Data only

Field nameBitsDescription
format3(other codes select other packet formats)
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
lridlrid_width_pLoad request ID
resp211: Differential data
datadata_width_pData

8.1.2 size field

The width of this field is 2 bits if max size is 64-bits (data_width_p < 128), 3 bits if wider.

8.1.3 diff field

Unlike instruction trace, compression options for data trace are somewhat limited. Following a synchronization instruction trace packet, the first data trace packet for a given access size must include the full (unencoded) data access address. Thereafter, the address may be reported differentially (i.e. address of this data access, minus the address of the previous data access of the same size).

Similarly, following a synchronization instruction trace packet, the first data trace packet for a given access size must include the full (unencoded) data value. Beyond this, data may be encoded or unencoded depending on whichever results in the most efficient represenation. Implementors may chose to offer one of XOR or differential compression, or both. XOR compression will be simpler to implement, and avoids the need for performing subtraction of large values.

If only one data compression type is offered, the diff field can be 1 bit wide rather than 2 for Table 29.

8.1.4 data_len field

However the data is compressed, upper bytes that are all the same value do not need to be included in the packet; the decoder can recreate the full-width value by sign extending from the most significant received bit. In cases where data is not the final field in the packet, the width of data is indicated by this field.

8.2 Atomic

8.2.1 size field

Strictly, size could be just one bit as atomics are currently either 32 or 64 bits. Defining as per regular loads and stores provisions for future extensions (proprietary or otherwise) that support smaller atomics.

Table 32. Packet format for Unified atomic with address and data

Field nameBitsDescription
format3(other codes other packet formats)
subtype3111: reserved
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff211: Differential address, differential data
op_lensizeNumber of bytes of operand is op_len + 1
operand8 * (op_len + 1)Operand. Value from rs2 before operator applied
data_lensizeNumber of bytes of data is data_len + 1
data8 * (data_len + 1)Data
addressdaddress_width_pAddress, aligned and encoded as per size

Table 33. Packet format for Unified atomic with address only

Field nameBitsDescription
format3(other codes other packet formats)
subtype3111: conditional store failure
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff11: Differential address
addressdaddress_width_pAddress, aligned and encoded as per size

Table 34. Packet format for Unified atomic with data only

Field nameBitsDescription
format3(other codes other packet formats)
subtype3111: reserved
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
diff1 or 211: Differential data
op_lensizeNumber of bytes of operand is op_len + 1
operand8 * (op_len + 1)Operand. Value from rs2 before operator applied
datadata_width_pData

8.2.2 diff field

See Section 8.1.3.

8.2.3 operand field

The operand value for the atomic operation. Uncompressed, although upper bytes that are all the same value do not need to be included in the packet; the decoder can recreate the full-width value by sign extending from the most significant received bit; see Section 8.2.4.

8.2.4 data_len and op_len fields

Width of *data and operand fields respectively. See Section 8.1.4.

Table 35. Packet format for Split atomic with operand only

Field nameBitsDescription
format3(other codes other packet formats)
subtype3111: reserved
sizemax(1, clog2(clog2( data_width_p/8 + 1)))Transfer size is 2size bytes
lridlrid_width_pLoad request ID
diff1 or 211: Differential address, differential data
op_lensizeNumber of bytes of operand is op_len + 1
operand8 * (op_len + 1)Operand. Value from rs2 before operator applied
addressdaddress_width_pAddress, aligned and encoded as per size

Table 36. Packet format for Split atomic load data only

Field nameBitsDescription
format3110: Split atomic data other codes other packet formats
lridlrid_width_pLoad request ID
resp211: differential data
data_lensizeNumber of bytes of operand is data_len + 1. Not included if resp indicates an error (sign-extend resp MSB)
data8 * (data_len + 1)Data. Not included if resp indicates an error (sign-extend resp MSB)

8.3 CSR

Table 37. Packet format for Unified CSR, with address, data and operand

Field nameBitsDescription
format3(other codes other packet formats)
subtype211: reserved
diff1 or 211 : Differential data
data_len2 or 3Number of bytes of data is data_len + 1
data8 * (data_len 1)Data
addr_msbs6Address[11:6]
op_len2 or 3Number of bytes of operand is op_len + 1
operand8 * (op_len + 1)Operand. Value from rs1 before operator applied
addr_lsbs6Address[5:0]

8.3.1 diff field

See Section 8.1.3.

8.3.2 operand field

See Section 8.2.3.

8.3.3 data_len and op_len fields

2 bits wide if hart has 32-bit CSRs, 3 bits if 64-bit. Width of data and operand fields respectively. See Section 8.1.4.

8.3.4 addr fields

The address is split into two parts, with the 6 LSBs output last as these are more likely to compress away.

Table 38. Packet format for Unified CSR, with address and read-only data (as determined by addr[11:10] = 11)

Field nameBitsDescription
format3other codes other packet formats
subtype211: reserved
diff1 or 211 : Differential data
data_len2 or 3Number of bytes of data is data_len + 1
data8 * (data_len + 1)Data
addr_msbs6Address[11:6]
addr_lsbs6Address[5:0]

Table 39. Packet format for Unified CSR, with address only

Field nameBitsDescription
format3other codes other packet formats
subtype311: reserved
diff0 or 11: Differential address
addr_msbs6Address[11:6]
addr_lsbs6Address[5:0]