Chapter 8 S12X Debug (S12XDBGV3) Module
MC9S12XE-Family Reference Manual Rev. 1.13
Freescale Semiconductor
327
8.4.2
Comparator Modes
The S12XDBG contains four comparators, A, B, C, and D. Each comparator can be congured to monitor
CPU12X or XGATE buses. Each comparator compares the selected address bus with the address stored in
DBGXAH, DBGXAM, and DBGXAL. Furthermore, comparators A and C also compare the data buses
to the data stored in DBGXDH, DBGXDL and allow masking of individual data bus bits.
S12X comparator matches are disabled in BDM and during BDM accesses.
The comparator match control logic congures comparators to monitor the buses for an exact address or
an address range, whereby either an access inside or outside the specied range generates a match
condition. The comparator conguration is controlled by the control register contents and the range control
by the DBGC2 contents.
On a match a trigger can initiate a transition to another state sequencer state (see
Section 8.4.3”). The
comparator control register also allows the type of access to be included in the comparison through the use
of the RWE, RW, SZE, and SZ bits. The RWE bit controls whether read or write comparison is enabled
for the associated comparator and the RW bit selects either a read or write access for a valid match.
Similarly the SZE and SZ bits allows the size of access (word or byte) to be considered in the compare.
Only comparators B and D feature SZE and SZ.
The TAG bit in each comparator control register is used to determine the triggering condition. By setting
TAG, the comparator will qualify a match with the output of opcode tracking logic and a trigger occurs
before the tagged instruction executes (tagged-type trigger). Whilst tagging, the RW, RWE, SZE, and SZ
bits are ignored and the comparator register must be loaded with the exact opcode address.
If the TAG bit is clear (forced type trigger) a comparator match is generated when the selected address
appears on the system address bus. If the selected address is an opcode address, the match is generated
when the opcode is fetched from the memory. This precedes the instruction execution by an indenite
number of cycles due to instruction pipe lining. For a comparator match of an opcode at an odd address
when TAG = 0, the corresponding even address must be contained in the comparator register. Thus for an
opcode at odd address (n), the comparator register must contain address (n–1).
Once a successful comparator match has occurred, the condition that caused the original match is not
veried again on subsequent matches. Thus if a particular data value is veried at a given address, this
address may not still contain that data value when a subsequent match occurs.
Comparators C and D can also be used to select an address range to trace from. This is determined by the
TRANGE bits in the DBGTCR register. The TRANGE encoding is shown in
Table 8-12. If the TRANGE
bits select a range denition using comparator D, then comparator D is congured for trace range
denition and cannot be used for address bus comparisons. Similarly if the TRANGE bits select a range
denition using comparator C, then comparator C is congured for trace range denition and cannot be
used for address bus comparisons.
Match[0, 1, 2, 3] map directly to Comparators[A, B, C, D] respectively, except in range modes (see