2.7.10. Comparator configuration example

This section uses an example to show how the comparators work:

Note

The description given in this example only considers the behavior of the address comparators when used to control TraceEnable.

Example 2.1. Configuration to demonstrate comparator behavior

Four single address comparators are configured as follows:

Single address comparator 1

Instruction execute, address 0x1000.

Single address comparator 2

Instruction execute, address 0x1008.

Address range comparator 1

Formed from address comparators 1 and 2.

Single address comparator 3

Data store, address 0x2000.

Single address comparator 4

Data store, address 0x2008.

Address range comparator 2

Formed from address comparators 3 and 4.


Operation of the comparators

With comparators configured as described in Example 2.1, consider the sequence of operations described in Table 2.8.

Table 2.8. Single address and address range comparators example

CycleActionComparators, TraceEnable output
SAC1SAC2ARC1SAC3SAC4ARC2
1

Instruction at 0x1000 executed.

Data written to 0x2000 for instruction at 0x1000.

Matches-MatchesMatches-Matches
2Instruction at 0x1004 executed.--Matches--Matches
3Data read from 0x2004 for instruction at 0x1004.--Matches---
4Instruction at 0x1008 executed.-Matches----

The following matches are produced:

  • Single address comparator 1, SAC1 in the table, matches during cycle 1.

  • Single address comparator 2, SAC2 in the table, matches during cycle 4.

  • Address range comparator 1, formed from address comparators 1 and 2, SAC1 and SAC2 in the table, matches during cycles 1, 2, and 3.

    No instruction address is accessed during cycle 3, so the address range comparator retains its previous state.

  • Single address comparator 3, SAC3 in the table, matches during cycle 1.

  • Single address comparator 4, SAC4 in the table, never matches.

  • Address range comparator 2, formed from address comparators 3 and 4, (SAC3 and SAC4 in the table) matches during cycles 1 and 2.

    No data address is accessed during cycle 2, so the address range comparator retains its previous state.

    Address range comparator 2 does not match during cycle 3 because it is configured for stores and a load occurs.

Only the first address comparator of an address range comparator pair can have a data value comparator. In this example, only address range comparator 2 can have a data value comparator, because address range comparator 1 is matching on instruction accesses. If a data value comparator is programmed for address range comparator 2, it applies to the whole address range. See the Notes in Programming the comparator registers for this example for more information.

Programming the comparator registers for this example

To implement the example, the comparator registers must be programmed as follows.

Single address comparator 1 (start address for address range comparator 1)
ETMACVR1

Program with the start address for address range comparator 1, 0x00001000.

ETMACTR1

Set the Data value comparison control field to b00, for no data comparison.

Set the access size field to b11 for ARM instructions, or as appropriate for the current processor state.

Set the Access type field to b001, for instruction execute.

The security level, Context ID and exact match fields of the register might also be used.

Single address comparator 2 (end address for address range comparator 1)
ETMACVR2

Program with the end address for address range comparator 1, 0x00001008.

ETMACTR2

Because this address comparator forms part of an address range comparator this register must be programmed with exactly the same value as that used for ETMACTR1.

Single address comparator 3 (start address for address range comparator 2)
ETMACVR3

Program with the start address for address range comparator 2, 0x00002000.

ETMACTR3

Set the Data value comparison control field to b00, for no data comparison.

Note

If required, data value comparison can be made part of the address range comparator 2 comparisons. To do this you must:

Set the access size field to b11 for word access address matching, or as appropriate for the required matching. The operation of this field depends on the ETM version. See Comparator access size.

Set the Access type field to b110, for data store.

The security level, Context ID and exact match fields of the register might also be used.

Single address comparator 4 (end address for address range comparator 2)
ETMACVR4

Program with the end address for address range comparator 2, 0x00002008.

ETMACTR4

Because this address comparator forms part of an address range comparator this register must be programmed with exactly the same value as that used for ETMACTR1.

Note

If a data value comparator is used with address range comparator 2 then the Data value comparison control field is only set in ETMACTR3, and this field is b000 in ETMACTR4. All other fields must be identical in the two ETMACTRs.

For information on the ETMACVRs and ETMACTRs see About the address comparator registers.

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