23-2
MPC561/MPC563 Reference Manual
MOTOROLA
Program Flow Tracking
In order to reconstruct a program trace, the program code and the following additional
information from the MCU are needed:
A description of the last fetched instruction (stall, sequential, branch not taken,
branch direct taken, branch indirect taken, exception taken)
The addresses of the targets of all indirect flow change. Indirect flow changes
include all branches using the link and count registers as the target address, all
exceptions, and rfi, mtmsr and mtspr (to some registers) because they may cause a
context switch.
The number of instructions canceled each clock
Instructions are fetched sequentially until branches (direct or indirect) or exceptions appear
in the program flow or some stall in execution causes the machine not to fetch the next
address. Instructions may be architecturally executed, or they may be canceled in some
stage of the machine pipeline.
The following sections define how this information is generated and how it should be used
to reconstruct the program trace. The issue of data compression that could reduce the
amount of memory needed by the debug system is also mentioned.
23.1.1
Program Trace Cycle
To allow visibility of the events happening in the machine a few dedicated pins are used
and a special bus cycle attribute, program trace cycle, is defined.
The program trace cycle attribute is attached to all fetch cycles resulting from indirect flow
changes. When program trace recording is needed, make sure these cycles are visible on the
external bus.
The VSYNC indication, when asserted, forces all fetch cycles marked with the program
trace cycle attribute to be visible on the external bus even if their data is found in one of the
internal devices. To enable the external hardware to properly synchronize with the internal
activity of the CPU, the assertion and negation of VSYNC forces the machine to
synchronize. The first fetch after this synchronization is marked as a program trace cycle
and is visible on the external bus. For more information on the activity of the external
In order to keep the pin count of the chip as low as possible, VSYNC is not implemented
as one of the chip’s external pins. It is asserted and negated using the serial interface
implemented in the development port. For more information on this interface refer to
Forcing the CPU to show all fetch cycles marked with the program trace cycle attribute can
be done either by asserting the VSYNC pin (as mentioned above) or by programming the
fetch show cycle bits in the instruction support control register, ICTRL. For more