Chapter 6 S12Z Debug (S12ZDBGV2) Module
S12ZVHY/S12ZVHL Family Reference Manual Rev. 1.05
224
Freescale Semiconductor
6.4.6.3
Code Profiling Internal Data Storage Format
When profiling starts, the first trace buffer entry is made to provide the start address. This uses a 4 byte
format (PTS), including the INFO byte and a 3-byte PC start address. In order to avoid trace buffer
overflow a fully compressed format is used for direct (conditional branch) COF information.
Table 6-58. Profiling Trace buffer line format
The INFO byte indicates the line format used. Up to 4 bytes of each line are dedicated to branch COFs.
Further bytes are used for storing indirect COF information (indexed jumps and interrupt vectors). Indexed
jumps force a full line entry with the PTIB format and require 3-bytes for the full 24-bit destination
address. Interrupts force a full line entry with the PTVB format, whereby vectors are stored as a single byte
and a 16-bit timestamp value is stored simultaneously to indicate the number of bus cycles relative to the
previous COF. At each trace buffer entry the 16-bit timestamp counter is cleared. The device vectors use
address[8:0] whereby address[1:0] are constant zero for vectors. Thus the value stored to the PTVB vector
byte is equivalent to (Vector Address[8:1]).
After the PTS entry, the pointer increments and the DBG begins to fill the next line with direct COF
information. This continues until the direct COF field is full or an indirect COF occurs, then the INFO byte
and, if needed, indirect COF information are entered on that line and the pointer increments to the next line.
If a timestamp overflow occurs, indicating a 65536 bus clock cycles without COF, then an entry is made
with the TSOVF bit set, INFO[6] (
If a trace buffer overflow occurs, a final entry is made with the TBOVF bit set, profiling is terminated and
the DBG is disarmed. Trace buffer overflow occurs when the trace buffer contains 64 lines pending
transmission.
Whenever the DBG is disarmed during profiling, a final entry is made with the TERM bit set to indicate
the final entry.
When a final entry is made then by default the PTW line format is used, except if a COF occurs in the same
cycle in which case the corresponding PTIB/PTVB/PTHF format is used. Since the development tool
receives the INFO byte first, it can determine in advance the format of data it is about to receive. The
Format
8-Byte Wide Trace Buffer Line
7
6
5
4
3
2
1
0
PTS
PC Start Address
INFO
PTIB
Indirect
Indirect
Indirect
Direct
Direct
Direct
Direct
INFO
PTHF
0
Direct
Direct
Direct
Direct
INFO
PTVB
Timestamp Timestamp
Vector
Direct
Direct
Direct
Direct
INFO
PTW
Timestamp Timestamp
0
Direct
Direct
Direct
Direct
INFO