6.5.1. Trace FIFO offsets

ETMv2 generates Trace FIFO Offsets (TFO) to enable the decompressor to synchronize the pipeline status (PIPESTAT) and FIFO output (TRACEPKT) signals.

There are two reasons for generating a TFO:

Periodic synchronization occurs as soon as possible after the synchronization counter reaches zero, when the current PIPESTAT is IE (Instruction Executed).

When the synchronization counter reaches zero it sets an internal flag to indicate that a periodic TFO is required, and immediately resets. If a periodic TFO does occur before the counter next reaches zero, the ETM must output a TFO with reason code 2, overflow. Some trace is lost as a result of this. This condition is very unusual and usually indicates that the processor is in an infinite loop.

When a TFO is generated, the following occur in that cycle:

TFO values

TCDs can discard TD (Trace Disabled) cycles where TRACEPKT[0] = 0. If TRACEPKT[0] is asserted, the TFO value is output on TRACEPKT[7:1] (lower bits on TRACEPKT[7:4]). The range of TFO encodings is shown in Table 6.4.

Table 6.4. TFO encodings

TRACEPKT[3:0]Description
bXXXXXXX0

Trace disabled, not cycle-accurate

bXXXX0111

Trace disabled, cycle-accurate

bXXXX1001

TFO value 0-15 (TRACEPKT[7:4] + 0)

bXXXX1011

TFO value 16-31 (TRACEPKT[7:4] + 16)

bXXXX1101

TFO value 32-47 (TRACEPKT[7:4] + 32)

bXXXX1111

TFO value 48-63 (TRACEPKT[7:4] + 48)

bXXXX0001

TFO value 64-79 (TRACEPKT[7:4] + 64)

bXXXX0011

TFO value 80-95 (TRACEPKT[7:4] + 80)

bXXXX0101

Reserved


TFO formula

The following formula generates the TFO values in Table 6.4:

  • TRACEPKT[7:4] = TFO[3:0]

  • TRACEPKT[3] = !TFO[6]

  • TRACEPKT[2:1] = TFO[5:4].

Example 6.1 shows how to calculate the value of a TFO.

Example 6.1. Calculating a TFO value

Suppose that there is one byte left in the FIFO before the TFO packet header (that is, the TFO value is b0001). Using the TFO formula, the mapping of TRACEPKT[7:1] to TFO is:

TRACEPKT

7 6 5 4  3 2 1

TFO

3 2 1 0 !6 5 4

So a TFO value of b0000001 is output on the TRACEPKT[7:1] pins as 0001100. TRACEPKT[0] must be asserted, so the full TRACEPKT[7:0] output is 00011001.

This example TFO value is used in Table 6.5.


General TFO packet structure

A TFO packet typically consists of:

Trigger considerations

When using a 4-bit port, the lower 4 bits are output on TRACEPKT on the cycle of the TD (Trace Disabled), and the upper 4 bits on the following cycle. The pipeline status is TD for the first cycle only.

If a trigger occurs on the same cycle as a TFO TD cycle, the PIPESTAT is TR (Trigger), and TRACEPKT[3:0] = 0111 (TD). This is the only way a trigger can have a replacement PIPESTAT of TD. If a trigger occurs when the PIPESTAT would have been a non-TFO TD, the replacement PIPESTAT is WT (Wait). The offset is output on the following cycle, or the following two cycles in the case of a 4-bit port.

If a trigger occurs on the cycle in which the upper 4 bits of the offset are being output on a 4-bit port, the replacement PIPESTAT is output, and the upper 4 bits of the offset are output on the following cycle.

If a trigger occurs on the same cycle as a gap nibble following a TFO on a 4-bit port, the replacement PIPESTAT is output and the gap nibble is output on the following cycle. Mid-byte TFO outputs describes the gap nibble.

Note

The trigger can occur only once per trace run.

Mid-byte TFO outputs

If a TFO occurs mid-byte in the 4-bit trace packet port configuration, a gap nibble is inserted in the TRACEPKT[3:0] output stream. TFO values specify synchronization in terms of bytes rather than nibbles. The gap nibble ensures that the current top of the FIFO, pointed to by the TFO value, is always byte-aligned.

The value of the gap nibble is always 0x6.

The example sequence in Table 6.5 shows how the PIPESTAT[3:0] and TRACEPKT[3:0] signals change when a TFO occurs between data nibbles.

Table 6.5. Example signal sequence for a mid-byte TFO

Trace operationPIPESTAT[3:0]TRACEPKT[3:0]
Data 0xABCD is output to TRACEPKT[3:0]IDb1101 (data nibble 0x---D)
IEb1100 (data nibble 0x--C-)
WTb1011 (data nibble 0x-B--)
TFO occurs, TFO value output beginsTD (originally IE)b1001
IEb0001
Gap nibble is inserted immediately following TFO valueWTb0110
Remaining data nibble is outputINb1010 (data nibble 0xA---)
TFO packet output beginsDNTFO header [3:0]

The TFO value output indicates one byte remaining. That byte is made up of the gap nibble followed by nibble 0xA---.

FIFO output is delayed until the complete TFO value (and extra nibble, if required) have been output on TRACEPKT[3:0].

Note

In cases where synchronization is not required, the decompressor must be aware that the gap nibble appears on TRACEPKT[3:0]. The decompressor must always expect this extra nibble when a TFO is generated on an odd nibble regardless of whether the TFO is because of synchronization or because trace has been enabled.

Copyright © 1999-2002, 2004-2009, 2011 ARM Limited. All rights reserved.ARM IHI 0014Q
Non-ConfidentialID101211